feat: restructure OKX options UI with header funds, settings card, and dual-column layout

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
dekun
2026-07-07 09:36:00 +08:00
parent 38f6bc240e
commit 090b9c6215
15 changed files with 619 additions and 225 deletions
+11 -5
View File
@@ -139,18 +139,21 @@ def build_instance_settings_view(
opt_key = (os.getenv("OKX_OPTIONS_API_KEY") or "").strip()
sections.append(
{
"title": "期权账户(主账户)",
"title": "期权设置",
"rows": [
_row("期权模块", "已启用"),
_row(
"期权 API",
f"已配置(…{opt_key[-4:]}" if len(opt_key) >= 4 else "未配置",
),
_row("单笔权利金上限", f"{_env_float('OKX_OPTIONS_TRADE_BUDGET_USDC', 10):g} USDC"),
_row(
"资金说明",
"资金账户 USDT 兑换 USDC 后划转到交易账户",
"期权页操作;与永续子账户资金分开",
"子账户",
(os.getenv("OKX_SUB_ACCOUNT_NAME") or "").strip() or "未配置 OKX_SUB_ACCOUNT_NAME",
"主/子账户划转用",
),
_row(
"说明",
"币种兑换与账户划转到右侧「期权设置」卡片操作",
),
],
}
@@ -169,6 +172,9 @@ def build_instance_settings_view(
"sections": sections,
"data_export_version": int(data_export_version),
"show_transfer": (exchange_key or "").strip().lower() in ("gate", "binance", "okx"),
"options_settings_enabled": (exchange_key or "").strip().lower() == "okx"
and _env_bool("OKX_OPTIONS_ENABLED", False),
"options_sub_account": (os.getenv("OKX_SUB_ACCOUNT_NAME") or "").strip(),
"auto_transfer_enabled": auto_transfer_on,
"auto_transfer_bj_hour": _env_int("AUTO_TRANSFER_BJ_HOUR", 8),
"auto_transfer_amount": _env_float("AUTO_TRANSFER_AMOUNT", 30),