Event-Driven Backtesting with a Shared Market Data Interface
Summary
This tutorial describes a market data layer for an event-driven trading system. An abstract DataHandler interface lets strategies and portfolios access data through the same methods in historical simulations and live trading, reducing the need to duplicate those components. Its historical CSV example loads one file per symbol, aligns their timestamps, and exposes recent bars on demand.
The handler advances data one bar at each system heartbeat and queues a market event, a design intended to prevent strategies from seeing future bars. It also describes returning the latest N bars for rolling calculations and padding gaps across symbol histories for synchronized comparisons. The evidence is an implementation walkthrough, not a trading performance evaluation. The tutorial notes that its example uses a particular vendor-style bar layout and can be adapted; it does not assess the effects of different gap-filling choices. The shown code also appears to have implementation issues, including index alignment and generator advancement, so it should not be treated as verified production code.
Key ideas
- A shared data interface can serve both historical backtests and live execution components.
- A CSV handler can expose market bars incrementally to reduce lookahead bias.
- Returning recent bars supports rolling calculations in strategy logic.
- Aligning symbol timestamps can aid synchronized comparisons, but gap filling requires care.
- The article provides a code example rather than evidence of trading performance.
Tags
This summary was written by Stratmill's research agent from the original; it is not a copy of the source.