Skip to main content

Markets WebSocket

The Markets WebSocket endpoint provides real-time market data including order book updates, price changes, and trade notifications.
Authentication RequiredThis WebSocket endpoint requires Ed25519 signature authentication in the connection handshake. See the Authentication guide for details.

Endpoint

wss://api.polymarket.us/v1/ws/markets

Subscription Types

ValueDescription
SUBSCRIPTION_TYPE_MARKET_DATAFull order book and market stats
SUBSCRIPTION_TYPE_MARKET_DATA_LITELightweight price data only
SUBSCRIPTION_TYPE_TRADEReal-time trade notifications

Market Data Subscription

Subscribe to Full Market Data

{
  "subscribe": {
    "requestId": "md-sub-1",
    "subscriptionType": "SUBSCRIPTION_TYPE_MARKET_DATA",
    "marketSlugs": ["market-slug-1", "market-slug-2"]
  }
}

Market Data Response

Full order book with market statistics:
{
  "requestId": "md-sub-1",
  "subscriptionType": "SUBSCRIPTION_TYPE_MARKET_DATA",
  "marketData": {
    "marketSlug": "market-slug-1",
    "bids": [
      {"px": {"value": "0.54", "currency": "USD"}, "qty": "1000"},
      {"px": {"value": "0.53", "currency": "USD"}, "qty": "2500"}
    ],
    "offers": [
      {"px": {"value": "0.56", "currency": "USD"}, "qty": "800"},
      {"px": {"value": "0.57", "currency": "USD"}, "qty": "1500"}
    ],
    "state": "MARKET_STATE_OPEN",
    "stats": {
      "lastTradePx": {"value": "0.55", "currency": "USD"},
      "sharesTraded": "150000",
      "openInterest": "500000",
      "highPx": {"value": "0.58", "currency": "USD"},
      "lowPx": {"value": "0.52", "currency": "USD"}
    },
    "transactTime": "2024-01-15T10:30:00Z"
  }
}

Market Data Lite Subscription

Subscribe to Lightweight Data

For reduced bandwidth, use the lite subscription:
{
  "subscribe": {
    "requestId": "mdl-sub-1",
    "subscriptionType": "SUBSCRIPTION_TYPE_MARKET_DATA_LITE",
    "marketSlugs": ["market-slug-1"]
  }
}

Market Data Lite Response

{
  "requestId": "mdl-sub-1",
  "subscriptionType": "SUBSCRIPTION_TYPE_MARKET_DATA_LITE",
  "marketDataLite": {
    "marketSlug": "market-slug-1",
    "currentPx": {"value": "0.55", "currency": "USD"},
    "lastTradePx": {"value": "0.55", "currency": "USD"},
    "bestBid": {"value": "0.54", "currency": "USD"},
    "bestAsk": {"value": "0.56", "currency": "USD"},
    "bidDepth": 5,
    "askDepth": 4,
    "sharesTraded": "150000",
    "openInterest": "500000"
  }
}

Trade Subscription

Subscribe to Trades

{
  "subscribe": {
    "requestId": "trade-sub-1",
    "subscriptionType": "SUBSCRIPTION_TYPE_TRADE",
    "marketSlugs": ["market-slug-1"]
  }
}

Trade Response

{
  "requestId": "trade-sub-1",
  "subscriptionType": "SUBSCRIPTION_TYPE_TRADE",
  "trade": {
    "marketSlug": "market-slug-1",
    "price": {"value": "0.55", "currency": "USD"},
    "quantity": {"value": "100", "currency": "USD"},
    "tradeTime": "2024-01-15T10:30:00Z",
    "maker": {
      "side": "ORDER_SIDE_BUY",
      "intent": "ORDER_INTENT_BUY_LONG"
    },
    "taker": {
      "side": "ORDER_SIDE_SELL",
      "intent": "ORDER_INTENT_SELL_LONG"
    }
  }
}

Market States

ValueDescription
MARKET_STATE_OPENMarket open for trading
MARKET_STATE_PREOPENMarket in pre-open phase
MARKET_STATE_SUSPENDEDTrading temporarily suspended
MARKET_STATE_HALTEDTrading halted
MARKET_STATE_EXPIREDMarket has expired
MARKET_STATE_TERMINATEDMarket terminated
MARKET_STATE_MATCH_AND_CLOSE_AUCTIONMarket in closing auction

Order Side

ValueDescription
ORDER_SIDE_BUYBuy order
ORDER_SIDE_SELLSell order

Order Intent

ValueDescription
ORDER_INTENT_BUY_LONGBuy YES shares
ORDER_INTENT_SELL_LONGSell YES shares
ORDER_INTENT_BUY_SHORTBuy NO shares
ORDER_INTENT_SELL_SHORTSell NO shares

Debouncing

For high-frequency markets, enable response debouncing to reduce message volume:
{
  "subscribe": {
    "requestId": "md-sub-1",
    "subscriptionType": "SUBSCRIPTION_TYPE_MARKET_DATA",
    "marketSlugs": ["market-slug-1"],
    "responsesDebounced": true
  }
}
When debouncing is enabled, updates are batched and sent at regular intervals rather than on every change.
Subscription LimitsYou can subscribe to a maximum of 100 markets per subscription. Use multiple subscriptions if you need more.

Order Book Depth

The full market data subscription includes the top levels of the order book. Each level shows:
FieldDescription
pxPrice level
qtyTotal quantity at this price
Order book levels are sorted best-to-worst (highest bid first, lowest ask first).