perf: 进化API改读预计算json——假设归纳/B组/资格概览不再实时重算(面板加载太慢)

This commit is contained in:
xxm
2026-08-16 13:20:30 +08:00
parent 2a81039180
commit eda5180396
+5 -30
View File
@@ -72,40 +72,15 @@ def get_evolution_dashboard():
'max_dd': pf.get('portfolio_max_dd_pct', 0),
}
# ── 2026-08-16 数据归纳假设(方向一):每个激活策略的归纳优化假设 ──
# ── 2026-08-16 进化机制数据:读预计算快照(precompute_evolution.py 定期生成,避免实时重算)──
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})
_ec = json.loads(open('/home/hmo/MoFin/data/evolution_center.json', encoding='utf-8').read())
hypotheses = _ec.get('hypotheses', [])
b_group = _ec.get('b_group', [])
qual_overview = _ec.get('qual_overview', [])
except Exception:
pass