algotradelib 0.0.0.9000
C++ header-only library for algorithmic trading
Loading...
Searching...
No Matches
algotradelib::runner::IndeterminacyLedger Class Reference

The instruments with an order of unknown outcome, where nothing may be placed until the broker's order list is read and the instrument resolved. More...

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

Public Member Functions

void mark (const InstrumentId &id, std::string detail)
 Records an instrument's order of unknown outcome; an existing entry keeps its first detail.
bool requires_reconcile (const InstrumentId &id) const
 Tests whether an instrument is waiting for reconciliation.
std::string_view detail (const InstrumentId &id) const
 Returns why an instrument is unresolved.
void resolve_after_reading_orders (const InstrumentId &id)
 Clears an instrument; call it only after reading the broker's order list for it.
std::vector< InstrumentId > pending () const
 Returns every instrument waiting for reconciliation.
bool empty () const noexcept
 Tests whether nothing is unresolved.

Detailed Description

The instruments with an order of unknown outcome, where nothing may be placed until the broker's order list is read and the instrument resolved.

Named cancellations are not blocked. Only resolve_after_reading_orders clears an entry; reading the list alone does not. The ledger is in memory: it does not survive the process, and an order in flight when a process is killed is never recorded. After an abnormal exit, read the broker's order list before trading; PollingLoop does this before its first send, and a FileJournal (live::bind_journaled) carries unresolved instructions across a restart for recover_runner.

Note
Killing a runner does not cancel orders the broker already accepted.

Definition at line 518 of file execution.hpp.

Member Function Documentation

◆ detail()

std::string_view algotradelib::runner::IndeterminacyLedger::detail ( const InstrumentId & id) const
inline

Returns why an instrument is unresolved.

Parameters
idThe instrument.
Returns
The detail, or an empty view if it is resolved.

Definition at line 554 of file execution.hpp.

Referenced by mark().

◆ empty()

bool algotradelib::runner::IndeterminacyLedger::empty ( ) const
inlinenoexcept

Tests whether nothing is unresolved.

Returns
true if the ledger is empty.

Definition at line 593 of file execution.hpp.

◆ mark()

void algotradelib::runner::IndeterminacyLedger::mark ( const InstrumentId & id,
std::string detail )
inline

Records an instrument's order of unknown outcome; an existing entry keeps its first detail.

Parameters
idThe instrument.
detailA description.

Definition at line 525 of file execution.hpp.

Referenced by algotradelib::runner::recover_into().

◆ pending()

std::vector< InstrumentId > algotradelib::runner::IndeterminacyLedger::pending ( ) const
inline

Returns every instrument waiting for reconciliation.

Returns
The instruments.

Definition at line 580 of file execution.hpp.

◆ requires_reconcile()

bool algotradelib::runner::IndeterminacyLedger::requires_reconcile ( const InstrumentId & id) const
inline

Tests whether an instrument is waiting for reconciliation.

Parameters
idThe instrument.
Returns
true if nothing may be placed for it.

Definition at line 540 of file execution.hpp.

Referenced by algotradelib::runner::recover_into().

◆ resolve_after_reading_orders()

void algotradelib::runner::IndeterminacyLedger::resolve_after_reading_orders ( const InstrumentId & id)
inline

Clears an instrument; call it only after reading the broker's order list for it.

Parameters
idThe instrument.

Definition at line 567 of file execution.hpp.


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