HftBacktest is a high-frequency trading and market making backtesting engine that simulates trading strategies with tick-by-tick accuracy using full order book and trade data.
The tool addresses the challenge of accurately simulating real-world trading conditions for high-frequency strategies. Traditional backtesting often oversimplifies execution by ignoring latencies and queue positions, leading to results that diverge significantly from live performance. HftBacktest reconstructs full order books from Level-2 and Level-3 market data, simulates both feed and order latencies with customizable models, and accounts for queue position when determining order fills. This tick-by-tick approach with configurable time intervals allows strategies to be tested under conditions that closely mirror actual market replay.
The tool suits traders and quants developing high-frequency or market-making strategies who need confidence that backtest results will translate to live performance. It handles multi-asset and multi-exchange scenarios, making it applicable to complex portfolio strategies. The framework supports Python development through Numba JIT compilation for performance, while also offering Rust for live trading deployment on Binance Futures and Bybit. Developers should adopt this tool if they operate in competitive markets where small edges matter and cannot afford the gap between backtest and live results that simpler simulators introduce.
The project maintains active development across both Python and Rust implementations, with documentation including practical tutorials on grid trading, market making with alpha signals, and accelerated backtesting techniques. The codebase demonstrates ongoing refinement of simulation accuracy and expansion of supported exchanges for live trading deployment.