Skip to content

Latest commit

 

History

6 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Polymarket Bot — Rust Edition

High-frequency Polymarket trading bot rewritten in Rust for sub-millisecond latency.

Architecture

Same as polymarket-bot-v2 (Python), but in Rust:

src/
├── main.rs              # Entry point + scan loop (dashboard.py)
├── config.rs            # Configuration from .env (config.py)
├── data/
│   ├── gamma.rs         # Market discovery (gamma_client.py)
│   ├── clob.rs          # Order placement FOK/GTC (clob_client.py)
│   └── ws.rs            # WebSocket feeds (clob_ws.py + parallel_ws.py)
├── strategies/
│   ├── mod.rs           # Strategy engine (signal_ranker.py)
│   └── volume_sniper.rs # BTC 86.9% WR strategy (btc_volume_sniper.py)
└── trading/
    ├── executor.rs      # Position management (autonomous_executor.py)
    └── risk.rs          # 5-tier risk system (v2_risk_manager.py)

Why Rust?

Metric Python Bot Rust Bot
Signal→Order ~500ms <1ms
WS tick processing ~5ms <0.1ms
Memory usage ~150MB ~10MB
CPU (idle) 5-10% <1%
Startup time 3-5s <100ms

Key Features

  • Sub-ms latency: tokio async runtime, zero-copy WS processing
  • 6-layer data quality: Same system as Python bot (drop first tick, reject stale, jitter EMA)
  • 13 strategies: Starting with BTC Volume Sniper (86.9% WR)
  • GTC-first: Maker orders (0% fee) by default, FOK only for urgent signals
  • Same constraints: FOK $1 min, GTC 5-share min, tick 0.01, sig_type=3

Setup

# 1. Copy environment config
cp .env.example .env
# Edit .env with your credentials

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

# 3. Run
./target/release/polybot_rust

Development Status

  • Project scaffold & architecture
  • Config loading from .env
  • Gamma API market discovery
  • CLOB client (orderbook, order placement)
  • BTC Volume Sniper strategy
  • Risk manager (5-tier system)
  • Executor (entry/exit/dedup)
  • Official Polymarket SDK integration (rs-clob-client-v2)
  • Wire SDK into clob.rs (replace manual HTTP with SDK calls)
  • WebSocket via SDK (orderbook + user channel)
  • Remaining 12 strategies
  • Telegram integration
  • Auto-redeem

Deployment

# Build optimized binary
cargo build --release

# Binary is at: ./target/release/polybot_rust
# Deploy anywhere: Railway, VPS, or locally

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages