feat: options UI scroll layout, stats card, funding balance, and cross-account transfer

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
dekun
2026-07-07 09:57:13 +08:00
parent 090b9c6215
commit e82fd15bb7
12 changed files with 245 additions and 66 deletions
+16 -4
View File
@@ -6507,13 +6507,16 @@ def render_main_page(page="trade", embed_mode=None):
funding_usdt = round(funding_capital, FUNDS_DECIMALS) if funding_capital is not None else None
current_capital = round(trading_capital, FUNDS_DECIMALS) if trading_capital is not None else round(local_current_capital, FUNDS_DECIMALS)
options_trading_usdc = None
options_funding_usdc = None
if OKX_OPTIONS_ENABLED and exchange_options.apiKey:
try:
from lib.exchange.okx_options_lib import fetch_options_trading_usdc
from lib.exchange.okx_options_lib import fetch_options_funding_usdc, fetch_options_trading_usdc
options_trading_usdc = fetch_options_trading_usdc(exchange_options)
options_funding_usdc = fetch_options_funding_usdc(exchange_options)
except Exception:
options_trading_usdc = None
options_funding_usdc = None
recommended_capital = get_recommended_capital(current_capital)
key_list = (
conn.execute("SELECT * FROM key_monitors").fetchall() if plan.key_list else []
@@ -6631,7 +6634,10 @@ def render_main_page(page="trade", embed_mode=None):
total=total,
rate=rate,
profit_loss_ratio=profit_loss_ratio,
total_funds=total_funds_usdt(funding_usdt, current_capital, options_trading_usdc),
total_funds=total_funds_usdt(
funding_usdt, current_capital, options_trading_usdc, options_funding_usdc
),
options_funding_usdc=options_funding_usdc,
options_trading_usdc=options_trading_usdc,
trading_day=trading_day,
daily_start_capital=DAILY_START_CAPITAL,
@@ -6793,13 +6799,16 @@ def api_account_snapshot():
funding_usdt = round(funding_capital, FUNDS_DECIMALS) if funding_capital is not None else None
current_capital = round(trading_capital, FUNDS_DECIMALS) if trading_capital is not None else round(local_current_capital, FUNDS_DECIMALS)
options_trading_usdc = None
options_funding_usdc = None
if OKX_OPTIONS_ENABLED and exchange_options.apiKey:
try:
from lib.exchange.okx_options_lib import fetch_options_trading_usdc
from lib.exchange.okx_options_lib import fetch_options_funding_usdc, fetch_options_trading_usdc
options_trading_usdc = fetch_options_trading_usdc(exchange_options)
options_funding_usdc = fetch_options_funding_usdc(exchange_options)
except Exception:
options_trading_usdc = None
options_funding_usdc = None
recommended_capital = get_recommended_capital(current_capital)
from lib.strategy.strategy_trade_labels import count_position_limit_active_monitors
@@ -6842,8 +6851,11 @@ def api_account_snapshot():
return jsonify({
"funding_usdt": funding_usdt,
"current_capital": current_capital,
"options_funding_usdc": options_funding_usdc,
"options_trading_usdc": options_trading_usdc,
"total_funds": total_funds_usdt(funding_usdt, current_capital, options_trading_usdc),
"total_funds": total_funds_usdt(
funding_usdt, current_capital, options_trading_usdc, options_funding_usdc
),
"available_trading_usdt": round(available_trading_usdt, FUNDS_DECIMALS) if available_trading_usdt is not None else None,
"unrealized_pnl": unrealized_pnl,
"recommended_capital": recommended_capital,