Add OKX three-way trade mode for options vs hedge.

Env OKX_TRADE_MODE selects standalone options, perp hedge, or OO hedge; hide the other module UI and use group or position limits per mode.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
dekun
2026-07-30 08:28:50 +08:00
parent f9c2a63cbc
commit 83ce50b24e
11 changed files with 417 additions and 69 deletions
@@ -73,6 +73,14 @@ def option_position_limit_block_msg(
- 期期两腿应一次传入两个 inst_id,在开仓前预检,避免上限=1 时开出半边仓
- 拉持仓失败:拒绝开仓(避免绕过上限)
"""
try:
from lib.hedge_plan.okx_trade_mode_lib import standalone_options_open_allowed
# 对冲模式用 MAX_ACTIVE_HEDGE_PLANS 管「组数」,不占用期权笔数上限
if max_active is None and not standalone_options_open_allowed():
return None
except Exception:
pass
mx = options_max_active_positions() if max_active is None else int(max_active)
if mx <= 0:
return None