A high-performance Rust-based automated trading bot that copies trades from successful Polymarket traders (whales) in real-time.
- Quick Start Guide
- Documentation
- Requirements
- Security Notes
- How It Works
- Features
- Advanced Usage
- Output Files
- Getting Help
- Disclaimer
Windows:
- Download and run the installer from https://rustup.rs/
- Follow the installation wizard
- Restart your terminal/PowerShell
macOS:
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | shLinux:
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | shgit clone https://github.com/terauss/Polymarket-Copy-Trading-Bot.git
git clone
cd Polymarket-Copy-Trading-Bot-
Copy the example environment file:
# Windows (PowerShell) Copy-Item .env.example .env # macOS/Linux cp .env.example .env
-
Open
.envin any text editor (Notepad, VS Code, etc.) -
Fill in the required values (see Configuration Guide for details):
PRIVATE_KEY- Your wallet's private key (keep this SECRET!)FUNDER_ADDRESS- Your wallet address (same wallet as private key)TARGET_WHALE_ADDRESS- The whale address you want to copy (40-char hex, no 0x)ALCHEMY_API_KEY- Get from https://www.alchemy.com/ (or use CHAINSTACK_API_KEY)
-
Optional: Adjust trading settings (see Configuration Guide)
Before running the bot, verify your setup is correct:
cargo run --release --bin validate_setupThis will check if all required settings are correct and provide helpful error messages if something is wrong.
Run in test mode to see what the bot would do without actually trading:
# Set MOCK_TRADING=true in your .env file, then:
cargo run --releaseOnce you're confident everything works:
# Enable trading in .env (ENABLE_TRADING=true, MOCK_TRADING=false)
cargo run --releaseWindows users: You can also double-click run.bat after setting up your .env file.
- 01. Quick Start Guide - 5-minute setup guide
- 02. Complete Setup Guide - Detailed step-by-step instructions
- 03. Configuration Guide - All settings explained
- 04. Features Overview - What the bot does and how it works
- 05. Trading Strategy - Complete strategy logic and decision-making
- 06. Troubleshooting - Common issues and solutions
- A Polymarket Account - Sign up at https://polymarket.com
- A Web3 Wallet - MetaMask recommended (with some USDC/USDC.e on Polygon)
- RPC Provider API Key - Free tier from Alchemy or Chainstack
- The Whale Address - The trader you want to copy (40-character hex address)
- Some Coding Knowledge - Not required, but helpful for troubleshooting
- Sufficient Funds - The bot uses 2% of whale trade size by default (configurable)
- Never share your
PRIVATE_KEYwith anyone - Never commit your
.envfile to git (it's already in.gitignore) - Start with small amounts to test
- Use
MOCK_TRADING=truefirst to verify everything works
- Monitors blockchain events for trades from your target whale (real-time via WebSocket)
- Analyzes each trade (size, price, market conditions) using multi-layer risk checks
- Calculates position size (2% default, with tier-based multipliers) and price (whale price + buffer)
- Executes a scaled copy of the trade with optimized order types (FAK/GTD)
- Retries failed orders with intelligent resubmission logic (up to 4-5 attempts)
- Protects you with risk guards (circuit breakers) and safety features
- Logs everything to CSV files for analysis
Strategy Highlights:
- 2% Position Scaling: Reduces risk while maintaining meaningful positions
- Tiered Execution: Different strategies for large (4000+), medium (2000-3999), and small (<2000) trades
- Multi-Layer Risk Management: 4 layers of safety checks prevent dangerous trades
- Intelligent Pricing: Price buffers optimize fill rates (higher for large trades, none for small)
- Sport-Specific Adjustments: Additional buffers for tennis and soccer markets
See Features Overview for feature details and Strategy Guide for complete trading logic.
- ✅ Real-time trade copying
- ✅ Intelligent position sizing (2% default, configurable)
- ✅ Circuit breakers for risk management
- ✅ Automatic order resubmission on failures
- ✅ Market cache system for fast lookups
- ✅ CSV logging for all trades
- ✅ Live market detection
- ✅ Tiered execution based on trade size
# Standard mode (monitors confirmed blocks)
cargo run --release
# Mempool mode (faster, but less reliable)
cargo run --release --bin mempool_monitor
# Monitor your own fills only (no trading)
cargo run --release --bin trade_monitor
# Validate configuration
cargo run --release --bin validate_setup# Optimized release build
cargo build --release
# The binary will be at: target/release/pm_bot.exe (Windows)
# target/release/pm_bot (macOS/Linux)matches_optimized.csv- All detected and executed trades.clob_creds.json- Auto-generated API credentials (don't modify).clob_market_cache.json- Market data cache (auto-updated)
- Check Troubleshooting Guide
- Run the config validator:
cargo run --release --bin validate_setup - Review your
.envfile against.env.example - Check console output for error messages
- Review Strategy Guide to understand bot logic
This bot is provided as-is. Trading involves financial risk. Use at your own discretion. Test thoroughly before using real funds. The authors are not responsible for any losses.
For questions or issues, contact via Telegram: @terauss