修复币本位顶栏改动导致 Gate/Binance 顶栏 UndefinedError 500

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
dekun
2026-08-20 14:56:30 +08:00
parent 87910ed71a
commit b0c331aa26
5 changed files with 22 additions and 8 deletions
@@ -1143,7 +1143,8 @@ function formatOptionsFundingLabel(usdc, usdt, eth, marginMode, underly) {
return `${n.toFixed(2)} USDC`;
}
function formatTradingAccountLabel(usdt, eth, btc, marginMode) {
const mode = String(marginMode || "coin").toLowerCase();
// 缺省按 usdc(xx.xxU):Gate/Binance 快照无 options_margin_mode;OKX 会显式下发.
const mode = String(marginMode || "usdc").toLowerCase();
if (mode !== "coin") {
if (usdt === null || usdt === undefined || usdt === "") return "—";
const n = Number(usdt);
@@ -1203,7 +1204,7 @@ function accountSnapshotFundingMissing(data){
let accountSnapshotRetryCount = 0;
function applyAccountSnapshot(data){
if(!data || typeof data !== "object") return;
const coinMode = String(data.options_margin_mode || "coin").toLowerCase() === "coin";
const coinMode = String(data.options_margin_mode || "").toLowerCase() === "coin";
if(typeof data.show_perp_funds !== "undefined"){
applyPerpFundsVisibility(data.show_perp_funds !== false || coinMode);
} else if (coinMode) {