Using the Polymarket Data API: Real-Time Prediction Market Data
Developers, researchers, and analysts increasingly rely on prediction market information for strategic decision-making and empirical studies. PolyGram provides access to Polymarket's comprehensive API infrastructure, enabling builders to leverage the globe's most substantial prediction market dataset through programmatic interfaces.
Available Data Endpoints
Gamma API (Market Data)
GET https://gamma-api.polymarket.com/events
?limit=100&active=true&order=volume24hr
Returns: event metadata, current prices, volume, tags
GET https://gamma-api.polymarket.com/events/{slug}
Returns: full event with all markets, prices, descriptions
GET https://gamma-api.polymarket.com/markets/{conditionId}
Returns: single market details, current order book price
CLOB API (Order Book)
GET https://clob.polymarket.com/book
?token_id={tokenId}
Returns: full order book depth (bids/asks)
GET https://clob.polymarket.com/prices/history
?market={conditionId}&resolution=1h&startTs=1700000000
Returns: hourly price history
WebSocket: wss://ws-subscriptions-clob.polymarket.com
Subscribe to real-time price updates
Python Quickstart
import requests
# Get top prediction markets by volume
r = requests.get(
"https://gamma-api.polymarket.com/events",
params={"limit": 10, "active": "true", "order": "volume24hr"}
)
for event in r.json():
market = event["markets"][0] if event.get("markets") else {}
prices = market.get("outcomePrices", "[0.5,0.5]")
import json; p = json.loads(prices)
print(f"{event['title'][:50]}: YES={float(p[0]):.2%}")
Use Cases
- Research dashboards: Monitor how prediction market odds shift throughout the lifecycle of a given event
- News tools: Identify markets experiencing rapid movement in response to emerging developments
- Aggregators: Examine probability divergence across Polymarket, Kalshi, and Metaculus platforms
- Alert systems: Trigger notifications whenever a market experiences significant price swings
- Academic research: Utilise resolved market outcomes to evaluate prediction accuracy and forecaster performance
FAQ
- Is the Polymarket API free to use?
- Absolutely — accessing market data through the Gamma API incurs no cost, though unauthenticated requests face rate restrictions (approximately 100 per minute). Submitting orders via the CLOB requires wallet funding, though querying order book information remains complimentary.
- Is there a Python library for Polymarket?
- Multiple community-developed Python libraries are available on GitHub. Look for "polymarket-py" to discover the most actively maintained versions.