Merge OKX dual APIs into one OKX_API_* account for perp and options.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
dekun
2026-08-05 21:28:33 +08:00
parent 22e6b68e6d
commit 09a763e47d
26 changed files with 166 additions and 473 deletions
+5 -10
View File
@@ -158,24 +158,20 @@ def build_instance_settings_view(
)
if (exchange_key or "").strip().lower() == "okx" and _env_bool("OKX_OPTIONS_ENABLED", False):
opt_key = (os.getenv("OKX_OPTIONS_API_KEY") or "").strip()
api_key = (os.getenv("OKX_API_KEY") or "").strip()
sections.append(
{
"title": "期权设置",
"rows": [
_row("期权模块", "已启用"),
_row(
"期权 API",
f"已配置(…{opt_key[-4:]})" if len(opt_key) >= 4 else "未配置",
),
_row(
"子账户",
(os.getenv("OKX_SUB_ACCOUNT_NAME") or "").strip() or "未配置 OKX_SUB_ACCOUNT_NAME",
"主/子账户划转用",
"账户 API",
f"已配置(…{api_key[-4:]})" if len(api_key) >= 4 else "未配置 OKX_API_*",
"永续与期权共用 OKX_API_*",
),
_row(
"说明",
"币种兑换与账户划转到右侧「期权设置」卡片操作",
"币种兑换与账户划转到右侧「期权设置」卡片操作",
),
],
}
@@ -196,7 +192,6 @@ def build_instance_settings_view(
"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),