Skip to content
All library documents

Accelerating Backtests by Precomputing Limit Order Fill Conditions

Notebook Stratmill research code

Summary

The tutorial describes a faster backtesting approach that precomputes fill conditions across intervals, reducing the need to replay every depth update or estimate queue position. It retains feed and order-entry latency but omits order-response latency. Orders are treated as fully filled or unfilled when prices cross specified thresholds, so queue-position effects and partial fills are absent. The text gives separate interval fill-price rules for buy and sell limit orders and explains how acknowledgments and fills are aligned with local timestamps.

The speed gain comes with material accuracy trade-offs, especially where queue position matters, such as markets with larger tick sizes. The tutorial also describes preprocessing latency and market data, then applies the resulting arrays in a single-loop simulation and computes performance statistics. It supplies implementation details and plotted outputs, but the provided excerpt does not state a quantitative speed comparison or a validation against the more detailed simulator. Results from this model should be interpreted with its simplified execution assumptions in mind.

Key ideas

  • Precomputing interval fill conditions can reduce market-depth processing and speed up backtests.
  • The model includes feed and order-entry latency but omits order-response latency.
  • Limit orders fill only after strict price crossing, and queue position and partial fills are not modeled.
  • Buy and sell fill thresholds use interval extrema of best quotes and trades, adjusted by one tick.
  • The speed improvement trades away execution realism where queue position affects fills.

Tags

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