fix: 回撤排序键对齐MC显示值+回撤类默认升序(小回撤优先)

This commit is contained in:
hmo
2026-07-30 01:35:07 +08:00
parent ce4b70c32b
commit c9d47b651a
+3 -2
View File
@@ -1959,12 +1959,13 @@ async function loadStrategyList() {
}
}
const ASC_DEFAULT = new Set(['max_dd']); // 回撤类:小=好,默认升序
function sortBy(key) {
if (window._sortKey === key) {
window._sortDir = window._sortDir === 'desc' ? 'asc' : 'desc';
} else {
window._sortKey = key;
window._sortDir = 'desc';
window._sortDir = ASC_DEFAULT.has(key) ? 'asc' : 'desc';
}
renderStrategyTable(window._strats || []);
}
@@ -1988,7 +1989,7 @@ function sortStrategies(strategies, key, dir) {
case 'avg_profit': return st.avg_profit_pct != null ? st.avg_profit_pct : -999;
case 'sharpe': return st.sharpe_ratio != null ? st.sharpe_ratio : -999;
case 'profit_factor': return st.profit_factor != null ? st.profit_factor : -999;
case 'max_dd': return pf.portfolio_max_dd_pct != null ? pf.portfolio_max_dd_pct : 999;
case 'max_dd': return (st.portfolio_full || pf).portfolio_max_dd_pct != null ? (st.portfolio_full || pf).portfolio_max_dd_pct : 999;
default: return 0;
}
};