From 34a7d521d0cf10efa0856ff61a2a8b9841181765 Mon Sep 17 00:00:00 2001 From: xxm Date: Mon, 17 Aug 2026 15:50:57 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20accumulation/mr=20scanner=E5=86=99candi?= =?UTF-8?q?dates.rr=E2=80=94=E2=80=94=E5=85=A8=E9=83=A8scanner=E6=8C=89?= =?UTF-8?q?=E8=A7=84=E8=8C=83=E6=8F=90=E4=BE=9BRR?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- deploy/profile-scripts/accumulation_scanner.py | 10 ++++++---- deploy/profile-scripts/mr_scanner.py | 10 ++++++---- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/deploy/profile-scripts/accumulation_scanner.py b/deploy/profile-scripts/accumulation_scanner.py index 0697655b..07ab7c77 100644 --- a/deploy/profile-scripts/accumulation_scanner.py +++ b/deploy/profile-scripts/accumulation_scanner.py @@ -230,16 +230,18 @@ def main(): # UPSERT:只更新扫描器自有列,保留 score_*/pass_*/promoted/log/zhiwei_* 等计算列 # (原 INSERT OR REPLACE 会把 promoted=1 的行整行替换,计算列全部清零——2026-07-23 审计发现) + _mid_v = (entry_low + entry_high) / 2 + _rr_v = round((tp - _mid_v) / (_mid_v - sl), 2) if _mid_v > sl > 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, "accumulation", f"主力建仓特征({reasons}) 评分{score}/7", - f"{entry_low}~{entry_high}", sl, tp) + f"{entry_low}~{entry_high}", sl, tp, _rr_v) ) inserted += 1 print(f" 🟢 {code} {name} 价{price} 评分{score}/7 {reasons}", flush=True) diff --git a/deploy/profile-scripts/mr_scanner.py b/deploy/profile-scripts/mr_scanner.py index 750fb5e7..be2c2b33 100644 --- a/deploy/profile-scripts/mr_scanner.py +++ b/deploy/profile-scripts/mr_scanner.py @@ -317,15 +317,17 @@ def main(): (code,)).fetchone() if exists: continue + _mid_v = (entry_low + entry_high) / 2 + _rr_v = round((tp - _mid_v) / (_mid_v - sl), 2) if _mid_v > sl > 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, "v_mr", reasons, - f"{entry_low}~{entry_high}", sl, tp)) + f"{entry_low}~{entry_high}", sl, tp, _rr_v)) inserted += 1 print(f" 🟢 {code} {name} 价{price} bias60={sig['bias60']}% " f"rsi={sig['rsi']} r5f={sig['r5f']}% {reasons}", flush=True)