From 224f4e58c2955677f3f2efe58973a412478b1905 Mon Sep 17 00:00:00 2001 From: hmo Date: Wed, 29 Jul 2026 02:08:44 +0800 Subject: [PATCH] =?UTF-8?q?ui:=20=E7=A0=94=E7=A9=B6Tab=E5=88=97=E8=A1=A8?= =?UTF-8?q?=E5=8A=A0=E5=9B=9E=E4=BA=A4=E6=98=93=E6=95=B0=E5=88=97+?= =?UTF-8?q?=E6=96=B0=E5=A2=9E=E5=9D=87=E6=8C=81=E4=BB=93=E5=91=A8=E6=9C=9F?= =?UTF-8?q?=E5=88=97(=E5=91=A8=E8=BD=AC=E7=8E=87=E6=A0=B8=E5=BF=83?= =?UTF-8?q?=E6=8C=87=E6=A0=87)=EF=BC=8C=E8=A1=A8=E6=A0=BC=E6=A8=AA?= =?UTF-8?q?=E5=90=91=E5=8F=AF=E6=BB=9A=E5=8A=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- static/index.html | 8 ++++++-- strategy_lab.py | 1 + 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/static/index.html b/static/index.html index 1a85774e..04d1336f 100644 --- a/static/index.html +++ b/static/index.html @@ -1974,11 +1974,13 @@ function renderStrategyTable(strategies) { const isBest = invert ? (val === bestVal && bestVal !== 999) : (val === bestVal && bestVal !== -999); return isBest ? 'text-green-400 font-bold' : ''; }; - let html = '' + + let html = '
' + '' + '' + '' + '' + + '' + + '' + '' + '' + '' + @@ -1995,6 +1997,8 @@ function renderStrategyTable(strategies) { '' + '' + '' + + '' + + '' + '' + '' + '' + @@ -2004,7 +2008,7 @@ function renderStrategyTable(strategies) { '' + ''; } - html += '
版本名称总收益最终资产年化交易数均持仓胜率平均收益夏普盈亏比资产回撤' + (pf.total_return_pct != null ? pf.total_return_pct + '%' : '—') + '' + (pf.capital_final != null ? '¥' + (pf.capital_final/10000).toFixed(0) + '万' : '—') + '' + (pf.cagr_pct != null ? pf.cagr_pct + '%' : '—') + '' + (st.total_trades != null ? st.total_trades : '—') + '' + (st.avg_hold_days != null ? st.avg_hold_days + 'd' : '—') + '' + (st.win_rate != null ? st.win_rate + '%' : '—') + '' + (st.avg_profit_pct != null ? st.avg_profit_pct + '%' : '—') + '' + (st.sharpe_ratio != null ? st.sharpe_ratio : '—') + '
' + + html += '' + '
总收益/最终资产 = 100万本金·最多10等分仓位·24个月组合模拟 · ⚠️样本<40笔 · 绿色=该列最优 · 悬停名称查看改进假设
'; el.innerHTML = html; } diff --git a/strategy_lab.py b/strategy_lab.py index 9093b58e..6221b87b 100644 --- a/strategy_lab.py +++ b/strategy_lab.py @@ -852,6 +852,7 @@ def calc_summary(trades, capital): 'avg_profit_pct': round(avg_p, 2), 'avg_win_pct': round(avg_w, 2), 'avg_loss_pct': round(avg_l, 2), + 'avg_hold_days': round(sum(t['hold_days'] for t in trades) / len(trades), 1), 'sharpe_ratio': round(sharpe, 2), 'max_drawdown_pct': round(max_dd, 2), 'profit_factor': round(abs(avg_w/avg_l), 2) if avg_l != 0 else None,