Skip to main content

Overview

Market makers need fast, reliable data to price markets and manage inventory. Polymarket provides several data feeds at different latency and detail levels.
FeedLatencyUse CaseAccess
WebSocket~100msStandard MM operationsPublic
Gamma API~1sMarket metadata, indexingPublic
OnchainBlock timeSettlement, resolutionPublic

WebSocket Feeds

The WebSocket API provides real-time market data with low latency. This is sufficient for most market making strategies.

Connecting

const ws = new WebSocket("wss://ws-subscriptions-clob.polymarket.com/ws/market");

ws.onopen = () => {
  // Subscribe to orderbook updates
  ws.send(JSON.stringify({
    type: "market",
    assets_ids: [tokenId]
  }));
};

ws.onmessage = (event) => {
  const data = JSON.parse(event.data);
  // Handle orderbook update
};

Available Channels

ChannelMessage TypesDocumentation
marketbook, price_change, last_trade_priceMarket Channel
userOrder fills, cancellationsUser Channel

User Channel (Authenticated)

Monitor your order activity in real-time:
// Requires authentication
const userWs = new WebSocket("wss://ws-subscriptions-clob.polymarket.com/ws/user");

userWs.onopen = () => {
  userWs.send(JSON.stringify({
    type: "user",
    auth: {
      apiKey: "your-api-key",
      secret: "your-secret",
      passphrase: "your-passphrase"
    },
    markets: [conditionId] // Optional: filter to specific markets
  }));
};

userWs.onmessage = (event) => {
  const data = JSON.parse(event.data);
  // Handle order fills, cancellations, etc.
};
See WebSocket Authentication for auth details.

Best Practices

  1. Reconnection logic - Implement automatic reconnection with exponential backoff
  2. Heartbeats - Respond to ping messages to maintain connection
  3. Local orderbook - Maintain a local copy and apply incremental updates
  4. Sequence numbers - Track sequence to detect missed messages
See WebSocket Overview for complete documentation.

Gamma API

The Gamma API provides market metadata and indexing. Use it for:
  • Market titles, slugs, categories
  • Event/condition mapping
  • Volume and liquidity data
  • Outcome token metadata

Get Markets

const response = await fetch(
  "https://gamma-api.polymarket.com/markets?active=true"
);
const markets = await response.json();

Get Events

const response = await fetch(
  "https://gamma-api.polymarket.com/events?slug=us-presidential-election"
);
const event = await response.json();

Key Fields for MMs

FieldDescription
conditionIdUnique market identifier
clobTokenIdsOutcome token IDs
outcomesOutcome names
outcomePricesCurrent outcome prices
volumeTrading volume
liquidityCurrent liquidity
rfqEnabledWhether RFQ is enabled for this market
See Gamma API Overview for complete documentation.

Onchain Data

For settlement, resolution, and position tracking, market makers may query onchain data directly.

Data Sources

DataSourceUse Case
Token balancesERC1155 balanceOfPosition tracking
ResolutionUMA Oracle eventsPre-resolution risk modeling
Condition resolutionCTF contractPost-resolution redemption

RPC Providers

Common providers for Polygon:
  • Alchemy
  • QuickNode
  • Infura

UMA Oracle

Markets are resolved via UMA’s Optimistic Oracle. Monitor resolution events for risk management. See Resolution for details on the resolution process.