Polymarket Autonomous Trader
Enables autonomous trading on Polymarket prediction markets using natural language thesis descriptions, with risk management and MCP integration.
README
Polymarket Autonomous Trader
Claude-powered autonomous trading system for Polymarket prediction markets.
Features
- Thesis → Markets: Describe an investment thesis in natural language; Claude finds, scores, and recommends the best markets to trade
- Autonomous Trading: Claude monitors markets continuously and executes within configurable risk limits
- MCP Integration: All trading capabilities exposed as MCP tools in Claude Desktop / Claude Code
- Risk Management: Configurable position limits, daily loss limits, exposure caps
- HFT Extension Point: Abstract pricing engine interface ready for Kelly criterion, ML models, or poker-inspired strategies
- Confirm-Before-Trade: Safe default mode — Claude proposes, you approve
Prerequisites
- Python 3.11+
- uv package manager
- A Polymarket account with USDC on Polygon
- Your wallet's private key
- An Anthropic API key
Setup
1. Install dependencies
curl -LsSf https://astral.sh/uv/install.sh | sh
cd /path/to/Polymarket
uv sync
2. Configure secrets
cp .env.example .env
# Edit .env with your POLYMARKET_PRIVATE_KEY, POLYMARKET_WALLET_ADDRESS, and ANTHROPIC_API_KEY
3. Generate CLOB API credentials (one-time)
uv run python scripts/setup_credentials.py
# Copy the printed API_KEY, API_SECRET, API_PASSPHRASE into .env
4. Configure risk limits
Edit config.yaml to set position sizes, loss limits, and approval mode.
5. Connect to Claude Desktop
Add to ~/Library/Application Support/Claude/claude_desktop_config.json:
{
"mcpServers": {
"polymarket-trader": {
"command": "uv",
"args": [
"--directory",
"/Users/parthgosalia/Desktop/Polymarket",
"run",
"python",
"-m",
"polymarket_trader.mcp.server"
]
}
}
}
Restart Claude Desktop. The trading tools will appear automatically.
Usage
Search markets
"Search for markets about the 2026 US midterm elections"
Thesis-driven trading
"Analyze my thesis: AI regulation will pass in the EU before end of 2026"
Check portfolio
"Show me my current positions and P&L"
Autonomous loop
"Start monitoring markets for my thesis that crypto will have a major regulatory event in 2026"
Toggle autonomous mode
"Set approval mode to autonomous" (trades within your risk limits without asking)
Risk Limits (config.yaml)
| Setting | Default | Description |
|---|---|---|
approval_mode |
confirm |
confirm = approve each trade; autonomous = auto-execute |
max_position_size_usdc |
100 | Max size per single position |
max_total_exposure_usdc |
500 | Max total open exposure across all positions |
daily_loss_limit_usdc |
50 | Halt trading if daily losses exceed this |
min_edge_threshold |
0.03 | Min probability edge (3%) required to trade |
max_kelly_fraction |
0.25 | Cap Kelly sizing at 25% of theoretical |
HFT Extension
To plug in a custom pricing engine (e.g., ML-based or poker-inspired HFT):
- Subclass
PricingEnginefromsrc/polymarket_trader/pricing/base.py - Implement
compute_signal()andcalibrate() - Register the engine name in
config.yamlunderapi.pricing_engine
See src/polymarket_trader/pricing/base.py for the full interface.
Architecture
MCP Server (Claude ↔ Tools)
↓
TradeExecutor (orchestration)
├── CLOBConnector ← py-clob-client (orders, orderbook, auth)
├── GammaConnector ← market search
├── DataConnector ← positions, P&L
├── ClaudeAnalyst ← thesis scoring, probability estimation
├── PricingEngine ← Kelly/HFT signal generation
└── RiskManager ← limits, approval gates
Running Tests
uv run pytest
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。