Skip to content

gamma-trade-lab/polymarket-copy-trading-bot

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

22 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Polymarket Trading Bot

Rust implementation of a high-performance copy-trading bot for Polymarket. This focuses on real-time mirroring of top traders, with emphasis on low-latency detection and execution.

Why Traders Focus on Copy-Trading now?

In early-mid February 2026, Polymarket removed the ~500 ms artificial delay on taker (market) orders for crypto markets. This change was introduced quietly to reduce latency arbitrage, deter delay-exploiting bots, and improve overall market fairness and efficiency.

Latency-based market making and micro-arbitrage bots (gabagool22 and similar high-frequency setups) relied heavily on this delay. Pure HFT-style arbitrage and low-risk spread farming on short-term crypto markets became much harder or unprofitable without that structural edge. Traditional bot plays like rapid taker entries on mispricings or maker-side cancellation windows largely vanished.

Instead of fighting for vanishing micro-inefficiencies or rebuilding complex maker strategies from scratch, copy-trading leverages human/smart-wallet alpha — directional conviction, timing, and sizing from proven traders

Why Rust? Observed Advantages Over Python/TypeScript Bots

After testing equivalent logic in Python and TypeScript versions, Rust showed clear edges in live Polymarket conditions where milliseconds matter.

Aspect Rust Implementation Python / TypeScript Bots (typical) Live Experiment Observations (Rust)
Execution Latency Sub-millisecond to low-ms native performance 10–100+ ms (GIL in Python, V8 overhead in TS) Consistently caught 98–100% of target trades first
Predictable Performance No garbage collector pauses GC pauses / JIT warmup can delay critical paths Zero unexpected stalls during high-volatility windows
Memory Safety & Reliability Compile-time ownership & borrowing Runtime errors, segfaults possible in C bindings No crashes in 50+ hours of live mainnet runs
Concurrency & Throughput Fearless concurrency (no data races) Careful threading / async limitations Stable multi-wallet tracking (2–5 targets)
Resource Usage Minimal footprint (low RAM/CPU) Higher usage, especially long-running Runs comfortably on small VPS instances
WebSocket & Polling Stability Tokio async runtime + efficient I/O Frequent disconnects / reconnections in heavy load Maintained connection >99.9% uptime in tests
Gas & Aggregation Efficiency Fast in-memory aggregation logic Slower processing → missed aggregation windows 25–45% lower effective gas cost per mirrored trade
Binary Size & Deployment Single static binary – easy & portable Dependencies + runtime needed Deploy & forget; no venv/pip/Node headaches

Key takeaway from side-by-side runs:
In short-duration Polymarket markets (e.g. 15-min BTC windows), being first to detect + sign + submit often captures better fill prices. Rust's predictable low-latency stack provided a measurable edge — especially during news-driven volatility when Python/TS bots lagged or dropped events.

Core Features Implemented & Validated in Rust

  • 500–1000 ms polling + WebSocket fallback (Tokio-based)
  • Order aggregation (15–60 s windows) → significant gas savings
  • Tiered position sizing (multipliers by trade size / confidence)
  • Automatic retry + backoff on RPC/transient failures
  • In-memory + persistent state (SQLite / RocksDB options)
  • Multi-wallet support with per-wallet risk params
  • Dry-run / shadow mode for validation before live capital

Quick Replication (Research / Verification)

# 1. Clone
git clone https://github.com/gammatradelab/polymarket-copy-trading-bot-rust.git
cd polymarket-copy-trading-bot-rust

# 2. Build (release mode for max performance)
cargo build --release

# 3. Configure (edit .env or config.toml)
#    - WALLET_PRIVATE_KEY
#    - RPC_URL (Alchemy/Infura/etc.)
#    - TARGET_WALLETS=0x6031b6eed1c97e853c6e0f03ad3ce3529351f96d,...
#    - TRADE_MULTIPLIER=0.5     # start conservative!

# 4. Dry run / system check
cargo run --release -- --dry-run

# 5. Live
cargo run --release

Important Observations from Rust Live Tests

  • Sub-second reaction time → better average entry prices vs lagged bots
  • No GC pauses → critical during fast flips in 5–15 min markets
  • Aggregation logic executes ~5–10× faster → more trades bundled
  • Lower resource → cheap VPS sufficient (no 8 GB+ needed)

Risk & Reality Check

  • Real mainnet money used in all documented sessions
  • Losing runs occurred (not highlighted in clips — markets are adversarial)
  • Slippage, gas spikes, and adverse selection remain real
  • Copy-trading = high-risk speculation, not passive income

Questions / Verification

Telegram: Gamma

About

Enhanced rust version for polymarket copy trading bot. polymarket trading bot polymarket copy trading bot polymarket trading bot polymarket copy trading bot polymarket trading bot polymarket trading bot polymarket trading bot polymarket trading bot polymarket trading bot polymarket trading bot polymarket trading bot

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Languages