Skip to content
All library documents

Event-Driven Architecture for More Realistic Trading Backtests

Article QuantStart

Summary

This article introduces event-driven backtesting as an alternative to vectorized simulation. A loop processes market data and queued events in sequence: the data handler produces market events, a strategy turns them into signals, the portfolio generates orders, and an execution handler returns fills. This structure supports the same strategy and portfolio components in historical simulation and live trading, while making it easier to model order types, transaction costs, and slippage.

The article provides an architectural outline and a sample event-routing loop, rather than empirical performance evidence or a complete implementation. It argues that sequentially feeding data can reduce lookahead bias and improve execution realism, but cautions that event-driven systems are more complex to build and test and generally run more slowly than vectorized backtests. The design is presented as a basic foundation, with risk controls and transaction cost modeling identified as areas for later expansion.

Key ideas

  • An event queue routes market, signal, order, and fill events through the backtesting system.
  • A data handler can provide historical or live market data through a shared interface.
  • Separating strategy, portfolio, and execution components can support reuse between simulation and live trading.
  • Sequentially processing data helps avoid lookahead and permits more realistic order and cost modeling.
  • Event-driven systems add implementation complexity and often run more slowly than vectorized approaches.

Tags

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