fix: RR架构统一——s2_panic_v2补rr列(断链)/per_stock_reassess删rr覆盖(RR由scanner定)/strategy_lifecycle不重算rr
This commit is contained in:
@@ -159,14 +159,17 @@ def main():
|
||||
inserted = 0
|
||||
for code, name, sig in hits:
|
||||
reasons = (f"rsi={sig['rsi']} mcap_q={sig['mcap_q']} score={sig['score']}")
|
||||
# 2026-08-18 补 rr 列(断链 bug:promote 的 _rr is None 全跳过,与 b_td1_v3 同口径)
|
||||
_mid_v = (sig['price'] * 0.98 + sig['price']) / 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, source_strategy, created_at) "
|
||||
"VALUES (?,?,?,?,?,?,?,?,datetime('now','localtime')) "
|
||||
"INSERT INTO candidates (code, name, sector, reason, entry_range, stop_loss, target, rr, source_strategy, 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, source_strategy=excluded.source_strategy",
|
||||
"entry_range=excluded.entry_range, stop_loss=excluded.stop_loss, target=excluded.target, rr=excluded.rr, source_strategy=excluded.source_strategy",
|
||||
(code, code, "s2_panic_v2", reasons,
|
||||
f"{sig['price']*0.98:.2f}~{sig['price']:.2f}", sig["stop_loss"], sig["target"], "s2_panic_v2"))
|
||||
f"{sig['price']*0.98:.2f}~{sig['price']:.2f}", sig["stop_loss"], sig["target"], _rr_v, "s2_panic_v2"))
|
||||
inserted += 1
|
||||
print(f" 🟢 {code} {name} 价{sig['price']} score={sig['score']} {reasons}", flush=True)
|
||||
conn.commit()
|
||||
|
||||
Reference in New Issue
Block a user