diff --git a/static/index.html b/static/index.html index 7bba7b13..3025d3d2 100644 --- a/static/index.html +++ b/static/index.html @@ -1979,6 +1979,7 @@ function sortStrategies(strategies, key, dir) { case 'composite': return s._composite != null ? s._composite : -999; case 'universality': return (st.universality || {}).score || 0; case 'total_return': return pf.total_return_pct != null ? pf.total_return_pct : -999; + case 'full_return': return (st.portfolio_full || {}).total_return_pct != null ? st.portfolio_full.total_return_pct : -999; case 'capital_final': return pf.capital_final || 0; case 'cagr': return pf.cagr_pct != null ? pf.cagr_pct : -999; case 'trades': return st.total_trades || 0; @@ -2084,7 +2085,8 @@ function renderStrategyTable(strategies) { th('sizing_slots', '仓位', 'text-center') + th('composite', '综合', 'text-right') + th('universality', '普适', 'text-right') + - th('total_return', '总收益', 'text-right') + + th('full_return', '全参与', 'text-right') + + th('total_return', '集中仓', 'text-right') + th('capital_final', '最终资产', 'text-right') + th('cagr', '年化', 'text-right') + th('trades', '交易数', 'text-right') + @@ -2107,7 +2109,8 @@ function renderStrategyTable(strategies) { '' + (st.sizing_slots ? st.sizing_slots + '仓' : '10仓') + '' + cell('composite', s._composite, v => v, 'font-bold text-amber-300') + cell('universality_score', (st.universality || {}).score, v => v + '/' + (st.universality || {}).months + '月') + - cell('total_return_pct', pf.total_return_pct, v => v + '%', 'font-bold ' + retCls + ' ' + hl(pf.total_return_pct, best.total_return_pct)) + + cell('total_return_pct', (st.portfolio_full || {}).total_return_pct, v => v + '%', 'font-bold text-amber-300') + + cell('total_return_pct', pf.total_return_pct, v => v + '%', retCls + ' ' + hl(pf.total_return_pct, best.total_return_pct)) + cell('capital_final', pf.capital_final, v => '¥' + (v/10000).toFixed(0) + '万') + cell('cagr_pct', pf.cagr_pct, v => v + '%', hl(pf.cagr_pct, best.cagr_pct)) + cell('total_trades', st.total_trades, v => v) + diff --git a/strategy_lab.py b/strategy_lab.py index ecc8c231..a7525187 100644 --- a/strategy_lab.py +++ b/strategy_lab.py @@ -1012,11 +1012,13 @@ def run_backtest(strategy_version, start_date, end_date, capital=1000000, save=T i += step summary = calc_summary(trades, capital) - # 组合级资产模拟:用该策略自己的最优仓位模型(波段策略大仓少股,固定出场小仓多股) if summary: + # 集中仓位(该策略最优激进仓位) slots = STRATEGY_SIZING.get(strategy_version, 10) summary['portfolio'] = portfolio_sim(trades, capital, slots) summary['sizing_slots'] = slots + # 全参与可行仓位(公平基线:单仓≥5万地板,消除上车运气) + summary['portfolio_full'] = portfolio_sim_full(trades, capital) result = { 'strategy': strat['version'], 'strategy_name': strat['name'],