Enterprise-grade automated copy trading system for Polymarket that mirrors trades from top performers with intelligent position sizing, real-time execution, and comprehensive risk management.
| Platform | Link |
|---|---|
| 📱 Telegram | t.me/novustch |
| wa.me/14105015750 | |
| 💬 Discord | discordapp.com/users/985432160498491473 |
Feel free to reach out for implementation assistance or integration support.
- Overview
- Key Features
- Architecture
- Quick Start
- Configuration
- Deployment
- Documentation
- Safety & Risk Management
- Troubleshooting
- Contributing
- Advanced Version
- Trading Tool
- License
- Acknowledgments
- Support
The Polymarket Copy Trading Bot is a production-ready TypeScript application that automatically replicates trades from successful Polymarket traders to your wallet. Built with enterprise-grade code quality standards, the bot provides:
- Real-time Trade Monitoring: Continuous monitoring of selected traders using Polymarket Data API
- Intelligent Position Sizing: Automatic calculation of proportional trade sizes based on capital ratios
- Advanced Risk Management: Built-in safeguards including slippage protection, position limits, and balance checks
- Persistent Data Storage: Complete trade history and position tracking via MongoDB
- Professional Codebase: Type-safe, well-documented, and maintainable code following industry best practices
- Trader Selection - Identify top performers from Polymarket Leaderboard or Predictfolio
- Continuous Monitoring - Bot polls trader positions at configurable intervals (default: 1 second)
- Position Calculation - Automatically scales trades based on your balance vs. trader's portfolio value
- Order Execution - Places matching orders on Polymarket using your wallet via CLOB API
- Performance Tracking - Maintains comprehensive trade history and position data in MongoDB
- Multi-Trader Support - Simultaneously track and copy trades from multiple traders
- Smart Position Sizing - Automatic trade size calculation with configurable strategies (Percentage, Fixed, Adaptive)
- Tiered Multipliers - Apply different multipliers based on trade size thresholds
- Position Tracking - Accurate tracking of purchases and sells, even after balance changes
- Trade Aggregation - Combines multiple small trades into larger executable orders (optional)
- Real-time Execution - Sub-second trade detection and execution
- Price Protection - Built-in slippage checks to prevent unfavorable fills
- Type-Safe Codebase - Full TypeScript implementation with strict type checking
- Error Handling - Comprehensive error handling with custom error classes
- Database Integration - MongoDB for persistent storage of trades and positions
- Configuration Management - Environment-based configuration with validation
- Logging System - Structured logging with file output and console display
- Health Monitoring - Built-in health check system for configuration validation
The bot currently uses the Polymarket Data API to monitor trader activity and detect new positions. The monitoring system polls trader positions at configurable intervals (default: 1 second) to ensure timely trade detection and execution.
🚀 Roadmap: Future versions will migrate to RTDS (Real-Time Data Stream) for even faster trade detection with lower latency and reduced API load, enabling near-instantaneous trade replication.
┌─────────────────┐
│ Trade Monitor │ → Monitors trader activity via Polymarket API
└────────┬────────┘
│
↓
┌─────────────────┐
│ Trade Executor │ → Executes trades based on copy strategy
└────────┬────────┘
│
↓
┌─────────────────┐
│ CLOB Client │ → Interfaces with Polymarket CLOB API
└─────────────────┘
│
↓
┌─────────────────┐
│ MongoDB │ → Stores trade history and positions
└─────────────────┘
- Runtime: Node.js 18+
- Language: TypeScript 5.7
- Database: MongoDB (Atlas supported)
- Blockchain: Polygon Network
- APIs: Polymarket CLOB Client, Polymarket Data API
- Infrastructure: Docker support for containerized deployment
Before installing, ensure you have:
- Node.js v18.0.0 or higher (Download)
- MongoDB Database - MongoDB Atlas (free tier supported)
- Polygon Wallet - Wallet with USDC balance and POL/MATIC for gas fees
- RPC Endpoint - Polygon RPC endpoint from Infura, Alchemy, or Ankr
# Clone the repository
git clone https://github.com/Novus-Tech-LLC/Polymarket-Copytrading-Bot.git
cd polymarket-copy-trading-bot
# 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- Run Setup Wizard: Execute
npm run setupto interactively configure your.envfile - Verify Configuration: Run
npm run health-checkto validate all settings - Fund Your Wallet: Ensure your Polygon wallet has sufficient USDC and POL/MATIC
- Select Traders: Add trader addresses to
USER_ADDRESSESin your.envfile - Start Monitoring: Run
npm startto begin trading
📖 For detailed setup instructions, see Getting Started Guide
The bot is configured via environment variables. Essential variables include:
| Variable | Description | Example | Required |
|---|---|---|---|
USER_ADDRESSES |
Comma-separated trader addresses to copy | '0xABC...,0xDEF...' |
✅ |
PROXY_WALLET |
Your Polygon wallet address | '0x123...' |
✅ |
PRIVATE_KEY |
Wallet private key (no 0x prefix) | 'abc123...' |
✅ |
MONGO_URI |
MongoDB connection string | 'mongodb+srv://...' |
✅ |
RPC_URL |
Polygon RPC endpoint | 'https://polygon...' |
✅ |
USDC_CONTRACT_ADDRESS |
USDC token contract | '0x2791Bca1f2de4661ED88A30C99A7a9449Aa84174' |
✅ |
CLOB_HTTP_URL |
CLOB HTTP endpoint | 'https://clob.polymarket.com/' |
✅ |
CLOB_WS_URL |
CLOB WebSocket endpoint | 'wss://ws-subscriptions-clob.polymarket.com/ws' |
✅ |
COPY_STRATEGY |
Copy strategy (PERCENTAGE, FIXED, ADAPTIVE) | 'PERCENTAGE' |
❌ |
COPY_SIZE |
Copy size parameter | 10.0 |
❌ |
TRADE_MULTIPLIER |
Position size multiplier | 1.0 |
❌ |
MAX_ORDER_SIZE_USD |
Maximum order size in USD | 100.0 |
❌ |
MIN_ORDER_SIZE_USD |
Minimum order size in USD | 1.0 |
❌ |
FETCH_INTERVAL |
Polling interval in seconds | 1 |
❌ |
TRADE_AGGREGATION_ENABLED |
Enable trade aggregation | false |
❌ |
The bot supports three copy strategies:
- PERCENTAGE - Copy a fixed percentage of trader's order size
- FIXED - Copy a fixed dollar amount per trade
- ADAPTIVE - Dynamically adjust percentage based on trader's order size
See Copy Strategy Documentation for detailed configuration options.
To identify traders worth copying:
- Visit Polymarket Leaderboard
- Look for traders with:
- Positive P&L over extended periods
- Win rate above 55%
- Active trading history
- Consistent performance
- Verify detailed statistics on Predictfolio
- Add wallet addresses to
USER_ADDRESSESin your.envfile
📖 For complete configuration guide, see Quick Start Guide
Deploy with Docker Compose for a production-ready, containerized setup:
# Copy environment template
cp .env.example .env
# Edit .env with your configuration
nano .env
# Start the container
docker-compose up -d
# View logs
docker-compose logs -f polymarket
# Stop the container
docker-compose down📖 Complete Docker Deployment Guide →
For manual deployment on a server:
# Install dependencies
npm install
# Build the project
npm run build
# Start with process manager (PM2 recommended)
pm2 start dist/index.js --name polymarket-bot
# Monitor logs
pm2 logs polymarket-bot- Use a process manager (PM2, systemd, etc.) for automatic restarts
- Set up log rotation for log files
- Monitor system resources and API rate limits
- Configure alerts for critical errors
- Regular database backups
- Keep dependencies updated
- 🚀 Getting Started Guide - Complete beginner's guide with step-by-step instructions
- ⚡ Quick Start - Fast setup guide for experienced users
- 🐳 Docker Deployment - Complete container deployment guide
- 👥 Multi-Trader Guide - Configuring and managing multiple traders
- 📍 Position Tracking - Understanding position tracking mechanics
- 💰 Funding Guide - Wallet funding and token management
- 📊 Tiered Multipliers - Advanced position sizing strategies
- 🧪 Simulation Guide - Backtesting trading strategies
- 🔬 Simulation Runner - Advanced backtesting tools
- 📝 Code Quality Improvements - Technical documentation on code quality standards
This software executes real trades with real money. Use at your own risk.
- No Guarantees - Past performance does not guarantee future results
- Financial Risk - Trading involves risk of financial loss
- No Liability - Developers are not responsible for financial losses
- Educational Purpose - This software is provided for educational purposes
- Start Small - Test with minimal funds before scaling up
- Diversify - Copy multiple traders with different strategies
- Monitor Regularly - Check bot logs and positions daily
- Set Limits - Use position size limits and daily volume caps
- Dedicated Wallet - Use a separate wallet from your main funds
- Emergency Stop - Know how to stop the bot quickly (Ctrl+C or process manager)
- Research Traders - Thoroughly research traders before copying
- Stay Informed - Monitor market conditions and bot performance
- Balance Checks - Automatic balance verification before trades
- Slippage Protection - Price validation to prevent unfavorable fills
- Position Limits - Configurable maximum position sizes
- Daily Volume Caps - Optional daily trading volume limits
- Error Handling - Comprehensive error handling and recovery
- Health Checks - Configuration validation before startup
Missing environment variables
# Run setup wizard
npm run setup
# Or manually create .env file from .env.example
cp .env.example .envInvalid configuration
# Run health check to validate
npm run health-checkMongoDB connection failed
- Verify
MONGO_URIis correct - Whitelist your IP address in MongoDB Atlas
- Check network connectivity
- Verify database credentials
Bot not detecting trades
- Verify trader addresses in
USER_ADDRESSES - Check trader has recent activity
- Verify
FETCH_INTERVALis appropriate - Check MongoDB connection
Insufficient balance errors
- Add USDC to your wallet
- Ensure POL/MATIC for gas fees
- Check token allowances
- Run
npm run check-allowance
Orders failing
- Verify wallet has sufficient balance
- Check token allowances
- Review slippage settings
- Check network connectivity
# Health check
npm run health-check
# Check token allowance
npm run check-allowance
# Verify wallet balance
npm run check-both
# View recent activity
npm run check-activity
# Check positions
npm run check-stats📖 For detailed troubleshooting, see Quick Start Guide
We welcome contributions! Please follow these guidelines:
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Follow code quality standards - See Code Quality Improvements
- Write tests for new features
- Update documentation as needed
- Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
- Follow TypeScript best practices
- Maintain type safety (no
anytypes) - Add JSDoc comments for public APIs
- Write meaningful commit messages
- Update relevant documentation
- Test thoroughly before submitting
This project is licensed under the ISC License - see the LICENSE file for details.
- Polymarket CLOB Client - Official Polymarket CLOB API client
- Predictfolio - Trader analytics and performance metrics
- Polygon Network - Layer 2 blockchain infrastructure
🚀 Version 2 Available: An advanced version with RTDS (Real-Time Data Stream) monitoring is now available as a private repository.
Version 2 features the fastest trade detection method with near-instantaneous trade replication, lower latency, and reduced API load. Copy trading works excellently in the advanced version.
- Real-Time Data Stream (RTDS) - Instant trade detection without polling delays
- Lower Latency - Near-instantaneous trade replication for optimal entry prices
- Reduced API Load - More efficient API usage compared to polling methods
- Enhanced Performance - Superior copy trading execution with minimal delay
- Scalability - Better handling of multiple traders and high-frequency trading
For access to the advanced version, please contact us through the Support channels.
I've also developed a trading bot for Polymarket built with Rust, providing high-performance trading capabilities with low-level system control.
- High Performance - Built with Rust for maximum speed and efficiency
- Low Latency - Optimized for minimal execution delay
- System-Level Control - Direct system access for advanced trading strategies
- Memory Safety - Rust's memory safety guarantees without garbage collection overhead
- Production Ready - Battle-tested for reliable trading operations
For questions, issues, or support:
- Telegram: Novus Tech
- Issues: GitHub Issues
- Documentation: See Documentation section above
Legal Disclaimer: This software is provided "as is" for educational purposes only. Trading cryptocurrencies and prediction markets involves substantial risk of loss. The developers, contributors, and maintainers of this software are not responsible for any financial losses, damages, or other consequences resulting from the use of this software. Users are solely responsible for their trading decisions and should consult with qualified financial advisors before engaging in any trading activities.