币本位顶栏去掉期权资金/交易列,交易账户显示USDT/ETH/BTC

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
dekun
2026-08-20 12:58:43 +08:00
parent a84554e613
commit 73efad6fa5
9 changed files with 218 additions and 90 deletions
+16 -6
View File
@@ -6613,6 +6613,7 @@ def render_main_page(page="trade", embed_mode=None):
show_perp_funds_enabled,
total_funds_usdt,
trade_records_summary,
trading_account_label,
)
plan = embed_render_plan(page, embed_mode)
@@ -6628,6 +6629,7 @@ def render_main_page(page="trade", embed_mode=None):
options_trading_usdt = None
options_funding_eth = None
options_trading_eth = None
options_trading_btc = None
options_margin_mode = "usdc"
options_underly = "ETH"
if (
@@ -6643,8 +6645,9 @@ def render_main_page(page="trade", embed_mode=None):
options_funding_usdc = _op.get("funding_usdc")
options_funding_usdt = _op.get("funding_usdt")
options_trading_usdt = _op.get("trading_usdt")
options_funding_eth = _op.get("funding_coin")
options_trading_eth = _op.get("trading_coin")
options_funding_eth = _op.get("funding_eth")
options_trading_eth = _op.get("trading_eth")
options_trading_btc = _op.get("trading_btc")
options_margin_mode = _op.get("options_margin_mode") or "usdc"
options_underly = _op.get("options_underly") or "ETH"
except Exception:
@@ -6654,6 +6657,7 @@ def render_main_page(page="trade", embed_mode=None):
options_trading_usdt = None
options_funding_eth = None
options_trading_eth = None
options_trading_btc = None
options_margin_mode = "usdc"
options_underly = "ETH"
recommended_capital = get_recommended_capital(current_capital)
@@ -6809,6 +6813,7 @@ def render_main_page(page="trade", embed_mode=None):
options_trading_usdt=options_trading_usdt,
options_funding_eth=options_funding_eth,
options_trading_eth=options_trading_eth,
options_trading_btc=options_trading_btc,
options_margin_mode=options_margin_mode,
options_underly=options_underly,
trading_day=trading_day,
@@ -6876,9 +6881,10 @@ def render_main_page(page="trade", embed_mode=None):
key_rule_ctx=key_rule_ctx,
funds_fmt=format_funds_u,
options_funding_label=options_funding_label,
trading_account_label=trading_account_label,
exchange_display=EXCHANGE_DISPLAY_NAME,
options_enabled=OKX_OPTIONS_ENABLED,
show_perp_funds=_show_perp_funds,
show_perp_funds=_show_perp_funds or (options_margin_mode == "coin"),
options_nav_visible=True,
okx_trade_mode=_okx_trade_mode,
options_open_allowed=_okx_trade_mode == "options",
@@ -7070,6 +7076,7 @@ def api_account_snapshot():
options_trading_usdt = None
options_funding_eth = None
options_trading_eth = None
options_trading_btc = None
options_margin_mode = "usdc"
options_underly = "ETH"
if OKX_OPTIONS_ENABLED and exchange_options.apiKey:
@@ -7081,8 +7088,9 @@ def api_account_snapshot():
options_funding_usdc = _op.get("funding_usdc")
options_funding_usdt = _op.get("funding_usdt")
options_trading_usdt = _op.get("trading_usdt")
options_funding_eth = _op.get("funding_coin")
options_trading_eth = _op.get("trading_coin")
options_funding_eth = _op.get("funding_eth")
options_trading_eth = _op.get("trading_eth")
options_trading_btc = _op.get("trading_btc")
options_margin_mode = _op.get("options_margin_mode") or "usdc"
options_underly = _op.get("options_underly") or "ETH"
except Exception:
@@ -7092,6 +7100,7 @@ def api_account_snapshot():
options_trading_usdt = None
options_funding_eth = None
options_trading_eth = None
options_trading_btc = None
options_margin_mode = "usdc"
options_underly = "ETH"
recommended_capital = get_recommended_capital(current_capital)
@@ -7167,7 +7176,7 @@ def api_account_snapshot():
unrealized_pnl = merge_unrealized_pnl_components(unrealized_pnl, options_unrealized_pnl)
except Exception:
options_unrealized_pnl = None
_show_perp_funds = show_perp_funds_enabled(exchange_key="okx")
_show_perp_funds = show_perp_funds_enabled(exchange_key="okx") or (options_margin_mode == "coin")
return jsonify({
"funding_usdt": funding_usdt,
"current_capital": current_capital,
@@ -7178,6 +7187,7 @@ def api_account_snapshot():
"options_trading_usdt": options_trading_usdt,
"options_funding_eth": options_funding_eth,
"options_trading_eth": options_trading_eth,
"options_trading_btc": options_trading_btc,
"options_margin_mode": options_margin_mode,
"options_underly": options_underly,
"total_funds": total_funds_usdt(
+52 -26
View File
@@ -107,10 +107,39 @@ def options_funding_label(
margin_mode: str | None = None,
underly: str = "ETH",
) -> str:
"""期权侧顶栏文案.
"""期权侧顶栏文案(仅 USDC 模式使用;币本位不展示期权资金/交易两列)."""
if funding_usdc is None:
return ""
try:
return f"{float(funding_usdc):.2f} USDC"
except (TypeError, ValueError):
return ""
USDC 模式:仅 USDC.
币本位:USDT + 标的币(ETH/BTC).
def _fmt_coin_amount(v: float | None) -> str | None:
if v is None:
return None
try:
n = float(v)
except (TypeError, ValueError):
return None
if abs(n) < 1e-12:
return None
txt = f"{n:.6f}".rstrip("0").rstrip(".")
return txt or None
def trading_account_label(
usdt: float | None,
eth: float | None = None,
btc: float | None = None,
*,
margin_mode: str | None = None,
) -> str:
"""交易账户顶栏文案.
币本位:USDT / ETH / BTC(有余额才带上,不显示其它币种).
其它模式:xx.xxU.
"""
try:
from lib.options.options_margin_mode_lib import normalize_options_margin_mode
@@ -118,29 +147,26 @@ def options_funding_label(
mode = normalize_options_margin_mode(margin_mode)
except Exception:
mode = str(margin_mode or "usdc").strip().lower() or "usdc"
if mode == "coin":
parts: list[str] = []
if funding_usdt is not None:
try:
parts.append(f"{float(funding_usdt):.2f} USDT")
except (TypeError, ValueError):
pass
coin = funding_eth
ccy = (underly or "ETH").strip().upper() or "ETH"
if coin is not None:
try:
n = float(coin)
txt = f"{n:.6f}".rstrip("0").rstrip(".")
parts.append(f"{txt or '0'} {ccy}")
except (TypeError, ValueError):
pass
return " / ".join(parts) if parts else ""
if funding_usdc is None:
return ""
try:
return f"{float(funding_usdc):.2f} USDC"
except (TypeError, ValueError):
return ""
if mode != "coin":
if usdt is None:
return ""
try:
return f"{float(usdt):.2f}U"
except (TypeError, ValueError):
return ""
parts: list[str] = []
if usdt is not None:
try:
parts.append(f"{float(usdt):.2f} USDT")
except (TypeError, ValueError):
pass
eth_txt = _fmt_coin_amount(eth)
if eth_txt is not None:
parts.append(f"{eth_txt} ETH")
btc_txt = _fmt_coin_amount(btc)
if btc_txt is not None:
parts.append(f"{btc_txt} BTC")
return " / ".join(parts) if parts else ""
def total_funds_usdt(
+45 -20
View File
@@ -1137,27 +1137,35 @@ function paintRealtimePnlFromSnapshot(data){
}
function formatOptionsFundingLabel(usdc, usdt, eth, marginMode, underly) {
const mode = String(marginMode || "usdc").toLowerCase();
if (mode === "coin") {
const parts = [];
if (usdt !== null && usdt !== undefined && usdt !== "") {
const n = Number(usdt);
if (!Number.isNaN(n)) parts.push(`${n.toFixed(2)} USDT`);
}
if (eth !== null && eth !== undefined && eth !== "") {
const n = Number(eth);
if (!Number.isNaN(n)) {
const txt = String(n.toFixed(6)).replace(/\.?0+$/, "");
parts.push(`${txt || "0"} ${String(underly || "ETH").toUpperCase()}`);
}
}
return parts.length ? parts.join(" / ") : "—";
}
if (usdc === null || usdc === undefined || usdc === "") return "—";
const n = Number(usdc);
if (Number.isNaN(n)) return "—";
return `${n.toFixed(2)} USDC`;
}
function formatTradingAccountLabel(usdt, eth, btc, marginMode) {
const mode = String(marginMode || "usdc").toLowerCase();
if (mode !== "coin") {
if (usdt === null || usdt === undefined || usdt === "") return "—";
const n = Number(usdt);
if (Number.isNaN(n)) return "—";
return `${n.toFixed(2)}U`;
}
const parts = [];
if (usdt !== null && usdt !== undefined && usdt !== "") {
const n = Number(usdt);
if (!Number.isNaN(n)) parts.push(`${n.toFixed(2)} USDT`);
}
const pushCoin = (v, ccy) => {
if (v === null || v === undefined || 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 setFundsFieldText(field, text){
if(text == null || text === "") return;
@@ -1171,6 +1179,11 @@ function applyPerpFundsVisibility(show){
el.style.display = on ? "" : "none";
});
}
function applyOptionsFundsVisibility(show){
document.querySelectorAll("[data-options-funds='1']").forEach((el) => {
el.style.display = show ? "" : "none";
});
}
function accountSnapshotFundingMissing(data){
if(!data || typeof data !== "object") return true;
if(data.show_perp_funds === false){
@@ -1190,9 +1203,13 @@ function accountSnapshotFundingMissing(data){
let accountSnapshotRetryCount = 0;
function applyAccountSnapshot(data){
if(!data || typeof data !== "object") return;
const coinMode = String(data.options_margin_mode || "usdc").toLowerCase() === "coin";
if(typeof data.show_perp_funds !== "undefined"){
applyPerpFundsVisibility(data.show_perp_funds);
applyPerpFundsVisibility(data.show_perp_funds !== false || coinMode);
} else if (coinMode) {
applyPerpFundsVisibility(true);
}
applyOptionsFundsVisibility(!coinMode);
if(data.funding_usdt != null && data.funding_usdt !== ""){
setFundsFieldText("total-capital", `${Number(data.funding_usdt).toFixed(2)}U`);
}
@@ -1200,9 +1217,17 @@ function applyAccountSnapshot(data){
setFundsFieldText("total-funds", `${Number(data.total_funds).toFixed(2)}U`);
}
if(data.current_capital != null && data.current_capital !== "" && !Number.isNaN(Number(data.current_capital))){
setFundsFieldText("current-capital", `${Number(data.current_capital).toFixed(2)}U`);
setFundsFieldText(
"current-capital",
formatTradingAccountLabel(
data.current_capital,
data.options_trading_eth,
data.options_trading_btc,
data.options_margin_mode
)
);
}
if(data.options_funding_usdc != null || data.options_funding_usdt != null || data.options_funding_eth != null){
if(!coinMode && (data.options_funding_usdc != null || data.options_funding_usdt != null || data.options_funding_eth != null)){
const optFunding = formatOptionsFundingLabel(
data.options_funding_usdc,
data.options_funding_usdt,
@@ -1212,7 +1237,7 @@ function applyAccountSnapshot(data){
);
setFundsFieldText("options-funding-usdc", optFunding);
}
if(data.options_trading_usdc != null || data.options_trading_usdt != null || data.options_trading_eth != null){
if(!coinMode && (data.options_trading_usdc != null || data.options_trading_usdt != null || data.options_trading_eth != null)){
const optTrading = formatOptionsFundingLabel(
data.options_trading_usdc,
data.options_trading_usdt,
+45 -20
View File
@@ -1618,27 +1618,35 @@ function paintRealtimePnlFromSnapshot(data){
}
function formatOptionsFundingLabel(usdc, usdt, eth, marginMode, underly) {
const mode = String(marginMode || "usdc").toLowerCase();
if (mode === "coin") {
const parts = [];
if (usdt != null && usdt !== "") {
const n = Number(usdt);
if (!Number.isNaN(n)) parts.push(`${n.toFixed(2)} USDT`);
}
if (eth != null && eth !== "") {
const n = Number(eth);
if (!Number.isNaN(n)) {
const txt = String(n.toFixed(6)).replace(/\.?0+$/, "");
parts.push(`${txt || "0"} ${String(underly || "ETH").toUpperCase()}`);
}
}
return parts.length ? parts.join(" / ") : "—";
}
if(usdc == null || usdc === "") return "—";
const n = Number(usdc);
if(Number.isNaN(n)) return "—";
return `${n.toFixed(2)} USDC`;
}
function formatTradingAccountLabel(usdt, eth, btc, marginMode) {
const mode = String(marginMode || "usdc").toLowerCase();
if (mode !== "coin") {
if (usdt == null || usdt === "") return "—";
const n = Number(usdt);
if (Number.isNaN(n)) return "—";
return `${n.toFixed(2)}U`;
}
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 setFundsFieldText(field, text){
if(text == null || text === "") return;
@@ -1652,6 +1660,11 @@ function applyPerpFundsVisibility(show){
el.style.display = on ? "" : "none";
});
}
function applyOptionsFundsVisibility(show){
document.querySelectorAll("[data-options-funds='1']").forEach((el) => {
el.style.display = show ? "" : "none";
});
}
function accountSnapshotFundingMissing(data){
if(!data || typeof data !== "object") return true;
if(data.show_perp_funds === false){
@@ -1671,9 +1684,13 @@ function accountSnapshotFundingMissing(data){
let accountSnapshotRetryCount = 0;
function applyAccountSnapshot(data){
if(!data || typeof data !== "object") return;
const coinMode = String(data.options_margin_mode || "usdc").toLowerCase() === "coin";
if(typeof data.show_perp_funds !== "undefined"){
applyPerpFundsVisibility(data.show_perp_funds);
applyPerpFundsVisibility(data.show_perp_funds !== false || coinMode);
} else if (coinMode) {
applyPerpFundsVisibility(true);
}
applyOptionsFundsVisibility(!coinMode);
if(data.funding_usdt != null && data.funding_usdt !== ""){
setFundsFieldText("total-capital", `${Number(data.funding_usdt).toFixed(2)}U`);
}
@@ -1681,9 +1698,17 @@ function applyAccountSnapshot(data){
setFundsFieldText("total-funds", `${Number(data.total_funds).toFixed(2)}U`);
}
if(data.current_capital != null && data.current_capital !== "" && !Number.isNaN(Number(data.current_capital))){
setFundsFieldText("current-capital", `${Number(data.current_capital).toFixed(2)}U`);
setFundsFieldText(
"current-capital",
formatTradingAccountLabel(
data.current_capital,
data.options_trading_eth,
data.options_trading_btc,
data.options_margin_mode
)
);
}
if(data.options_funding_usdc != null || data.options_funding_usdt != null || data.options_funding_eth != null){
if(!coinMode && (data.options_funding_usdc != null || data.options_funding_usdt != null || data.options_funding_eth != null)){
const optFunding = formatOptionsFundingLabel(
data.options_funding_usdc,
data.options_funding_usdt,
@@ -1693,7 +1718,7 @@ function applyAccountSnapshot(data){
);
setFundsFieldText("options-funding-usdc", optFunding);
}
if(data.options_trading_usdc != null || data.options_trading_usdt != null || data.options_trading_eth != null){
if(!coinMode && (data.options_trading_usdc != null || data.options_trading_usdt != null || data.options_trading_eth != null)){
const optTrading = formatOptionsFundingLabel(
data.options_trading_usdc,
data.options_trading_usdt,
@@ -38,11 +38,13 @@
{% include 'instance_header_stats.html' %}
</div>
<div class="instance-header-phone-strip instance-phone-only" aria-label="手机资金摘要">
<span class="inst-phone-chip"{% if not (show_perp_funds|default(true)) %} style="display:none"{% endif %} data-perp-funds="1">
{% set _coin_margin = (options_margin_mode|default('usdc')) == 'coin' %}
{% set _show_perp = (show_perp_funds|default(true)) or _coin_margin %}
<span class="inst-phone-chip"{% if not _show_perp %} style="display:none"{% endif %} data-perp-funds="1">
<em>交易</em>
<b data-funds-field="current-capital">{{ funds_fmt(current_capital) }}U</b>
<b data-funds-field="current-capital">{{ trading_account_label(current_capital, options_trading_eth, options_trading_btc, margin_mode=options_margin_mode|default('usdc')) }}</b>
</span>
<span class="inst-phone-chip"{% if not (show_perp_funds|default(true)) %} style="display:none"{% endif %} data-perp-funds="1">
<span class="inst-phone-chip"{% if not _show_perp %} style="display:none"{% endif %} data-perp-funds="1">
<em>资金</em>
<b data-funds-field="total-capital">{% if funding_usdt is not none %}{{ funds_fmt(funding_usdt) }}U{% else %}—{% endif %}</b>
</span>
@@ -1,4 +1,6 @@
{# 资金与统计条(顶栏 / 系统设置共用,单行展示) #}
{% set _coin_margin = (options_margin_mode|default('usdc')) == 'coin' %}
{% set _show_perp = (show_perp_funds|default(true)) or _coin_margin %}
<div class="instance-header-stats{% if options_enabled %} instance-header-stats--options{% endif %}">
<div class="stat-strip-item stat-strip-item--primary">
<div class="label">交易所</div>
@@ -24,20 +26,20 @@
<div class="label">总资金</div>
<div class="value" id="total-funds" data-funds-field="total-funds">{% if total_funds is not none %}{{ funds_fmt(total_funds) }}U{% else %}—{% endif %}</div>
</div>
<div class="stat-strip-item"{% if not (show_perp_funds|default(true)) %} style="display:none"{% endif %} data-perp-funds="1">
<div class="stat-strip-item"{% if not _show_perp %} style="display:none"{% endif %} data-perp-funds="1">
<div class="label">资金账户</div>
<div class="value" id="total-capital" data-funds-field="total-capital">{% if funding_usdt is not none %}{{ funds_fmt(funding_usdt) }}U{% else %}—{% endif %}</div>
</div>
<div class="stat-strip-item"{% if not (show_perp_funds|default(true)) %} style="display:none"{% endif %} data-perp-funds="1">
<div class="stat-strip-item"{% if not _show_perp %} style="display:none"{% endif %} data-perp-funds="1">
<div class="label">交易账户</div>
<div class="value" id="current-capital" data-funds-field="current-capital">{{ funds_fmt(current_capital) }}U</div>
<div class="value" id="current-capital" data-funds-field="current-capital">{{ trading_account_label(current_capital, options_trading_eth, options_trading_btc, margin_mode=options_margin_mode|default('usdc')) }}</div>
</div>
{% if options_enabled %}
<div class="stat-strip-item">
{% if options_enabled and not _coin_margin %}
<div class="stat-strip-item" data-options-funds="1">
<div class="label">期权资金账户</div>
<div class="value" id="options-funding-usdc" data-funds-field="options-funding-usdc">{{ options_funding_label(options_funding_usdc, options_funding_usdt, options_funding_eth, options_margin_mode, options_underly|default('ETH')) }}</div>
</div>
<div class="stat-strip-item">
<div class="stat-strip-item" data-options-funds="1">
<div class="label">期权交易账户</div>
<div class="value" id="options-trading-usdc" data-funds-field="options-trading-usdc">{{ options_funding_label(options_trading_usdc, options_trading_usdt, options_trading_eth, options_margin_mode, options_underly|default('ETH')) }}</div>
</div>
+30 -5
View File
@@ -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"
+3 -3
View File
@@ -152,14 +152,14 @@ class TestShowPerpFunds(unittest.TestCase):
os.environ["OKX_SHOW_PERP_FUNDS"] = old
def test_options_funding_label_usdc_only(self):
from lib.instance.instance_embed_context_lib import options_funding_label
from lib.instance.instance_embed_context_lib import options_funding_label, trading_account_label
self.assertEqual(options_funding_label(12.5, 99.0), "12.50 USDC")
self.assertEqual(options_funding_label(0.0, 50.0), "0.00 USDC")
self.assertEqual(options_funding_label(None, 10.0), "")
self.assertEqual(
options_funding_label(1.0, 20.0, 0.01, "coin", "ETH"),
"20.00 USDT / 0.01 ETH",
trading_account_label(20.0, 0.01, 0.001, margin_mode="coin"),
"20.00 USDT / 0.01 ETH / 0.001 BTC",
)
+14 -1
View File
@@ -39,8 +39,21 @@ class TestHeaderStatsLib(unittest.TestCase):
self.assertEqual(options_funding_label(10.19, 0), "10.19 USDC")
self.assertEqual(options_funding_label(None, 10), "")
self.assertEqual(options_funding_label(None, None), "")
def test_trading_account_label_coin(self):
from lib.instance.instance_embed_context_lib import trading_account_label
self.assertEqual(trading_account_label(100, None, None, margin_mode="usdc"), "100.00U")
self.assertEqual(
options_funding_label(None, 12.5, 0.004321, "coin", "ETH"),
trading_account_label(100, 0.2, 0.001, margin_mode="coin"),
"100.00 USDT / 0.2 ETH / 0.001 BTC",
)
self.assertEqual(
trading_account_label(0.02, 0.0, None, margin_mode="coin"),
"0.02 USDT",
)
self.assertEqual(
trading_account_label(12.5, 0.004321, None, margin_mode="coin"),
"12.50 USDT / 0.004321 ETH",
)