fix: RR架构统一——s2_panic_v2补rr列(断链)/per_stock_reassess删rr覆盖(RR由scanner定)/strategy_lifecycle不重算rr

This commit is contained in:
xxm
2026-08-18 13:27:45 +08:00
parent 13ff507a3e
commit 0ca4e4b69f
3 changed files with 16 additions and 25 deletions
+5 -9
View File
@@ -1179,15 +1179,11 @@ def reassess_strategy(code, name, price, cost, shares, current_action,
found = True
break
# ----- 风险回报比最终计算 -----
# 2026-08-18 修复:买入价用买入区中值(entry_mid)算 risk,不是现价
# 现价不是买入价——实盘按 entry_mid 买入,risk=entry_mid-stopreward=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
# ----- 风险回报比(不重算,RR 由 scanner 定)-----
# 2026-08-18 修复:RR 由 scanner 定(candidates.rr=holding.rr_ratio),
# strategy_lifecycle 管持仓状态(信号/止损移动),不重算/重写 RR。
# 正确架构:RR 是 scanner 定义的单一事实来源,lifecycle 只读不重算。
rr_ratio = result.get("rr_ratio") or 0
# ----- 状态判断 -----
if is_deep_loss: