Welcome! This guide will help you set up your copy trading bot in 10 minutes or less.
Automatically copies trades from successful Polymarket traders to your wallet. Think of it as "follow the experts" for prediction markets.
When a trader you're following makes a bet, the bot:
- Detects it within 1 second
- Calculates your proportional position size
- Places the same bet for you automatically
- Tracks your performance
Before starting, make sure you have:
- Computer with Node.js v18+ (Download here)
- Polygon wallet (MetaMask or any Web3 wallet)
- USDC on Polygon network (your trading capital)
- POL (MATIC) (~$5-10 for gas fees)
- MongoDB database (free tier available)
- RPC endpoint (free from Infura/Alchemy)
Don't have these yet? No worries! See Detailed Setup below.
# Clone the repository
git clone <repository-url>
cd polymarket-copytrading-bot
# Install dependencies
npm install# Copy the example config
cp .env.example .envThe wizard will ask you simple questions and create your configuration file automatically.
# Build the bot
npm run build
# Run health check to verify everything works
npm run health-check# Start the bot
npm startThat's it! Your bot is now running and will copy trades automatically.
If you don't have one:
- Install MetaMask
- Create a new wallet
- Important: Create a DEDICATED wallet just for the bot (don't use your main wallet!)
- Save your:
- Wallet address (starts with 0x...)
- Private key (Settings → Security & Privacy → Show Private Key)
You need two things in your Polygon wallet:
Option 1: Bridge from Ethereum
- Visit Polygon Bridge
- Connect wallet and bridge USDC to Polygon
- Takes ~10 minutes
Option 2: Buy on Exchange
- Buy USDC on Coinbase, Binance, Kraken, etc.
- Withdraw to your wallet on Polygon network
- Make sure to select "Polygon" not "Ethereum"!
- Get $5-10 worth from any exchange
- Withdraw to your wallet on Polygon network
- This pays for transaction fees
- Visit MongoDB Atlas
- Sign up for free account
- Click "Build a Database" → Choose FREE tier
- Select a region close to you
- Click "Create Cluster" (takes ~5 minutes)
Configure Access:
-
Click "Database Access" → Add New User
- Username:
botuser(or anything you want) - Password: Generate a strong password
- User Privileges: "Read and write to any database"
- Click "Add User"
- Username:
-
Click "Network Access" → Add IP Address
- Click "Allow Access from Anywhere"
- IP:
0.0.0.0/0 - Click "Confirm"
Get Connection String:
- Click "Database" → "Connect"
- Choose "Connect your application"
- Copy the connection string
- Replace
<password>with your actual password - Replace
myFirstDatabasewithpolymarket
Example: mongodb+srv://myusername676:[email protected]/?appName=Cluster0
Option A: Infura (Recommended)
- Visit Infura.io
- Sign up for free account
- Create new project
- Select "Polygon PoS"
- Copy the HTTPS endpoint
Example: https://polygon-mainnet.infura.io/v3/d11c16c6dd2c45a786ecd9f8877daec4
Option B: Alchemy
- Visit Alchemy.com
- Sign up and create app
- Select "Polygon" network
- Copy the HTTPS URL
Visit the Polymarket Leaderboard and look for traders with:
✅ Good characteristics:
- Positive total profit (green numbers)
- Win rate above 55%
- Active trading (traded in last 7 days)
- Consistent history (not just one lucky bet)
❌ Red flags to avoid:
- Single big win with no other trades
- Win rate below 50%
- Inactive for weeks
- Massive position sizes you can't afford to copy
How to get their address:
- Click on a trader's profile
- Copy their wallet address from the URL
- Example:
https://polymarket.com/profile/0x7c3db723f1d4d8cb9c550095203b686cb11e5c6b - The address is:
0x7c3db723f1d4d8cb9c550095203b686cb11e5c6b
Pro tip: Use Predictfolio to analyze traders in detail!
# How much to trade
COPY_STRATEGY='PERCENTAGE' # Copy as % of trader's position
COPY_SIZE='10.0' # Copy 10% of their position size
TRADE_MULTIPLIER='1.0' # 1.0 = normal, 2.0 = 2x aggressive
# Risk limits
MAX_ORDER_SIZE_USD='100.0' # Never trade more than $100 per order
MIN_ORDER_SIZE_USD='1.0' # Polymarket minimum# Trade aggregation (combine small trades)
TRADE_AGGREGATION_ENABLED='true'
TRADE_AGGREGATION_WINDOW_SECONDS='300'
# Bot behavior
FETCH_INTERVAL='1' # Check for trades every 1 second
RETRY_LIMIT='3' # Retry failed orders 3 timesBefore starting the bot, run the health check:
npm run health-checkExpected output if everything is good:
🏥 HEALTH CHECK
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
Overall Status: ✅ Healthy
Database: ✅ Connected
RPC: ✅ RPC endpoint responding
Balance: ✅ Balance: $100.00
Polymarket API: ✅ API responding
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
🎉 All Systems Operational!
You're ready to start trading:
npm start
If you see errors, the health check will tell you exactly what's wrong and how to fix it!
Once health check passes:
npm startWhat you'll see:
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
🤖 POLYMARKET COPY TRADING BOT
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
📊 Tracking 1 trader(s):
1. 0x7c3d...6b
💼 Your Wallet:
0x4fbb...1DE8C
✓ MongoDB connected
✓ CLOB client ready
──────────────────────────────────────────────────────────────
⏳ Waiting for trades from 1 trader(s)...
The bot is now running! It will automatically execute trades when your tracked traders make moves.
-
Start Small
- Begin with $500-1000 to test
- Verify the bot works correctly
- Scale up gradually
-
Diversify
- Copy 3-5 different traders
- Don't put all eggs in one basket
- Mix different trading styles
-
Monitor Daily
- Check bot logs at least once per day
- Verify trades are executing correctly
- Watch for errors or issues
-
Understand the Risks
- You can lose ALL your trading capital
- Past performance ≠ future results
- No built-in stop-loss
- Only invest what you can afford to lose
Press Ctrl+C to stop the bot immediately. It will gracefully shut down and close all connections.
# Setup and configuration
npm run setup # Interactive setup wizard
npm run health-check # Verify everything works
# Running the bot
npm run build # Compile TypeScript
npm start # Start the bot
npm run dev # Run in development mode
# Monitoring and stats
npm run check-proxy # Check your wallet balance
npm run check-stats # View your trading statistics
npm run check-activity # See recent trading activity
# Utilities
npm run find-traders # Find profitable traders to copy
npm run simulate # Backtest strategiesError: "USER_ADDRESSES is not defined"
- Run
npm run setupto create your .env file - Or manually create .env with all required variables
Error: "MongoDB connection failed"
- Check MONGO_URI is correct
- Verify IP whitelist in MongoDB Atlas
- Test connection in MongoDB Compass
- Check traders are active (visit their Polymarket profile)
- Verify USER_ADDRESSES are correct
- Look for errors in bot logs
"Insufficient balance"
- Add USDC to your wallet
- Get POL for gas fees
"Price slippage too high"
- Market moved too fast
- Increase FETCH_INTERVAL from 1 to 2-3 seconds
Once your bot is running successfully:
- Monitor continuously
- Verify each trade execution
- Check position sizing is correct
- Ensure no errors in logs
- Review profitability daily
- Compare your P&L to trader's P&L
- Adjust TRADE_MULTIPLIER if needed
- Add/remove traders based on performance
- Check logs daily
- Research new traders to copy
- Optimize your strategy
- Join community discussions
- README.md - Complete documentation
- Quick Start Guide - Alternative setup instructions
- Multi-Trader Guide - Advanced multi-trader strategies
- Simulation Guide - Backtest before going live
Have questions?
- Check this guide thoroughly
- Read the README.md
- Run
npm run health-checkto diagnose issues - Open a GitHub issue with details (remove private keys!)
# 1. Setup (one-time)
npm install
# 2. Test
npm run build
npm run health-check
# 3. Go live!
npm startHappy trading! 🚀
Disclaimer: This software is for educational purposes. Trading involves risk of loss. The developers are not responsible for any financial losses. Only invest what you can afford to lose.