Polymarket Twin Engine
Deterministic trading infrastructure for prediction markets
Deterministic execution · Backtesting engine · Live trading infrastructure · Event-driven architecture
A trading infrastructure platform built around one architectural constraint: live execution and backtesting must share a single execution path. No environment flags, no conditional branches - the same StrategyRunner, OrderManager, and Portfolio logic processes every event in both modes.
This constraint shaped every design decision. Market data is persisted as raw, ordered events in Parquet so replay can reconstruct exact book state. Strategies are schema-validated and plugin-driven so they remain portable across environments. Fills are latency-aware so backtest results reflect real execution dynamics. The result is a full research-to-production platform, not a trading bot with a backtest mode bolted on.
Impact
- Achieved full behavioral parity between live and backtest - identical strategy outputs given identical input data.
- Built a complete event pipeline from raw WebSocket ingestion to structured Parquet storage, enabling reproducible replay at any historical point.
- Delivered a production system executing automated strategies on Polymarket with end-to-end PnL tracking and settlement.
- Designed a platform architecture that scales from single-strategy research to multi-bot deployment with isolated per-bot configuration and monitoring.
👤 My Role
- Architecture - defined the single-pipeline constraint and layered event-driven design that ensures execution determinism across environments.
- Data infrastructure - built the ingestion pipeline, Parquet storage layer, and replay engine with tick-level order book reconstruction.
- Execution system - implemented the live trading engine including order management with risk limits, cancel/replace logic, and out-of-order fill handling.
- Strategy platform - designed the modular framework, plugin system, and schema validation layer for portable, reproducible strategy development.
- Research tooling - built batch analytics, grid search, and feature export pipelines for systematic strategy evaluation.
- Operations - created CLI tooling for key management, balance checks, approvals, and multi-bot deployment workflows.