polymarket-paper-trader

作者 agent-next已验证

Paper trading simulator for Polymarket — built for AI agents. MCP server, live order books, strategy backtesting. Install: npx clawhub install polymarket-paper-trader

374
Stars
52
Forks
Python
语言
2026/8/23
添加时间

⚠️ 第三方软件声明

本 Skill 为第三方开源软件,独立托管于 GitHub。SkillTip 仅为信息目录,不控制或维护底层仓库。所显示的安全检查为自动化且范围有限,安装前请自行审查源码。

阅读服务条款

安装

添加到你的 Claude Code skills 目录:

# Add to your Claude Code skills
git clone https://github.com/agent-next/polymarket-paper-trader

快速入门

使用 polymarket-paper-trader 等 Skills 的指南。

安全报告

已验证

上次扫描:—

{
  "status": "PASSED",
  "issues": []
}

README.md

polymarket-paper-trader

PyPI Tests ClawHub License: MIT

Your AI agent just became a Polymarket trader.

Install → your agent gets $10,000 paper money → trades real Polymarket order books → tracks P&L → competes on a public leaderboard. Zero risk. Real prices.

"My AI agent hit +18% ROI on Polymarket in one week. Zero risk, real order books."

Part of agent-next — open research lab for self-evolving autonomous agents.

60-second demo

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

# 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+.

Not a toy — this is a real exchange simulator

Other tools mock prices or use random numbers. We simulate the actual exchange:

  • Level-by-level order book execution — your order walks the real Polymarket ask/bid book, consuming liquidity at each price level, just like a real trade

  • Exact fee modelbps/10000 × min(price, 1-price) × shares — the same formula Polymarket uses

  • Slippage tracking — every trade records how much worse your fill was vs the midpoint, in basis points

  • Limit order state machine — GTC (good-til-cancelled) and GTD (good-til-date) with full lifecycle

  • Strategy backtesting — replay your strategy against historical price snapshots

  • Multi-outcome markets — not just YES/NO binary, supports any number of outcomes

Your paper P&L would match real P&L within the spread. That's the point.

Quick start

# 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

CLI commands

Command Description

init [--balance N] Create paper trading account

balance Show 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

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

orders list Pending limit orders

orders cancel ID Cancel a limit order

orders check Fill limit orders if price crosses

stats [--card|--tweet|--plain] Win rate, ROI, profit, max drawdown

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

benchmark run MODULE.FUNC Run a trading strategy

benchmark compare ACCT1 ACCT2 Compare account performance

benchmark pk STRAT_A STRAT_B Battle: who's the better trader?

accounts list List named accounts

accounts create NAME Create account for A/B testing

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:

pm-trader-mcp  # starts on stdio

Add to your Claude Code config:

{
  "mcpServers": {
    "polymarket-paper-trader": {
      "command": "pm-trader-mcp"
    }
  }
}

MCP tools

Tool What it does

init_account Create paper account with starting balance

get_balance 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 multiple markets

buy Buy shares at best available prices

sell Sell shares at best available prices

portfolio Open positions with live valuations and P&L

history Recent trade log with execution details

place_limit_order Limit order — stays open until filled or cancelled/expired

list_orders Pending limit orders

cancel_order Cancel a pending order

cancel_all_orders Cancel all pending limit orders at once

check_orders Execute pending orders against live prices

stats Win rate, ROI, profit, max drawdown

resolve Resolve a closed market (winners get $1/share)

resolve_all Resolve all closed markets

backtest Backtest a strategy against historical snapshots

stats_card Shareable stats card (tweet/markdown/plain)

share_content Platform-specific content (twitter/telegram/discord)

leaderboard_entry Generate verifiable leaderboard submission

leaderboard_card Top 10 ranking card from all local accounts

pk_card Head-to-head comparison between two accounts

pk_battle Run two strategies head-to-head, auto-compare

Strategy examples

Three ready-to-use strategies in examples/:

Momentum (examples/momentum.py)

Buys when YES price crosses above 0.55, takes profit at 0.70, stops loss at 0.35.

pm-trader benchmark run examples.momentum.run

Mean reversion (examples/mean_reversion.py)

Buys when YES price drops 12+ cents below 0.50 fair value, sells when it reverts.

pm-trader benchmark run examples.mean_reversion.run

Limit grid (examples/limit_grid.py)

Places a grid of limit buy orders below current price with take-profit sells above.

pm-trader benchmark run examples.limit_grid.run

Writing your own strategy

# my_strategy.py
from pm_trader.engine import Engine

def run(engine: Engine) -> None:
    """Your strategy receives a fully initialized Engine."""
    markets = engine.api.search_markets("crypto")
    for market in markets:
        if market.closed or market.yes_price < 0.3:
            continue
        engine.buy(market.slug, "yes", 100.0)
pm-trader benchmark run my_strategy.run

For backtesting with historical data:

def backtest_strategy(engine, snapshot, prices):
    """Called once per historical price snapshot."""
    if snapshot.midpoint > 0.6:
        engine.buy(snapshot.market_slug, snapshot.outcome, 50.0)

Multi-account support

Run parallel strategies with isolated accounts:

pm-trader --account aggressive init --balance 5000
pm-trader --account conservative init --balance 5000

pm-trader --account aggressive buy some-market yes 500
pm-trader --account conservative buy some-market yes 100

pm-trader benchmark compare aggressive conservative

Share your results

Generate a shareable stats card and post to X/Twitter:

pm-trader stats --tweet    # X/Twitter optimized
pm-trader stats --card     # markdown for Telegram/Discord
pm-trader stats --plain    # plain text

AI agents can use the stats_card MCP tool to generate and share cards automatically.

OpenClaw / ClawHub

Available on ClawHub as polymarket-paper-trader:

npx clawhub install polymarket-paper-trader

GitHub bot

Comment /oc or /opencode on an issue or PR. New issues get a triage reply; non-draft PRs get a shallow review. The public bot uses FreeInference (qwen3.6-35b) via a repo Actions secret — no wallet, no real trades. Sessions are not shared.

Tests

pytest -m "not live"             # unit + integration (skips live API tests)
pytest                           # full test suite (requires network)
pytest tests/test_e2e_live.py    # live API integration tests only

License

MIT

常见问题

What is polymarket-paper-trader?

polymarket-paper-trader is an open-source ai agents skill for AI coding assistants such as Claude Code, Codex CLI, and ChatGPT, built by agent-next. 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 374 GitHub stars.

Is polymarket-paper-trader safe to use?

Yes. polymarket-paper-trader passed SkillsLLM's automated security scan — a dependency vulnerability audit plus prompt-injection heuristics — with no high-severity issues. You can read the full report in the Security Report section on this page.

How do I install polymarket-paper-trader?

Clone the repository with "git clone https://github.com/agent-next/polymarket-paper-trader" and add it to your Claude Code skills directory (see the Installation section above).

What programming language is polymarket-paper-trader written in?

polymarket-paper-trader is primarily written in Python. It is open-source under agent-next on GitHub, so you can review or fork the full source.

Are there alternatives to polymarket-paper-trader?

Yes. SkillsLLM lists many other AI Agents skills you can browse and compare side by side. Open the AI Agents category from the badge at the top of this page, or use the Related Skills and comparison links further down to weigh polymarket-paper-trader against similar tools.

评论 (0)

暂无评论,成为第一个分享想法的人!

ECC

by affaan-m

10

The agent harness performance optimization system. Skills, instincts, memory, security, and research-first development for Claude Code, Codex, Opencode, Cursor and beyond.

242,21936,702JavaScript
AI 智能体ai-agentsanthropicclaude-code
查看详情
15

An agentic skills framework & software development methodology that works.

234,96620,863Shell
AI 智能体ai-agentsbrainstorming
查看详情

hermes-agent

by NousResearch

10

The agent that grows with you

234,43747,175Python
AI 智能体ai-agentsagent-orchestration
查看详情

The agent harness performance optimization system. Skills, instincts, memory, security, and research-first development for Claude Code, Codex, Opencode, Cursor and beyond.

185,94028,768JavaScript
AI 智能体ai-agentsanthropicclaude-code
查看详情

cc-switch

by farion1231

3

A cross-platform desktop All-in-One assistant for Claude Code, Codex, OpenCode, OpenClaw, Grok Build & Hermes Agent. Only official website: ccswitch.io

128,8688,826Rust
AI 智能体claude-codeai-tools
查看详情

claude-code

by anthropics

Claude Code is an agentic coding tool that lives in your terminal, understands your codebase, and helps you code faster by executing routine tasks, explaining complex code, and handling git workflows - all through natural language commands.

120,03119,897Shell
AI 智能体
查看详情

开发者还喜欢

基于喜欢此 Skill 的开发者投票和收藏

ECC

by affaan-m

10

The agent harness performance optimization system. Skills, instincts, memory, security, and research-first development for Claude Code, Codex, Opencode, Cursor and beyond.

242,21936,702JavaScript
AI 智能体ai-agentsanthropicclaude-code
查看详情
15

An agentic skills framework & software development methodology that works.

234,96620,863Shell
AI 智能体ai-agentsbrainstorming
查看详情

hermes-agent

by NousResearch

10

The agent that grows with you

234,43747,175Python
AI 智能体ai-agentsagent-orchestration
查看详情

n8n

by n8n-io

12

Fair-code workflow automation platform with native AI capabilities. Combine visual building with custom code, self-host or cloud, 400+ integrations.

201,88160,308TypeScript
MCP 服务器apisai-tools
查看详情

The agent harness performance optimization system. Skills, instincts, memory, security, and research-first development for Claude Code, Codex, Opencode, Cursor and beyond.

185,94028,768JavaScript
AI 智能体ai-agentsanthropicclaude-code
查看详情

cc-switch

by farion1231

3

A cross-platform desktop All-in-One assistant for Claude Code, Codex, OpenCode, OpenClaw, Grok Build & Hermes Agent. Only official website: ccswitch.io

128,8688,826Rust
AI 智能体claude-codeai-tools
查看详情