fix: 全参与列色条键缺失导致加载失败(ranges[total_return_pct] undefined)
This commit is contained in:
+3
-3
@@ -2052,12 +2052,12 @@ function renderStrategyTable(strategies) {
|
||||
// 条件格式色条:计算每列 min/max,单元格背景按相对大小画色条
|
||||
const CURRENT_STRATEGY = 'v7.1';
|
||||
const ranges = {};
|
||||
const cols = ['composite','universality_score','capital_final','cagr_pct','total_trades','avg_hold_days','win_rate','avg_profit_pct','sharpe_ratio','profit_factor','portfolio_max_dd_pct'];
|
||||
const cols = ['composite','universality_score','full_return_pct','capital_final','cagr_pct','total_trades','avg_hold_days','win_rate','avg_profit_pct','sharpe_ratio','profit_factor','portfolio_max_dd_pct'];
|
||||
for (const c of cols) {
|
||||
let mn = Infinity, mx = -Infinity;
|
||||
for (const s of strategies) {
|
||||
const st = s.summary_stats || {}; const pf = st.portfolio || {};
|
||||
const v = c === 'composite' ? s._composite : (c === 'universality_score' ? (st.universality || {}).score : ((c in pf) ? pf[c] : st[c]));
|
||||
const v = c === 'composite' ? s._composite : (c === 'universality_score' ? (st.universality || {}).score : (c === 'full_return_pct' ? (st.portfolio_full || {}).total_return_pct : ((c in pf) ? pf[c] : st[c])));
|
||||
if (v != null) { mn = Math.min(mn, v); mx = Math.max(mx, v); }
|
||||
}
|
||||
ranges[c] = { mn: mn === Infinity ? 0 : mn, mx: mx === -Infinity ? 1 : mx };
|
||||
@@ -2108,7 +2108,7 @@ function renderStrategyTable(strategies) {
|
||||
'<td class="text-center px-2 py-1.5 font-mono text-cyan-300">' + (st.sizing_slots ? st.sizing_slots + '仓' : '10仓') + '</td>' +
|
||||
cell('composite', s._composite, v => v, 'font-bold text-amber-300') +
|
||||
cell('universality_score', (st.universality || {}).score, v => v + '<span class="text-slate-500">/' + (st.universality || {}).months + '月</span>') +
|
||||
cell('total_return_pct', (st.portfolio_full || {}).total_return_pct, v => v + '%' + ((st.portfolio_full||{}).std ? '<span class="text-slate-500 text-[10px]">±' + (st.portfolio_full||{}).std + '</span>' : ''), 'font-bold text-amber-300') +
|
||||
cell('full_return_pct', (st.portfolio_full || {}).total_return_pct, v => v + '%' + ((st.portfolio_full||{}).std ? '<span class="text-slate-500 text-[10px]">±' + (st.portfolio_full||{}).std + '</span>' : ''), 'font-bold text-amber-300') +
|
||||
cell('capital_final', (st.portfolio_full||pf).capital_final, v => '¥' + (v/10000).toFixed(0) + '万') +
|
||||
cell('cagr_pct', (st.portfolio_full||pf).cagr_pct, v => v + '%', hl((st.portfolio_full||pf).cagr_pct, best.cagr_pct)) +
|
||||
cell('total_trades', st.total_trades, v => (pf.positions_taken||0) + '/' + (v > 999 ? Math.round(v/1000) + 'k' : v), '', false) +
|
||||
|
||||
Reference in New Issue
Block a user