Skip to main content

Connection

URL: wss://ws.limitless.exchange Namespace: /markets Transport: WebSocket only (no polling fallback)
import { io } from 'socket.io-client';

const socket = io('wss://ws.limitless.exchange/markets', {
  transports: ['websocket'],
  extraHeaders: { 'X-API-Key': 'lmts_your_key_here' }
});

Subscribing

Subscribe to markets by emitting subscribe_market_prices:
// AMM price updates
socket.emit('subscribe_market_prices', {
  marketAddresses: ['0x1234...']
});

// CLOB orderbook updates
socket.emit('subscribe_market_prices', {
  marketSlugs: ['btc-100k-weekly']
});

// Both at once (recommended to avoid overwriting subscriptions)
socket.emit('subscribe_market_prices', {
  marketAddresses: ['0x1234...'],
  marketSlugs: ['btc-100k-weekly']
});
Subscriptions replace previous ones. If you want both AMM prices and CLOB orderbook, send both marketAddresses and marketSlugs together in a single call.

Event Reference

EventDirectionAuth RequiredDescription
connectServer → ClientNoConnection established
disconnectServer → ClientNoConnection lost
subscribe_market_pricesClient → ServerNoSubscribe to price/orderbook updates
subscribe_positionsClient → ServerYesSubscribe to position updates
newPriceDataServer → ClientNoAMM market price update
orderbookUpdateServer → ClientNoCLOB orderbook update
positionsServer → ClientYesPosition balance update
systemServer → ClientNoSystem notifications
authenticatedServer → ClientYesAuthentication confirmation
exceptionServer → ClientNoError notifications

Event Payloads

newPriceData

{
  "marketAddress": "0x1234...",
  "updatedPrices": {
    "yes": "0.65",
    "no": "0.35"
  },
  "blockNumber": 12345678,
  "timestamp": "2024-01-01T00:00:00.000Z"
}

orderbookUpdate

{
  "marketSlug": "btc-100k-weekly",
  "orderbook": { ... },
  "timestamp": "2024-01-01T00:00:00.000Z"
}

positions

{
  "account": "0xabcd...",
  "marketAddress": "0x1234...",
  "positions": [
    {
      "tokenId": "123456",
      "balance": "1000000",
      "outcomeIndex": 0
    }
  ],
  "type": "AMM"
}