New HFT Backtesting Library Gains Traction
An open-source Python library for high-frequency trading backtesting is gaining attention for its ability to simulate latencies and order queue positions. The `hftbacktest` library provides a more realistic environment for evaluating HFT strategies by modeling key market microstructure effects.
The `hftbacktest` library is engineered to overcome a common flaw in algorithmic trading backtests: the failure to account for the physics of the market. By simulating the entire tick-by-tick order book and incorporating feed/order latencies, it provides a more robust evaluation of strategy performance than tools that don't model these market microstructure effects. A key feature is its ability to model the order queue position, which is critical for predicting the probability of a limit order fill. This allows developers to test market-making and other liquidity-providing strategies with higher fidelity, as the simulation accounts for whether your order is at the front or back of the queue. For performance, the core backtesting logic is JIT-compiled using Numba, enabling faster execution of Python code. This is crucial for processing the massive datasets associated with high-frequency tick data. The library reconstructs the full order book from Level 2 (Market-By-Price) feeds to create a realistic market environment. The project, developed by GitHub user nkaz001, also features an experimental version rewritten in Rust. This high-performance implementation is being developed to support multi-asset and multi-exchange backtesting and to allow for the deployment of live trading bots using the same underlying algorithm code.