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

The summary of a replay; read halted_ and caveats_ before the figures. More...

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

Collaboration diagram for algotradelib::backtest::Report:

Public Attributes

std::size_t bars_ {0}
 The bars replayed.
std::size_t executions_ {0}
 The executions.
Decimal64 opening_equity_
 Equity at the first recorded point.
Decimal64 closing_equity_
 Equity at the last recorded point.
math::Scalar total_return_ {0}
 The total return over the replay, as a fraction; math::undefined() when the opening equity is zero or negative (a replay may start with negative cash), math::missing() when every execution was in another currency than the curve's (ReportCaveats::other_currency_executions_).
math::Scalar sharpe_ {0}
 The per-period Sharpe ratio; see analytics::sharpe.
math::Scalar annualized_sharpe_ {0}
 The annualized Sharpe ratio; missing() unless a period count was given to summarize.
math::Scalar sortino_ {0}
 The per-period Sortino ratio; see analytics::sortino.
math::Scalar max_drawdown_ {0}
 The worst peak-to-trough decline of equity, as a non-negative fraction.
math::Scalar total_turnover_ {0}
 One-way turnover summed over the replay, as a fraction of equity.
std::optional< Decimal64 > commission_paid_
 Commission paid.
std::vector< Money > commission_by_currency_
 Commission paid per currency.
std::optional< Decimal64 > institution_fees_paid_
 Institution fees (유관기관제비용) paid.
std::vector< Money > institution_by_currency_
 Institution fees per currency.
std::optional< Decimal64 > slippage_paid_
 Slippage given up, in money.
std::vector< Money > slippage_by_currency_
 Slippage given up per currency.
std::size_t rejected_ {0}
 Instructions not placed: reconciliation could not build them, or the replay cannot model them (BINDING_REFUSED).
std::size_t refused_ {0}
 Instructions a risk guard refused.
std::optional< BrokerError > halted_
 Why the replay stopped early, if it did; read this before any figure.
std::size_t aborted_ {0}
 Orders cleared from the queue by a halt (unlike ReportCaveats::unfilled_).
ReportCaveats caveats_
 What this run assumed and did not model.
std::optional< Decimal64 > tax_paid_
 Sale tax paid.
std::vector< Money > tax_by_currency_
 Sale tax paid per currency, over executions in the taxed market.

Detailed Description

The summary of a replay; read halted_ and caveats_ before the figures.

Unobserved figures follow the analytics conventions (missing(), math::undefined()).

Definition at line 203 of file report.hpp.

Member Data Documentation

◆ aborted_

std::size_t algotradelib::backtest::Report::aborted_ {0}

Orders cleared from the queue by a halt (unlike ReportCaveats::unfilled_).

Definition at line 298 of file report.hpp.

◆ annualized_sharpe_

math::Scalar algotradelib::backtest::Report::annualized_sharpe_ {0}

The annualized Sharpe ratio; missing() unless a period count was given to summarize.

With a period count, undefined whenever sharpe_ is.

Definition at line 232 of file report.hpp.

◆ bars_

std::size_t algotradelib::backtest::Report::bars_ {0}

The bars replayed.

Definition at line 205 of file report.hpp.

◆ caveats_

ReportCaveats algotradelib::backtest::Report::caveats_

What this run assumed and did not model.

Definition at line 301 of file report.hpp.

◆ closing_equity_

Decimal64 algotradelib::backtest::Report::closing_equity_

Equity at the last recorded point.

Definition at line 212 of file report.hpp.

◆ commission_by_currency_

std::vector<Money> algotradelib::backtest::Report::commission_by_currency_

Commission paid per currency.

Definition at line 258 of file report.hpp.

◆ commission_paid_

std::optional<Decimal64> algotradelib::backtest::Report::commission_paid_

Commission paid.

Includes the institution fee for executions charged a combined rate (ReportCaveats::inclusive_commission_executions_). Absent when nothing executed, when the executions span currencies (see commission_by_currency_), or when a sum did not fit.

Definition at line 256 of file report.hpp.

◆ executions_

std::size_t algotradelib::backtest::Report::executions_ {0}

The executions.

Definition at line 207 of file report.hpp.

◆ halted_

std::optional<BrokerError> algotradelib::backtest::Report::halted_

Why the replay stopped early, if it did; read this before any figure.

Set when an execution could not be costed, the ledger could not record one, or positions could not be marked at a bar's close (mark_not_representable). The figures cover the bars up to that point; the halting bar is counted in bars_, and fills settled on it before the refusal are included. Nothing ran after the refusal, and on_stop was not called.

Definition at line 296 of file report.hpp.

◆ institution_by_currency_

std::vector<Money> algotradelib::backtest::Report::institution_by_currency_

Institution fees per currency.

Partial when ReportCaveats::inclusive_commission_executions_ is nonzero: it covers only the executions whose rate split the fee.

Definition at line 272 of file report.hpp.

◆ institution_fees_paid_

std::optional<Decimal64> algotradelib::backtest::Report::institution_fees_paid_

Institution fees (유관기관제비용) paid.

Absent unless every execution's rate split the fee out; also under the same currency rule as commission_paid_.

Definition at line 265 of file report.hpp.

◆ max_drawdown_

math::Scalar algotradelib::backtest::Report::max_drawdown_ {0}

The worst peak-to-trough decline of equity, as a non-negative fraction.

Definition at line 240 of file report.hpp.

◆ opening_equity_

Decimal64 algotradelib::backtest::Report::opening_equity_

Equity at the first recorded point.

Definition at line 210 of file report.hpp.

◆ refused_

std::size_t algotradelib::backtest::Report::refused_ {0}

Instructions a risk guard refused.

Definition at line 286 of file report.hpp.

◆ rejected_

std::size_t algotradelib::backtest::Report::rejected_ {0}

Instructions not placed: reconciliation could not build them, or the replay cannot model them (BINDING_REFUSED).

Definition at line 284 of file report.hpp.

◆ sharpe_

math::Scalar algotradelib::backtest::Report::sharpe_ {0}

The per-period Sharpe ratio; see analytics::sharpe.

math::undefined() when equity was zero or negative at any point but the last: the periods that follow have no return, and a ratio over the rest would describe a run that did not happen.

Definition at line 226 of file report.hpp.

◆ slippage_by_currency_

std::vector<Money> algotradelib::backtest::Report::slippage_by_currency_

Slippage given up per currency.

Definition at line 281 of file report.hpp.

◆ slippage_paid_

std::optional<Decimal64> algotradelib::backtest::Report::slippage_paid_

Slippage given up, in money.

Absent when nothing executed, the executions span currencies, or a sum did not fit; see slippage_by_currency_.

Definition at line 279 of file report.hpp.

◆ sortino_

math::Scalar algotradelib::backtest::Report::sortino_ {0}

The per-period Sortino ratio; see analytics::sortino.

math::undefined() when equity was zero or negative at any point but the last, as sharpe_.

Definition at line 238 of file report.hpp.

◆ tax_by_currency_

std::vector<Money> algotradelib::backtest::Report::tax_by_currency_

Sale tax paid per currency, over executions in the taxed market.

Definition at line 311 of file report.hpp.

◆ tax_paid_

std::optional<Decimal64> algotradelib::backtest::Report::tax_paid_

Sale tax paid.

Absent when no tax was modelled (which is not a tax of zero), nothing executed in the taxed market, the executions in the taxed market span currencies, or a sum did not fit. Untaxed executions in other currencies do not affect it.

Definition at line 309 of file report.hpp.

◆ total_return_

math::Scalar algotradelib::backtest::Report::total_return_ {0}

The total return over the replay, as a fraction; math::undefined() when the opening equity is zero or negative (a replay may start with negative cash), math::missing() when every execution was in another currency than the curve's (ReportCaveats::other_currency_executions_).

Definition at line 218 of file report.hpp.

◆ total_turnover_

math::Scalar algotradelib::backtest::Report::total_turnover_ {0}

One-way turnover summed over the replay, as a fraction of equity.

missing() when any execution was in a currency other than the equity curve's (whatever the opening equity), and otherwise math::undefined() when the opening equity is zero or negative.

Definition at line 247 of file report.hpp.


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