Fix OKX header trade stats stuck at zero after settings shell load.
Always SSR records summary on embed shell (including settings/risk/env), and refresh total/win-rate/PL ratio via account_snapshot so soft-nav cannot leave the strip blank. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -7458,6 +7458,9 @@ def api_account_snapshot():
|
||||
active_pnl_rows = conn.execute(
|
||||
"SELECT exchange_symbol, symbol, direction FROM order_monitors WHERE status='active'"
|
||||
).fetchall()
|
||||
from lib.instance.instance_embed_context_lib import header_trade_stats_for_window, total_funds_usdt
|
||||
|
||||
header_trade_stats = header_trade_stats_for_window(conn, _list_window_from_request(), APP_TZ)
|
||||
conn.close()
|
||||
can_trade = can_trade_new_open(
|
||||
time_allows=trading_day_reset_allows_new_open(now),
|
||||
@@ -7468,7 +7471,6 @@ def api_account_snapshot():
|
||||
extra_blocks=not risk_status.get("can_trade", True),
|
||||
)
|
||||
available_trading_usdt = get_available_trading_usdt()
|
||||
from lib.instance.instance_embed_context_lib import total_funds_usdt
|
||||
|
||||
unrealized_pnl = None
|
||||
if exchange_private_api_configured():
|
||||
@@ -7498,6 +7500,9 @@ def api_account_snapshot():
|
||||
"daily_open_alert_threshold": DAILY_OPEN_ALERT_THRESHOLD,
|
||||
"manual_min_planned_rr": MANUAL_MIN_PLANNED_RR,
|
||||
"trading_day": trading_day,
|
||||
"total": header_trade_stats["total"],
|
||||
"rate": header_trade_stats["rate"],
|
||||
"profit_loss_ratio": header_trade_stats.get("profit_loss_ratio"),
|
||||
"risk_status": risk_status,
|
||||
**force_close_template_context(
|
||||
FORCE_CLOSE_ENABLED,
|
||||
|
||||
Reference in New Issue
Block a user