algotradelib 0.0.0.9000
C++ header-only library for algorithmic trading
Loading...
Searching...
No Matches
algotradelib::strategy::BarSlice Struct Reference

Every instrument's bar of one interval for one period end, delivered to on_bars. More...

#include <algotradelib/src/strategy/event.hpp>

Public Member Functions

const BarEvent * find (const InstrumentId &id) const noexcept
 Finds an instrument's bar.

Public Attributes

std::chrono::system_clock::time_point period_end_ {}
 When the period ended, shared by every bar in bars_.
BarInterval interval_ {BarInterval::ONE_DAY}
 The period length every bar in bars_ covers.
std::vector< BarEvent > bars_
 The bars, one per instrument, in the order they were fed.

Detailed Description

Every instrument's bar of one interval for one period end, delivered to on_bars.

A runner calls on_bars once per period end and interval, after every bar of that period has been fed: cached (with a linear algebra backend, so ctx.bars(id, interval_) ends at period_end_ for each instrument here), priced and clocked. An instrument with no bar for the period is absent; there is no deadline and no placeholder. Several intervals ending at the same instant give one slice each.

The slice is valid only during the call.

Definition at line 298 of file event.hpp.

Member Function Documentation

◆ find()

const BarEvent * algotradelib::strategy::BarSlice::find ( const InstrumentId & id) const
inlinenoexcept

Finds an instrument's bar.

Parameters
idThe instrument.
Returns
Its bar, or nullptr if it has none for this period.

Definition at line 311 of file event.hpp.

Member Data Documentation

◆ bars_

std::vector<BarEvent> algotradelib::strategy::BarSlice::bars_

The bars, one per instrument, in the order they were fed.

Definition at line 304 of file event.hpp.

Referenced by find().

◆ interval_

BarInterval algotradelib::strategy::BarSlice::interval_ {BarInterval::ONE_DAY}

The period length every bar in bars_ covers.

Definition at line 302 of file event.hpp.

◆ period_end_

std::chrono::system_clock::time_point algotradelib::strategy::BarSlice::period_end_ {}

When the period ended, shared by every bar in bars_.

Definition at line 300 of file event.hpp.


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