Skip to content
All library documents

Event-Driven Backtesting with a Simulated Execution Handler

Article QuantStart

Summary

This installment explains how to connect a portfolio’s order events to simulated fill events through an execution-handler interface. The abstract handler defines an order execution method, while the simulated implementation checks for order events and places a corresponding fill event on the shared event queue. The example uses the order’s symbol, quantity, and direction, along with a placeholder exchange and timestamp.

The approach fills every order immediately at the current market price, without latency, slippage, partial fills, or fill-ratio constraints. It is presented as a simple baseline for testing the event-driven backtester, not as a realistic execution model. The article notes that fill costs are omitted because the preceding portfolio component accounts for them; a more advanced handler would use market data to estimate execution costs. This design gives simulated and live brokerage handlers a common interface, but the example itself does not model market impact or venue-specific behavior.

Key ideas

  • An execution handler translates order events into fill events for the rest of an event-driven backtester.
  • A shared handler interface can support both simulated and live brokerage implementations.
  • The example automatically fills every order at the current market price with no latency or slippage.
  • Realistic execution models need to account for costs, market impact, and incomplete fills.
  • The example uses a placeholder exchange and leaves fill cost to the portfolio component.

Tags

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