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,