Hide unused risk-policy nav and options-account env for hedge-only.
Gate system-settings options panels on STANDALONE_OPTIONS_UI so settings no longer 500 without the options trading module. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -160,7 +160,19 @@ def build_instance_settings_view(
|
||||
}
|
||||
)
|
||||
|
||||
if (exchange_key or "").strip().lower() == "okx" and _env_bool("OKX_OPTIONS_ENABLED", True):
|
||||
# 单独期权 UI 才展示「期权设置」说明;本仓对冲不装该产品面
|
||||
try:
|
||||
from lib.hedge_plan.okx_trade_mode_lib import standalone_options_ui_enabled
|
||||
|
||||
_standalone_opt = standalone_options_ui_enabled()
|
||||
except Exception:
|
||||
_standalone_opt = False
|
||||
options_settings_on = (
|
||||
(exchange_key or "").strip().lower() == "okx"
|
||||
and _standalone_opt
|
||||
and _env_bool("OKX_OPTIONS_ENABLED", True)
|
||||
)
|
||||
if options_settings_on:
|
||||
api_key = (os.getenv("OKX_API_KEY") or "").strip()
|
||||
sections.append(
|
||||
{
|
||||
@@ -193,8 +205,7 @@ 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", True),
|
||||
"options_settings_enabled": options_settings_on,
|
||||
"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),
|
||||
|
||||
Reference in New Issue
Block a user