Pandas API client to Polymarket
Project description
polymarket-pandas
Pandas-native Python client for the full Polymarket API surface — REST, WebSocket, Relayer, and Bridge — with automatic type coercion and DataFrame output.
Documentation | Getting Started | API Reference | Notebooks | Changelog
Features
- 102 public methods across 9 API mixins (Gamma, CLOB, Data, Rewards, Bridge, Relayer, CTF, XTracker)
- Every endpoint returns a
pd.DataFramewith automatic type coercion (datetimes, numerics, booleans) - Sync + Async HTTP clients —
PolymarketPandasandAsyncPolymarketPandas - WebSocket streaming — real-time orderbook, prices, trades, sports, crypto feeds
- pandera schemas for column documentation and optional runtime validation
- TypedDicts for dict-returning endpoints with full IDE autocomplete
- Order building & EIP-712 signing —
build_order,place_order,submit_orders(DataFrame batch) - On-chain CTF operations — merge, split, redeem positions via web3
- Title parsers — extract bracket bounds, directional thresholds, and sports lines from market titles
- Auto-pagination — offset-based and cursor-based
_all()methods - Interactive Streamlit explorer with 11 pages and Plotly charts
- MCP server with 74 tools for Claude Code / Claude Desktop
Installation
pip install polymarket-pandas
Optional extras:
pip install "polymarket-pandas[ctf]" # on-chain merge/split/redeem (web3)
pip install "polymarket-pandas[explorer]" # Streamlit dashboard (11 pages)
pip install "polymarket-pandas[mcp]" # MCP server (74 tools)
Quick Start
from polymarket_pandas import PolymarketPandas
client = PolymarketPandas()
# Get active markets sorted by volume
markets = client.get_markets(closed=False, order="volume24hr", ascending=False, limit=20)
print(markets[["slug", "question", "volume24hr", "endDate"]])
# Orderbook for a token
token_id = markets["clobTokenIds"].iloc[0]
book = client.get_orderbook(token_id)
# Price history
prices = client.get_price_history(market=token_id, interval="1d", fidelity=60)
See the Getting Started guide for a complete walkthrough.
MCP Server
Query Polymarket data from any MCP client with 74 tools covering the full API surface.
polymarket-mcp # stdio transport
polymarket-mcp --sse # SSE transport
Add to Claude Code / Claude Desktop (~/.claude/settings.json):
{
"mcpServers": {
"polymarket": {
"command": "polymarket-mcp"
}
}
}
See the MCP Server guide for the full list of 74 tools and environment variables.
Interactive Explorer
pip install "polymarket-pandas[explorer]"
polymarket-explore
11 pages covering Markets, Events, Series, Tags, Orderbook, Prices, Positions, Trades, Leaderboard, Rewards, and Bridge. Each page shows the raw DataFrame, an interactive Plotly chart, and the equivalent Python code.
Configuration
All credentials are read from environment variables (or a .env file). No auth needed for public endpoints.
export POLYMARKET_ADDRESS=0xYourProxyWallet
export POLYMARKET_API_KEY=your-api-key
export POLYMARKET_API_SECRET=your-secret
export POLYMARKET_API_PASSPHRASE=your-passphrase
Or derive API keys from your private key:
client = PolymarketPandas(private_key="0xYourKey")
creds = client.derive_api_key() # auto-sets L2 credentials
See the Configuration guide for all environment variables and authentication layers.
Examples
| Script | Description |
|---|---|
btc_5min.py |
Find BTC 5-min market, fetch orderbook and prices |
btc_5min_trade_merge.py |
Full trading flow: submit_orders, cancel, merge |
rewards_overview.py |
All 7 CLOB rewards endpoints |
xtracker_overview.py |
All 7 XTracker endpoints |
market_structures.py |
Event structures + title parsers demo |
post_only_buy.py |
Post-only order example |
rtds_ws.py |
Real-Time Data Streams via WebSocket |
user_ws.py |
Private user channel — live order and trade events |
License
Apache-2.0
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file polymarket_pandas-0.6.23.tar.gz.
File metadata
- Download URL: polymarket_pandas-0.6.23.tar.gz
- Upload date:
- Size: 105.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8169e09d8af43b1fae8206fd2369143404d362f5920b16d672881b377e1d9336
|
|
| MD5 |
55617a4e8d869382bd1d1d81ab4a0113
|
|
| BLAKE2b-256 |
6840ac817fc3dcd20415f7c7406d731a2eabf1b8a0043d12d400e34402d61093
|
Provenance
The following attestation bundles were made for polymarket_pandas-0.6.23.tar.gz:
Publisher:
release.yml on sigma-quantiphi/polymarket-pandas
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
polymarket_pandas-0.6.23.tar.gz -
Subject digest:
8169e09d8af43b1fae8206fd2369143404d362f5920b16d672881b377e1d9336 - Sigstore transparency entry: 1284770232
- Sigstore integration time:
-
Permalink:
sigma-quantiphi/polymarket-pandas@cb939c745ce864725c9d03839f86c432bd92a6e8 -
Branch / Tag:
refs/tags/v0.6.23 - Owner: https://github.com/sigma-quantiphi
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@cb939c745ce864725c9d03839f86c432bd92a6e8 -
Trigger Event:
release
-
Statement type:
File details
Details for the file polymarket_pandas-0.6.23-py3-none-any.whl.
File metadata
- Download URL: polymarket_pandas-0.6.23-py3-none-any.whl
- Upload date:
- Size: 106.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8b1d705316fe3cc732efd5507875089f9726dc01797ce1e56c5b00a4eab146ae
|
|
| MD5 |
2d2ca6081c733be149ee9bad37353288
|
|
| BLAKE2b-256 |
6437c1887fad53f9d7c8d2e780619eed9ad8f910180d8fc51322638d5cb27842
|
Provenance
The following attestation bundles were made for polymarket_pandas-0.6.23-py3-none-any.whl:
Publisher:
release.yml on sigma-quantiphi/polymarket-pandas
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
polymarket_pandas-0.6.23-py3-none-any.whl -
Subject digest:
8b1d705316fe3cc732efd5507875089f9726dc01797ce1e56c5b00a4eab146ae - Sigstore transparency entry: 1284770360
- Sigstore integration time:
-
Permalink:
sigma-quantiphi/polymarket-pandas@cb939c745ce864725c9d03839f86c432bd92a6e8 -
Branch / Tag:
refs/tags/v0.6.23 - Owner: https://github.com/sigma-quantiphi
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@cb939c745ce864725c9d03839f86c432bd92a6e8 -
Trigger Event:
release
-
Statement type: