![]() |
algotradelib 0.0.0.9000
C++ header-only library for algorithmic trading
|
Everything a replay produced; summarize turns it into a Report. More...
#include <algotradelib/src/backtest/engine.hpp>
Public Attributes | |
| std::vector< EquityPoint > | equity_ |
| The equity curve, in order: one point per period end, or per bar, or none (ReplayConfig::equity_curve_), each where the equity could be valued. | |
| std::vector< Execution > | executions_ |
| Every execution, in order. | |
| std::vector< strategy::Rejection > | rejected_ |
| Instructions not placed: reconciliation could not build them, or the replay cannot model them (BINDING_REFUSED; see QueueingExecutor::can_model). | |
| std::vector< strategy::GuardRejection > | refused_ |
| Instructions a risk guard refused. | |
| std::size_t | gaps_ {0} |
| Bars that did not follow their predecessor; gaps are not interpolated. | |
| std::size_t | bars_ {0} |
| The bars replayed; bars fed as history (ReplayConfig::trade_from_) are in history_bars_. | |
| std::size_t | unfilled_ {0} |
| Orders still queued when finish ran. | |
| Currency | currency_ {Currency{"KRW"}} |
| The currency of the equity curve (the replay's accounting currency). | |
| std::optional< BrokerError > | halted_ |
| Why the replay stopped early, if it did. | |
| std::size_t | aborted_ {0} |
| Orders still working when the replay halted, cleared from the queue (unlike unfilled_). | |
| std::size_t | quotes_ {0} |
| The quotes fed; see ReportCaveats::quotes_ for what quote-driven orders mean in a replay. | |
| std::size_t | records_ {0} |
| The records fed to on_data. | |
| std::size_t | unchecked_fill_causality_ {0} |
| How many fill decisions could not be checked for causality; see ReportCaveats::unchecked_fill_causality_. | |
| std::size_t | unvalued_bars_ {0} |
| Bars whose equity total did not fit an exact decimal, so they have no curve point. | |
| std::optional< std::chrono::system_clock::time_point > | first_unvalued_ |
| The period end of the first unvalued bar, if any. | |
| std::size_t | stop_releases_ {0} |
| Stop-limit orders a bar released; see ReportCaveats::stop_releases_. | |
| std::size_t | stop_fills_intrabar_ {0} |
| Fills of stops released inside a bar; see ReportCaveats::stop_fills_intrabar_. | |
| std::size_t | limit_fills_bounded_ {0} |
| Limit-type fills moved to stay in range; see ReportCaveats::limit_fills_bounded_. | |
| std::string | market_price_rule_ |
| The fill model's market-price rule, or empty; see ReportCaveats::market_price_rule_. | |
| std::size_t | market_fills_by_rule_ {0} |
| Fills priced by the fill model's market-price rule; see ReportCaveats::market_fills_by_rule_. | |
| std::size_t | overdrawn_bars_ {0} |
| Bars that closed with cash below zero in currency_ (counted per bar fed, so two instruments count both). | |
| std::optional< std::chrono::system_clock::time_point > | first_overdrawn_ |
| The first bar end at which cash was below zero, if any. | |
| std::optional< Money > | lowest_cash_ |
| The lowest cash any execution left in currency_, if below zero (checked at every fill). | |
| std::optional< std::chrono::system_clock::time_point > | lowest_cash_at_ |
| When lowest_cash_ was reached (that execution's Fill::at_). | |
| std::size_t | expired_day_orders_ {0} |
| DAY orders withdrawn unfilled when their session ended, as a broker does at the close. | |
| std::size_t | history_bars_ {0} |
| The bars fed as history, before ReplayConfig::trade_from_. | |
Everything a replay produced; summarize turns it into a Report.
Definition at line 676 of file engine.hpp.
| std::size_t algotradelib::backtest::ReplayResult::aborted_ {0} |
Orders still working when the replay halted, cleared from the queue (unlike unfilled_).
Definition at line 709 of file engine.hpp.
Referenced by algotradelib::backtest::chain_results().
| std::size_t algotradelib::backtest::ReplayResult::bars_ {0} |
The bars replayed; bars fed as history (ReplayConfig::trade_from_) are in history_bars_.
Definition at line 694 of file engine.hpp.
Referenced by algotradelib::backtest::chain_results().
The currency of the equity curve (the replay's accounting currency).
Definition at line 698 of file engine.hpp.
Referenced by algotradelib::backtest::chain_results().
| std::vector<EquityPoint> algotradelib::backtest::ReplayResult::equity_ |
The equity curve, in order: one point per period end, or per bar, or none (ReplayConfig::equity_curve_), each where the equity could be valued.
Definition at line 681 of file engine.hpp.
Referenced by algotradelib::backtest::chain_results().
| std::vector<Execution> algotradelib::backtest::ReplayResult::executions_ |
Every execution, in order.
Definition at line 683 of file engine.hpp.
Referenced by algotradelib::backtest::chain_results().
| std::size_t algotradelib::backtest::ReplayResult::expired_day_orders_ {0} |
DAY orders withdrawn unfilled when their session ended, as a broker does at the close.
Definition at line 762 of file engine.hpp.
Referenced by algotradelib::backtest::chain_results().
| std::optional<std::chrono::system_clock::time_point> algotradelib::backtest::ReplayResult::first_overdrawn_ |
The first bar end at which cash was below zero, if any.
Definition at line 756 of file engine.hpp.
Referenced by algotradelib::backtest::chain_results().
| std::optional<std::chrono::system_clock::time_point> algotradelib::backtest::ReplayResult::first_unvalued_ |
The period end of the first unvalued bar, if any.
Definition at line 733 of file engine.hpp.
Referenced by algotradelib::backtest::chain_results().
| std::size_t algotradelib::backtest::ReplayResult::gaps_ {0} |
Bars that did not follow their predecessor; gaps are not interpolated.
Definition at line 692 of file engine.hpp.
Referenced by algotradelib::backtest::chain_results().
| std::optional<BrokerError> algotradelib::backtest::ReplayResult::halted_ |
Why the replay stopped early, if it did.
Set when an execution could not be costed (no rate for the date or venue, or a market whose trading day the replay cannot compute), the ledger could not record one, or a position could not be marked at a bar's close (mark_not_representable). Every figure then covers the bars up to the halt; the halting bar is counted in bars_, but nothing after the refusal ran on it.
Definition at line 707 of file engine.hpp.
Referenced by algotradelib::backtest::chain_results().
| std::size_t algotradelib::backtest::ReplayResult::history_bars_ {0} |
The bars fed as history, before ReplayConfig::trade_from_.
Definition at line 764 of file engine.hpp.
Referenced by algotradelib::backtest::chain_results().
| std::size_t algotradelib::backtest::ReplayResult::limit_fills_bounded_ {0} |
Limit-type fills moved to stay in range; see ReportCaveats::limit_fills_bounded_.
Definition at line 739 of file engine.hpp.
Referenced by algotradelib::backtest::chain_results().
| std::optional<Money> algotradelib::backtest::ReplayResult::lowest_cash_ |
The lowest cash any execution left in currency_, if below zero (checked at every fill).
Definition at line 758 of file engine.hpp.
Referenced by algotradelib::backtest::chain_results().
| std::optional<std::chrono::system_clock::time_point> algotradelib::backtest::ReplayResult::lowest_cash_at_ |
When lowest_cash_ was reached (that execution's Fill::at_).
Definition at line 760 of file engine.hpp.
Referenced by algotradelib::backtest::chain_results().
| std::size_t algotradelib::backtest::ReplayResult::market_fills_by_rule_ {0} |
Fills priced by the fill model's market-price rule; see ReportCaveats::market_fills_by_rule_.
Definition at line 743 of file engine.hpp.
Referenced by algotradelib::backtest::chain_results().
| std::string algotradelib::backtest::ReplayResult::market_price_rule_ |
The fill model's market-price rule, or empty; see ReportCaveats::market_price_rule_.
Definition at line 741 of file engine.hpp.
Referenced by algotradelib::backtest::chain_results().
| std::size_t algotradelib::backtest::ReplayResult::overdrawn_bars_ {0} |
Bars that closed with cash below zero in currency_ (counted per bar fed, so two instruments count both).
Under the default limits a replay borrows without limit: nothing refuses an unaffordable buy unless RiskLimits::enforce_buying_power_ is on, and even then a market buy is checked at the reference price without commission and can overdraw on a gap. Short proceeds count as cash. With negative starting cash every bar counts, while lowest_cash_ (set by executions) may stay empty.
Definition at line 754 of file engine.hpp.
Referenced by algotradelib::backtest::chain_results().
| std::size_t algotradelib::backtest::ReplayResult::quotes_ {0} |
The quotes fed; see ReportCaveats::quotes_ for what quote-driven orders mean in a replay.
Definition at line 711 of file engine.hpp.
Referenced by algotradelib::backtest::chain_results().
| std::size_t algotradelib::backtest::ReplayResult::records_ {0} |
The records fed to on_data.
Definition at line 713 of file engine.hpp.
Referenced by algotradelib::backtest::chain_results().
| std::vector<strategy::GuardRejection> algotradelib::backtest::ReplayResult::refused_ |
Instructions a risk guard refused.
Definition at line 690 of file engine.hpp.
Referenced by algotradelib::backtest::chain_results().
| std::vector<strategy::Rejection> algotradelib::backtest::ReplayResult::rejected_ |
Instructions not placed: reconciliation could not build them, or the replay cannot model them (BINDING_REFUSED; see QueueingExecutor::can_model).
Definition at line 688 of file engine.hpp.
Referenced by algotradelib::backtest::chain_results().
| std::size_t algotradelib::backtest::ReplayResult::stop_fills_intrabar_ {0} |
Fills of stops released inside a bar; see ReportCaveats::stop_fills_intrabar_.
Definition at line 737 of file engine.hpp.
Referenced by algotradelib::backtest::chain_results().
| std::size_t algotradelib::backtest::ReplayResult::stop_releases_ {0} |
Stop-limit orders a bar released; see ReportCaveats::stop_releases_.
Definition at line 735 of file engine.hpp.
Referenced by algotradelib::backtest::chain_results().
| std::size_t algotradelib::backtest::ReplayResult::unchecked_fill_causality_ {0} |
How many fill decisions could not be checked for causality; see ReportCaveats::unchecked_fill_causality_.
Besides quotes, an order decided on one interval's bar and filled against another interval's bar of the same instrument (a Tuesday daily bar against that week's weekly bar) can be one. Separately, the nominal period end of an open-stamped monthly or yearly bar also dates its fills and equity points, so a February fill can be dated in March.
Definition at line 723 of file engine.hpp.
Referenced by algotradelib::backtest::chain_results().
| std::size_t algotradelib::backtest::ReplayResult::unfilled_ {0} |
Orders still queued when finish ran.
Definition at line 696 of file engine.hpp.
Referenced by algotradelib::backtest::chain_results().
| std::size_t algotradelib::backtest::ReplayResult::unvalued_bars_ {0} |
Bars whose equity total did not fit an exact decimal, so they have no curve point.
The next point carries no return. The replay and its callbacks continue, with per-lot and per-currency figures available, but the missing total also means no portfolio value for weight sizing, so a weight-sized intent on such a bar is rejected (NO_PORTFOLIO_VALUE).
Definition at line 731 of file engine.hpp.
Referenced by algotradelib::backtest::chain_results().