From 0708a5ffaa0f8b7d5c4cf33409b02bd0e0c82a2c Mon Sep 17 00:00:00 2001 From: hmo Date: Mon, 27 Jul 2026 10:02:40 +0800 Subject: [PATCH] =?UTF-8?q?fix(rr):=20=E5=8D=96=E5=87=BA/=E6=AD=A2?= =?UTF-8?q?=E7=9B=88=E4=BF=A1=E5=8F=B7=E4=B8=8D=E8=AE=A1=E7=AE=97RR(RR?= =?UTF-8?q?=E6=98=AF=E4=B9=B0=E5=85=A5=E5=8C=BA=E9=97=B4=E7=9A=84=E7=9B=88?= =?UTF-8?q?=E4=BA=8F=E6=AF=94,=E5=AF=B9=E5=8D=96=E6=97=A0=E6=84=8F?= =?UTF-8?q?=E4=B9=89)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - recompute_rr检测到卖出信号直接写0返回 - 前端RR=0时显示'—'(已有逻辑) - 补充: 卖出/止盈/关注/观望等非买入信号RR不显示 --- mofin_db.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/mofin_db.py b/mofin_db.py index 74935ba4..8651a83c 100644 --- a/mofin_db.py +++ b/mofin_db.py @@ -1186,6 +1186,16 @@ def recompute_rr(conn, code: str) -> float: return 0.0 el, eh, sl, tp = (row[0] or 0), (row[1] or 0), (row[2] or 0), (row[3] or 0) + # 卖出/止盈信号:RR(买在区间的盈亏比)对卖出无意义,直接返回0(2026-07-27 老爸) + try: + _sig_r = conn.execute("SELECT timing_signal FROM holding_strategies WHERE code=? AND status='active'", (code,)).fetchone() + if _sig_r and _sig_r[0] in ("卖出", "止盈"): + conn.execute("UPDATE holding_strategies SET rr_ratio=0, rr_low=0, rr_high=0 WHERE code=? AND status='active'", (code,)) + conn.commit() + return 0.0 + except Exception: + pass + # 20日新高(前高阻力) high_20d = 0.0 try: