Skip to main content

Order updates WebSocket

GET

{BASE_URL}/websocket

wss://{BASE_URL}/websocket

Streams real-time updates for every Hong Kong order whose receiving initiator is your API key's initiator, across all of your accounts. Updates are not filtered by account.

Connecting

  • Send X-API-KEY as a header on the upgrade request; there is no query-string key. A missing or invalid key gets 401 before the upgrade. A request whose Origin header does not match the API host is rejected with 403, so browsers cannot connect directly.
  • You may open several connections with the same key. Every connection receives every update.
  • The stream is receive-only. Any text or binary message sent by the client closes the connection with status 1008 (policy violation).
  • The server sends a WebSocket ping every 30 seconds. Standard clients reply automatically.

Messages

Every frame is a text frame with message_type: order_update (schema hk_websocket_message). message.order has the same shape as GET /orders/status, but order.status is the status at the time of the event.

order_eventSent whenorder.statusExtra fields
newThe order was accepted (201).new
partial_fillA fill leaves quantity open.partially_filledlast_qty, last_px
fillA fill completes the order.filledlast_qty, last_px
canceledThe order was canceled.canceled or canceled_after_partial_filltext if a reason is recorded
rejectedThe order was rejected after it was accepted.rejected or rejected_after_partial_filltext
replacedA modify took effect. order is the replacement; order.orig_order_id is the replaced order.replaced or replaced_after_partial_fill
cancel_rejectedA cancel request failed; the order keeps working.current statustext
replace_rejectedA modify request failed. order is the rejected replacement; the original keeps working.status of the original ordertext

pending_cancel, pending_replace and stopped are never sent here. A request that fails synchronously (a 4xx/5xx HTTP response) does not produce a rejected message. When an order is canceled after a partial fill you receive partial_fill followed by canceled with status canceled_after_partial_fill.

Top-level text has the form <error_code>: <message> (Misc_Error: ... when the venue's reason has no Atomic Vaults code). order.text holds the raw reason stored on the order.

Delivery

  • Messages are delivered only to connections open at that moment. There is no replay and no sequence number; after reconnecting, reconcile with GET /orders.
  • Messages for the same order are sent in event order.
  • Each connection buffers up to 1,000 messages; beyond that, messages for a slow connection are dropped.

Responses​

Switching Protocols. The WebSocket is open.