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

A replay's settings, besides the strategy and the bars. More...

#include <algotradelib/src/backtest/engine.hpp>

Collaboration diagram for algotradelib::backtest::ReplayConfig:

Public Attributes

Decimal64 cash_ {Decimal64::parse("10000000")}
 The starting cash, in currency_.
Currency currency_ {Currency{"KRW"}}
 The accounting currency; the equity curve is in this currency only.
std::vector< Instrument > instruments_
 Reference data for every instrument replayed; orders on an instrument without it are refused.
strategy::RiskLimits limits_
 The risk limits, applied as they are live.
strategy::SessionWindow session_ {strategy::SessionWindow::krx()}
 The session window phases are derived from and DAY orders expire at; one for the whole replay.
std::size_t series_capacity_ {512}
 How many trailing bars the context caches per series, for indicators; must be positive. Unused for a strategy declaring reads_bar_history = false, which keeps none.
EquityCurve equity_curve_ {EquityCurve::PER_PERIOD}
 Which points the equity curve records: one per period end (the default), one per bar, or none.
TradingCalendar calendar_
 The calendar ctx.calendar() returns, for a strategy asking about dates it has no bar for (such as whether tomorrow trades).
std::optional< std::chrono::system_clock::time_point > trade_from_
 Where trading starts: an event earlier than it is history; empty, none is.

Detailed Description

A replay's settings, besides the strategy and the bars.

Definition at line 768 of file engine.hpp.

Member Data Documentation

◆ calendar_

TradingCalendar algotradelib::backtest::ReplayConfig::calendar_

The calendar ctx.calendar() returns, for a strategy asking about dates it has no bar for (such as whether tomorrow trades).

Empty by default. It does not change the phase of a fed bar, which comes from feed's trading_day argument.

Definition at line 803 of file engine.hpp.

◆ cash_

Decimal64 algotradelib::backtest::ReplayConfig::cash_ {Decimal64::parse("10000000")}

The starting cash, in currency_.

Definition at line 770 of file engine.hpp.

◆ currency_

Currency algotradelib::backtest::ReplayConfig::currency_ {Currency{"KRW"}}

The accounting currency; the equity curve is in this currency only.

Definition at line 772 of file engine.hpp.

◆ equity_curve_

EquityCurve algotradelib::backtest::ReplayConfig::equity_curve_ {EquityCurve::PER_PERIOD}

Which points the equity curve records: one per period end (the default), one per bar, or none.

The bar counts (overdrawn_bars_, unvalued_bars_) are counted per bar whichever is chosen.

Definition at line 795 of file engine.hpp.

◆ instruments_

std::vector<Instrument> algotradelib::backtest::ReplayConfig::instruments_

Reference data for every instrument replayed; orders on an instrument without it are refused.

Definition at line 774 of file engine.hpp.

◆ limits_

strategy::RiskLimits algotradelib::backtest::ReplayConfig::limits_

The risk limits, applied as they are live.

Definition at line 776 of file engine.hpp.

◆ series_capacity_

std::size_t algotradelib::backtest::ReplayConfig::series_capacity_ {512}

How many trailing bars the context caches per series, for indicators; must be positive. Unused for a strategy declaring reads_bar_history = false, which keeps none.

Definition at line 789 of file engine.hpp.

◆ session_

strategy::SessionWindow algotradelib::backtest::ReplayConfig::session_ {strategy::SessionWindow::krx()}

The session window phases are derived from and DAY orders expire at; one for the whole replay.

Set it to the replayed market's session: US bars under the KRX default would expire orders at the KRX close.

Definition at line 784 of file engine.hpp.

◆ trade_from_

std::optional<std::chrono::system_clock::time_point> algotradelib::backtest::ReplayConfig::trade_from_

Where trading starts: an event earlier than it is history; empty, none is.

A bar is history when its period end is earlier, a record when it became known earlier. History runs the strategy's handlers, so its series and state warm up, and discards what they ask for, as a live warm-up does (Runner::feed_warmup): nothing fills, no equity point is recorded, the clock and on_phase do not move, and nothing is counted as rejected or refused. on_start still runs at the first event, and an order it places rests through history and may fill on the first traded bar. A strategy keeping its own record of having traded can start trading believing it holds a position the book does not.

Set it to the smallest period end among the first traded date's bars, not to a bar's timestamp: an open-stamped daily bar ends at the next one's timestamp. A quote before it is refused.

Definition at line 817 of file engine.hpp.


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