algotradelib 0.0.0.9000
C++ header-only library for algorithmic trading
Loading...
Searching...
No Matches
algotradelib::backtest::QueuedOrder< BrokerTag > Struct Template Reference

One order a replay accepted and has not yet filled or withdrawn. More...

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

Collaboration diagram for algotradelib::backtest::QueuedOrder< BrokerTag >:

Public Attributes

strategy::PlannedOrder order_
 The order as reconciliation planned it.
OrderRef< BrokerTag > ref_
 The reference the replay issued for it.
std::uint64_t accepted_on_ {0}
 The bar it was accepted during; it cannot fill against that bar.
std::optional< std::chrono::system_clock::time_point > decided_at_
 When the strategy decided the order, if known.
bool decision_is_exact_ {true}
 Whether decided_at_ is enforced strictly, or only a nominal upper bound (the period end of an open-stamped daily or longer bar).
bool released_ {false}
 Whether a stop-limit order has been released, so it now rests as its limit.
std::optional< Decimal64 > decision_price_
 The order's instrument's last price when the strategy decided it, for a market-price rule (NextBarFillModel::with_market_price); stamped by Backtester after the pass that placed it. For an order placed in on_fill it is the close before the fill bar, which is priced only after settlement.
std::optional< std::chrono::system_clock::time_point > decision_price_at_
 When decision_price_ was observed: the period end of the bar, or the time of the quote, it came from. Older than the decision when the instrument had no newer price, as after a halt.
std::optional< Date > session_
 The market-local date of the session a DAY order lives in, once known (the date of the first bar it could trade against); Backtester withdraws it when that session ends.

Detailed Description

template<typename BrokerTag>
struct algotradelib::backtest::QueuedOrder< BrokerTag >

One order a replay accepted and has not yet filled or withdrawn.

Template Parameters
BrokerTagThe order-reference tag.

Definition at line 44 of file engine.hpp.

Member Data Documentation

◆ accepted_on_

template<typename BrokerTag>
std::uint64_t algotradelib::backtest::QueuedOrder< BrokerTag >::accepted_on_ {0}

The bar it was accepted during; it cannot fill against that bar.

Definition at line 50 of file engine.hpp.

◆ decided_at_

template<typename BrokerTag>
std::optional<std::chrono::system_clock::time_point> algotradelib::backtest::QueuedOrder< BrokerTag >::decided_at_

When the strategy decided the order, if known.

Where the engine knows when a bar's period began and this instant is exact, the order may fill only against a bar whose period began at or after it (so a decision at 10:30 is not filled at that day's 09:00 open). A nominal instant (decision_is_exact_ false) is an upper bound: a start at or after it still proves the order came first, while an earlier start is allowed and counted in ReplayResult::unchecked_fill_causality_. Empty (an order placed by a caller driving the executor directly) is always eligible.

Definition at line 61 of file engine.hpp.

◆ decision_is_exact_

template<typename BrokerTag>
bool algotradelib::backtest::QueuedOrder< BrokerTag >::decision_is_exact_ {true}

Whether decided_at_ is enforced strictly, or only a nominal upper bound (the period end of an open-stamped daily or longer bar).

Strict for every intraday bar, including a session's last one cut short by the close, whose derived end is late rather than exact: a late bound defers a fill and never credits an earlier price.

Definition at line 69 of file engine.hpp.

◆ decision_price_

template<typename BrokerTag>
std::optional<Decimal64> algotradelib::backtest::QueuedOrder< BrokerTag >::decision_price_

The order's instrument's last price when the strategy decided it, for a market-price rule (NextBarFillModel::with_market_price); stamped by Backtester after the pass that placed it. For an order placed in on_fill it is the close before the fill bar, which is priced only after settlement.

Definition at line 81 of file engine.hpp.

◆ decision_price_at_

template<typename BrokerTag>
std::optional<std::chrono::system_clock::time_point> algotradelib::backtest::QueuedOrder< BrokerTag >::decision_price_at_

When decision_price_ was observed: the period end of the bar, or the time of the quote, it came from. Older than the decision when the instrument had no newer price, as after a halt.

Definition at line 86 of file engine.hpp.

◆ order_

template<typename BrokerTag>
strategy::PlannedOrder algotradelib::backtest::QueuedOrder< BrokerTag >::order_

The order as reconciliation planned it.

Definition at line 46 of file engine.hpp.

◆ ref_

template<typename BrokerTag>
OrderRef<BrokerTag> algotradelib::backtest::QueuedOrder< BrokerTag >::ref_

The reference the replay issued for it.

Definition at line 48 of file engine.hpp.

◆ released_

template<typename BrokerTag>
bool algotradelib::backtest::QueuedOrder< BrokerTag >::released_ {false}

Whether a stop-limit order has been released, so it now rests as its limit.

The order itself (and the strategy's working row) still reads as a stop, as a live listing does.

Definition at line 75 of file engine.hpp.

◆ session_

template<typename BrokerTag>
std::optional<Date> algotradelib::backtest::QueuedOrder< BrokerTag >::session_

The market-local date of the session a DAY order lives in, once known (the date of the first bar it could trade against); Backtester withdraws it when that session ends.

Definition at line 91 of file engine.hpp.


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