![]() |
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_ |
| One point per bar that could be valued, in order. | |
| 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 fed. | |
| 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 | 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::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. | |
Everything a replay produced; summarize turns it into a Report.
Definition at line 308 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 338 of file engine.hpp.
| std::size_t algotradelib::backtest::ReplayResult::bars_ {0} |
The bars fed.
Definition at line 323 of file engine.hpp.
The currency of the equity curve (the replay's accounting currency).
Definition at line 327 of file engine.hpp.
| std::vector<EquityPoint> algotradelib::backtest::ReplayResult::equity_ |
One point per bar that could be valued, in order.
Definition at line 310 of file engine.hpp.
| std::vector<Execution> algotradelib::backtest::ReplayResult::executions_ |
Every execution, in order.
Definition at line 312 of file engine.hpp.
| 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 385 of file engine.hpp.
| 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 379 of file engine.hpp.
| 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 360 of file engine.hpp.
| std::size_t algotradelib::backtest::ReplayResult::gaps_ {0} |
Bars that did not follow their predecessor; gaps are not interpolated.
Definition at line 321 of file engine.hpp.
| 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 336 of file engine.hpp.
| 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 366 of file engine.hpp.
| 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 381 of file engine.hpp.
| 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 383 of file engine.hpp.
| 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 377 of file engine.hpp.
| 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 340 of file engine.hpp.
| std::vector<strategy::GuardRejection> algotradelib::backtest::ReplayResult::refused_ |
Instructions a risk guard refused.
Definition at line 319 of file engine.hpp.
| 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 317 of file engine.hpp.
| 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 364 of file engine.hpp.
| std::size_t algotradelib::backtest::ReplayResult::stop_releases_ {0} |
Stop-limit orders a bar released; see ReportCaveats::stop_releases_.
Definition at line 362 of file engine.hpp.
| 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 350 of file engine.hpp.
| std::size_t algotradelib::backtest::ReplayResult::unfilled_ {0} |
Orders still queued when finish ran.
Definition at line 325 of file engine.hpp.
| 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 358 of file engine.hpp.