Hub monitor: read-only OKX options positions aggregation (Phase B).

Expose /api/hub/options/snapshot from OKX instance and render options summary on hub monitor cards when the options capability is enabled.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
dekun
2026-07-07 12:55:35 +08:00
parent 11a50c02cd
commit 6cc3382526
10 changed files with 299 additions and 6 deletions
+15
View File
@@ -454,6 +454,21 @@ def register_hub_routes(app):
except Exception as e:
return jsonify({"ok": False, "msg": str(e)}), 500
@app.route("/api/hub/options/snapshot")
@_hub_auth_required
def api_hub_options_snapshot():
"""中控监控:期权持仓 / 资金 / 本地统计(只读)。"""
fn = _ctx().get("options_snapshot_fn")
if not callable(fn):
return jsonify({"ok": True, "enabled": False})
try:
data = fn()
if not isinstance(data, dict):
data = {"ok": False, "enabled": True, "msg": "invalid snapshot"}
return jsonify(data)
except Exception as e:
return jsonify({"ok": False, "enabled": True, "msg": str(e)}), 500
@app.route("/api/account_risk_status")
@_hub_auth_required
def api_account_risk_status():