algotradelib 0.0.0.9000
C++ header-only library for algorithmic trading
Loading...
Searching...
No Matches
algotradelib::strategy::SellableConventionProbe< Broker > Class Template Reference

Infers a broker's SellableConvention from successive portfolios. More...

#include <algotradelib/src/strategy/sellable_convention.hpp>

Inheritance diagram for algotradelib::strategy::SellableConventionProbe< Broker >:

Public Member Functions

void observe (const Portfolio< Broker > &portfolio)
 Records one polled portfolio, comparing it with the previous one.
void forget (const InstrumentId &instrument)
 Discards the last recorded reading for an instrument, so the next one is not compared across a gap.
SellableEvidence evidence (const InstrumentId &instrument) const
 Returns the evidence for one instrument.
SellableEvidence overall () const
 Returns the evidence summed over every instrument.
SellableConvention verdict () const
 Returns the broker's convention as observed so far.
const std::vector< std::pair< InstrumentId, SellableEvidence > > & per_instrument () const noexcept
 Returns the evidence per instrument.

Detailed Description

template<typename Broker>
class algotradelib::strategy::SellableConventionProbe< Broker >

Infers a broker's SellableConvention from successive portfolios.

Call observe with each polled portfolio. An observation is recorded only when, between two polls, an instrument's holding is unchanged, the resting sell quantity the broker reported grew, and the gap between held and sellable moved by exactly that amount (NET_OF_RESTING) or not at all (GROSS_OF_RESTING); anything else is discarded. Positions whose sellable basis is not enforceable, or which carry no sellable figure, are skipped, so with a broker that does not publish the figure the verdict stays UNDETERMINED.

Warning
Fed a backtest's portfolios, it learns the replay ledger's model (which reports sellable as held), not a broker's behaviour.
Template Parameters
BrokerThe broker tag of the portfolio.

Definition at line 104 of file sellable_convention.hpp.

Member Function Documentation

◆ evidence()

template<typename Broker>
SellableEvidence algotradelib::strategy::SellableConventionProbe< Broker >::evidence ( const InstrumentId & instrument) const
inline

Returns the evidence for one instrument.

Parameters
instrumentThe instrument.
Returns
Its counts, zero if nothing was observed.

Definition at line 166 of file sellable_convention.hpp.

◆ forget()

template<typename Broker>
void algotradelib::strategy::SellableConventionProbe< Broker >::forget ( const InstrumentId & instrument)
inline

Discards the last recorded reading for an instrument, so the next one is not compared across a gap.

Parameters
instrumentThe instrument.

Definition at line 152 of file sellable_convention.hpp.

Referenced by observe().

◆ observe()

template<typename Broker>
void algotradelib::strategy::SellableConventionProbe< Broker >::observe ( const Portfolio< Broker > & portfolio)
inline

Records one polled portfolio, comparing it with the previous one.

Parameters
portfolioThe portfolio.

Definition at line 110 of file sellable_convention.hpp.

◆ overall()

template<typename Broker>
SellableEvidence algotradelib::strategy::SellableConventionProbe< Broker >::overall ( ) const
inline

Returns the evidence summed over every instrument.

Returns
The counts for the broker as a whole.

Definition at line 177 of file sellable_convention.hpp.

Referenced by verdict().

◆ per_instrument()

template<typename Broker>
const std::vector< std::pair< InstrumentId, SellableEvidence > > & algotradelib::strategy::SellableConventionProbe< Broker >::per_instrument ( ) const
inlinenoexcept

Returns the evidence per instrument.

Returns
Each instrument that contributed an observation, with its counts.

Definition at line 196 of file sellable_convention.hpp.

◆ verdict()

template<typename Broker>
SellableConvention algotradelib::strategy::SellableConventionProbe< Broker >::verdict ( ) const
inline

Returns the broker's convention as observed so far.

Returns
overall().verdict().

Definition at line 190 of file sellable_convention.hpp.


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