fix: 重评同步trigger_json(price_monitor阈值源,广信教训)+RR淘汰门槛1.5→2.0(与promote闭环)

This commit is contained in:
xxm
2026-08-17 16:30:37 +08:00
parent 15887c4d67
commit 364911b865
2 changed files with 20 additions and 3 deletions
+17
View File
@@ -578,6 +578,23 @@ def save_result(code, full_text, parsed, ta_levels=None):
updates.append("action=?")
params.append(parsed["action_advice"])
# ── 2026-08-17 同步 trigger_jsonprice_monitor 的监控阈值来源 ──
if updates:
_cur = conn.execute(
"SELECT stop_loss, take_profit, entry_low, entry_high FROM holding_strategies "
"WHERE code=? AND status='active'", (code,)).fetchone()
_sl = _tp = _el = _eh = 0
if _cur:
_sl, _tp, _el, _eh = _cur
if "stop_loss=?" in updates:
_sl = params[updates.index("stop_loss=?")]
if "take_profit=?" in updates:
_tp = params[updates.index("take_profit=?")]
import json as _json
_trigger = {"stop_loss": _sl, "entry_zone": f"{_el}~{_eh}" if _el and _eh else "",
"take_profit_zone": f"0~{_tp}" if _tp else ""}
updates.append("trigger_json=?")
params.append(_json.dumps(_trigger, ensure_ascii=False))
params.append(code)
sql = f"UPDATE holding_strategies SET {', '.join(updates)} WHERE code=? AND status='active'"
conn.execute(sql, params)
@@ -71,13 +71,13 @@ def main(dry_run=False):
except Exception:
pass
# 条件5: RR闸——RR<1.5 的平庸标的直接出(老爸:1.5边缘也是阿猫阿狗
# 条件5: RR闸——RR<2.0 淘汰(2026-08-17 老莫:每日重评后低于2.0淘汰,与promote门槛2.0闭环
try:
_rr = conn.execute(
"SELECT rr_ratio FROM holding_strategies WHERE code=? AND status='active'",
(code,)).fetchone()
if _rr and _rr[0] is not None and 0 < _rr[0] < 1.5:
reasons.append(f"RR={_rr[0]}<1.5")
if _rr and _rr[0] is not None and 0 < _rr[0] < 2.0:
reasons.append(f"RR={_rr[0]}<2.0")
except Exception:
pass