From 236c7bce1ab0cfba7e0e49780090c8ccd605056d Mon Sep 17 00:00:00 2001 From: xxm Date: Tue, 18 Aug 2026 12:30:53 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20RR=E5=8F=A3=E5=BE=84=E4=BF=AE=E6=AD=A3?= =?UTF-8?q?=E2=80=94=E2=80=94=E4=B9=B0=E5=85=A5=E4=BB=B7=E7=94=A8entry=5Fm?= =?UTF-8?q?id=E7=AE=97risk(=E4=B8=8D=E6=98=AF=E7=8E=B0=E4=BB=B7),risk=3Den?= =?UTF-8?q?try=5Fmid-stop,reward=3Dtp-entry=5Fmid?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- deploy/profile-scripts/strategy_lifecycle.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/deploy/profile-scripts/strategy_lifecycle.py b/deploy/profile-scripts/strategy_lifecycle.py index 7dcf4d08..8e1d0e45 100644 --- a/deploy/profile-scripts/strategy_lifecycle.py +++ b/deploy/profile-scripts/strategy_lifecycle.py @@ -1180,8 +1180,13 @@ def reassess_strategy(code, name, price, cost, shares, current_action, break # ----- 风险回报比最终计算 ----- - risk = max(price - new_stop, price * 0.01) - reward = max(new_target - price, 0) + # 2026-08-18 修复:买入价用买入区中值(entry_mid)算 risk,不是现价 + # 现价不是买入价——实盘按 entry_mid 买入,risk=entry_mid-stop,reward=tp-entry_mid + _el = result.get("entry_low") or 0 + _eh = result.get("entry_high") or 0 + _entry_mid = (_el + _eh) / 2 if (_el > 0 and _eh > _el) else price + risk = max(_entry_mid - new_stop, _entry_mid * 0.01) + reward = max(new_target - _entry_mid, 0) rr_ratio = reward / risk if risk > 0 else 0 # ----- 状态判断 -----