Paper trading simulator for Polymarket — built for AI agents. MCP server, live order books, strategy backtesting. Install: npx clawhub install polymarket-paper-trader
- ✓Open-source license (MIT)
- ✓Actively maintained (<30d)
- ✓Healthy fork ratio
- ✓Clear description
- ✓Topics declared
- ✓Documented (README)
claude mcp add polymarket-paper-trader -- npx -y clawhub{
"mcpServers": {
"polymarket-paper-trader": {
"command": "npx",
"args": ["-y", "clawhub"]
}
}
}MCP Servers overview
# polymarket-paper-trader
[](https://pypi.org/project/polymarket-paper-trader/)
[](https://github.com/agent-next/polymarket-paper-trader/actions/workflows/test.yml)
[](https://clawhub.com/robotlearning123/polymarket-paper-trader)
[](https://github.com/agent-next/polymarket-paper-trader/blob/main/LICENSE)
**A zero-risk gym for AI agents on real prediction markets — real order books, official fees, verified fill fidelity. Practice, evaluate, and benchmark decision intelligence.**
Agents make probability judgments all day. Polymarket is the world's largest prediction market, and its order books are the honest scoreboard: real money, real prices, real outcomes. But you cannot hand an agent a wallet to learn with. So this project gives every agent what SWE-bench gave coders — a faithful environment where judgment has consequences and gets scored:
- **Practice** — your agent trades $10k of paper money against live Polymarket order books, with the same fee model and fill mechanics as the real exchange
- **Evaluate** — the `polymarket-benchmark` harness in this repository (installed separately) scores any model on prediction-market decision sets (Brier score, calibration, alpha)
- **Compare** — multi-account battles and leaderboards rank agents against each other
Part of [agent-next](https://github.com/agent-next) — building an agentic world.
## 60-second demo
```bash
npx clawhub install polymarket-paper-trader # install via ClawHub
pm-trader init --balance 10000 # $10k paper money
pm-trader markets search "bitcoin" # find markets
pm-trader buy will-bitcoin-hit-100k yes 500 # buy $500 of YES
pm-trader stats --card # shareable stats card
```
That's it. Your AI agent is now trading Polymarket with zero risk.
## Install
```bash
# via pip
pip install polymarket-paper-trader
# via ClawHub (for OpenClaw agents)
npx clawhub install polymarket-paper-trader
# from source (development)
uv pip install -e ".[dev]"
```
Requires Python 3.10+.
## Works with
| Runtime | One-line install |
|---|---|
| Claude Code | `/plugin marketplace add agent-next/polymarket-paper-trader` |
| Codex CLI | `codex mcp add polymarket-paper-trader -- uvx --from polymarket-paper-trader pm-trader-mcp` |
| Cursor | [](cursor://anysphere.cursor-deeplink/mcp/install?name=polymarket-paper-trader&config=eyJjb21tYW5kIjoidXZ4IiwiYXJncyI6WyItLWZyb20iLCJwb2x5bWFya2V0LXBhcGVyLXRyYWRlciIsInBtLXRyYWRlci1tY3AiXX0=) |
| Gemini CLI | `gemini extensions install https://github.com/agent-next/polymarket-paper-trader` |
| OpenCode / Goose / Cline / Windsurf / Copilot | add `pm-trader-mcp` to the client's MCP config |
| OpenClaw / ClawHub | `npx clawhub install polymarket-paper-trader` |
| Hermes Agent / LangChain / OpenAI Agents SDK / CrewAI | wrap `uvx --from polymarket-paper-trader pm-trader-mcp` |
Full copy-paste config for every runtime above (plus Grok/xAI remote MCP): [docs/integrations.md](docs/integrations.md).
## Quick start
```bash
# Initialize with $10k paper balance
pm-trader init --balance 10000
# Browse markets
pm-trader markets list --sort liquidity
pm-trader markets search "bitcoin"
# Trade
pm-trader buy will-bitcoin-hit-100k yes 100 # buy $100 of YES
pm-trader sell will-bitcoin-hit-100k yes 50 # sell 50 shares
# Check portfolio and P&L
pm-trader portfolio
pm-trader stats
```
## How it works — and why to trust it
- **Your order walks the real book.** A buy consumes live ask levels from the lowest price upward, exactly like a real taker order — slippage is real and reported in basis points
- **Fees follow the official per-match curve** — `fee = C × rate × p × (1-p)`, rounded to 5 decimals, makers exempt (exact spec in the [CHANGELOG](CHANGELOG.md)) — charged per filled level from each market's published fee schedule, not an approximation
- **Paper cash, real discipline.** Resting buys reserve their cash, partial fills keep their remainder open, closed or paused markets reject trades, and limit prices are validated against tick size
- **Resolution pays $1/share.** Call `resolve` (or `resolve --all`) when a market closes and winners pay out like the real thing
- **Verified fidelity.** The live test suite asserts that simulated fills land inside the band of prices the market actually quoted (Data API v2 price history) and that fees match the official curve exactly — run against real APIs on CI
- **Upstream-aligned.** The client tracks the current Gamma / CLOB / Data API surface, contract-verified by live probes
- **Multi-outcome markets** — any number of outcomes, not just YES/NO
- **100% coverage gate** on the core package, plus end-to-end tests against the live API
## CLI commands
| Command | Description |
|---------|-------------|
| `init [--balance N]` | Create paper trading account |
| `balance` | Show cash, reserved/available cash, positions value, total P&L |
| `reset --confirm` | Wipe all data |
| `markets list [--limit N] [--sort volume\|liquidity]` | Browse active markets |
| `markets search QUERY` | Full-text market search |
| `markets get SLUG` | Market details |
| `markets tags` | List all market categories/tags |
| `markets event SLUG` | Event details — a group of related markets |
| `price SLUG` | YES/NO midpoints and spread |
| `book SLUG [--depth N]` | Order book snapshot |
| `watch SLUG [SLUG...] [--outcome yes\|no]` | Monitor live prices |
| `buy SLUG OUTCOME AMOUNT [--type fok\|fak]` | Buy at market price |
| `sell SLUG OUTCOME SHARES [--type fok\|fak]` | Sell at market price |
| `portfolio` | Open positions with live prices |
| `history [--limit N]` | Trade history |
| `orders place SLUG OUTCOME SIDE AMOUNT PRICE` | Limit order (GTC/GTD) |
| `orders list` | Open limit orders (pending and partially filled) |
| `orders cancel ID` | Cancel a limit order |
| `orders cancel-all` | Cancel all pending limit orders at once |
| `orders check` | Fill limit orders if price crosses |
| `stats [--card\|--tweet\|--plain]` | Win rate, ROI, profit, max drawdown |
| `resolve [SLUG] [--all]` | Resolve a closed market, or all closed markets (winners get $1/share) |
| `leaderboard` | Local account rankings |
| `pk ACCOUNT_A ACCOUNT_B` | Battle: who's the better trader? |
| `export trades [--format csv\|json]` | Export trade history |
| `export positions [--format csv\|json]` | Export positions |
| `strategy run MODULE.FUNC` | Run a trading strategy |
| `strategy compare ACCT1 ACCT2` | Compare account performance |
| `strategy pk STRAT_A STRAT_B` | Battle: who's the better trader? |
| `benchmark run MODULE.FUNC` | Alias of `strategy run` |
| `benchmark compare ACCT1 ACCT2` | Alias of `strategy compare` |
| `benchmark pk STRAT_A STRAT_B` | Alias of `strategy pk` |
| `accounts list` | List named accounts |
| `accounts create NAME` | Create account for A/B testing |
| `accounts delete NAME --confirm` | Delete a named account and all its data |
| `mcp` | Start MCP server (stdio transport) |
Global flags: `--data-dir PATH`, `--account NAME` (or env vars `PM_TRADER_DATA_DIR`, `PM_TRADER_ACCOUNT`).
## MCP server — what your agent can do
Your agent gets the following tools via the [Model Context Protocol](https://modelcontextprotocol.io).
The server also carries the full trading playbook with it — as MCP server
`instructions`, as a `trading_playbook` prompt, and as a `skill://trading-playbook`
resource — so MCP-only clients (Cursor, Claude.ai connectors, Grok API remote
MCP, ChatGPT apps) get the same guidance skill-aware agents get from
[`skill/polymarket-paper-trader/SKILL.md`](skill/polymarket-paper-trader/SKILL.md).
```bash
pm-trader-mcp # starts on stdio
# or, with no local install:
uvx --from polymarket-paper-trader pm-trader-mcp
```
Add to your Claude Code config:
```json
{
"mcpServers": {
"polymarket-paper-trader": {
"command": "pm-trader-mcp"
}
}
}
```
### Remote transport (streamable-http)
For MCP clients that only speak HTTP, run the server with `--transport streamable-http`:
```bash
pm-trader-mcp --transport streamable-http --host 0.0.0.0 --port 8000
# or: pm-trader mcp --transport streamable-http --host 0.0.0.0 --port 8000
```
The MCP endpoint is then `http://<host>:<port>/mcp`. There is no isolation
between callers — everyone who reaches the server shares all of its paper
accounts; it is self-host-only, not a public multi-user service. **There is no authentication** on this transport;
anyone who can reach the port can call every exposed tool. `backtest` and
`pk_battle` (local file reads + local strategy-module execution) are
**stdio-only** and are not registered when serving over streamable-http.
### Docker
```bash
docker build -t pm-trader-mcp .
docker run -p 127.0.0.1:8000:8000 -v pm-trader-data:/root/.pm-trader pm-trader-mcp
```
Publish the port to `127.0.0.1` only (as above) unless you put a real
authenticating proxy in front of it — the container has no auth of its own.
### MCP tools
| Tool | What it does |
|------|---------|
| `init_account` | Create paper account with starting balance |
| `get_balance` | Cash, reserved/available cash, positions value, total P&L |
| `reset_account` | Wipe all data and start fresh |
| `search_markets` | Find markets by keyword |
| `list_markets` | Browse markets sorted by volume/liquidity |
| `get_tags` | All market categories/tags for filtering |
| `get_markets_by_tag` | Markets in a specific category/tag |
| `get_event` | Event details — a group of related markets |
| `get_market` | Market details with outcomes and prices |
| `get_order_book` | Live order book snapshot (bids + asks) |
| `watch_prices` | Monitor prices for multipWhat people ask about polymarket-paper-trader
What is agent-next/polymarket-paper-trader?
+
agent-next/polymarket-paper-trader is mcp servers for the Claude AI ecosystem. Paper trading simulator for Polymarket — built for AI agents. MCP server, live order books, strategy backtesting. Install: npx clawhub install polymarket-paper-trader It has 399 GitHub stars and its last recorded update is dated 2026-09-26.
How do I install polymarket-paper-trader?
+
You can install polymarket-paper-trader by cloning the repository (https://github.com/agent-next/polymarket-paper-trader) or following the README instructions on GitHub. ClaudeWave also provides quick install blocks on this page.
Is agent-next/polymarket-paper-trader safe to use?
+
Our security agent has analyzed agent-next/polymarket-paper-trader and assigned a Trust Score of 100/100 (tier: Verified). See the full breakdown of passed checks and flags on this page.
Who maintains agent-next/polymarket-paper-trader?
+
agent-next/polymarket-paper-trader is maintained by agent-next. The last recorded GitHub activity is dated 2026-09-26, with 0 open issues.
Are there alternatives to polymarket-paper-trader?
+
Yes. On ClaudeWave you can browse similar mcp servers at /categories/mcp, sorted by popularity or recent activity.
Deploy polymarket-paper-trader to your cloud
Ship this repo to production in minutes. Each platform spins up its own environment with editable env vars.
Maintain this repo? Add a badge to your README
Drop the badge into your GitHub README to show it's tracked on ClaudeWave. Each badge links back to this page and reflects the live Trust Score.
[](https://claudewave.com/repo/agent-next-polymarket-paper-trader)<a href="https://claudewave.com/repo/agent-next-polymarket-paper-trader"><img src="https://claudewave.com/api/badge/agent-next-polymarket-paper-trader" alt="Featured on ClaudeWave: agent-next/polymarket-paper-trader" width="320" height="64" /></a>More MCP Servers
Fair-code workflow automation platform with native AI capabilities. Combine visual building with custom code, self-host or cloud, 400+ integrations.
User-friendly AI Interface (Supports Ollama, OpenAI API, ...)
An open-source AI agent that brings the power of Gemini directly into your terminal.
Real-time global intelligence dashboard. AI-powered news aggregation, geopolitical monitoring, and infrastructure tracking in a unified situational awareness interface
🕷️ An adaptive Web Scraping framework that handles everything from a single request to a full-scale crawl! Don't be shy, join here: https://discord.gg/EMgGbDceNQ and follow here for daily tips and tricks: https://x.com/Scrapling_dev
The fastest path to AI-powered full stack observability, even for lean teams.