fix: strategy_lifecycle RR用new_stop/new_target/price算(修NameError result未定义)
This commit is contained in:
@@ -1179,11 +1179,14 @@ def reassess_strategy(code, name, price, cost, shares, current_action,
|
||||
found = True
|
||||
break
|
||||
|
||||
# ----- 风险回报比(不重算,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
|
||||
# ----- 风险回报比(供状态判断,不写回 holding)-----
|
||||
# 2026-08-18 修复:RR 用局部变量 new_stop/new_target/price 算(result 未定义→NameError)。
|
||||
# 供状态判断(is_new_entry+rr<1.5 → 不建议买入);不重锚定 stop/tp 写回 holding
|
||||
# (RR 由 scanner 定,per_stock_reassess 用 holding 的 rr_ratio)。
|
||||
_entry_ref = price
|
||||
_risk_r = max(_entry_ref - new_stop, _entry_ref * 0.01)
|
||||
_reward_r = max(new_target - _entry_ref, 0)
|
||||
rr_ratio = _reward_r / _risk_r if _risk_r > 0 else 0
|
||||
|
||||
# ----- 状态判断 -----
|
||||
if is_deep_loss:
|
||||
|
||||
Reference in New Issue
Block a user