feat: 无价值策略淘汰——2y+10y温区年化都跑不赢大盘→历史(unavailable),基准=market_regime指数年化

This commit is contained in:
xxm
2026-08-15 22:31:06 +08:00
parent 9549ec44d5
commit 0a316c1dae
+30 -2
View File
@@ -832,8 +832,36 @@ def api_research_strategies():
s['state'] = 'unavailable'
s['state_reason'] = '已证伪: ' + str(s['deprecated'])[:80]
elif s['version'] in _candidate_pool:
s['state'] = 'available'
s['state_reason'] = '候选池内,当前温区未激活(温区切换即可激活)'
# ── 2026-08-15 无价值淘汰:2y+10y 温区年化都跑不赢大盘 → 历史 ──
# 只在 2y/10y 请求时判定;用当次数据(2y) + 缓存(10y),避免额外重算
_elim_reason = None
try:
_b2, _b10 = _get_benchmarks()
if _b2 is not None and _b10 is not None and pt in ('2y', '10y'):
_r2 = _regime_winrates if pt == '2y' else None
_r10 = _regime_winrates if pt == '10y' else None
# 缓存里拿另一周期(命中才判定,未命中本轮跳过)
_slots_c = _regime_winrates_cache.get("slots") or {}
if _r2 is None and ('2y' in _slots_c):
_r2 = _slots_c['2y'][1]
if _r10 is None and ('10y' in _slots_c):
_r10 = _slots_c['10y'][1]
if _r2 is not None and _r10 is not None:
_v2 = _r2.get(s['version']) or {}
_v10 = _r10.get(s['version']) or {}
if _v2 and _v10:
_best2 = max(r.get('cagr_pct') or -999 for r in _v2.values())
_best10 = max(r.get('cagr_pct') or -999 for r in _v10.values())
if _best2 < _b2 and _best10 < _b10:
_elim_reason = f'2y年化{round(_best2,1)}%<大盘{_b2}% 且 10y年化{round(_best10,1)}%<大盘{_b10}%'
except Exception:
_elim_reason = None
if _elim_reason:
s['state'] = 'unavailable'
s['state_reason'] = '跑不赢大盘已淘汰: ' + _elim_reason
else:
s['state'] = 'available'
s['state_reason'] = '候选池内,当前温区未激活(温区切换即可激活)'
else:
s['state'] = 'unavailable'
s['state_reason'] = '不在候选池(历史版本,路由不会选中)'