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.