币本位顶栏去掉期权资金/交易列,交易账户显示USDT/ETH/BTC
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -3889,13 +3889,20 @@
|
||||
const tradeLabel = isOpt ? "期权交易账户" : "交易账户";
|
||||
const pnlLabel = isOpt ? "期权浮盈" : "浮盈合计";
|
||||
const rowCls = isOpt ? "stat-row stat-row-options" : "stat-row";
|
||||
const coinMode = isOpt && optMeta && (optMeta.options_margin_mode === "coin" || optMeta.margin_mode === "coin");
|
||||
if (coinMode) {
|
||||
const bal = (optMeta && optMeta.balances) || {};
|
||||
const usdt = bal.trading_usdt != null ? bal.trading_usdt : (optMeta.trading_usdt != null ? optMeta.trading_usdt : trading);
|
||||
const eth = bal.trading_eth;
|
||||
const btc = bal.trading_btc;
|
||||
const tradeTxt = formatCoinTradingLabel(usdt, eth, btc);
|
||||
return `<div class="${rowCls}">
|
||||
<div class="stat-box"><div class="stat-label">交易账户</div><div class="stat-value">${tradeTxt}</div></div>
|
||||
<div class="stat-box"><div class="stat-label">${pnlLabel}</div><div class="stat-value ${pnlCls(upnl)}">${fmt(upnl, 2)}</div></div>
|
||||
</div>`;
|
||||
}
|
||||
let fundTxt = `${fmt(funding, 2)} <small style="font-size:12px;color:var(--muted)">U</small>`;
|
||||
let tradeTxt = `${fmt(trading, 2)} <small style="font-size:12px;color:var(--muted)">U</small>`;
|
||||
if (isOpt && optMeta && (optMeta.options_margin_mode === "coin" || optMeta.margin_mode === "coin")) {
|
||||
const underly = String(optMeta.options_underly || "ETH").toUpperCase();
|
||||
fundTxt = formatCoinOptFunds(optMeta, "funding", underly);
|
||||
tradeTxt = formatCoinOptFunds(optMeta, "trading", underly);
|
||||
}
|
||||
return `<div class="${rowCls}">
|
||||
<div class="stat-box"><div class="stat-label">${fundLabel}</div><div class="stat-value">${fundTxt}</div></div>
|
||||
<div class="stat-box"><div class="stat-label">${tradeLabel}</div><div class="stat-value">${tradeTxt}</div></div>
|
||||
@@ -3903,6 +3910,24 @@
|
||||
</div>`;
|
||||
}
|
||||
|
||||
function formatCoinTradingLabel(usdt, eth, btc) {
|
||||
const parts = [];
|
||||
if (usdt != null && usdt !== "") {
|
||||
const n = Number(usdt);
|
||||
if (!Number.isNaN(n)) parts.push(`${n.toFixed(2)} USDT`);
|
||||
}
|
||||
const pushCoin = (v, ccy) => {
|
||||
if (v == null || v === "") return;
|
||||
const n = Number(v);
|
||||
if (Number.isNaN(n) || Math.abs(n) < 1e-12) return;
|
||||
const txt = String(n.toFixed(6)).replace(/\.?0+$/, "");
|
||||
parts.push(`${txt || "0"} ${ccy}`);
|
||||
};
|
||||
pushCoin(eth, "ETH");
|
||||
pushCoin(btc, "BTC");
|
||||
return parts.length ? parts.join(" / ") : "—";
|
||||
}
|
||||
|
||||
function formatCoinOptFunds(opt, side, underly) {
|
||||
const bal = (opt && opt.balances) || {};
|
||||
const usdt = side === "funding"
|
||||
|
||||
Reference in New Issue
Block a user