币本位顶栏资金显示USDT+ETH,单笔期权本位改为下拉选择

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
dekun
2026-08-20 12:38:39 +08:00
parent 1314349fe5
commit a84554e613
12 changed files with 271 additions and 46 deletions
+44 -9
View File
@@ -6626,22 +6626,36 @@ def render_main_page(page="trade", embed_mode=None):
options_funding_usdc = None
options_funding_usdt = None
options_trading_usdt = None
options_funding_eth = None
options_trading_eth = None
options_margin_mode = "usdc"
options_underly = "ETH"
if (
OKX_OPTIONS_ENABLED
and exchange_options.apiKey
and embed_mode != "fragment"
):
try:
from lib.exchange.okx_options_lib import options_header_balances
from lib.exchange.okx_options_lib import options_header_balance_pack
options_trading_usdc, options_funding_usdc, options_funding_usdt, options_trading_usdt = options_header_balances(
exchange_options
)
_op = options_header_balance_pack(exchange_options)
options_trading_usdc = _op.get("trading_usdc")
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_margin_mode = _op.get("options_margin_mode") or "usdc"
options_underly = _op.get("options_underly") or "ETH"
except Exception:
options_trading_usdc = None
options_funding_usdc = None
options_funding_usdt = None
options_trading_usdt = None
options_funding_eth = None
options_trading_eth = None
options_margin_mode = "usdc"
options_underly = "ETH"
recommended_capital = get_recommended_capital(current_capital)
key_list = (
conn.execute("SELECT * FROM key_monitors").fetchall() if plan.key_list else []
@@ -6793,6 +6807,10 @@ def render_main_page(page="trade", embed_mode=None):
options_funding_usdt=options_funding_usdt,
options_trading_usdc=options_trading_usdc,
options_trading_usdt=options_trading_usdt,
options_funding_eth=options_funding_eth,
options_trading_eth=options_trading_eth,
options_margin_mode=options_margin_mode,
options_underly=options_underly,
trading_day=trading_day,
daily_start_capital=DAILY_START_CAPITAL,
current_capital=current_capital,
@@ -7050,19 +7068,32 @@ def api_account_snapshot():
options_funding_usdc = None
options_funding_usdt = None
options_trading_usdt = None
options_funding_eth = None
options_trading_eth = None
options_margin_mode = "usdc"
options_underly = "ETH"
if OKX_OPTIONS_ENABLED and exchange_options.apiKey:
try:
from lib.exchange.okx_options_lib import options_header_balances
from lib.exchange.okx_options_lib import options_header_balance_pack
options_trading_usdc, options_funding_usdc, options_funding_usdt, options_trading_usdt = options_header_balances(
exchange_options,
force=force_refresh,
)
_op = options_header_balance_pack(exchange_options, force=force_refresh)
options_trading_usdc = _op.get("trading_usdc")
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_margin_mode = _op.get("options_margin_mode") or "usdc"
options_underly = _op.get("options_underly") or "ETH"
except Exception:
options_trading_usdc = None
options_funding_usdc = None
options_funding_usdt = None
options_trading_usdt = None
options_funding_eth = None
options_trading_eth = None
options_margin_mode = "usdc"
options_underly = "ETH"
recommended_capital = get_recommended_capital(current_capital)
from lib.strategy.strategy_trade_labels import count_position_limit_active_monitors
@@ -7145,6 +7176,10 @@ def api_account_snapshot():
"options_funding_usdt": options_funding_usdt,
"options_trading_usdc": options_trading_usdc,
"options_trading_usdt": options_trading_usdt,
"options_funding_eth": options_funding_eth,
"options_trading_eth": options_trading_eth,
"options_margin_mode": options_margin_mode,
"options_underly": options_underly,
"total_funds": total_funds_usdt(
funding_usdt if _show_perp_funds else None,
current_capital if _show_perp_funds else None,