Get your Polymarket copy trading bot running in 5 minutes. This guide walks you through the essential setup steps to start copying trades from top performers.
Before starting, ensure you have:
- ✅ Node.js v18+ - Download here
- ✅ MongoDB Database - Free tier on MongoDB Atlas
- ✅ Polygon Wallet - MetaMask or any Web3 wallet
- ✅ USDC on Polygon - For executing trades
- ✅ MATIC - Small amount for gas fees (~$5-10 worth)
Don't have USDC? Bridge from Ethereum using Polygon Bridge or buy directly on an exchange that supports Polygon withdrawals.
# Clone the repository
git clone <repository-url>
cd polymarket-copy-trading-bot-v1
# Install packages
npm install# Copy the example config
cp .env.example .envEdit .env with your settings:
# Traders to copy (find addresses on Polymarket leaderboard)
USER_ADDRESSES = '0x7c3db723f1d4d8cb9c550095203b686cb11e5c6b'
# Your trading wallet (the wallet that will execute trades)
PROXY_WALLET = 'your_polygon_wallet_address'
PRIVATE_KEY = 'your_private_key_without_0x_prefix'
# MongoDB (get free database at mongodb.com/cloud/atlas)
MONGO_URI = 'mongodb+srv://username:password@cluster.mongodb.net/database'
# Polygon RPC (get free key at infura.io or alchemy.com)
RPC_URL = 'https://polygon-mainnet.infura.io/v3/YOUR_PROJECT_ID'
# Don't change these
CLOB_HTTP_URL = 'https://clob.polymarket.com/'
CLOB_WS_URL = 'wss://ws-subscriptions-clob.polymarket.com/ws'
USDC_CONTRACT_ADDRESS = '0x2791Bca1f2de4661ED88A30C99A7a9449Aa84174'# Compile TypeScript
npm run build
# Start the bot
npm startWhen the bot starts successfully, you should see:
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
🤖 POLYMARKET COPY TRADING BOT
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
📊 Tracking 1 trader(s):
1. 0x7c3db723f1d4d8cb9c550095203b686cb11e5c6b
💼 Your Wallet:
0x4fbBe5599c06e846D2742014c9eB04A8a3d1DE8C
✓ MongoDB connected
ℹ Initializing CLOB client...
✓ CLOB client ready
──────────────────────────────────────────────────────────────────────
[2:35:54 PM] ⏳ Waiting for trades from 1 trader(s)...
The sandglass icon (⏳⌛) will animate while waiting for trades.
- Visit Polymarket Leaderboard
- Sort by "Profit" or "Volume"
- Click on a trader to view their profile
- Copy their wallet address from the URL
- Add to
USER_ADDRESSESin.env
- Visit Predictfolio
- Browse top performers
- Check detailed stats (win rate, P&L, trade history)
- Copy wallet address
- Add to
USER_ADDRESSES
✅ Good Trader Characteristics:
- Positive total P&L (green numbers)
- Win rate above 55%
- Consistent trading activity (not just one lucky bet)
- Position sizes you can afford to copy proportionally
- Recent activity (traded in last 7 days)
❌ Red Flags:
- One massive winning bet with no other activity
- Win rate below 50%
- Position sizes too large for your capital
- Inactive for weeks/months
When a trader you're following makes a trade, the bot:
Checks every second for new positions
ratio = your_balance / (trader_balance + trade_size)
your_trade_size = trader_trade_size × ratio
Example:
- Trader has $10,000, buys $1,000 worth (10% of capital)
- You have $1,000
- Ratio:
1,000 / (10,000 + 1,000) = 0.091(9.1%) - You buy:
$1,000 × 0.091 = $91(9.1% of your capital)
- Compares current market price to trader's execution price
- Skips trade if difference is > $0.05 (to avoid bad fills)
- Places market order at best available price
- Uses Fill-or-Kill (FOK) order type
- Retries up to 3 times if initial order fails
──────────────────────────────────────────────────────────────────────
📊 NEW TRADE DETECTED
Trader: 0x7c3d...6b
Side: BUY
Amount: $1,000
Price: 0.68
──────────────────────────────────────────────────────────────────────
Balances:
Your balance: $1000.00
Trader balance: $10000.00
ℹ Executing BUY strategy...
ℹ Position ratio: 9.1%
ℹ Best ask: 100 @ $0.685
✓ Order executed: Bought 133 tokens at $0.685
──────────────────────────────────────────────────────────────────────
- Begin with $100-500 to test the bot
- Verify it's copying trades correctly
- Scale up gradually once confident
- Don't use your main wallet
- Create a fresh wallet just for the bot
- Only keep trading capital there
- Check logs at least once per day
- Verify trades are executing as expected
- Watch for any errors or failed orders
- Don't copy just one trader
- Track 3-5 different strategies
- Example:
USER_ADDRESSES = 'trader1, trader2, trader3'
- Bot has no built-in stop-loss
- Can potentially lose all funds if traders lose
- Only invest what you can afford to lose
Error: "USER_ADDRESSES is not defined"
- Check your
.envfile exists - Verify
USER_ADDRESSESis spelled correctly - Ensure no extra spaces around the
=sign
Error: "MongoDB connection failed"
- Verify
MONGO_URIis correct - Check MongoDB Atlas IP whitelist (allow
0.0.0.0/0for testing) - Ensure database user has read/write permissions
-
Verify trader is active
- Check their Polymarket profile
- Confirm they've traded recently
-
Check logs for errors
- Look for API connection issues
- Verify MongoDB is storing data
-
Increase verbosity
- Bot only shows trades when they happen
- Silence is normal when traders aren't trading
"Insufficient balance"
- Ensure
PROXY_WALLEThas USDC - Verify you have MATIC for gas
"Price slippage too high"
- Market moved too fast
- Consider increasing tolerance in code
- Or increase
FETCH_INTERVALto 2-3 seconds
"No bids/asks available"
- Market may have low liquidity
- Try trading more popular markets
- Check Polymarket directly to verify
Bot using too much CPU
- Increase
FETCH_INTERVALfrom 1 to 2-3 seconds - Reduce number of traders tracked
Trades executing too slowly
- Decrease
FETCH_INTERVALto 0.5 seconds (risky) - Use faster RPC endpoint (Alchemy vs Infura)
- Ensure stable internet connection
Once your bot is running successfully:
-
First 24 Hours
- Monitor continuously
- Verify each trade execution
- Check position sizing is correct
-
Week 1
- Review profitability
- Compare your P&L to trader's P&L
- Adjust if trades are too large/small
-
Ongoing
- Check logs daily
- Research new traders to copy
- Consider adding protective features
# Comma-separated
USER_ADDRESSES = 'trader1, trader2, trader3'
# Or JSON array
USER_ADDRESSES = '["trader1", "trader2", "trader3"]'# Check every 2 seconds (less CPU usage)
FETCH_INTERVAL = 2
# Check every 0.5 seconds (faster execution)
FETCH_INTERVAL = 0.5# Retry failed orders up to 5 times
RETRY_LIMIT = 5- Main README - Complete documentation
- Multi-Trader Guide - Advanced multi-trader setup
- Logging Preview - Console output examples
If you encounter issues:
- Check this guide's troubleshooting section
- Review the main README
- Open a GitHub issue with:
- Error message (remove private keys!)
- Steps to reproduce
- Your environment (Node version, OS)
Ready to trade smarter? Start the bot and let it mirror the best! 🚀
Disclaimer: Trading involves risk. Past performance doesn't guarantee future results. Only invest what you can afford to lose.