fix: 箱体/收敛突破标记价反向越界时自动撤销监控
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -167,6 +167,8 @@ from key_monitor_lib import (
|
||||
KEY_MONITOR_RS_TYPES,
|
||||
auto_amp_ok,
|
||||
auto_confirm_ok,
|
||||
box_breakout_invalidate_by_mark,
|
||||
box_breakout_invalidate_edge_label,
|
||||
claim_rs_level_notify,
|
||||
detect_rs_box_break,
|
||||
format_auto_amp_line,
|
||||
@@ -5780,6 +5782,21 @@ def check_key_monitors():
|
||||
direction = (r["direction"] or "long").lower()
|
||||
if direction == KEY_DIRECTION_WATCH:
|
||||
continue
|
||||
if typ in KEY_MONITOR_AUTO_TYPES:
|
||||
mark = get_symbol_mark_price(sym)
|
||||
if mark is not None and box_breakout_invalidate_by_mark(direction, mark, up, low):
|
||||
edge = float(low) if direction == "long" else float(up)
|
||||
edge_label = box_breakout_invalidate_edge_label(direction)
|
||||
msg = (
|
||||
f"# ⚠️ {sym} 关键位监控失效\n"
|
||||
f"**账户:{_wechat_account_label()}**\n"
|
||||
f"- 类型:{typ}|{_wechat_direction_text(direction)}\n"
|
||||
f"- 标记价 {format_price_for_symbol(sym, mark)} 已突破反向{edge_label} "
|
||||
f"{format_price_for_symbol(sym, edge)}(设置失效)\n"
|
||||
)
|
||||
send_wechat_msg(msg)
|
||||
_finalize_key_monitor_one_shot(conn, r, msg, "box_opposite_break")
|
||||
continue
|
||||
try:
|
||||
checks = _key_hard_checks(sym, direction, up, low, typ)
|
||||
except Exception:
|
||||
@@ -7102,6 +7119,7 @@ def api_price_snapshot():
|
||||
fib_gate_ok = True
|
||||
fb_gate_ok = True
|
||||
te_gate_ok = True
|
||||
box_gate_ok = True
|
||||
if is_fib:
|
||||
direction = (r["direction"] or "long").lower()
|
||||
inval = fib_invalidate_by_mark(direction, price, r["upper"], r["lower"])
|
||||
@@ -7158,16 +7176,22 @@ def api_price_snapshot():
|
||||
except Exception:
|
||||
gate_summary = "-"
|
||||
elif (r["monitor_type"] or "").strip() in KEY_MONITOR_AUTO_TYPES:
|
||||
try:
|
||||
gate = _key_hard_checks(
|
||||
r["symbol"],
|
||||
(r["direction"] or "long").lower(),
|
||||
r["upper"],
|
||||
r["lower"],
|
||||
r["monitor_type"],
|
||||
)
|
||||
except Exception:
|
||||
gate = None
|
||||
direction = (r["direction"] or "long").lower()
|
||||
if box_breakout_invalidate_by_mark(direction, price, r["upper"], r["lower"]):
|
||||
edge_label = box_breakout_invalidate_edge_label(direction)
|
||||
gate_summary = f"反向突破{edge_label}·将撤销"
|
||||
box_gate_ok = False
|
||||
else:
|
||||
try:
|
||||
gate = _key_hard_checks(
|
||||
r["symbol"],
|
||||
direction,
|
||||
r["upper"],
|
||||
r["lower"],
|
||||
r["monitor_type"],
|
||||
)
|
||||
except Exception:
|
||||
gate = None
|
||||
if gate:
|
||||
rank_seg = "ERR" if int(gate.get("rank_total") or 0) <= 0 else f"{gate.get('rank')}/{gate.get('rank_total')}"
|
||||
gate_summary = (
|
||||
@@ -7210,7 +7234,7 @@ def api_price_snapshot():
|
||||
fib_gate_ok if is_fib
|
||||
else fb_gate_ok if is_fb
|
||||
else te_gate_ok if is_te
|
||||
else bool(gate and gate.get("ok"))
|
||||
else box_gate_ok and bool(gate and gate.get("ok"))
|
||||
),
|
||||
"gate_metrics": gate_metrics,
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user