algotradelib 0.0.0.9000
C++ header-only library for algorithmic trading
Loading...
Searching...
No Matches
algotradelib::runner::ManualSource< Runner > Class Template Reference

A source for tests: each poll returns a queued or default outcome, without any network. More...

#include <algotradelib/src/runner/loop.hpp>

Public Member Functions

void queue (PollKind kind, PollOutcome outcome)
 Queues the outcome of the next poll of a kind.
void set_default (PollKind kind, PollOutcome outcome)
 Sets the outcome of every unqueued poll of a kind (UNCHANGED by default).
void set_order_list (PollOutcome outcome)
 Sets the outcome of the order-list read (UPDATED by default).
void set_buying_power_currencies (std::vector< Currency > currencies)
 Sets the buying-power currencies the source claims to ask about.
void set_calendar (TradingCalendar calendar)
 Sets the calendar a successful calendar poll installs, and makes that poll default to UPDATED.
const std::vector< Currency > & buying_power_currencies () const noexcept
 Returns the buying-power currencies.
std::size_t order_list_reads () const noexcept
 Returns how many times the order list was read.
std::size_t polls (PollKind kind) const noexcept
 Returns how many times a kind was polled.
void set_price_limits (InstrumentId instrument, PriceLimits limits)
 Adds a band a successful price-limits poll installs, and makes that poll default to UPDATED.
PollOutcome poll (PollKind kind, Runner &runner_instance)
 Polls: returns the next queued outcome or the default, and on UPDATED installs the calendar or bands set for that kind.
PollOutcome read_order_list (Runner &)
 Reads the order list: returns the configured outcome. The runner argument is ignored.

Static Public Attributes

static constexpr bool provides_working_orders = true
 true: its outcomes stand for a real working-order listing.

Detailed Description

template<typename Runner>
class algotradelib::runner::ManualSource< Runner >

A source for tests: each poll returns a queued or default outcome, without any network.

It installs a calendar only during PollKind::CALENDAR (see set_calendar), the rule every source must follow.

Template Parameters
RunnerThe runner type.

Definition at line 801 of file loop.hpp.

Member Function Documentation

◆ buying_power_currencies()

template<typename Runner>
const std::vector< Currency > & algotradelib::runner::ManualSource< Runner >::buying_power_currencies ( ) const
inlinenoexcept

Returns the buying-power currencies.

Returns
The currencies.

Definition at line 852 of file loop.hpp.

◆ order_list_reads()

template<typename Runner>
std::size_t algotradelib::runner::ManualSource< Runner >::order_list_reads ( ) const
inlinenoexcept

Returns how many times the order list was read.

Returns
The count.

Definition at line 858 of file loop.hpp.

◆ poll()

template<typename Runner>
PollOutcome algotradelib::runner::ManualSource< Runner >::poll ( PollKind kind,
Runner & runner_instance )
inline

Polls: returns the next queued outcome or the default, and on UPDATED installs the calendar or bands set for that kind.

Parameters
kindThe kind.
runner_instanceThe runner to install into.
Returns
The outcome.

Definition at line 885 of file loop.hpp.

◆ polls()

template<typename Runner>
std::size_t algotradelib::runner::ManualSource< Runner >::polls ( PollKind kind) const
inlinenoexcept

Returns how many times a kind was polled.

Parameters
kindThe kind.
Returns
The count.

Definition at line 865 of file loop.hpp.

◆ queue()

template<typename Runner>
void algotradelib::runner::ManualSource< Runner >::queue ( PollKind kind,
PollOutcome outcome )
inline

Queues the outcome of the next poll of a kind.

Parameters
kindThe kind.
outcomeThe outcome.

Definition at line 811 of file loop.hpp.

◆ read_order_list()

template<typename Runner>
PollOutcome algotradelib::runner::ManualSource< Runner >::read_order_list ( Runner & )
inline

Reads the order list: returns the configured outcome. The runner argument is ignored.

Returns
The outcome.

Definition at line 914 of file loop.hpp.

◆ set_buying_power_currencies()

template<typename Runner>
void algotradelib::runner::ManualSource< Runner >::set_buying_power_currencies ( std::vector< Currency > currencies)
inline

Sets the buying-power currencies the source claims to ask about.

Parameters
currenciesThe currencies.

Definition at line 834 of file loop.hpp.

◆ set_calendar()

template<typename Runner>
void algotradelib::runner::ManualSource< Runner >::set_calendar ( TradingCalendar calendar)
inline

Sets the calendar a successful calendar poll installs, and makes that poll default to UPDATED.

Parameters
calendarThe calendar.

Definition at line 843 of file loop.hpp.

◆ set_default()

template<typename Runner>
void algotradelib::runner::ManualSource< Runner >::set_default ( PollKind kind,
PollOutcome outcome )
inline

Sets the outcome of every unqueued poll of a kind (UNCHANGED by default).

Parameters
kindThe kind.
outcomeThe outcome.

Definition at line 820 of file loop.hpp.

◆ set_order_list()

template<typename Runner>
void algotradelib::runner::ManualSource< Runner >::set_order_list ( PollOutcome outcome)
inline

Sets the outcome of the order-list read (UPDATED by default).

Parameters
outcomeThe outcome.

Definition at line 828 of file loop.hpp.

◆ set_price_limits()

template<typename Runner>
void algotradelib::runner::ManualSource< Runner >::set_price_limits ( InstrumentId instrument,
PriceLimits limits )
inline

Adds a band a successful price-limits poll installs, and makes that poll default to UPDATED.

Parameters
instrumentThe instrument.
limitsThe band.

Definition at line 873 of file loop.hpp.

Member Data Documentation

◆ provides_working_orders

template<typename Runner>
bool algotradelib::runner::ManualSource< Runner >::provides_working_orders = true
staticconstexpr

true: its outcomes stand for a real working-order listing.

Definition at line 804 of file loop.hpp.


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