From 38e4a5b160193fae9d7bc1d7b385cc07ab6b96c3 Mon Sep 17 00:00:00 2001 From: hmo Date: Wed, 12 Aug 2026 00:53:47 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20run=5Fmr=5Fbacktest=20tp=5Fpct=3DNone?= =?UTF-8?q?=E5=85=9C=E5=BA=95=E9=BB=98=E8=AE=A40.18;=20evolution=5Fapi=20b?= =?UTF-8?q?aseline=E6=94=B9=E4=B8=BAv=5Fweak/v=5Foversold,=20get=5Fhealth?= =?UTF-8?q?=5Ftrend=E9=BB=98=E8=AE=A4v=5Fweak?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- evolution/evolution_api.py | 6 +++--- strategy_lab.py | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/evolution/evolution_api.py b/evolution/evolution_api.py index 7bcbe5af..adf77bd3 100644 --- a/evolution/evolution_api.py +++ b/evolution/evolution_api.py @@ -40,9 +40,9 @@ def get_evolution_dashboard(): """).fetchall(): evolution.append(dict(r)) - # 当前策略基线 + # 当前策略基线(2026-08-11: 改为当前实盘 v_weak + 新策略 v_oversold) baseline = {} - for v in ['v_next4', 'v_next3', 'v8.1']: + for v in ['v_weak', 'v_oversold']: r = conn.execute(""" SELECT results_json FROM strategy_research 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.row_factory = sqlite3.Row diff --git a/strategy_lab.py b/strategy_lab.py index f2a08da9..236263b2 100644 --- a/strategy_lab.py +++ b/strategy_lab.py @@ -2299,8 +2299,8 @@ def run_mr_backtest(strategy_version, start_date, end_date, capital=913000, skip_stats['next_open'] += 1; i += 1; continue # ── 出场(均值回归:让利润跑向止盈,无 MA20 截断)── - tp_pct = exit_cfg.get('tp_pct', 0.18) - sl_pct = exit_cfg.get('sl_pct', 0.08) + tp_pct = exit_cfg.get('tp_pct', 0.18) or 0.18 # None 时用默认 0.18 + sl_pct = exit_cfg.get('sl_pct', 0.08) or 0.08 max_hold = exit_cfg.get('max_hold_days', 25) target = ep * (1 + tp_pct) stop = ep * (1 - sl_pct)