Overview
The Limitless WebSocket API provides real-time market prices, orderbook updates, and position notifications. This guide covers connecting with Python usingpython-socketio with asyncio.
Prerequisites
1
Install dependencies
Install the required packages:
Authentication modes
- Public (no auth)
- Authenticated (HMAC)
Connect without authentication to receive public market data only:
newPriceData(AMM market prices)orderbookUpdate(CLOB orderbook)system(system notifications)
Cookie-based session authentication is deprecated. Authenticate the handshake with HMAC-signed headers (
lmts-api-key, lmts-timestamp, lmts-signature) — see Authentication.Connection details
Authenticated connections sign the socket.io handshake with HMAC. The signed canonical message uses a fixed path and empty body, and the HMAC key is the base64-decoded
secret:
ws_auth.py
Subscribing to market prices
Emitsubscribe_market_prices with market identifiers. Subscriptions replace previous ones, so include all markets you want in a single call.
Subscribing to positions
Position updates require authentication. Emitsubscribe_positions after connecting:
Handling events
Register handlers for each event type. All handlers usenamespace="/markets".
Event payloads
newPriceData — AMM market price update:
positions — Position balance update (auth required):
system — System notification:
Complete async Python client
Usage examples
Environment variables
Auto-reconnection
The client usesreconnection=True by default. On reconnect, call _resubscribe() in the connect handler to restore market and position subscriptions, since the server does not persist them across disconnects.