DEV Community

Cover image for Querying Polymarket with Pandas in 5 lines
Lucas Jamar
Lucas Jamar

Posted on

Querying Polymarket with Pandas in 5 lines

Been doing quant stuff on Polymarket for a while and kept running into the same problem. Every API call gives you raw dicts you immediately have to parse: numeric strings, Unix timestamps in milliseconds, nested token arrays. Wrote the same boilerplate over and over before deciding to fix it properly.
So I built a wrapper that just returns pd.DataFrame directly, types already coerced:

from polymarket_pandas import PolymarketPandas
client = PolymarketPandas()
markets = client.get_markets(closed=False, limit=500)
markets[["slug", "volume24hr", "endDate"]].sort_values("volume24hr", ascending=False)
Enter fullscreen mode Exit fullscreen mode

volume24hr is float64. endDate is datetime64[UTC]. Nested token arrays are already unnested. Straight into .groupby(), .merge(), .resample().
Covers the full API: REST, WebSocket, async, CTF on-chain ops (split/merge/redeem), and an MCP server with 74 tools if you use Claude Code or Claude Desktop.

command

pip install polymarket-pandas
Enter fullscreen mode Exit fullscreen mode

Repo: https://github.com/sigma-quantiphi/polymarket-pandas

If you're working with prediction market data in Python, would love to know what your current setup looks like and whether this solves the same pain points. Drop a comment or open an issue if something's missing or broken.

Top comments (0)