algotradelib 0.0.0.9000
C++ header-only library for algorithmic trading
Loading...
Searching...
No Matches
clock.hpp File Reference

Bar-interval arithmetic and the replay clock. More...

#include "../strategy/event.hpp"
#include "../math/scalar.hpp"
#include <algotradelib/core>
#include <chrono>
#include <utility>
#include <optional>
Include dependency graph for clock.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  algotradelib::backtest::ReplayClock
 A backtest's clock: the current instant and market phase, moved by the replayed events. More...

Namespaces

namespace  algotradelib
 The library: broker-neutral types (core), and the modules below.
namespace  algotradelib::backtest
 Replays a strategy over stored bars: fill and cost models, the replay ledger, and the report.

Functions

std::optional< std::chrono::seconds > algotradelib::backtest::interval_duration (BarInterval interval)
 Returns the fixed duration of an interval (bar_interval_length).
std::optional< math::Scalar > algotradelib::backtest::periods_per_year (BarInterval interval, const strategy::SessionWindow &session, math::Scalar trading_days)
 Returns how many bars of an interval a year contains, for analytics::annualize_ratio.

Detailed Description

Bar-interval arithmetic and the replay clock.

Nothing here assumes a bar is a day: period counts come from the interval, the session window and a trading-day count the caller states.

Definition in file clock.hpp.