ITCHCPP 1.6.0
High-Performance NASDAQ TotalView-ITCH 5.0 Parser & Market-Data Platform
Loading...
Searching...
No Matches
itch::analytics::BarBuilder< Clock > Class Template Reference

Builds OHLCV bars from a trade stream under a configurable clock. More...

#include <bars.hpp>

Public Member Functions

 BarBuilder (Clock clock, BarCallback callback)
 Constructs a builder with the given clock policy and completion callback.
 
auto add (const Trade &trade) -> void
 Adds one trade, emitting the previous bar when the bucket changes.
 
auto flush () -> void
 Emits the current partial bar, if any, and clears it.
 

Detailed Description

template<typename Clock>
class itch::analytics::BarBuilder< Clock >

Builds OHLCV bars from a trade stream under a configurable clock.

Feed trades in timestamp order with add; each time the clock's bucket id changes, the completed bar is emitted to the callback. flush emits the final, partial bar. The clock is a small policy (see TimeClock, TickClock, VolumeClock) so time-, tick-, and volume-based aggregation share one builder.

Definition at line 87 of file bars.hpp.

Constructor & Destructor Documentation

◆ BarBuilder()

template<typename Clock >
itch::analytics::BarBuilder< Clock >::BarBuilder ( Clock  clock,
BarCallback  callback 
)
inline

Constructs a builder with the given clock policy and completion callback.

Parameters
clockBucketing policy (e.g. TimeClock, TickClock, VolumeClock) that decides when a bar completes.
callbackFunction invoked with each completed Bar.

Definition at line 94 of file bars.hpp.

Member Function Documentation

◆ add()

template<typename Clock >
auto itch::analytics::BarBuilder< Clock >::add ( const Trade trade) -> void
inline

Adds one trade, emitting the previous bar when the bucket changes.

Parameters
tradeThe next trade in timestamp order to fold into the current bar.

Definition at line 100 of file bars.hpp.

References itch::analytics::Bar::bucket, itch::analytics::Bar::close, itch::analytics::Bar::end_timestamp, itch::analytics::Bar::high, itch::analytics::Bar::low, itch::analytics::Bar::open, itch::analytics::Bar::start_timestamp, itch::analytics::Bar::trade_count, and itch::analytics::Bar::volume.

◆ flush()

template<typename Clock >
auto itch::analytics::BarBuilder< Clock >::flush ( ) -> void
inline

Emits the current partial bar, if any, and clears it.

Definition at line 126 of file bars.hpp.


The documentation for this class was generated from the following file: