How Bar Generators Route Different Timeframe Data to Strategy Callbacks
Summary
The document explains why similarly named strategy handlers can receive bars of different durations. In an event-driven trading framework, a callback such as a five-minute handler or a ten-minute handler is called when the corresponding timeframe bar is ready. The bar’s period comes from the data-generation and dispatch setup, rather than from the shared variable name or the repeated update operation inside each handler.
It uses vn.py and a bar generator as examples: a generator can aggregate incoming market data into bars of configured lengths and invoke the matching callback when each bar completes. The practical lesson is to verify how handlers are registered and which aggregation settings feed them, so calculations use the intended granularity. The page provides conceptual explanations and small handler snippets, but no complete configuration or runnable strategy demonstrating the dispatch path. The details may vary with framework setup, so developers should inspect the actual generator and callback wiring in their own system.
Key ideas
- A callback’s input timeframe is determined by the event or bar-generation setup that invokes it.
- Different handlers can process different durations even when both use a variable named bar.
- A bar generator may aggregate incoming data into configured timeframes and dispatch completed bars.
- Strategy developers should check callback registration and aggregation settings to confirm the data frequency.
Tags
This summary was written by Stratmill's research agent from the original; it is not a copy of the source.