From 0604532cfe25a1c76cac7d7b64255e0118c8fa4a Mon Sep 17 00:00:00 2001 From: xxm Date: Mon, 17 Aug 2026 20:10:26 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20watchlist=E6=B7=98=E6=B1=B0=E5=9B=9E?= =?UTF-8?q?=E6=B3=A8=E7=94=A8strategy=5Fname=E9=9D=9Ev=5Fmr=E7=A1=AC?= =?UTF-8?q?=E7=BC=96=E7=A0=81(=E4=BF=9D=E7=95=99=E6=9D=A5=E6=BA=90?= =?UTF-8?q?=E7=AD=96=E7=95=A5=E8=AF=AD=E4=B9=89)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- deploy/profile-scripts/watchlist_auto_exit.py | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/deploy/profile-scripts/watchlist_auto_exit.py b/deploy/profile-scripts/watchlist_auto_exit.py index 85e537fd..b1bdeec6 100644 --- a/deploy/profile-scripts/watchlist_auto_exit.py +++ b/deploy/profile-scripts/watchlist_auto_exit.py @@ -81,14 +81,20 @@ def main(dry_run=False): ) # 回归选股池(2026-08-03 老莫修正:废除策略后票回归候选池,下次重走完整流程) _stock_name = conn.execute("SELECT name FROM stocks WHERE code=?", (code,)).fetchone() + # 2026-08-17 修复:sector 用该股自己的 strategy_name(保留来源策略语义,不再硬编码 v_mr) + _strat = conn.execute( + "SELECT strategy_name FROM holding_strategies WHERE code=? AND status='active'", + (code,)).fetchone() + _strat_name = (_strat[0] if _strat and _strat[0] else "unknown") conn.execute( - "INSERT INTO candidates (code, name, sector, reason, dropped, drop_reason, promoted, created_at) " - "VALUES (?,?,?,?,0,NULL,0,datetime('now','localtime')) " + "INSERT INTO candidates (code, name, sector, reason, dropped, drop_reason, promoted, " + "source_strategy, created_at) " + "VALUES (?,?,?,?,0,NULL,0,?,datetime('now','localtime')) " "ON CONFLICT(code) DO UPDATE SET " "name=excluded.name, dropped=0, drop_reason=NULL, promoted=0, " - "reason=excluded.reason, created_at=excluded.created_at", - (code, (_stock_name[0] if _stock_name else name) or "", "v_mr", - "自选退出回归选股池: " + reason_text) + "reason=excluded.reason, source_strategy=excluded.source_strategy, created_at=excluded.created_at", + (code, (_stock_name[0] if _stock_name else name) or "", _strat_name, + "自选退出回归选股池: " + reason_text, _strat_name) ) print(f" 🔴 删除: {code} {name or ''} | {reason_text}") else: