Lighten hub options snapshot by skipping history stats.
Monitor board only needs positions, balances, and targets; drop the OKX positions-history pull each poll, and surface timeout errors via msg. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -1,17 +1,9 @@
|
||||
"""中控只读聚合:OKX 期权持仓 / 资金 / 本地统计."""
|
||||
"""中控只读聚合:OKX 期权持仓 / 资金(轻量,不含历史统计)."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from typing import Any
|
||||
|
||||
from lib.options.options_history_lib import load_options_history
|
||||
from lib.options.options_stats_lib import compute_options_stats_from_history
|
||||
|
||||
|
||||
def _compute_options_stats(ex, cfg) -> dict[str, Any]:
|
||||
history = load_options_history(ex, cfg)
|
||||
return compute_options_stats_from_history(history)
|
||||
|
||||
|
||||
def build_options_hub_snapshot(cfg: dict[str, Any]) -> dict[str, Any]:
|
||||
if not cfg.get("enabled"):
|
||||
@@ -83,7 +75,6 @@ def build_options_hub_snapshot(cfg: dict[str, Any]) -> dict[str, Any]:
|
||||
has_upl = True
|
||||
upl_total += float(net)
|
||||
bal = cfg["fetch_options_balances"](ex)
|
||||
stats = _compute_options_stats(ex, cfg)
|
||||
return {
|
||||
"ok": True,
|
||||
"enabled": True,
|
||||
@@ -96,7 +87,8 @@ def build_options_hub_snapshot(cfg: dict[str, Any]) -> dict[str, Any]:
|
||||
"funding_usdt": bal.get("funding_usdt"),
|
||||
"trading_usdc": bal.get("trading_usdc"),
|
||||
"trading_usdt": bal.get("trading_usdt"),
|
||||
"stats": stats,
|
||||
# 监控区不用历史统计;保留空对象兼容旧调用方
|
||||
"stats": {},
|
||||
"trade_budget": cfg.get("trade_budget"),
|
||||
"account_label": cfg.get("account_label") or "OKX期权",
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user