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
+12
View File
@@ -54,10 +54,22 @@ def install_options_trading(app: Flask, repo_root: str, app_module: Any) -> None
cfg = _build_cfg(app_module)
app.extensions["options_cfg"] = cfg
register_options_routes(app, cfg)
_register_options_hub_bridge(app, cfg)
if enabled:
_start_monitor_thread(app, cfg)
def _register_options_hub_bridge(app: Flask, cfg: dict[str, Any]) -> None:
from lib.options.options_hub_lib import build_options_hub_snapshot
def snapshot_fn():
return build_options_hub_snapshot(cfg)
hub_ctx = dict(app.config.get("HUB_CTX") or {})
hub_ctx["options_snapshot_fn"] = snapshot_fn
app.config["HUB_CTX"] = hub_ctx
def _build_cfg(app_module: Any) -> dict[str, Any]:
from lib.exchange.okx_options_lib import (
build_option_chain,