BitCo - Low-Latency Trading Engine
A Rust engine for Polymarket BTC markets where the risk manager can veto every single trade.
BitCo is a high-performance trading system targeting Polymarket's Bitcoin up/down prediction markets. The core is a single Rust engine that owns all live state and runs a decision cycle on every market tick.
The design rule that shapes everything: strategies never place orders. They only propose positions. The executor and the risk manager are the only components that can authorise an order - and the risk manager can block every entry.
Highlights
- Sub-millisecond tick-to-order in the Rust execution engine.
- Co-located on AWS in the same region as the exchange - 0.9 ms ping.
- Five modes: offline backtest, paper, shadow, small-live, full-live.
- Every decision logged; every non-trade records the reason it didn't fire.
- ~77 passing tests over the core engine; ML strategy research stays strictly offline, never in the live path.
Centralised, event-driven core
One central Rust engine owns all live state and runs the decision cycle on every tick. Data flows exchange → collectors → in-memory state → strategy controller → risk manager → executor. Because there is a single owner of truth, there is no race between strategies fighting over the same capital.
Market data arrives over WebSocket from Bybit, Binance, Chainlink and Polymarket; a TimescaleDB store keeps the time-series history for research and audit.
Latency is a location problem
Past a point, you cannot out-code the speed of light. Deploying the engine in the same AWS region as the exchange dropped ping to 0.9 ms - a bigger win than most micro-optimisations, and the reason the sub-millisecond internal budget is even meaningful.
Safety-first execution
Live trading is opt-in through progressively riskier modes. Shadow mode runs the full decision path against real data but places nothing; small-live caps exposure; only full-live is unrestrained. The read-only Next.js dashboard exposes advisory controls - pause, resume, emergency stop, metrics - but cannot itself invent trades.
Outstanding work: Polymarket API validation and EIP-712 order signing for live execution.
Stack
Engine
- Rust
- Tokio
- WebSocket feeds
Data
- PostgreSQL
- TimescaleDB
Research
- Python
- Backtesting
Dashboard
- Next.js
- TypeScript
Gallery