fix: show limit-order gate for false breakout monitors
False breakout used box/convergence volume/break gates in the UI; now shows pending limit order status like fib monitors. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -57,6 +57,7 @@ from false_breakout_key_monitor_lib import (
|
||||
FALSE_BREAKOUT_VALIDITY_HOURS,
|
||||
calc_false_breakout_plan,
|
||||
expires_at_text,
|
||||
false_breakout_gate_preview,
|
||||
is_false_breakout_expired,
|
||||
is_false_breakout_key_monitor_type,
|
||||
is_limit_key_monitor_type,
|
||||
@@ -6329,7 +6330,8 @@ def api_price_snapshot():
|
||||
key_prices = []
|
||||
for r in key_rows:
|
||||
is_fib = is_fib_key_monitor_type(r["monitor_type"])
|
||||
if is_fib:
|
||||
is_fb = is_false_breakout_key_monitor_type(r["monitor_type"])
|
||||
if is_fib or is_fb:
|
||||
price = get_symbol_mark_price(r["symbol"])
|
||||
else:
|
||||
price = prices.get(r["symbol"])
|
||||
@@ -6341,6 +6343,7 @@ def api_price_snapshot():
|
||||
gate_summary = "-"
|
||||
gate_metrics = ""
|
||||
fib_gate_ok = True
|
||||
fb_gate_ok = True
|
||||
if is_fib:
|
||||
direction = (r["direction"] or "long").lower()
|
||||
inval = fib_invalidate_by_mark(direction, price, r["upper"], r["lower"])
|
||||
@@ -6350,6 +6353,18 @@ def api_price_snapshot():
|
||||
gate_summary = f"斐波 挂E={entry_txt} {'标记价将失效' if inval else '等待成交'}"
|
||||
if _sqlite_row_val(r, "fib_limit_order_id"):
|
||||
gate_metrics = f"限价单:{_sqlite_row_val(r, 'fib_limit_order_id')}"
|
||||
elif is_fb:
|
||||
entry = _sqlite_row_val(r, "fib_entry_price")
|
||||
entry_txt = format_price_for_symbol(r["symbol"], entry) if entry else "-"
|
||||
prev = false_breakout_gate_preview(
|
||||
entry_display=entry_txt,
|
||||
limit_order_id=_sqlite_row_val(r, "fib_limit_order_id"),
|
||||
created_at=r["created_at"],
|
||||
now=app_now(),
|
||||
)
|
||||
gate_summary = prev.get("summary") or "-"
|
||||
gate_metrics = prev.get("metrics") or ""
|
||||
fb_gate_ok = bool(prev.get("gate_ok"))
|
||||
elif (r["monitor_type"] or "").strip() in KEY_MONITOR_RS_TYPES:
|
||||
try:
|
||||
prev = _key_rs_gate_preview(r["symbol"], r["upper"], r["lower"])
|
||||
@@ -6357,7 +6372,7 @@ def api_price_snapshot():
|
||||
gate_metrics = prev.get("metrics") or ""
|
||||
except Exception:
|
||||
gate_summary = "-"
|
||||
else:
|
||||
elif (r["monitor_type"] or "").strip() in KEY_MONITOR_AUTO_TYPES:
|
||||
try:
|
||||
gate = _key_hard_checks(
|
||||
r["symbol"],
|
||||
@@ -6402,7 +6417,11 @@ def api_price_snapshot():
|
||||
"lower_diff": lower_diff,
|
||||
"lower_pct": lower_pct,
|
||||
"gate_summary": gate_summary,
|
||||
"gate_ok": fib_gate_ok if is_fib else bool(gate and gate.get("ok")),
|
||||
"gate_ok": (
|
||||
fib_gate_ok if is_fib
|
||||
else fb_gate_ok if is_fb
|
||||
else bool(gate and gate.get("ok"))
|
||||
),
|
||||
"gate_metrics": gate_metrics,
|
||||
})
|
||||
|
||||
|
||||
Reference in New Issue
Block a user