A Simulated Execution Handler for Event-Driven Backtests
Summary
This installment explains how to add an execution handler to an event-driven Python backtester. An abstract handler defines an order-execution interface, while a simple simulated implementation converts each order event into a fill event and places it on an event queue. This design separates strategy and portfolio logic from the mechanism that turns orders into fills, allowing simulated and live handlers to share an interface.
The example fills every order immediately at the current market price, with no latency, slippage, partial fills, or market impact. The author presents it as a basic starting point and explicitly notes that realistic execution modeling needs more work. The example also uses a placeholder exchange and leaves fill cost unset because costs were handled elsewhere in the preceding portfolio component. It demonstrates architecture, not reliable estimates of trading performance; results from a backtest using this execution assumption may be materially unrealistic.
Key ideas
- An execution handler translates order events into fill events for the event queue.
- An abstract interface lets simulated and live execution implementations fit the same backtester architecture.
- The sample handler fills all order quantities immediately at the market price.
- The example omits latency, slippage, fill ratios, and market impact, limiting backtest realism.
Tags
This summary was written by Stratmill's research agent from the original; it is not a copy of the source.