diff --git a/deploy/profile-scripts/s2_scanner.py b/deploy/profile-scripts/s2_scanner.py index a8da9d20..8e5b67df 100644 --- a/deploy/profile-scripts/s2_scanner.py +++ b/deploy/profile-scripts/s2_scanner.py @@ -227,15 +227,18 @@ def main(): (code,)).fetchone() if exists: continue + # RR 由策略算(老莫规范 2026-08-17):promote 只卡阈值不重锚定 + _mid_v = (entry_low + entry_high) / 2 + _rr_v = round((sig["target"] - _mid_v) / (_mid_v - sig["stop_loss"]), 2) if _mid_v > sig["stop_loss"] > 0 else 0 conn.execute( "INSERT INTO candidates (code, name, sector, reason, " - "entry_range, stop_loss, target, created_at) " - "VALUES (?,?,?,?,?,?,?,datetime('now','localtime')) " + "entry_range, stop_loss, target, rr, created_at) " + "VALUES (?,?,?,?,?,?,?,?,datetime('now','localtime')) " "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", + "entry_range=excluded.entry_range, stop_loss=excluded.stop_loss, target=excluded.target, rr=excluded.rr", (code, name, "s2_panic", reasons, - f"{entry_low}~{entry_high}", sig["stop_loss"], sig["target"])) + f"{entry_low}~{entry_high}", sig["stop_loss"], sig["target"], _rr_v)) inserted += 1 print(f" 🟢 {code} {name} 价{price} bias60={sig['bias60']}% r5f={sig['r5f']}% dist_lo20={sig['dist_lo20']}%", flush=True) conn.commit()