From 057fdd23dae06603d1e1fc6687814ca4063c48f9 Mon Sep 17 00:00:00 2001 From: xxm Date: Mon, 17 Aug 2026 09:33:47 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20scanner=20all=5Fstocks=E7=BA=AFcode?= =?UTF-8?q?=E8=A7=A3=E5=8C=85bug=E2=80=94=E2=80=94b=5Ftd1=5Fv3/s2=5Fpanic?= =?UTF-8?q?=5Fv2=E5=AE=9E=E7=9B=98=E6=89=AB=E6=8F=8F=E4=B8=8D=E5=86=8D?= =?UTF-8?q?=E5=B4=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- deploy/profile-scripts/b_td1_v3_scanner.py | 10 ++++++---- deploy/profile-scripts/s2_panic_v2_scanner.py | 8 +++++--- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/deploy/profile-scripts/b_td1_v3_scanner.py b/deploy/profile-scripts/b_td1_v3_scanner.py index 3195a043..137a5cb0 100644 --- a/deploy/profile-scripts/b_td1_v3_scanner.py +++ b/deploy/profile-scripts/b_td1_v3_scanner.py @@ -152,13 +152,15 @@ def main(): all_stocks, existing = get_stock_pool() print(f" 股票池 {len(all_stocks)} 只", flush=True) hits = [] - for code, name in all_stocks: + for code in all_stocks: + if code in existing: + continue try: klines = fetch_tx_klines(code, datalen=120) sig = check_b_td1(klines, code) if sig: - hits.append((code, name, sig)) - except Exception as e: + hits.append((code, code, sig)) # name 暂用 code(与 mr_scanner 同源) + except Exception: pass # score 降序 top-N hits.sort(key=lambda x: -x[2]["score"]) @@ -176,7 +178,7 @@ def main(): "ON CONFLICT(code) DO UPDATE SET " "name=excluded.name, sector=excluded.sector, reason=excluded.reason, " "entry_range=excluded.entry_range, stop_loss=excluded.stop_loss, target=excluded.target", - (code, name, "b_td1_v3", reasons, + (code, code, "b_td1_v3", reasons, f"{sig['price']*0.98:.2f}~{sig['price']:.2f}", sig["stop_loss"], sig["target"])) inserted += 1 print(f" 🟢 {code} {name} 价{sig['price']} score={sig['score']} {reasons}", flush=True) diff --git a/deploy/profile-scripts/s2_panic_v2_scanner.py b/deploy/profile-scripts/s2_panic_v2_scanner.py index 3a47cf1a..e9fd4b68 100644 --- a/deploy/profile-scripts/s2_panic_v2_scanner.py +++ b/deploy/profile-scripts/s2_panic_v2_scanner.py @@ -134,12 +134,14 @@ def main(): all_stocks, existing = get_stock_pool() print(f" 股票池 {len(all_stocks)} 只", flush=True) hits = [] - for code, name in all_stocks: + for code in all_stocks: + if code in existing: + continue try: klines = fetch_tx_klines(code, datalen=120) sig = check_s2v2(klines, code) if sig: - hits.append((code, name, sig)) + hits.append((code, code, sig)) # name 暂用 code except Exception: pass hits.sort(key=lambda x: -x[2]["score"]) @@ -155,7 +157,7 @@ def main(): "ON CONFLICT(code) DO UPDATE SET " "name=excluded.name, sector=excluded.sector, reason=excluded.reason, " "entry_range=excluded.entry_range, stop_loss=excluded.stop_loss, target=excluded.target", - (code, name, "s2_panic_v2", reasons, + (code, code, "s2_panic_v2", reasons, f"{sig['price']*0.98:.2f}~{sig['price']:.2f}", sig["stop_loss"], sig["target"])) inserted += 1 print(f" 🟢 {code} {name} 价{sig['price']} score={sig['score']} {reasons}", flush=True)