跳到主要内容

组件与观测

组件名:oracle · liquidator · hedger · bridge_deposit · bridge_withdraw。 下列接口均需 Bearer,除非另注。

进程健康字段为 tagged JSON:

{ "status": "Running" }
{ "status": "Stopped" }
{ "status": "Error", "detail": "…" }

GET /api/status

聚合状态。

字段说明
chain_rpc_urlzepto-server 连接的链 RPC
components{ oracle_enabled, liquidator_enabled, hedger_enabled, bridge_deposit_enabled, bridge_withdraw_enabled }
health五组件 Running / Stopped / Error
oracle / liquidator / hedger / bridge与下列分项接口相同

GET /api/oracle/status

字段说明
last_tick_ms / last_success_ms最近一轮 / 最近成功
markets_quoted本轮报价市场数
latest_quotessymbol → { symbol, coin, mid_price, bid, ask, seq }
error_count / last_error累计错误
tick_count / submit_count轮询次数 / 提交次数

GET /api/liquidator/status

liquidatable[]at_risk[](账户、symbol、market_id、仓位、保证金健康度等)、 last_liquidation、错误计数。

GET /api/liquidator/watch

实时可清算 / 近清算快照(字段为 status 的子集:计数 + 两个数组 + 时间戳)。

GET /api/hedger/status

字段说明
positionscoin → 净仓、目标对冲、当前对冲、漂移、状态
active_account_count启用的对冲账户数
default_ratio / default_mode全局默认
last_order_error / last_order_error_at_ms最近下单错误

GET /api/bridge/status

待入金 / 待出金计数、累计 credit/settle、settlement_paused、 可选 evm_deposit_count / evm_deposit_cursor / pending_settle_backlog

POST /api/components/toggle

Body: { "component": "oracle", "enabled": true }

未知组件 → 400200: { "ok": true, "message": "oracle enabled" }

POST /api/components/restart

Body: { "component": "oracle" }

重启失败 → 500200: { "ok": true, "message": "oracle 已重启" }

POST /api/components/config

Body: { "component": "oracle", "interval_ms"?, "dry_run"?, "spread_bps"?, "cooldown_ms"?, "threshold_notional"? }

当前只记事件,不落库改运行参数。运行参数以编译期 env + 密钥与服务 绑定为准。

GET /api/events

进程内环形事件缓冲。

Query默认说明
offset0偏移
limit50最大 500

200: { "events": [{ "timestamp_ms", "level", "component", "message" }], "offset", "limit", "total" }

GET /api/logs

SQLite 持久日志。

Query默认说明
component组件名过滤
level级别过滤
start_ms / end_ms时间窗
offset0偏移
limit100最大 1000

200: { "data": [{ "id", "ts_ms", "level", "component", "message" }], "page": { "offset", "limit", "total" } }