feat: 进化API返回假设归纳+B组候选+策略资格概览——界面体现后台进化机制

This commit is contained in:
xxm
2026-08-16 13:08:19 +08:00
parent 48765e615b
commit b63fe3cf5f
+40
View File
@@ -72,6 +72,43 @@ def get_evolution_dashboard():
'max_dd': pf.get('portfolio_max_dd_pct', 0),
}
# ── 2026-08-16 数据归纳假设(方向一):每个激活策略的归纳优化假设 ──
hypotheses = []
try:
sys.path.insert(0, '/home/hmo/MoFin/evolution')
from hypothesis_miner import induce_hypotheses
for v in _active_versions():
mkt = 'hk' if v.startswith('hk') else 'a'
hs, _ = induce_hypotheses(v, mkt, period_tag='2y')
for h in hs[:3]:
hypotheses.append({
'strategy': v, 'market': mkt, **h,
})
except Exception:
pass
# ── 2026-08-16 B组候选(方向二):由果及因挖掘的候选策略 ──
b_group = []
try:
import json as _j
p = _j.loads(open('/home/hmo/MoFin/data/b_group_candidates.json', encoding='utf-8').read())
b_group = p.get('candidates', [])
except Exception:
pass
# ── 2026-08-16 策略资格概览(研究Tab进化中心用)──
qual_overview = []
try:
import sys as _sy
_sy.path.insert(0, '/home/hmo/MoFin/deploy/profile-scripts')
from strategy_qualify import evaluate_all_regimes, get_benchmarks
for v in _active_versions():
mkt = 'hk' if v.startswith('hk') else 'a'
q = evaluate_all_regimes(v, mkt, bench=get_benchmarks(mkt))
qual_overview.append({'strategy': v, 'market': mkt, 'qualification': q})
except Exception:
pass
conn.close()
return {
@@ -79,6 +116,9 @@ def get_evolution_dashboard():
'lessons': lessons,
'evolution': evolution,
'baseline': baseline,
'hypotheses': hypotheses,
'b_group': b_group,
'qual_overview': qual_overview,
}