币本位顶栏去掉期权资金/交易列,交易账户显示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(