交易所動態

Coinbase、Kraken 与 OKX WebSocket 撤单状态对账控制

4 分鐘

本文正文暫以英文原文展示,翻譯版本需完成來源複核後再發布。

已验证事实边界

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.

收起完整分析

决策矩阵

文章表格:可橫向滑動,或聚焦表格區域後使用方向鍵。

CheckWhat it meansPractical actionUnknown to keep explicit
Authentication scopeprivate order streams and trading methods require permissions that differ by venuerecord the exact key scope before subscribing or cancellingprivate account permission changes after the key was created
Subscription channeleach venue names channels and methods differentlymap every message to its official source before normalizing eventstemporary channel deprecations or beta-only fields
Client identifierclient order identifiers help join local intent to venue statestore a non-secret client id and venue order id pairduplicate IDs generated by a faulty bot
Cancel acknowledgementa cancel request or acknowledgement is not always the same as final cancelled statewait for venue state or REST backfill before freeing risk limitsrace conditions with fills during cancellation
Reconnect gapWebSocket drops can hide lifecycle transitionsbackfill from REST or account history after reconnectwhether all interim transitions are recoverable from public APIs
Evidence hygienelogs should contain endpoint, timestamp, client id and state label without secretsredact API keys, signatures and private balancesinternal retention policy for trading logs
Stop rulenew orders should pause when cancel state cannot be reconciledfreeze automation until local and venue states agreemanual 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。 本文停在证据边界内,帮助读者决定下一步核验什么,而不是把公开文档改写成私人账户、钱包、回调、政策框架、结算路径或流动性头寸在任何未来条件下都能成功的承诺。

來源與證據

04
  1. Coinbase Developer DocumentationExchange WebSocket Channels
  2. Kraken DevelopersWebSocket v2 Add Order · docs.kraken.com
  3. Kraken DevelopersWebSocket v2 Cancel Order · docs.kraken.com
  4. OKX Technical SupportOKX API guide WebSocket order channel · okx.com