Skip to content

danielsilva010/Polymarket-Copy-Trading-Bot

Β 
Β 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

18 Commits
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Polymarket Copy Trading Bot

Automated copy trading bots for Polymarket that mirror trades from successful traders (whales) in real-time.

GitHub License: ISC

πŸ“‹ Overview

This repository contains two implementations of a Polymarket copy trading bot:

  1. Rust Bot (rust/) - High-performance, production-ready implementation
  2. Python Bot (python/) - Feature-rich implementation with extensive tooling

Both bots automatically monitor and copy trades from successful Polymarket traders, executing scaled positions based on your capital and risk preferences.

πŸš€ Quick Start

Choose Your Bot

Use the Rust Bot if you want:

  • ⚑ Maximum performance and speed
  • 🎯 Focused, streamlined trading functionality
  • πŸ”’ Production-grade reliability
  • πŸ“¦ Single binary deployment

Use the Python Bot if you want:

  • πŸ› οΈ Extensive tooling and research scripts
  • πŸ“Š Advanced simulation and backtesting
  • πŸ” Trader research and analysis tools
  • πŸ’Ό Position management utilities
  • πŸ“ˆ Comprehensive logging and monitoring

Rust Bot Quick Start

cd rust
# Follow the setup guide in rust/README.md
cargo run --release --bin validate_setup
cargo run --release

πŸ“– Full Documentation: rust/README.md

Python Bot Quick Start

cd python
pip install -r requirements.txt
python -m src.scripts.setup.setup
python -m src.main

πŸ“– Full Documentation: python/README.md

πŸ“ Repository Structure

Polymarket-Copy-Trading-Bot/
β”‚
β”œβ”€β”€ rust/                    # Rust implementation
β”‚   β”œβ”€β”€ src/                # Source code
β”‚   β”œβ”€β”€ docs/               # Documentation
β”‚   β”œβ”€β”€ README.md           # Rust bot documentation
β”‚   └── Cargo.toml          # Rust dependencies
β”‚
β”œβ”€β”€ python/                  # Python implementation
β”‚   β”œβ”€β”€ src/                # Source code
β”‚   β”œβ”€β”€ docs/               # Documentation
β”‚   β”œβ”€β”€ scripts/            # Utility scripts
β”‚   β”œβ”€β”€ README.md           # Python bot documentation
β”‚   └── requirements.txt    # Python dependencies
β”‚
└── README.md               # This file

πŸ”„ Key Differences

Feature Rust Bot Python Bot
Performance ⚑ Extremely fast 🐍 Moderate
Setup Complexity 🟒 Simple 🟑 Moderate
Trading Features βœ… Core trading βœ… Core + Advanced
Research Tools ❌ No βœ… Extensive
Simulation ❌ No βœ… Full backtesting
Position Management ❌ Basic βœ… Advanced
MongoDB Integration ❌ No βœ… Yes
Multi-Trader Support βœ… Single trader βœ… Multiple traders
Documentation πŸ“š Comprehensive πŸ“š Extensive

🎯 How It Works

Both bots follow a similar core workflow:

  1. Monitor - Watch for trades from target traders (whales)
  2. Analyze - Evaluate trade size, price, and market conditions
  3. Calculate - Determine scaled position size based on your capital
  4. Execute - Place matching orders on Polymarket
  5. Track - Log all trades for analysis

Rust Bot Strategy

  • Real-time blockchain monitoring via WebSocket
  • 2% default position scaling (configurable)
  • Tiered execution based on trade size
  • Multi-layer risk management
  • Sport-specific market adjustments

Python Bot Strategy

  • API polling or WebSocket monitoring
  • Proportional position sizing based on capital ratios
  • Trade aggregation for efficiency
  • MongoDB persistence for trade history
  • Advanced risk management and circuit breakers

πŸ“š Documentation

Rust Bot Documentation

Python Bot Documentation

βš™οΈ Requirements

Common Requirements

  • Polymarket Account - Sign up at polymarket.com
  • Web3 Wallet - MetaMask recommended
  • USDC/USDC.e - On Polygon network for trading
  • RPC Provider - Alchemy, Chainstack, or Infura API key
  • Whale Address - The trader address you want to copy

Rust Bot Specific

Python Bot Specific

πŸ”’ Security Notes

⚠️ IMPORTANT:

  • Never share your PRIVATE_KEY with anyone
  • Never commit your .env file to git
  • Start with small amounts to test
  • Use test/mock mode first to verify everything works
  • Use a dedicated wallet separate from your main funds

πŸ› οΈ Features

Rust Bot Features

  • βœ… Real-time trade copying via WebSocket
  • βœ… Intelligent position sizing (2% default)
  • βœ… Circuit breakers for risk management
  • βœ… Automatic order resubmission
  • βœ… Market cache system
  • βœ… CSV logging
  • βœ… Live market detection
  • βœ… Tiered execution

Python Bot Features

  • βœ… Multi-trader support
  • βœ… Smart position sizing
  • βœ… Trade aggregation
  • βœ… Real-time execution
  • βœ… MongoDB integration
  • βœ… Price protection
  • βœ… Extensive research tools
  • βœ… Simulation & backtesting
  • βœ… Position management utilities
  • βœ… Wallet management scripts

πŸ“Š Output Files

Rust Bot

  • matches_optimized.csv - All detected and executed trades
  • .clob_creds.json - Auto-generated API credentials
  • .clob_market_cache.json - Market data cache

Python Bot

  • logs/bot-YYYY-MM-DD.log - Daily log files
  • trader_data_cache/ - Cached trader data
  • simulation_results/ - Simulation results
  • MongoDB collections - Trade history and positions

πŸ†˜ Getting Help

  1. Check the bot-specific troubleshooting guides:
  2. Validate your configuration:
    • Rust: cargo run --release --bin validate_setup
    • Python: python -m src.scripts.setup.system_status
  3. Review your .env file against the examples
  4. Check console output for error messages

πŸ“„ Contact

For questions or issues, contact via Telegram: @terauss

βš–οΈ Disclaimer

This software 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.

πŸ“ License

ISC License - See LICENSE file for details.

🌟 Contributing

Contributions are welcome! Please:

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

πŸ”— Links


Made with ❀️ for the Polymarket community

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 64.8%
  • Rust 34.0%
  • Other 1.2%