Add OKX options max active positions env gate.

Enforce concurrent option contract count on standalone and hedge buys; editable in env UI with hot reload (0 = unlimited).

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
dekun
2026-07-30 08:12:50 +08:00
parent 644dcdf092
commit 94c65cbd6e
8 changed files with 203 additions and 0 deletions
+2
View File
@@ -16,6 +16,7 @@ def build_options_hub_snapshot(cfg: dict[str, Any]) -> dict[str, Any]:
if not ok:
return {"ok": False, "enabled": True, "msg": reason or "期权 API 未配置"}
try:
from lib.options.options_position_limit_lib import options_max_active_positions
from lib.options.options_positions_lib import build_display_option_positions
raw = cfg["fetch_option_positions"](ex)
@@ -93,6 +94,7 @@ def build_options_hub_snapshot(cfg: dict[str, Any]) -> dict[str, Any]:
"stats": {},
"trade_budget": cfg.get("trade_budget"),
"account_label": cfg.get("account_label") or "OKX期权",
"max_active_positions": options_max_active_positions(),
}
except Exception as e:
return {"ok": False, "enabled": True, "msg": str(e)}