Fix OKX spot swap tgtCcy and show options trading USDT in header.
OKX requires quote_ccy/base_ccy for market orders; include trading_usdt in balance display and total funds. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -103,6 +103,7 @@ def total_funds_usdt(
|
||||
options_trading_usdc: float | None = None,
|
||||
options_funding_usdc: float | None = None,
|
||||
options_funding_usdt: float | None = None,
|
||||
options_trading_usdt: float | None = None,
|
||||
) -> float | None:
|
||||
if funding_usdt is None:
|
||||
return None
|
||||
@@ -114,6 +115,8 @@ def total_funds_usdt(
|
||||
total += float(options_funding_usdt)
|
||||
if options_trading_usdc is not None:
|
||||
total += float(options_trading_usdc)
|
||||
if options_trading_usdt is not None:
|
||||
total += float(options_trading_usdt)
|
||||
return round(total, 2)
|
||||
except (TypeError, ValueError):
|
||||
return None
|
||||
|
||||
@@ -1168,8 +1168,9 @@ function applyAccountSnapshot(data){
|
||||
const optFunding = formatOptionsFundingLabel(data.options_funding_usdc, data.options_funding_usdt);
|
||||
if(optFunding !== "—") setFundsFieldText("options-funding-usdc", optFunding);
|
||||
}
|
||||
if(data.options_trading_usdc != null && data.options_trading_usdc !== ""){
|
||||
setFundsFieldText("options-trading-usdc", `${Number(data.options_trading_usdc).toFixed(2)} USDC`);
|
||||
if(data.options_trading_usdc != null || data.options_trading_usdt != null){
|
||||
const optTrading = formatOptionsFundingLabel(data.options_trading_usdc, data.options_trading_usdt);
|
||||
if(optTrading !== "—") setFundsFieldText("options-trading-usdc", optTrading);
|
||||
}
|
||||
if(typeof data.unrealized_pnl !== "undefined"){
|
||||
updateRealtimePnl(data.unrealized_pnl);
|
||||
|
||||
@@ -1813,8 +1813,9 @@ function applyAccountSnapshot(data){
|
||||
const optFunding = formatOptionsFundingLabel(data.options_funding_usdc, data.options_funding_usdt);
|
||||
if(optFunding !== "—") setFundsFieldText("options-funding-usdc", optFunding);
|
||||
}
|
||||
if(data.options_trading_usdc != null && data.options_trading_usdc !== ""){
|
||||
setFundsFieldText("options-trading-usdc", `${Number(data.options_trading_usdc).toFixed(2)} USDC`);
|
||||
if(data.options_trading_usdc != null || data.options_trading_usdt != null){
|
||||
const optTrading = formatOptionsFundingLabel(data.options_trading_usdc, data.options_trading_usdt);
|
||||
if(optTrading !== "—") setFundsFieldText("options-trading-usdc", optTrading);
|
||||
}
|
||||
if(typeof data.unrealized_pnl !== "undefined"){
|
||||
updateRealtimePnl(data.unrealized_pnl);
|
||||
|
||||
@@ -39,7 +39,7 @@
|
||||
</div>
|
||||
<div class="stat-strip-item">
|
||||
<div class="label">期权交易账户</div>
|
||||
<div class="value" id="options-trading-usdc" data-funds-field="options-trading-usdc">{% if options_trading_usdc is not none %}{{ funds_fmt(options_trading_usdc) }} USDC{% else %}—{% endif %}</div>
|
||||
<div class="value" id="options-trading-usdc" data-funds-field="options-trading-usdc">{{ options_funding_label(options_trading_usdc, options_trading_usdt) }}</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
<div class="stat-strip-item stat-strip-item--pnl">
|
||||
|
||||
Reference in New Issue
Block a user