fix: scanner all_stocks纯code解包bug——b_td1_v3/s2_panic_v2实盘扫描不再崩

This commit is contained in:
xxm
2026-08-17 09:33:47 +08:00
parent 63aeecefad
commit 057fdd23da
2 changed files with 11 additions and 7 deletions
+6 -4
View File
@@ -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)
@@ -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)