How to Pull Polymarket Data Into a Trading Bot
If you're automating a Polymarket strategy, the hard part isn't the trading logic — it's getting clean, current data into your code: live prices, where the mispricings are, which reward pools are funded. You can scrape Polymarket's own APIs, but you'll spend more time maintaining the plumbing than trading.
What a bot actually needs
- Live prices for the markets you care about, refreshed on a schedule.
- A fair-value reference so you know which prices are mispriced, not just what they are.
- Reward-pool data if you're market-making, ranked by what actually pays.
- Clean JSON over a stable endpoint, so you're not parsing HTML.
A simple pattern
Poll a JSON endpoint on your own schedule (once a minute is plenty — most candle and event prices don't move faster than your bot needs), diff against your last snapshot, and act when a market crosses your threshold. Authenticate with a bearer token so your key never leaks in URLs:
import requests
r = requests.get("https://polygap.io/api/v1/all",
headers={"Authorization": "Bearer pe_live_yourkey"})
board = r.json()
for m in board["lp"]:
if m["per1k"] > 5 and m["stab"] < 0.3: # calm pool paying >$5/$1k/day
print(m["q"], m["per1k"])
Don't over-trade
The most common bot mistake on prediction markets is trading too often — fees and spreads quietly eat thin edges. Poll for real divergences, size sensibly, and let the bot sit on its hands most of the time.
PolyGap's REST API gives you exactly this: crypto mispricings (vs Deribit), the ranked reward pools, and live prices — one bearer token, three endpoints, JSON. Full docs and copy-paste Python/Node examples are in the documentation.