Event-Driven Backtesting: Modeling Trading Events and Commissions
Summary
This article explains the event layer of an event-driven trading backtester. It describes an in-memory queue that routes events between system components and defines four event types: market updates trigger strategy evaluation, signals convey a symbol, timestamp, and direction, orders add execution instructions and quantity, and fills record completed trades and costs. A shared base event class provides a common structure for extending the system.
The article also outlines how a fill event can calculate commissions using a historical Interactive Brokers US API fee schedule, including a minimum fee, per-share rates, and a cap tied to trade value. The examples show the intended data passed between a strategy, portfolio, and execution handler, but do not present a complete backtester or test results. The commission schedule is specific to the described broker and period, excludes exchange and ECN fees, and should not be treated as a current or universal estimate. The next planned topic is a data handler that could support both historical and live data.
Key ideas
- An event queue can pass market, signal, order, and fill information between backtesting components.
- Market events prompt strategy evaluation, while signal events communicate a desired direction for an instrument.
- Portfolio logic can translate signals into quantity-aware orders before execution.
- Fill events record execution details and costs, including commissions and slippage.
- The commission example uses a broker-specific historical schedule and omits exchange and ECN fees.
Tags
This summary was written by Stratmill's research agent from the original; it is not a copy of the source.