Last updated: 2026-05-04 · Audience: senior engineers, quants, market-microstructure researchers · Reading time: ~18 minutes

I have been running OKX perp book-building backtests for a market-neutral funding-rate arbitrage book for almost three years, and the single biggest lesson I learned the hard way is that the data layer is everything. A strategy that prints 38% APY in research can collapse to 6% APY in production purely because the backtest was fed interpolated L2 snapshots instead of true trade ticks. This guide documents the production architecture we settle on after shipping four generations of a Tardis-fed backtester for an OKX BTC/USDT and ETH/USDT options + perpetual book — including the exact headers, the exact polling cadence, the exact vectorization tricks, and where I inject HolySheep AI to annotate the strategy's failure modes automatically. If you only have time for one takeaway: never trust a candle that wasn't ground from raw trade prints.

1. Why Tardis.dev for OKX Tick Data?

Tardis is a replayable historical market-data relay that records raw feeds from major venues — Binance, Bybit, OKX, Deribit, Kraken, Coinbase, BitMEX, and 25+ others — and exposes them through three surfaces:

For OKX specifically, Tardis records the full raw books-l2-tbt (top-of-book + 400 levels), books5, trades, funding, and liquidations channels. Per their published data dictionary, the OKX feed on Tardis has a mean replay latency of 17.4 ms p50 and 42.1 ms p99 measured against the original OKX ingest timestamp on cross-venue coin pairs (source: Tardis status page, last verified 2026-04-28).

2. Reference Architecture

┌────────────────┐    S3/Range     ┌─────────────────┐    Polars      ┌──────────────────┐
│ Tardis Machine │ ───────────────▶│ Parquet cache   │ ──────────────▶│ Vectorized BTE   │
│  (raw .lz5)    │                 │ (Zstd level 9)  │                │ Numba JIT backtest│
└────────────────┘                 └─────────────────┘                └────────┬─────────┘
        │                                  │                                     │
        │ HTTP API                         │ OHLCV resample                     │ Equity curve
        ▼                                  ▼                                     ▼
┌────────────────┐                 ┌─────────────────┐                ┌──────────────────┐
│ /historical-   │                 │ Tick→Bar agg    │                │ Tearsheet +      │
│  data (NDJSON) │                 │ (200 ms L2      │                │ LLM commentary   │
└────────────────┘                 │   aggregation)  │                │ via HolySheep AI │
                                   └─────────────────┘                └──────────────────┘

The pipeline has three stages:

  1. Ingest