CandleBus¶
CandleBus is a publish-subscribe channel for CandleEvent messages, used to deliver aggregated candles from CandleAggregator to downstream consumers (e.g., strategies, loggers).
#ifdef FLOX_USE_SYNC_CANDLE_BUS
using CandleBus = EventBus<CandleEvent, SyncPolicy<CandleEvent>>;
#else
using CandleBus = EventBus<CandleEvent, AsyncPolicy<CandleEvent>>;
#endif
Purpose¶
- Fan-out distribution of
CandleEventto all registered subscribers.
Responsibilities¶
| Aspect | Details |
|---|---|
| Policy | Chooses between SyncPolicy and AsyncPolicy via compile-time flag. |
| Binding | Type alias for EventBus<CandleEvent, Policy>. |
| Usage | Integrated into CandleAggregator; consumed by strategies and metrics. |
Notes¶
SyncPolicyensures deterministic tick-to-tick sequencing for backtesting.AsyncPolicyenables low-latency lock-free fan-out in live trading.- Controlled via the
FLOX_USE_SYNC_CANDLE_BUSmacro, toggled at compile time.