Converting Bybit Order Book and Trade Feeds for Backtesting
Summary
The document describes processing Bybit’s compressed raw feed files into event data compatible with a high-frequency backtesting system. It handles order book snapshots and updates, as well as public trades, and offers two approaches: combine multiple book depths into a fused representation or process a selected depth level. Prices, quantities, exchange times, and local receipt times are mapped into structured events.
For fused depth, the implementation passes snapshots and deltas through a market-depth processor, then combines its output with trade events. For single-depth processing, snapshots clear and rebuild the relevant book side while deltas update it. Both paths adjust local timestamps for a supplied latency and correct and validate event ordering. The document explains the data flow and configurable tick size, lot size, and buffer capacity, but supplies no benchmark or validation against live exchange behavior. Correct interpretation depends on feed conventions and suitable instrument settings.
Key ideas
- The converter reads Bybit order book and public trade messages from compressed files.
- It supports both fused multi-depth books and processing one selected depth level.
- Snapshots rebuild book state, while deltas represent subsequent updates.
- Local timestamps can be adjusted for latency before event ordering is corrected and validated.
- Tick size, lot size, and buffer capacity must suit the instrument and dataset.
Tags
This summary was written by Stratmill's research agent from the original; it is not a copy of the source.