fix: run_mr_backtest tp_pct=None兜底默认0.18; evolution_api baseline改为v_weak/v_oversold, get_health_trend默认v_weak

This commit is contained in:
hmo
2026-08-12 00:53:47 +08:00
parent 614b4570d6
commit 38e4a5b160
2 changed files with 5 additions and 5 deletions
+3 -3
View File
@@ -40,9 +40,9 @@ def get_evolution_dashboard():
""").fetchall(): """).fetchall():
evolution.append(dict(r)) evolution.append(dict(r))
# 当前策略基线 # 当前策略基线2026-08-11: 改为当前实盘 v_weak + 新策略 v_oversold
baseline = {} baseline = {}
for v in ['v_next4', 'v_next3', 'v8.1']: for v in ['v_weak', 'v_oversold']:
r = conn.execute(""" r = conn.execute("""
SELECT results_json FROM strategy_research SELECT results_json FROM strategy_research
WHERE version=? AND period_tag='5y' ORDER BY id DESC LIMIT 1 WHERE version=? AND period_tag='5y' ORDER BY id DESC LIMIT 1
@@ -174,7 +174,7 @@ def get_combo_dashboard():
} }
def get_health_trend(version='v_next4', days=30): def get_health_trend(version='v_weak', days=30):
"""健康度趋势""" """健康度趋势"""
conn = sqlite3.connect(DB) conn = sqlite3.connect(DB)
conn.row_factory = sqlite3.Row conn.row_factory = sqlite3.Row
+2 -2
View File
@@ -2299,8 +2299,8 @@ def run_mr_backtest(strategy_version, start_date, end_date, capital=913000,
skip_stats['next_open'] += 1; i += 1; continue skip_stats['next_open'] += 1; i += 1; continue
# ── 出场(均值回归:让利润跑向止盈,无 MA20 截断)── # ── 出场(均值回归:让利润跑向止盈,无 MA20 截断)──
tp_pct = exit_cfg.get('tp_pct', 0.18) tp_pct = exit_cfg.get('tp_pct', 0.18) or 0.18 # None 时用默认 0.18
sl_pct = exit_cfg.get('sl_pct', 0.08) sl_pct = exit_cfg.get('sl_pct', 0.08) or 0.08
max_hold = exit_cfg.get('max_hold_days', 25) max_hold = exit_cfg.get('max_hold_days', 25)
target = ep * (1 + tp_pct) target = ep * (1 + tp_pct)
stop = ep * (1 - sl_pct) stop = ep * (1 - sl_pct)