Get Open Orders by Side WebSocket API
Introduction
The List Open Orders WebSocket API provides real-time updates for all Open Orders matching the specified criteria. This API is useful for monitoring open orders for specific currency pairs.
WebSocket Endpoint
This endpoint provides updates for all Open Orders matching the specified criteria.
Query Parameters
The WebSocket connection accepts the following optional query parameter:
currency
: Filter updates by base currency.side
: Filter updates by order side (e.g.,buy
orsell
).
Message Format
The server sends messages in JSON format. Each message represents an Open Orders update and has the following structure:
Examples
Python
Here’s an example of how to connect to the WebSocket and receive updates using Python:
To run this example:
- 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 filter)
- 1011: Internal server error
Clients should be prepared to handle these closure codes and implement appropriate reconnection logic.
Rate Limiting
To prevent abuse, the API implements rate limiting. Clients that exceed the allowed number of connection attempts may be temporarily blocked. Implement exponential backoff in your client applications to handle rate limiting gracefully.