Skip to content
All library documents

Event-Driven Backtesting: Architecture, Execution Realism, and Trade-Offs

Article FMZ forum · Author: 善

Summary

This article introduces event-driven backtesting as an alternative to vectorized simulation, focusing on how an event loop processes market data and trading actions in sequence. It outlines a queue-based architecture with events for market updates, signals, orders, and fills, handled by separate data, strategy, portfolio, and execution components. The execution handler can model brokerage interaction, fees, commissions, and slippage.

The article argues that this structure can reduce lookahead bias by feeding market data incrementally and can support reuse between historical simulation and live trading. It also allows more realistic order handling, including market and limit orders and orders placed at the open or close. These benefits come with greater implementation complexity and slower calculations than vectorized methods. The piece is an architectural overview, not an empirical comparison; it notes that later installments will develop the system further and that added realism requires careful testing.

Key ideas

  • An event loop routes market, signal, order, and fill events through a trading simulation.
  • A queue connects the data, strategy, portfolio, and execution components.
  • Incremental market-data delivery can help prevent lookahead bias.
  • A custom execution handler can model order types and transaction costs.
  • Event-driven systems offer flexibility at the cost of greater complexity and slower processing.

Tags

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