fix: 清理残留_qual引用→_cur_regime_q(per-regime改造遗漏导致500)

This commit is contained in:
xxm
2026-08-16 08:56:05 +08:00
parent eaab1fc258
commit 0e047b0df3
+5 -5
View File
@@ -845,7 +845,7 @@ def api_research_strategies():
elif not _l_ok:
s['state'] = 'unavailable'
s['state_reason'] = '长期不合格(10y适应温区年化%s%%<大盘%s%%)' % (
round(_qual['cagr_10y'], 1) if _qual and _qual.get('cagr_10y') is not None else '?',
round(_cur_regime_q['cagr_10y'], 1) if _cur_regime_q and _cur_regime_q.get('cagr_10y') is not None else '?',
_qbench_data.get('10y'))
elif _qual_ok_2:
s['state'] = 'available'
@@ -858,14 +858,14 @@ def api_research_strategies():
s['state_reason'] = '不在候选池(历史版本,路由不会选中)'
# 2026-08-16 警告标记:可用性下降(近期转差)/ 回升(不可用但近期转好)
s['qual_warning'] = None
if _qual and s.get('manual_available'):
if _cur_regime_q and s.get('manual_available'):
if not _m_ok and _l_ok:
s['qual_warning'] = '⚠️近期转差: 2y年化%s%%<大盘%s%%' % (
round(_qual['cagr_2y'], 1) if _qual.get('cagr_2y') is not None else '?',
round(_cur_regime_q['cagr_2y'], 1) if _cur_regime_q.get('cagr_2y') is not None else '?',
_qbench_data.get('2y'))
if _qual and not s.get('manual_available') and _s_ok:
if _cur_regime_q and not s.get('manual_available') and _s_ok:
s['qual_warning'] = '🔄近期回升: 1y年化%s%%>大盘%s%%,可考虑重新启用' % (
round(_qual['cagr_1y'], 1) if _qual.get('cagr_1y') is not None else '?',
round(_cur_regime_q['cagr_1y'], 1) if _cur_regime_q.get('cagr_1y') is not None else '?',
_qbench_data.get('1y'))
# 2026-08-13 关键修复:激活策略必须始终在列表中(即使该 period 无回测记录)