Coinbase、Kraken 与 OKX WebSocket 撤单状态对账控制
本文正文暫以英文原文展示,翻譯版本需完成來源複核後再發布。
已验证事实边界
1. Coinbase Exchange documentation describes WebSocket channels for real-time exchange data and channel-specific subscriptions. 2. Kraken WebSocket v2 documentation includes add_order as a trading method with authenticated order placement semantics. 3. Kraken WebSocket v2 documentation includes cancel_order as a separate method for cancelling open orders. 4. OKX API documentation includes a trading WebSocket order channel for order updates under its API guide. 5. Cancel-state reconciliation must distinguish an acknowledgement message from final venue order state. 6. A local bot log, UI toast or user screenshot is not enough to prove the venue has accepted, rejected, filled or cancelled the order.
收起完整分析
决策矩阵
文章表格:可橫向滑動,或聚焦表格區域後使用方向鍵。
| Check | What it means | Practical action | Unknown to keep explicit |
|---|---|---|---|
| Authentication scope | private order streams and trading methods require permissions that differ by venue | record the exact key scope before subscribing or cancelling | private account permission changes after the key was created |
| Subscription channel | each venue names channels and methods differently | map every message to its official source before normalizing events | temporary channel deprecations or beta-only fields |
| Client identifier | client order identifiers help join local intent to venue state | store a non-secret client id and venue order id pair | duplicate IDs generated by a faulty bot |
| Cancel acknowledgement | a cancel request or acknowledgement is not always the same as final cancelled state | wait for venue state or REST backfill before freeing risk limits | race conditions with fills during cancellation |
| Reconnect gap | WebSocket drops can hide lifecycle transitions | backfill from REST or account history after reconnect | whether all interim transitions are recoverable from public APIs |
| Evidence hygiene | logs should contain endpoint, timestamp, client id and state label without secrets | redact API keys, signatures and private balances | internal retention policy for trading logs |
| Stop rule | new orders should pause when cancel state cannot be reconciled | freeze automation until local and venue states agree | manual override and incident commander authority |
来源地图
- Coinbase Developer Documentation:Exchange WebSocket Channels(coinbase-websocket-channels)
- Kraken Developers:WebSocket v2 Add Order(kraken-ws-add-order)
- Kraken Developers:WebSocket v2 Cancel Order(kraken-ws-cancel-order)
- OKX Technical Support:OKX API guide WebSocket order channel(okx-order-channel)
控制说明
1. Authentication scope
这一项要求读者先把公开来源翻译成操作规则。这里的含义是:private order streams and trading methods require permissions that differ by venue。可执行动作是:record the exact key scope before subscribing or cancelling。仍然未知的是:private account permission changes after the key was created。因此本文不会把未知部分包装成收益承诺、牌照承诺、审批保证、恢复保证、结算保证、可用性保证、价格暗示或平台排名。
2. Subscription channel
这里的含义是:each venue names channels and methods differently。可执行动作是:map every message to its official source before normalizing events。仍然未知的是:temporary channel deprecations or beta-only fields。
操作测试也必须很窄。这就是本节保留边界的原因。
3. Client identifier
这里的含义是:client order identifiers help join local intent to venue state。可执行动作是:store a non-secret client id and venue order id pair。仍然未知的是:duplicate IDs generated by a faulty bot。
操作测试也必须很窄。这就是本节保留边界的原因。
4. Cancel acknowledgement
这里的含义是:a cancel request or acknowledgement is not always the same as final cancelled state。可执行动作是:wait for venue state or REST backfill before freeing risk limits。仍然未知的是:race conditions with fills during cancellation。
操作测试也必须很窄。这就是本节保留边界的原因。
5. Reconnect gap
这里的含义是:WebSocket drops can hide lifecycle transitions。可执行动作是:backfill from REST or account history after reconnect。仍然未知的是:whether all interim transitions are recoverable from public APIs。
操作测试也必须很窄。这就是本节保留边界的原因。
6. Evidence hygiene
这里的含义是:logs should contain endpoint, timestamp, client id and state label without secrets。可执行动作是:redact API keys, signatures and private balances。仍然未知的是:internal retention policy for trading logs。
操作测试也必须很窄。这就是本节保留边界的原因。
7. Stop rule
这里的含义是:new orders should pause when cancel state cannot be reconciled。可执行动作是:freeze automation until local and venue states agree。仍然未知的是:manual override and incident commander authority。
操作测试也必须很窄。这就是本节保留边界的原因。
仍需明确的未知项
- private account permission changes after the key was created
- temporary channel deprecations or beta-only fields
- duplicate IDs generated by a faulty bot
- race conditions with fills during cancellation
- whether all interim transitions are recoverable from public APIs
- internal retention policy for trading logs
- manual override and incident commander authority
实用结论
Coinbase、Kraken 与 OKX 的 WebSocket 订单生命周期表面不同,因此撤单状态 runbook 不应把所有消息归一成一个泛化事件。Coinbase 文档说明 Exchange WebSocket channels,Kraken 文档说明 WebSocket v2 add_order 与 cancel_order,OKX 文档说明 trading WebSocket API 下的 order channel。实用结论是:在把本地机器人状态当成最终状态前,先对账 authentication scope、subscription channel、client order identifier、cancel acknowledgement、final order status 与 REST backfill。 本文停在证据边界内,帮助读者决定下一步核验什么,而不是把公开文档改写成私人账户、钱包、回调、政策框架、结算路径或流动性头寸在任何未来条件下都能成功的承诺。
相關專題與工具:交易所 API 與行情資料核查
來源與證據
04- Exchange WebSocket Channels
- WebSocket v2 Add Order · docs.kraken.com
- WebSocket v2 Cancel Order · docs.kraken.com
- OKX API guide WebSocket order channel · okx.com