Polymarket Auto-Trader
Autonomous Polymarket prediction market trading agent. Scans markets, evaluates probabilities with LLM, sizes positions with Kelly criterion, and executes trades via CLOB API. Use …
srikanthbellary
@srikanthbellary
Install
$ openclaw skills install @srikanthbellary/polymarket-auto-traderPolymarket Auto-Trader
Fully autonomous prediction market trading agent for Polymarket. Evaluates markets using LLM probability estimation, sizes positions with Kelly criterion, and executes trades via the Polymarket CLOB API from a non-US VPS.
Prerequisites
- Non-US VPS — Polymarket blocks US IPs. Use DigitalOcean Amsterdam, Hetzner EU, etc.
- Polygon wallet with USDC.e (bridged USDC, NOT native USDC)
- MATIC for gas (~0.1 MATIC sufficient for hundreds of trades)
- Anthropic API key (uses Haiku at ~$0.001/evaluation)
Setup
1. VPS Environment
SSH into your non-US VPS and run:
python3 {baseDir}/scripts/setup_vps.sh
Or manually:
apt update && apt install -y python3 python3-venv
python3 -m venv /opt/trader
/opt/trader/bin/pip install py-clob-client python-dotenv web3 requests
2. Configuration
Create /opt/trader/app/.env:
PRIVATE_KEY=<your-polygon-wallet-private-key>
LLM_API_KEY=<your-anthropic-api-key>
3. Blockchain Approvals
Before trading, approve USDC.e and CTF tokens for Polymarket contracts. Run:
python3 {baseDir}/scripts/approve_contracts.py
Required approvals (6 total):
- USDC.e → CTF Exchange, Neg Risk Exchange, Neg Risk Adapter
- CTF → CTF Exchange, Neg Risk Exchange, Neg Risk Adapter
4. Deploy Trading Script
cp {baseDir}/scripts/run_trade.py /opt/trader/app/
cp {baseDir}/scripts/pnl_tracker.py /opt/trader/app/
5. Cron Automation
crontab -e
# Add: */10 * * * * cd /opt/trader/app && /opt/trader/bin/python3 run_trade.py >> cron.log 2>&1
How It Works
- Market Scan — Fetches active markets from Gamma API, filters by liquidity and time horizon
- LLM Evaluation — Asks Claude Haiku to estimate true probability for each market
- Edge Detection — Compares LLM fair value vs market price (min 5% edge threshold)
- Kelly Sizing — Half-Kelly criterion with 25% max position size cap
- Order Execution — Places limit orders via CLOB API with GTC (good-till-cancelled)
- Dedup — Tracks all trades in
trades.jsonl, skips already-traded markets - Budget Control — Tracks LLM inference costs separately from trading capital
Trading Parameters
Configurable in run_trade.py:
EDGE_THRESHOLD— Minimum edge to trade (default: 0.05 = 5%)MIN_SHARES— Minimum order size (Polymarket requires ≥5 shares)- Bankroll allocation: 80% usable, 25% max per trade, 30% cap per single position
- Market horizon: Prioritizes markets ending within 30 days
Monitoring
Check P&L anytime:
python3 /opt/trader/app/pnl_tracker.py
Check recent activity:
tail -50 /opt/trader/app/cron.log
Key Technical Details
- Wallet type: EOA (signature_type=0), NOT proxy wallet
- Token: USDC.e (
0x2791Bca1f2de4661ED88A30C99A7a9449Aa84174), not native USDC - Neg-risk markets (elections, sports leagues) require USDC.e approval for Neg Risk Adapter (
0xd91E80cF2E7be2e162c6513ceD06f1dD0dA35296) - US geoblock — All API calls must originate from non-US IP. VPN insufficient; use actual non-US VPS.
Cost
- LLM inference: ~$0.001 per market evaluation (Haiku)
- Typical cycle (40 evals): ~$0.04
- Gas: negligible on Polygon (~$0.001 per trade)
⚠️ Security Considerations
- Use a DEDICATED wallet with minimal funds. Never use your main wallet's private key. Create a fresh wallet and fund it only with what you're willing to risk.
- PRIVATE_KEY is stored on disk in
.env. Harden your VPS: strict file permissions (chmod 600 .env), no shared access, firewall, SSH keys only. - MAX_UINT approvals are standard in DeFi but grant broad spending rights. The approved contracts are official Polymarket contracts. Review addresses in
references/contract-addresses.mdbefore running. - Test with tiny amounts first ($5-10) before scaling up.
- Monitor actively — check
cron.logand runpnl_tracker.pyregularly. - LLM_API_KEY billing — each cycle costs ~$0.04 (Haiku). Set billing alerts on your Anthropic account.
- This is autonomous trading software. Bugs or market conditions can cause losses. Use at your own risk.
References
- See
references/polymarket-api.mdfor full CLOB API documentation - See
references/contract-addresses.mdfor all Polygon contract addresses
Related skills
Polymarket Arbitrage
@johny0920Monitor and execute arbitrage opportunities on Polymarket prediction markets. Detects math arbitrage (multi-outcome probability mismatches), cross-market arbitrage (same event different prices), and orderbook inefficiencies. Use when user wants to find or trade Polymarket arbitrage, monitor prediction markets for opportunities, or implement automated trading strategies. Includes risk management, P&L tracking, and alerting.
Binance Spot Trader
@srikanthbellaryAutonomous Binance spot trading bot with LLM-powered market analysis. Supports momentum trading, mean reversion, and DCA strategies on any Binance spot pair. Use when user wants to trade on Binance, set up automated crypto trading, build a spot trading bot, or automate DCA buying. Features technical analysis, LLM sentiment evaluation, position sizing, and portfolio tracking.
Hyperliquid Trading & Analysis
@anajuliabitTrade and monitor Hyperliquid perpetual futures. Check balances, view positions with P&L, place/cancel orders, execute market trades. Use when the user asks about Hyperliquid trading, portfolio status, crypto positions, or wants to execute trades on Hyperliquid.
Apex Trading & Analysis
@joshlin111Trade and monitor ApeX perpetual futures. Check balances, view positions with P&L, place/cancel orders, execute market trades, or submit trade reward enrollments. Use when the user asks about ApeX trading, portfolio status, crypto positions, activity enrollments, or wants to execute trades on ApeX.
Polymarket Analysis
@lukebazeAnalyze Polymarket prediction markets for trading edges. Pair Cost arbitrage, whale tracking, sentiment analysis, momentum signals, user profile tracking. No execution.
mt5-httpapi
@psyb0tHTTP client for a user-deployed mt5-httpapi MetaTrader 5 bridge. Use ONLY when the user has explicitly installed and configured mt5-httpapi AND provided MT5_API_URL. Read endpoints (account, symbols, rates, ticks, server-side technical-analysis enrichment via the wickworks sidecar, history, backtest report fetching) are safe to invoke. Trade-mutating endpoints (POST/PUT/DELETE on /orders and /positions, /terminal/restart, /terminal/shutdown) MUST require explicit per-action user confirmation showing symbol, side, volume, and SL/TP — never invoke them on inferred intent. Do not use this skill for generic market-data, charting, or trading questions where the user hasn't named mt5-httpapi.