Introduction
Order Book WebSocket API. This API allows real-time access to order book updates for specific instruments and currencies.WebSocket Endpoint
Query Parameters
The WebSocket connection accepts the following optional query parameter:currency
: Filter updates by base currency.instrument_name
: Filter updates by instrument name.
Message Format
The server sends messages in JSON format. Each message represents an order book update and has the following structure:Examples
Python
Here’s an example of how to connect to the WebSocket and receive updates using Python:- Install the required library:
pip install websockets
- Save the code to a file (e.g.,
main.py
) - Run the script:
python main.py
Error Handling
The WebSocket may close the connection with specific codes in case of errors:- 1000: Normal closure
- 1008: Policy violation (e.g., invalid instrument name)
- 1011: Internal server error