fix: 三层修复promote/重评entry错乱——A重评覆盖entry_low/high+B偏离>50%标记校准+C可执行性检查(止损≥2%/止盈≥3%/修正风报比≥2)
This commit is contained in:
@@ -576,6 +576,26 @@ def save_result(code, full_text, parsed, ta_levels=None):
|
||||
params.append(_tp)
|
||||
elif _tp > 0:
|
||||
print(f" ⚠️ 止盈{_tp}与区间/止损不一致,跳过写入(保留原值)", flush=True)
|
||||
# 2026-08-18 修复:LLM 算的 entry 区间也写回 entry_low/entry_high(纠正 promote 错误区间)
|
||||
# 例:promote 入库 entry 95~99 vs 现价 7.59 严重偏离,重评算正确 7.55~7.70 应覆盖
|
||||
_el_new = parsed.get("entry_low") or 0
|
||||
_eh_new = parsed.get("entry_high") or 0
|
||||
if _el_new > 0 and _eh_new > _el_new:
|
||||
# 校验 entry 与现 stop_loss/take_profit 一致(sl < el < eh < tp)
|
||||
_ok = True
|
||||
if "stop_loss=?" in updates:
|
||||
_cur_sl = params[updates.index("stop_loss=?")]
|
||||
if _cur_sl >= _el_new:
|
||||
_ok = False
|
||||
if "take_profit=?" in updates:
|
||||
_cur_tp = params[updates.index("take_profit=?")]
|
||||
if _cur_tp <= _eh_new:
|
||||
_ok = False
|
||||
if _ok:
|
||||
updates.append("entry_low=?")
|
||||
params.append(_el_new)
|
||||
updates.append("entry_high=?")
|
||||
params.append(_eh_new)
|
||||
if parsed["position"]:
|
||||
updates.append("position_advice=?")
|
||||
params.append(parsed["position"])
|
||||
|
||||
Reference in New Issue
Block a user