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
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
| Setting | Value |
|---|---|
| URL | wss://ws.limitless.exchange |
| Namespace | /markets |
| Transport | WebSocket only (no polling) |
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 | Auth Required | Description |
|---|---|---|
newPriceData | No | AMM market price update |
orderbookUpdate | No | CLOB orderbook update |
positions | Yes | Position balance update |
system | No | System notifications |
authenticated | Yes | Authentication confirmation |
exception | No | Error notifications |
Event Payloads
newPriceData — AMM market price update:
positions — Position balance update (auth required):
system — System notification:
Complete Async Python Client
Usage Examples
Environment Variables
| Variable | Description |
|---|---|
LMTS_TOKEN_ID | Scoped API token id for authenticated features (positions). Omit for public-only. |
LMTS_TOKEN_SECRET | Token secret used to sign the HMAC handshake. Omit for public-only. |
DEBUG | Set to 1 to enable verbose socket.io logging. |
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.