HftBacktest simulates market making and HFT strategies using full tick data, limit order books, queue position, and configurable latencies, with optional live Binance and Bybit bots in Rust.
Overview
HftBacktest focuses on realistic replay of high-frequency and market-making strategies. It models feed and order latencies, queue position for fills, and level-2 or level-3 order book reconstruction from tick streams.
Simulations can step on fixed intervals or event-driven timings. Multi-asset and multi-exchange setups are supported, and Rust components enable deploying the same algorithm code to live trading on Binance Futures and Bybit for prototyping.
Python 3.11+ installs via pip; data preparation docs describe expected tick formats and hosted sample datasets. Tutorials cover grid trading, order book imbalance signals, accelerated backtests, and pricing frameworks.
The authors stress aligning backtests with live results before optimization, arguing that inaccurate simulation hides small edges common in competitive trading.
Key features
- Tick-by-tick order book replay
- Feed and order latency models
- Queue-position fill simulation
- Level-2 and Level-3 market data
- Multi-asset and multi-exchange support
- Python API with Numba-style examples
- Rust live trading for select exchanges
- Documented data prep and tutorials
Use cases
- Backtesting market making strategies
- Researching latency-sensitive crypto bots
- Validating simulators against live fills
- Prototyping Rust live traders from backtests