Polymarket Bot Tutorial · Chapter 8 of 32

Polymarket CLOB API for bots: REST endpoints for order book snapshots, WebSocket subscriptions for real-time updates, parsing bids/asks, computing mid-price and depth, code samples.

What this chapter covers

This is chapter 8 of our 32-part series on building a Polymarket trading bot. We cover the topic in depth across the sections below. Body content for each section is being written and rolled out chapter-by-chapter; FAQ answers and references are already complete and reflect production experience from running our own trader.

  • CLOB v1 vs v2 (use v2]
  • Order book REST snapshot
  • WebSocket subscriptions: market and user channels
  • Parsing bids/asks/depth
  • Computing mid-price and best-bid/ask
  • Maker fees, taker fees, rebates
  • Code: connect WS and process price-change events
  • Reconnect and gap-handling

CLOB v1 vs v2 (use v2]

This section is in active development. Want to be notified when it goes live? Contact us or watch the authors page.

Order book REST snapshot

This section is in active development. Want to be notified when it goes live? Contact us or watch the authors page.

WebSocket subscriptions: market and user channels

This section is in active development. Want to be notified when it goes live? Contact us or watch the authors page.

Parsing bids/asks/depth

This section is in active development. Want to be notified when it goes live? Contact us or watch the authors page.

Computing mid-price and best-bid/ask

This section is in active development. Want to be notified when it goes live? Contact us or watch the authors page.

Maker fees, taker fees, rebates

This section is in active development. Want to be notified when it goes live? Contact us or watch the authors page.

Code: connect WS and process price-change events

This section is in active development. Want to be notified when it goes live? Contact us or watch the authors page.

Reconnect and gap-handling

This section is in active development. Want to be notified when it goes live? Contact us or watch the authors page.

Frequently asked questions

What is the Polymarket CLOB API endpoint?
The base CLOB endpoint is https://clob.polymarket.com (REST) and wss://ws-subscriptions-clob.polymarket.com/ws/market (WebSocket). These are the V2 endpoints used by @polymarket/clob-client-v2 and py-clob-client.
Do I need an API key to read the order book?
No. Order book reads (snapshots and WebSocket subscriptions) are public and require no authentication. You only need an API key for placing/canceling orders and reading account-specific data (positions, fills).
How fast does the CLOB WebSocket push price updates?
As fast as orders match. Active markets see updates every few hundred milliseconds; thin markets only update on actual orders. Both depth changes and trade events flow through the same WS channel - parse the event type to handle each correctly.
How do I compute the mid-price of a Polymarket order book?
mid = (best_bid + best_ask) / 2 if both exist; otherwise use last_trade_price as a fallback. Be careful with thin books where best_bid is far below best_ask - the mid can be meaningless. Always also consider the spread before treating mid as a fair price.
What is the maker fee on Polymarket in 2026?
0% on most categories. Makers earn rebates equal to 20-25% of taker fees. Taker fees vary by category: 0.75% sports, 1.00% politics, 1.25% economics, 1.80% crypto. The rebate-vs-fee asymmetry is why active bots almost always quote with limit orders rather than market orders.
How do I handle WebSocket disconnects?
Reconnect with exponential backoff (1s, 2s, 4s, max 30s), re-subscribe to the same markets, and re-fetch a REST snapshot to fill any gap. Never trust a stale order book - if you have been disconnected for more than 5 seconds, request a fresh snapshot before placing orders.