feat: single-row funds strip on header and system settings page
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -6494,6 +6494,7 @@ def render_main_page(page="trade", embed_mode=None):
|
||||
from lib.instance.instance_embed_context_lib import (
|
||||
embed_render_plan,
|
||||
minimal_stats_bundle,
|
||||
options_funding_label,
|
||||
profit_loss_ratio_from_trades,
|
||||
total_funds_usdt,
|
||||
trade_records_summary,
|
||||
@@ -6508,15 +6509,22 @@ def render_main_page(page="trade", embed_mode=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
|
||||
options_funding_usdt = None
|
||||
if OKX_OPTIONS_ENABLED and exchange_options.apiKey:
|
||||
try:
|
||||
from lib.exchange.okx_options_lib import fetch_options_funding_usdc, fetch_options_trading_usdc
|
||||
from lib.exchange.okx_options_lib import (
|
||||
fetch_options_funding_usdc,
|
||||
fetch_options_funding_usdt,
|
||||
fetch_options_trading_usdc,
|
||||
)
|
||||
|
||||
options_trading_usdc = fetch_options_trading_usdc(exchange_options)
|
||||
options_funding_usdc = fetch_options_funding_usdc(exchange_options)
|
||||
options_funding_usdt = fetch_options_funding_usdt(exchange_options)
|
||||
except Exception:
|
||||
options_trading_usdc = None
|
||||
options_funding_usdc = None
|
||||
options_funding_usdt = None
|
||||
recommended_capital = get_recommended_capital(current_capital)
|
||||
key_list = (
|
||||
conn.execute("SELECT * FROM key_monitors").fetchall() if plan.key_list else []
|
||||
@@ -6635,9 +6643,14 @@ def render_main_page(page="trade", embed_mode=None):
|
||||
rate=rate,
|
||||
profit_loss_ratio=profit_loss_ratio,
|
||||
total_funds=total_funds_usdt(
|
||||
funding_usdt, current_capital, options_trading_usdc, options_funding_usdc
|
||||
funding_usdt,
|
||||
current_capital,
|
||||
options_trading_usdc,
|
||||
options_funding_usdc,
|
||||
options_funding_usdt,
|
||||
),
|
||||
options_funding_usdc=options_funding_usdc,
|
||||
options_funding_usdt=options_funding_usdt,
|
||||
options_trading_usdc=options_trading_usdc,
|
||||
trading_day=trading_day,
|
||||
daily_start_capital=DAILY_START_CAPITAL,
|
||||
@@ -6697,6 +6710,7 @@ def render_main_page(page="trade", embed_mode=None):
|
||||
journal_chart_default_anchor=JOURNAL_CHART_DEFAULT_ANCHOR,
|
||||
key_rule_ctx=key_rule_ctx,
|
||||
funds_fmt=format_funds_u,
|
||||
options_funding_label=options_funding_label,
|
||||
exchange_display=EXCHANGE_DISPLAY_NAME,
|
||||
options_enabled=OKX_OPTIONS_ENABLED,
|
||||
options_nav_visible=True,
|
||||
@@ -6800,15 +6814,22 @@ def api_account_snapshot():
|
||||
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
|
||||
options_funding_usdt = None
|
||||
if OKX_OPTIONS_ENABLED and exchange_options.apiKey:
|
||||
try:
|
||||
from lib.exchange.okx_options_lib import fetch_options_funding_usdc, fetch_options_trading_usdc
|
||||
from lib.exchange.okx_options_lib import (
|
||||
fetch_options_funding_usdc,
|
||||
fetch_options_funding_usdt,
|
||||
fetch_options_trading_usdc,
|
||||
)
|
||||
|
||||
options_trading_usdc = fetch_options_trading_usdc(exchange_options)
|
||||
options_funding_usdc = fetch_options_funding_usdc(exchange_options)
|
||||
options_funding_usdt = fetch_options_funding_usdt(exchange_options)
|
||||
except Exception:
|
||||
options_trading_usdc = None
|
||||
options_funding_usdc = None
|
||||
options_funding_usdt = None
|
||||
recommended_capital = get_recommended_capital(current_capital)
|
||||
from lib.strategy.strategy_trade_labels import count_position_limit_active_monitors
|
||||
|
||||
@@ -6852,9 +6873,14 @@ def api_account_snapshot():
|
||||
"funding_usdt": funding_usdt,
|
||||
"current_capital": current_capital,
|
||||
"options_funding_usdc": options_funding_usdc,
|
||||
"options_funding_usdt": options_funding_usdt,
|
||||
"options_trading_usdc": options_trading_usdc,
|
||||
"total_funds": total_funds_usdt(
|
||||
funding_usdt, current_capital, options_trading_usdc, options_funding_usdc
|
||||
funding_usdt,
|
||||
current_capital,
|
||||
options_trading_usdc,
|
||||
options_funding_usdc,
|
||||
options_funding_usdt,
|
||||
),
|
||||
"available_trading_usdt": round(available_trading_usdt, FUNDS_DECIMALS) if available_trading_usdt is not None else None,
|
||||
"unrealized_pnl": unrealized_pnl,
|
||||
|
||||
Reference in New Issue
Block a user