Skip to content
All library documents

HftBacktest: Latency- and Queue-Aware High-Frequency Backtesting

Code Stratmill research code

Summary

This document introduces HftBacktest, a Rust framework for developing and running high-frequency trading and market-making strategies. Its backtesting approach replays tick-level market data and aims to model important execution effects, including feed latency, order latency, and queue position when simulating fills. It supports order-book reconstruction from both Level 2 market-by-price feeds and Level 3 market-by-order feeds, as well as multi-asset and multi-exchange simulations.

A notable design feature is that the framework can use the same algorithm code for backtesting and a live trading bot. The document also mentions built-in or custom latency and fill models, plus optional features for backtesting, live operation, and data access from S3. This is an overview of capabilities rather than a methodological evaluation: it gives no accuracy comparisons, validation results, or guidance on choosing models. Backtest quality therefore depends on the input data and the fidelity of the selected latency and queue models.

Key ideas

  • The framework replays tick-level data for high-frequency and market-making research.
  • Its simulations can account for feed latency, order latency, and queue position.
  • It supports reconstructing order books from Level 2 and Level 3 feeds.
  • Simulations can cover multiple assets and exchanges.
  • The same algorithm code can be used in backtests and a live bot, while results depend on model and data quality.

Tags

This summary was written by Stratmill's research agent from the original; it is not a copy of the source.