β οΈ DISCLAIMER: This is a TEST/DEMO PROJECTThis is research and educational software demonstrating autonomous AI trading concepts. NOT suitable for production use or real financial trading. Use for learning and testing only. No warranty provided.
An autonomous trading agent for Polymarket prediction markets, powered by Claude AI and multi-source data analysis.
Status: π MVP Phase (Foundation & Configuration) - Educational/Test Purpose
- β Project structure & configuration management
- β Claude Tool-Use integration (decision engine)
- π Multi-source data collection (Polls, Sports, Crypto, News)
- π Semi-autonomous execution with confidence thresholds
- π Memory system for trade history & performance tracking
- Phase 2: Full data collectors for all market categories
- Phase 3: Real-time Polymarket API integration
- Phase 4: Advanced risk management (Kelly Criterion)
- Phase 5: Backtesting framework
βββββββββββββββββββββββββββββββββββββββββββββββ
β DATA LAYER (Collectors) β
βββββββββββββββββββββββββββββββββββββββββββββββ€
β β’ Polls (FiveThirtyEight) β
β β’ Sports (ESPN) β
β β’ Crypto (Binance, Whale Alert) β
β β’ News (NewsAPI, Twitter/X) β
ββββββββββββββββββββ¬βββββββββββββββββββββββββββ
β
ββββββββββββββββββββΌβββββββββββββββββββββββββββ
β CLAUDE DECISION ENGINE (Tool-Use) β
ββββββββββββββββββββββββββββββββββββββββββββββββ€
β β’ Sentiment Analysis β
β β’ Expected Value Calculation β
β β’ Risk Management β
β β’ Arbitrage Detection β
ββββββββββββββββββββ¬βββββββββββββββββββββββββββ
β
ββββββββββββββββββββΌβββββββββββββββββββββββββββ
β EXECUTION (Semi-Autonomous) β
ββββββββββββββββββββββββββββββββββββββββββββββββ€
β IF confidence > 75% + size < $50: β
β β AUTO-EXECUTE β
β IF 60-75% confidence: β
β β QUEUE FOR APPROVAL β
β ELSE: β
β β HUMAN REVIEW β
ββββββββββββββββββββ¬βββββββββββββββββββββββββββ
β
ββββββββββββββββββββΌβββββββββββββββββββββββββββ
β MEMORY (Tracking & Performance) β
ββββββββββββββββββββββββββββββββββββββββββββββββ€
β β’ Trade History β
β β’ Win Rate by Category β
β β’ Claude Calibration β
β β’ Risk Metrics β
ββββββββββββββββββββββββββββββββββββββββββββββββ
cd PolymarketAgent
python -m venv venv
source venv/bin/activate # Windows: venv\Scripts\activate
pip install -r requirements.txtcp .env.example .env.local
# Edit .env.local with your API keys:
# - ANTHROPIC_API_KEY (Claude)
# - POLYMARKET credentials
# - WALLET address & PRIVATE_KEY
# - Data source APIs (NewsAPI, Twitter, etc.)python -m src.main- Anthropic Claude: https://console.anthropic.com (free tier available)
- Polymarket CLOB: https://clob.polymarket.com (free, only gas)
- News API: https://newsapi.org (free: 100 req/day)
- Twitter/X API v2: $100/month (Essential tier) for tweet analysis
- FiveThirtyEight: Free polls (read-only)
- ESPN API: Free sports data
- Pinnacle: Bookmaker odds API ($200-500/month)
| Category | Strategy | Target ROI | Risk |
|---|---|---|---|
| Politics | Polling + sentiment | +3-5% / week | π’ Low |
| Sports | Historical + injuries | +5-10% / week | π‘ Medium |
| Crypto | Arbitrage + news | +2-4% / week | π΄ High |
| Arbitrage | Cross-market spreads | +1-2% / week | π’ Low |
The agent uses Claude's tool-use capability to:
- Sentiment Analysis - Extract market signals from news/tweets
- Expected Value Calc - Compare market odds vs. model probability
- Risk Calculator - Determine position size (Kelly Criterion)
- Arbitrage Detection - Spot cross-market inefficiencies
Example decision flow:
Market: "Will Bitcoin exceed $50k by April 2026?"
Current odds: 0.38 (38% probability)
Claude thinks: 42% probability (based on data)
Edge: +4.2%
Confidence: 82%
Decision: BUY 0.38 odds (underpriced)
Position Size: $100 (1% of balance)
Key settings in .env.local:
# Risk Parameters
INITIAL_BALANCE=500 # Starting USDC
MAX_POSITION_SIZE=0.02 # 2% per trade
MIN_CONFIDENCE_AUTO=0.75 # Auto-execute threshold
MIN_CONFIDENCE_APPROVAL=0.60 # Needs human review
# Execution Mode
EXECUTION_MODE=APPROVAL # PAPER | APPROVAL | AUTOSee .env.example for all options.
polymarket-agent/
βββ src/
β βββ main.py # Entry point
β βββ config.py # Configuration & constants
β βββ data/
β β βββ collectors/ # Market data sources
β β βββ datastore.py # Data caching
β βββ agents/
β β βββ claude_agent.py # Decision engine (Tool-Use)
β β βββ tools/ # Claude tools
β βββ execution/
β β βββ executor.py # Trade executor
β β βββ polymarket_client.py
β β βββ approval_queue.py
β βββ memory/
β βββ trades_history.py
β βββ performance_tracker.py
βββ tests/
βββ logs/
βββ .env.local # Your secrets (GITIGNORE)
βββ .env.example # Template
βββ requirements.txt
- This is NOT production software. This is a proof-of-concept for educational purposes only.
- Real financial risk: Do not use with real money, real private keys, or production accounts.
- For production deployment, you would need:
- Hardware security module (HSM) for key management
- Professional security audit
- Compliance review (securities regulation)
- Institutional-grade monitoring & alerting
- Insurance & liability coverage
- Never commit
.env.local(private key stored here!) - Use
.env.exampleas template only - Test in
PAPERmode first (simulated trades)
π‘ Best Practices (For Learning):
- Start in
PAPERmode (simulation only) - Graduate to
APPROVAL(human review of each trade) - Only then move to
AUTO(fully automatic) - Never use real credentials or significant amounts while learning
Agent logs all trades to memory/:
trades_history.json- All trades with PnLcategory_performance.json- Win rate by market typeclaude_calibration.json- Confidence accuracy metrics
# View performance
python -c "from src.memory import PerformanceTracker; \
p = PerformanceTracker(); p.print_summary()"pytest tests/ -v
pytest tests/ --cov=src # Coverage reportCurrent contributors: 1 Focus area: Core agent loop & Claude integration
This project is licensed under the MIT License - see LICENSE file for details.
All use is strictly for educational and testing purposes only.
- β Phase 1 (NOW): Configure & validate API connections
- π Phase 2: Build data collectors
- π Phase 3: Claude decision engine
- π Phase 4: Trade execution
- π Phase 5: Memory & performance tracking
Let's get this agent trading! π