Enterprise-grade automated copy trading bot for Polymarket prediction markets
Features β’ Quick Start β’ Documentation β’ FAQ β’ Support
For questions, issues, or feature requests:
- Telegram: @opensea712
- Twitter: @shinytechapes
- GitHub Issues: Open an issue
- Overview
- How It Works
- Features
- Quick Start
- Configuration
- Docker Deployment
- Documentation
- Security
- Contributing
- Frequently Asked Questions
- Advanced Version
- TypeScript Trading Bot Implementation
- High-Performance Rust Trading Bot
- Python Trading Bot Implementation
- License
- Acknowledgments
- Support
The Polymarket Copy Trading Bot is a production-ready, open-source automated trading solution for Polymarket prediction markets. This enterprise-grade bot automatically replicates trades from successful Polymarket traders directly to your wallet, enabling you to mirror top performers without manual intervention.
Copy trading on Polymarket allows you to automatically mirror the trades of successful traders. When a trader you're following makes a trade, this bot instantly replicates it in your wallet with proportional position sizing based on your capital. This is the most effective way to leverage the expertise of top Polymarket traders while maintaining full control over your funds.
- π€ Automated Trade Replication: Seamlessly mirrors trades from selected top-performing traders
- π Intelligent Position Sizing: Dynamically calculates trade sizes based on capital ratios
- β‘ Real-Time Execution: Monitors and executes trades with sub-second latency
- π Comprehensive Tracking: Maintains complete trade history and performance analytics
- π Security First: Open-source codebase with local key storage and full transparency
-
Trader Selection
- Identify top performers from the Polymarket Leaderboard
- Validate trader statistics using Predictfolio
- Configure trader addresses in the system
-
Continuous Monitoring
- Bot monitors trader activity using the Polymarket Data API
- Detects new positions and trade executions in real-time
- Polls at configurable intervals (default: 1 second)
-
Intelligent Calculation
- Analyzes trader's order size and portfolio value
- Calculates proportional position size based on your capital
- Applies configured multipliers and risk management rules
-
Order Execution
- Places matching orders on Polymarket using your wallet
- Implements price protection and slippage checks
- Handles order aggregation for optimal execution
-
Performance Tracking
- Maintains comprehensive trade history in MongoDB
- Tracks positions, P&L, and performance metrics
- Provides detailed analytics and reporting
| Feature | Description |
|---|---|
| Multi-Trader Support | Track and copy trades from multiple Polymarket traders simultaneously with independent configuration for each trader |
| Smart Position Sizing | Automatically adjusts trade sizes based on your capital relative to trader's capital, ensuring proportional risk management |
| Tiered Multipliers | Apply different multipliers based on trade size ranges for sophisticated risk management and capital allocation |
| Position Tracking | Accurately tracks purchases and sells even after balance changes with complete historical context |
| Trade Aggregation | Combines multiple small trades into larger executable orders to optimize execution and reduce gas costs |
| Real-Time Execution | Monitors Polymarket trades every second and executes instantly with minimal latency for optimal entry prices |
| MongoDB Integration | Persistent storage of all trades, positions, and historical data for comprehensive analytics |
| Price Protection | Built-in slippage checks and price validation to avoid unfavorable fills and protect your capital |
| 24/7 Monitoring | Continuous automated monitoring of selected traders without manual intervention |
| Open Source | Free and open-source codebase allowing full transparency and customization |
- Monitoring Method: Polymarket Data API with configurable polling intervals for real-time trade detection
- Default Polling Interval: 1 second (configurable via
FETCH_INTERVAL) for optimal balance between speed and API usage - Database: MongoDB for persistent storage and analytics of all trading activity
- Network: Polygon blockchain for low-cost transactions and efficient gas usage
- Architecture: Modular design with comprehensive error handling and logging
- Deployment: Supports Docker deployment for easy setup and production use
This project provides three independent, production-ready implementations to suit different needs:
- TypeScript: Production-ready implementation with full feature set, comprehensive documentation, and Docker support
- Rust: High-performance implementation with zero-cost abstractions and memory safety
- Python: Production-ready implementation optimized for Python ecosystem integration and data science workflows
Before you begin, ensure you have the following:
- Node.js v18.0.0 or higher
- MongoDB Database (MongoDB Atlas free tier recommended)
- Polygon Wallet with USDC and POL/MATIC for gas fees
- RPC Endpoint (Infura or Alchemy free tier)
# 1. Clone the repository
git clone https://github.com/earthskyorg/polymarket-copy-trading-bot.git
cd polymarket-copy-trading-bot/TypeScript
# 2. Install dependencies
npm install
# 3. Run interactive setup wizard
npm run setup
# 4. Build the project
npm run build
# 5. Verify configuration
npm run health-check
# 6. Start the bot
npm startπ Detailed Setup: For comprehensive setup instructions, see the Getting Started Guide
The following environment variables are required for the bot to function:
| Variable | Description | Example |
|---|---|---|
USER_ADDRESSES |
Comma-separated list of trader addresses to copy | '0xABC..., 0xDEF...' |
PROXY_WALLET |
Your Polygon wallet address | '0x123...' |
PRIVATE_KEY |
Wallet private key (without 0x prefix) | 'abc123...' |
MONGO_URI |
MongoDB connection string | 'mongodb+srv://...' |
RPC_URL |
Polygon RPC endpoint URL | 'https://polygon...' |
TRADE_MULTIPLIER |
Position size multiplier (default: 1.0) | 2.0 |
FETCH_INTERVAL |
Monitoring interval in seconds (default: 1) | 1 |
To identify traders worth copying, follow these steps:
- Visit the Leaderboard: Navigate to Polymarket Leaderboard
- Evaluate Performance: Look for traders with:
- Positive P&L over extended periods
- Win rate above 55%
- Active and consistent trading history
- Verify Statistics: Cross-reference detailed stats on Predictfolio
- Configure: Add verified wallet addresses to
USER_ADDRESSESin your configuration
π Complete Configuration Guide: See Quick Start Documentation for detailed configuration options
polymarket-copy-trading-bot/
βββ TypeScript/ # TypeScript implementation
β βββ src/
β β βββ config/ # Configuration management
β β βββ services/ # Core business logic
β β β βββ tradeMonitor.ts # Monitors trader activity
β β β βββ tradeExecutor.ts # Executes trades
β β βββ utils/ # Utility functions
β β βββ models/ # Database models
β β βββ interfaces/ # TypeScript interfaces
β β βββ scripts/ # Utility scripts
β βββ docs/ # Documentation
β βββ package.json
βββ Rust/ # Rust implementation (high-performance)
β βββ src/
β β βββ config/ # Configuration management
β β βββ services/ # Core business logic
β β β βββ trade_monitor.rs # Monitors trader activity
β β β βββ trade_executor.rs # Executes trades
β β βββ utils/ # Utility functions
β β βββ models/ # Database models
β β βββ interfaces/ # Type definitions
β β βββ main.rs # Entry point
β βββ Cargo.toml # Rust project configuration
βββ Python/ # Python implementation
β βββ src/
β β βββ config/ # Configuration management
β β βββ services/ # Core business logic
β β β βββ trade_monitor.py # Monitors trader activity
β β β βββ trade_executor.py # Executes trades
β β βββ utils/ # Utility functions
β β βββ models/ # Database models
β β βββ interfaces/ # Type definitions
β βββ requirements.txt # Python dependencies
βββ README.md
- Modular Architecture: Clear separation of concerns with dedicated modules
- Type Safety: Full TypeScript coverage with strict type checking
- Error Handling: Comprehensive error handling with graceful degradation
- Logging: Structured logging with file and console output
- Configuration: Environment-based configuration with validation
- Testing: Unit tests for critical components
- Trade Monitor: Continuously monitors selected traders for new trades
- Trade Executor: Executes trades based on configured strategy
- Position Calculator: Calculates optimal position sizes
- Risk Manager: Enforces risk limits and position sizing rules
- Database Layer: MongoDB integration for trade history and analytics
Deploy the bot using Docker Compose for a production-ready, containerized setup:
# 1. Navigate to TypeScript directory
cd TypeScript
# 2. Configure environment variables
cp .env.example .env
# Edit .env with your configuration
# 3. Start services
docker-compose up -d
# 4. View logs
docker-compose logs -f bot- Isolated Environment: Runs in a containerized environment
- Automatic Restart: Configured for automatic restart on failure
- MongoDB Integration: Includes MongoDB service in the stack
- Health Checks: Built-in health monitoring
π Docker Documentation: For complete Docker setup and configuration, see Docker Deployment Guide
- π Getting Started Guide - Comprehensive beginner's guide with step-by-step instructions
- β‘ Quick Start Guide - Fast setup guide for experienced users
- Docker Guide - Complete Docker deployment documentation
- Multi-Trader Guide - Managing multiple traders
- Tiered Multipliers - Advanced position sizing configuration
- Position Tracking - Understanding position management
- Simulation Guide - Backtesting strategies
- Private Key Storage: Private keys are stored locally in
.envfile and never transmitted - Open Source: Full code transparency allows security audits
- No External Services: All operations use official Polymarket APIs
- Read-Only by Default: Bot only executes trades you explicitly configure
- Environment Variables: Never commit
.envfile to version control - Private Keys: Use a dedicated trading wallet, not your main wallet
- Access Control: Restrict file permissions on
.envfile - Monitoring: Regularly review trade history and positions
- Updates: Keep dependencies up to date
We welcome contributions! Please see our Contributing Guide for details.
# Clone the repository
git clone https://github.com/earthskyorg/polymarket-copy-trading-bot.git
cd polymarket-copy-trading-bot/TypeScript
# Install dependencies
npm install
# Run tests
npm test
# Run linter
npm run lint
# Format code
npm run format- Follow TypeScript best practices
- Use ESLint and Prettier for code formatting
- Write tests for new features
- Update documentation for API changes
A Polymarket copy trading bot is an automated software that monitors successful traders on Polymarket and automatically replicates their trades in your wallet. This bot provides 24/7 monitoring, intelligent position sizing, and real-time execution to mirror top-performing traders.
The bot continuously monitors selected traders using the Polymarket Data API. When a trader makes a trade, the bot calculates the proportional position size based on your capital, applies configured multipliers, and executes the trade on your behalf with minimal latency.
Yes! This is a completely free and open-source Polymarket copy trading bot. The code is available on GitHub under the ISC license, allowing you to use, modify, and distribute it freely.
You need:
- Node.js v18.0.0 or higher
- MongoDB database (free tier available on MongoDB Atlas)
- Polygon wallet with USDC and POL/MATIC for gas fees
- RPC endpoint (free tier available on Infura or Alchemy)
- Visit the Polymarket Leaderboard
- Look for traders with positive P&L over extended periods
- Verify statistics on Predictfolio
- Add their wallet addresses to your bot configuration
Yes! The bot supports multi-trader functionality, allowing you to copy trades from multiple traders simultaneously with independent configuration for each trader.
The bot is open-source, allowing you to review all code. Your private keys are stored locally and never transmitted. The bot only executes trades you've configured, and you maintain full control over your funds at all times.
This automated bot provides:
- 24/7 monitoring without manual oversight
- Instant trade replication (sub-second latency)
- Intelligent position sizing based on capital ratios
- Comprehensive trade history and analytics
- Ability to copy multiple traders simultaneously
The bot itself is free. You only pay for:
- Polygon network gas fees (typically very low)
- Optional MongoDB Atlas hosting (free tier available)
- Optional RPC endpoint (free tier available)
Yes! The bot supports:
- Custom position multipliers
- Tiered multipliers based on trade size
- Configurable polling intervals
- Multiple trader configurations
- Risk management rules
An advanced version with Real-Time Data Stream (RTDS) monitoring is available as a private repository.
- Fastest Trade Detection: Near-instantaneous trade replication
- Reduced Latency: Optimized for minimal execution delay
- Lower API Load: More efficient data streaming architecture
- Superior Performance: Enhanced copy trading capabilities
The TypeScript implementation is a production-ready, enterprise-grade trading bot for Polymarket. It features comprehensive documentation, full Docker support, extensive testing, and a rich ecosystem of utility scripts for advanced trading operations.
The TypeScript implementation offers unique advantages for JavaScript/TypeScript developers:
- π Comprehensive Documentation: Extensive guides, tutorials, and examples
- π³ Docker Support: Full containerization with docker-compose for easy deployment
- β Production Tested: Battle-tested in production environments
- π Active Development: Continuously maintained with latest features and improvements
- π οΈ Rich Tooling: Extensive utility scripts for monitoring, analysis, and management
- π Advanced Features: Simulation tools, position tracking, and comprehensive analytics
- π§ Easy Setup: Interactive setup wizard and health check utilities
- π Node.js Ecosystem: Seamless integration with the vast Node.js and npm ecosystem
- Complete Feature Set: All core and advanced features including multi-trader support, tiered multipliers, and trade aggregation
- Production Ready: Comprehensive error handling, retry logic, and graceful degradation
- Docker Deployment: Full containerization support with docker-compose for production use
- Utility Scripts: Extensive collection of scripts for trader analysis, position management, and performance tracking
- Simulation Tools: Built-in backtesting and simulation capabilities for strategy validation
- Comprehensive Logging: Structured logging with file and console output for monitoring and debugging
- Runtime: Node.js v18.0+ with TypeScript 5.7
- Blockchain:
ethers.jsfor Ethereum/Polygon interactions - Database:
mongoosefor MongoDB integration with schema validation - CLOB Client: Official
@polymarket/clob-clientpackage - HTTP: Native
fetchandaxiosfor API interactions - Configuration:
dotenvfor environment management - Testing: Jest for unit and integration testing
# Navigate to TypeScript directory
cd TypeScript
# Install dependencies
npm install
# Run interactive setup wizard
npm run setup
# Build the project
npm run build
# Verify configuration
npm run health-check
# Start the bot
npm start# Configure environment
cp .env.example .env
# Edit .env with your configuration
# Start with Docker Compose
docker-compose up -d
# View logs
docker-compose logs -f botnpm start- Start the trading botnpm run build- Build TypeScript to JavaScriptnpm run setup- Interactive configuration wizardnpm run health-check- Verify configuration and connectionsnpm test- Run test suitenpm run lint- Lint codenpm run format- Format code with Prettier
π TypeScript Documentation: For comprehensive guides, see the Getting Started Guide, Quick Start, and Docker Guide
A high-performance trading bot for Polymarket built with Rust is available for advanced users seeking maximum performance, memory safety, and zero-cost abstractions. This production-ready implementation leverages Rust's unique features to deliver exceptional performance and reliability for enterprise-grade trading operations.
The Rust implementation offers significant advantages for production trading systems:
- π Maximum Performance: Zero-cost abstractions with no runtime overhead, enabling sub-millisecond trade execution
- π‘οΈ Memory Safety: Compile-time guarantees prevent memory leaks, buffer overflows, and data races without garbage collection pauses
- β‘ Concurrent Execution: Excellent async/await support with
tokioruntime for highly concurrent trade monitoring and execution - π Type Safety: Rust's powerful type system catches errors at compile-time, reducing runtime failures
- π¦ Resource Efficiency: Minimal memory footprint and CPU usage, ideal for long-running trading bots
- π§ Production Ready: Comprehensive error handling with
anyhowandthiserrorfor robust error management
- Complete Feature Set: Full implementation including trade monitoring, execution, copy strategies, and position tracking
- High-Performance Architecture: Built on
tokioasync runtime for maximum concurrency and throughput - Memory Safety: Rust's ownership system ensures memory safety without runtime overhead
- Robust Error Handling: Comprehensive error types with
Result<T, E>pattern and graceful error recovery - Type-Safe Design: Strong type system with compile-time checks for all critical operations
- Production Logging: Structured logging with
env_loggerfor comprehensive monitoring and debugging
- Async Runtime:
tokio(full features) for high-performance async I/O - Blockchain:
ethers-rsandweb3crates for Ethereum/Polygon interactions - Database:
mongodbcrate (v3.5) for MongoDB integration with async support - HTTP Client:
reqwestwith JSON support for API interactions - Serialization:
serdeandserde_jsonfor efficient data serialization - Error Handling:
anyhowfor error context andthiserrorfor custom error types - Utilities:
chronofor date/time,rust_decimalfor precise decimal calculations
# Navigate to Rust directory
cd Rust
# Install Rust (if not already installed)
# Windows: .\install_rust.ps1
# Linux/Mac: curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
# Build the project (release mode for optimal performance)
cargo build --release
# Configure environment
# Create .env file with your configuration (see Rust/README.md)
# Run the bot
cargo run --release
# Or use helper scripts:
# Windows: .\run.bat
# Linux/Mac: ./run.sh- Latency: Sub-millisecond trade detection and execution
- Throughput: Handles thousands of concurrent operations with minimal resource usage
- Memory: Low memory footprint with predictable allocation patterns
- CPU: Efficient CPU utilization with zero-cost abstractions
- Startup: Fast initialization with compile-time optimizations
β Completed:
- Project structure and Cargo configuration
- Configuration system with environment variable loading
- Database models and MongoDB connection
- Logger utility with structured logging
- Trade monitoring service with async polling
- Trade executor service with concurrent execution
- Copy strategy calculations (PERCENTAGE, FIXED, ADAPTIVE)
- Health checks and comprehensive error handling
- Graceful shutdown with signal handling
π Rust Documentation: For detailed setup, building, and usage instructions, see the Rust README
A Python implementation of the Polymarket Copy Trading Bot is a production-ready, enterprise-grade solution for developers and organizations working in the Python ecosystem. This independent implementation is designed from the ground up to leverage Python's strengths for trading automation, data analysis, and system integration.
The Python implementation offers unique advantages for developers and organizations:
- π Python Ecosystem: Seamless integration with Python data science, machine learning, and analytics tools
- π Rich Libraries: Access to extensive Python ecosystem for custom analytics, reporting, and integrations
- π§ Easy Customization: Python's simplicity makes it easy to modify and extend functionality
- π Data Analysis: Perfect for teams that need to integrate trading with data analysis pipelines
- π€ Team Familiarity: Leverage existing Python expertise in your organization
- π Rapid Development: Fast iteration and prototyping capabilities
- Complete Feature Set: Full implementation including trade monitoring, execution, copy strategies, and position tracking
- Modern Async Architecture: Built with Python 3.9+ using native
asynciofor efficient concurrent operations - Type Safety: Comprehensive type hints throughout the codebase for better IDE support and maintainability
- Advanced Trading Logic: Sophisticated trade detection algorithms, intelligent order size calculations, and comprehensive position management
- Rich Logging: Colorized console output using
coloramaand structured logging withrichfor enhanced visibility - Production Ready: Comprehensive error handling, health checks, and graceful shutdown mechanisms
- Async Runtime: Python's native
asynciofor concurrent operations and non-blocking I/O - Blockchain:
web3.py(v6.15+) for Ethereum/Polygon blockchain interactions - Database:
pymongo(v4.6+) for MongoDB integration with async support - HTTP Clients:
httpx(v0.27+) for async HTTP requests andrequestsfor synchronous operations - Configuration:
python-dotenvfor environment variable management - Logging:
coloramafor cross-platform colored terminal output andrichfor enhanced formatting - Utilities:
python-dateutilfor date/time handling andtyping-extensionsfor advanced type hints
# Navigate to Python directory
cd Python
# Install dependencies
pip install -r requirements.txt
# Or using pip with specific Python version:
# python -m pip install -r requirements.txt
# Configure environment
cp .env.example .env
# Edit .env with your configuration
# Verify installation
python -m src.main --help # If help is implemented
# Run the bot
python -m src.main# Install in development mode (if using pyproject.toml)
pip install -e .
# Run with verbose logging
PYTHONPATH=. python -m src.main
# Run health check (if implemented)
python -m src.utils.health_checkβ Completed:
- Configuration system with environment variable loading
- Database models and MongoDB connection with async support
- Trade monitoring service with async polling
- Trade executor service with concurrent execution
- Copy strategy calculations (PERCENTAGE, FIXED, ADAPTIVE)
- Tiered multipliers and trade aggregation
- Health checks and comprehensive error handling
- Structured logging with colored output
- Graceful shutdown handling
- Integration: Easy integration with Jupyter notebooks for analysis and backtesting
- Scripting: Simple to create custom scripts for trader analysis, performance metrics, and reporting
- ML Integration: Seamless integration with scikit-learn, pandas, and other data science libraries
- API Development: Straightforward to build REST APIs or web interfaces using Flask/FastAPI
π Python Documentation: For detailed setup, configuration, and usage instructions, see the Python README and Quick Start Guide
This project is licensed under the ISC License. See the LICENSE file for details.
This project is built using the following technologies and services:
- Polymarket CLOB Client - Official Polymarket trading client library
- Predictfolio - Trader analytics and performance metrics
- Polygon Network - Low-cost blockchain infrastructure for efficient trading
If you're looking for a Polymarket copy trading bot, automated trading bot for Polymarket, Polymarket trading automation, copy trading strategy, or Polymarket bot tutorial, you've found the right solution. This is the best free open-source Polymarket trading bot available.
Built with β€οΈ for the Polymarket community


