Why naive orders lose money on Polymarket

Most people's first Polymarket bot places a market order and calls it done. That works fine on liquid, high-volume markets like major elections But Polymarket has thousands of long-tail markets with thin order books and wide bid-ask spreads. On those markets, a naive market order can fill at a price 5-10 cents away from the quote you saw a second ago, which for a binary contract priced in cents is a massive effective cost.

Polymarket splits its API into two separate services worth knowing up front: the Gamma API (gamma-api.polymarket.com) for public, read-only market discovery, and the CLOB API (clob.polymarket.com) for order books, prices, and actual trading. Market data reads require no authentication; placing orders does.

Basic bot skeleton: discovering a market and reading the book

import httpx