feat: RR规范落地——各scanner写candidates.rr(策略算RR),promote只卡阈值不重锚定(b_td1/p_oversold豁免超跌门槛)

This commit is contained in:
xxm
2026-08-17 15:39:06 +08:00
parent 16c18377f5
commit 327f9d3e00
+7 -4
View File
@@ -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()