Quantitative Infrastructure
Turnip Farm
Orderbook-level data collection, quantitative signal detection, and backtesting infrastructure for prediction markets.
Prediction Markets Have a Data Problem
Prediction markets are growing fast, but the data infrastructure hasn't kept up. Most participants trade on sentiment and headlines. The orderbook — the actual record of supply, demand, and informed flow — goes uncaptured and unanalyzed.
Turnip Farm is a complete quantitative pipeline: from live orderbook capture across multiple exchanges to Bayesian signal detection, validated backtesting, and safety-first execution. Built in Rust for the performance and reliability that financial data demands.
Core Capabilities
End-to-end infrastructure from data collection to trade execution.
Real-Time Orderbook Capture
Live WebSocket collectors capturing Level 2 orderbook data across Kalshi and Polymarket. Tens of thousands of markets tracked simultaneously with automated reconnection and drift detection.
Quantitative Signal Detection
Bayesian anomaly detection on trade flow patterns using Normal-Inverse-Gamma priors with Empirical Bayes calibration. Detect informed flow before the market reprices.
Parquet Data Warehouse
Multi-stage Parquet-based warehouse with DataFusion SQL queries, row-group pruning, and incremental checkpointing. Hundreds of millions of historical records with efficient analytics.
Safety-First Execution
Compile-time hard caps on order sizes, daily loss limits, position tracking, and a tested kill switch for emergency halt. Risk controls that cannot be bypassed at runtime.
Three-Stage Backtesting
Validated pipeline: signal generation from warehouse data, fill simulation with realistic execution costs, and settlement resolution with P&L analysis. No optimistic assumptions.
Multi-Exchange Coverage
Dual-exchange data collection across Kalshi and Polymarket with exchange-specific adapters. Unified data format regardless of source, with automated quality monitoring.
Data Pipeline
Collect
WebSocket collectors capture live orderbook snapshots and trade events across exchanges, writing to local storage and S3 archive.
Warehouse
Raw data is converted to Parquet format with automated sorting, deduplication, and indexing for high-performance analytical queries.
Signal
Quantitative strategies process warehouse data to detect anomalies in trade flow, orderbook imbalance, and external data sources.
Backtest
Three-stage validated pipeline: generate signals, simulate fills with realistic costs, resolve settlements against exchange APIs.
Execute
Signals meeting confidence thresholds route through the order management system with position-aware sizing, risk limits, and kill switch protection.
Collect
WebSocket collectors capture live orderbook snapshots and trade events across exchanges, writing to local storage and S3 archive.
Warehouse
Raw data is converted to Parquet format with automated sorting, deduplication, and indexing for high-performance analytical queries.
Signal
Quantitative strategies process warehouse data to detect anomalies in trade flow, orderbook imbalance, and external data sources.
Backtest
Three-stage validated pipeline: generate signals, simulate fills with realistic costs, resolve settlements against exchange APIs.
Execute
Signals meeting confidence thresholds route through the order management system with position-aware sizing, risk limits, and kill switch protection.
Trading Strategies
Multiple quantitative approaches exploiting different market inefficiencies.
InsiderFlow
Anomaly DetectionBayesian anomaly detection on trade flow using 4D Mahalanobis distance across size, volume, depth, and imbalance dimensions. Detects uninformed retail flow and potential informed trading.
WeatherStrategy
External DataIntegrates NWS NBM forecasts, HRRR high-resolution data, and METAR observations to price weather bracket markets more accurately than current market consensus.
QuoteAroundMid
Market MakingClassic market-making: maintain standing buy/sell orders around the mid-price to capture the spread. Position-aware sizing adjusts exposure dynamically.
SpeedEdge
Latency ArbitrageExploits the latency between external data announcements and prediction market repricing. First-mover advantage on publicly available information.
Built in Rust
15 modular crates, 860+ tests, zero clippy warnings. Tokio async runtime for concurrent WebSocket connections, DataFusion for analytical SQL, and compile-time safety guarantees that matter when real money is on the line.
AWS infrastructure: S3 data lake, EC2 collectors with CloudWatch monitoring, Secrets Manager for credentials.
Interested in Turnip Farm?
Turnip Farm is in active development with live data collection running in production. If you're working with prediction market data or building quantitative strategies, get in touch.