# 行情回退事件契约 ## 1. 回退指令事件 - **用途**:行情服务检测到主源异常后,向控制平面广播回退动作 - **事件结构**: ```json { "eventId": "uuid", "eventType": "market-data-failover", "exchange": "pacifica", "symbol": "BTC", "primaryChannel": "websocket", "backupChannel": "http", "detectTimestamp": "2025-09-27T12:10:00Z", "failoverDeadlineMs": 10000, "reason": "ws-stale-data", "metrics": { "wsLastUpdateMs": 3000, "httpLatencyMs": 400 } } ``` ## 2. 回退完成通知 ```json { "eventId": "uuid", "eventType": "market-data-failover-complete", "exchange": "pacifica", "symbol": "BTC", "completedTimestamp": "2025-09-27T12:10:07Z", "failoverMethod": "http", "synthPrice": { "mid": 109305.2, "bid": 109302.1, "ask": 109308.3 }, "durationMs": 7000, "triggeredOrders": [ "recalc-delta", "resume-trading" ] } ``` ## 3. 回退失败警报 ```json { "eventId": "uuid", "eventType": "market-data-failover-failed", "exchange": "pacifica", "symbol": "BTC", "elapsedMs": 12000, "attempts": [ { "channel": "http", "result": "timeout" }, { "channel": "synth", "result": "insufficient-data" } ], "recommendedAction": "halt-trading", "severity": "CRITICAL" } ``` ## 4. 业务要求 - 每个事件必须写入日志与 `MonitoringEvent`,供仪表盘展示。 - 若 `market-data-failover-failed` 触发,控制平面需暂停相关交易对的所有新订单,直到人工或自动恢复。 - 完成通知需携带最新合成价格或备选数据,用于后续订单定价。