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:
dekun
2026-07-17 13:03:04 +08:00
parent 3a20546782
commit f27b4bc1ec
7 changed files with 72 additions and 5 deletions
@@ -1178,6 +1178,20 @@ function applyAccountSnapshot(data){
if(typeof data.unrealized_pnl !== "undefined"){
updateRealtimePnl(data.unrealized_pnl);
}
if(typeof data.total !== "undefined" && data.total !== null){
setFundsFieldText("stat-total", String(data.total));
}
if(typeof data.rate !== "undefined" && data.rate !== null){
setFundsFieldText("stat-rate", `${Number(data.rate)}%`);
}
if(typeof data.profit_loss_ratio !== "undefined"){
setFundsFieldText(
"stat-pl-ratio",
data.profit_loss_ratio != null && data.profit_loss_ratio !== ""
? String(data.profit_loss_ratio)
: "—"
);
}
if(typeof data.available_trading_usdt !== "undefined" && data.available_trading_usdt !== null){
latestAvailableUsdt = Number(data.available_trading_usdt);
}