Deterministic trading infrastructure for prediction markets.
Built as a unified execution engine where live trading and historical replay run through the exact same runtime, ensuring consistent strategy behavior and reproducible results.
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.
No backtesting infrastructure exists for Polymarket - strategies had to be tested live with real capital, with no way to validate behavior before deployment.
The gap isn't just tooling:
Building a backtesting engine for prediction markets meant solving all of these from scratch.
Rather than adapting traditional backtesting tools, the architecture was designed specifically for prediction markets with one core constraint: live trading and historical replay must run through the same execution pipeline.
The key insight was that execution determinism isn't a feature you add - it's an architectural constraint you design around from the start.
The system is structured as a layered event-driven pipeline. Each layer has a single responsibility and communicates through a shared event model:
The layers compose into the same pipeline in every mode. Swapping the data source is the only difference between live and replay.
Designed and built the entire platform end-to-end:
The backtesting engine replays recorded market data tick-by-tick, reconstructs the order book exactly as it appeared live, and runs the same StrategyRunner/OrderManager/Portfolio logic used in production. It supports latency simulation (intent -> exchange visibility) to better match real fills and includes market-end settlement logic (merge/redeem) so PnL is fully accounted for per market. This makes research outcomes far more realistic and reduces the typical live-vs-backtest gap.
The system resolves the current markets, subscribes to the CLOB market WebSocket, and persists every raw event to Parquet with strict ordering and timestamps. Those files are rotated per window and include explicit disconnect markers, making the dataset auditable and safe to replay deterministically.
Strategies are modular and registered with schema-validated parameters, so live runs and backtests are consistent and reproducible. The framework is event-driven (market ticks + account events), and it supports optional plugins to attach computed signals without changing core strategy code.
The execution engine includes a deterministic plugin layer that updates once per market tick and exposes cached snapshots to strategies. Plugins provide computed signals and external data while preserving identical runtime behavior across live and replay environments.
All orders flow through a central OrderManager that enforces risk limits and manages lifecycle (intent queue, cancel/replace, order status). Execution is abstracted so the same logic works in live trading and in backtests, with consistent handling of out-of-order fills.
A deterministic portfolio layer tracks positions, open orders, fills, and realized PnL. It is event-driven and consistent across live and backtest, including end-of-market settlement for complete PnL reporting.
The project includes batch-level analytics, grid search tooling, and feature export pipelines so strategies can be tuned and evaluated at scale. This makes it a full research system, not just a trading bot.
The system supports multi-bot deployments with per-bot configs and a lightweight monitoring UI. It also includes CLI tooling for key management, balance checks, approvals, and automation around Polymarket operational workflows.