Skip to main content

Maintaining Order Book via WebSocket

To maintain a local copy of the order book with minimal latency, use the WebSocket API to receive both snapshots and delta updates. This enables your trading logic to react to real-time market changes efficiently. Steps to Maintain a Local Order Book:
  1. Connect to the WebSocket and subscribe to the Order Book Stream to receive real-time updates.
  2. Initialize your local order book by sending an emitPublicOrderBook request to obtain a full snapshot.
  3. Apply each subsequent publicOrderBookDelta update in the order received to keep your local copy synchronized.

Refreshing via REST

To refresh your local order book snapshot without disconnecting, use the Get Order Book REST endpoint as needed.