Add mutual-exclusion gate between hedge plans and standalone options.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
dekun
2026-07-19 08:51:46 +08:00
parent 899a2de931
commit e11c13747a
8 changed files with 236 additions and 0 deletions
+12
View File
@@ -509,6 +509,18 @@ def register_options_routes(app: Flask, cfg: dict[str, Any]) -> None:
ex, err = _require_options_ex(cfg)
if ex is None:
return jsonify({"ok": False, "msg": err})
try:
from lib.hedge_plan.hedge_options_exclusive_lib import block_standalone_option_open_msg
conn_gate = cfg["get_db"]()
try:
block_msg = block_standalone_option_open_msg(conn_gate)
finally:
conn_gate.close()
if block_msg:
return jsonify({"ok": False, "msg": block_msg})
except Exception:
pass
data = request.get_json(silent=True) or {}
inst_id = (data.get("inst_id") or "").strip()
mode = (data.get("mode") or "budget_full").strip()