![]() |
algotradelib 0.0.0.9000
C++ header-only library for algorithmic trading
|
The replay's executor: accepts orders and holds them until they fill or are withdrawn. More...
#include <algotradelib/src/backtest/engine.hpp>
Public Member Functions | |
| runner::SendOutcome | place (const strategy::PlannedOrder &order) |
| Accepts and queues an order, issuing it a reference. | |
| runner::SendOutcome | cancel (const WorkingOrder< BrokerTag > &working) |
| Withdraws the order a working row names, matched by reference. | |
| std::optional< OrderRef< BrokerTag > > | last_ref () const |
| Returns the reference issued to the most recently accepted order. | |
| const std::vector< QueuedOrder< BrokerTag > > & | queued () const noexcept |
| Returns every outstanding order. | |
| const QueuedOrder< BrokerTag > * | find (const OrderRef< BrokerTag > &ref) const |
| Finds an outstanding order. | |
| void | assign_session (const OrderRef< BrokerTag > &ref, Date session) |
| Records the session date of a queued order; see QueuedOrder::session_. | |
| bool | withdraw (const OrderRef< BrokerTag > &ref) |
| Removes an order from the queue. | |
| bool | release (const OrderRef< BrokerTag > &ref) |
| Marks a queued stop-limit order as released. | |
| void | open_bar () noexcept |
| Starts the next bar; orders accepted from now on cannot fill against it. | |
| std::uint64_t | bar () const noexcept |
| Returns the bar being replayed. | |
| void | deciding_at (std::chrono::system_clock::time_point at, bool exact=true) |
| Sets the decision instant stamped on orders accepted from now on. | |
Static Public Member Functions | |
| static bool | can_model (const strategy::PlannedOrder &order) noexcept |
| Tests whether a replay can price an order from bars. | |
| static constexpr bool | models_time_in_force (TimeInForce condition) noexcept |
| Tests whether the replay models a limit or market order's time in force. | |
Static Public Attributes | |
| static constexpr bool | reaches_a_broker = false |
| false: a replay reaches no broker. | |
The replay's executor: accepts orders and holds them until they fill or are withdrawn.
queued() is always the complete set of outstanding orders; the engine shows them to the strategy as working orders.
| BrokerTag | The order-reference tag. |
Definition at line 87 of file engine.hpp.
|
inline |
Records the session date of a queued order; see QueuedOrder::session_.
| ref | The order. |
| session | The session's market-local date. |
Definition at line 221 of file engine.hpp.
|
inlinenoexcept |
Returns the bar being replayed.
Definition at line 269 of file engine.hpp.
|
inlinestaticnoexcept |
Tests whether a replay can price an order from bars.
Only regular-session limit and market orders without a trigger, and DAY stop-limit orders with both a trigger and a limit price. Best-limit, primary-limit, mid-price, conditional-limit and closing-price orders need a book or a session close that bars do not carry.
| order | The order. |
Definition at line 129 of file engine.hpp.
|
inline |
Withdraws the order a working row names, matched by reference.
| working | The working row. |
Definition at line 180 of file engine.hpp.
|
inline |
Sets the decision instant stamped on orders accepted from now on.
| at | The instant. |
| exact | Whether at is exact or only an upper bound; see QueuedOrder::decision_is_exact_. |
Definition at line 276 of file engine.hpp.
|
inline |
Finds an outstanding order.
| ref | The reference. |
Definition at line 207 of file engine.hpp.
|
inline |
Returns the reference issued to the most recently accepted order.
Definition at line 194 of file engine.hpp.
|
inlinestaticconstexprnoexcept |
Tests whether the replay models a limit or market order's time in force.
A day order rests on later bars until the session ends; every other condition is filled or not on the next bar and not kept after it (NextBarFillModel::rests_unfilled), which is how an UNKNOWN one is replayed too.
| condition | The condition. |
Definition at line 163 of file engine.hpp.
|
inlinenoexcept |
Starts the next bar; orders accepted from now on cannot fill against it.
Definition at line 263 of file engine.hpp.
|
inline |
Accepts and queues an order, issuing it a reference.
A replay invents no transport failure.
| order | The order. |
Definition at line 103 of file engine.hpp.
|
inlinenoexcept |
Returns every outstanding order.
Definition at line 200 of file engine.hpp.
|
inline |
Marks a queued stop-limit order as released.
| ref | The order. |
Definition at line 250 of file engine.hpp.
|
inline |
Removes an order from the queue.
| ref | The order. |
Definition at line 235 of file engine.hpp.
|
staticconstexpr |
false: a replay reaches no broker.
Definition at line 91 of file engine.hpp.