Enable options by default and allow full sim trading without OKX API keys.

Relax hedge start gates in sim, route perp open/close through sim broker, and mount strategy templates for records pages.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
dekun
2026-10-14 09:26:38 +08:00
parent d4b970cfd5
commit b4d62ea0a6
8 changed files with 445 additions and 352 deletions
+6 -3
View File
@@ -716,6 +716,7 @@ def gate_status(
show_options_options: bool = True,
mutual_exclusive: bool = True,
has_standalone_option: bool = False,
sim_mode: bool = False,
) -> dict[str, Any]:
from lib.trade.position_sizing_lib import is_full_margin_mode
@@ -739,7 +740,8 @@ def gate_status(
can_preview = False
can_start = False
reasons.append("期期对冲已隐藏(HEDGE_PLAN_SHOW_OPTIONS_OPTIONS)")
if not live_order:
# 模拟盘用本地钱包撮合,不要求实盘开关 / API
if not sim_mode and not live_order:
can_start = False
reasons.append("未允许对冲真实下单(HEDGE_PLAN_LIVE_ORDER)")
if active_count >= max(1, int(max_active or 1)):
@@ -749,10 +751,10 @@ def gate_status(
can_start = False
reasons.append("存在单独期权持仓,禁止启动对冲计划(互斥门控)")
if pt == "perp_options":
if not full:
if not full and not sim_mode:
can_start = False
reasons.append("永期开仓仅全仓模式可用(当前可测算)")
if not live_trading:
if not sim_mode and not live_trading:
can_start = False
reasons.append("未开启实盘(LIVE_TRADING_ENABLED)")
elif pt == "options_options":
@@ -770,6 +772,7 @@ def gate_status(
"plan_type": pt,
"live_order": live_order,
"live_trading": live_trading,
"sim_mode": bool(sim_mode),
"active_count": active_count,
"max_active": max_active,
"show_perp_options": bool(show_perp_options),