![]() |
algotradelib 0.0.0.9000
C++ header-only library for algorithmic trading
|
Turns successive working-order listings into order updates: the rows that changed since the previous listing. More...
#include <algotradelib/src/runner/order_updates.hpp>
Public Member Functions | |
| std::vector< OrderSnapshot > | changed (const std::vector< WorkingOrder< Broker > > &rows) |
| Compares a listing with the previous one and returns the rows that changed. | |
| void | adopt (const std::vector< WorkingOrder< Broker > > &rows) |
| Takes a listing as the baseline without reporting anything (such as the startup read, which appears in Portfolio::working_ instead). | |
| std::size_t | untracked_rows () const noexcept |
| Returns how many rows had an empty reference, and so were never reported. | |
| std::size_t | tracked_orders () const noexcept |
| Returns how many orders the watch is tracking. | |
| std::size_t | contradicted_rows () const noexcept |
| Returns how many times a listing stated one order twice with disagreeing readings (and so it was not reported). | |
Turns successive working-order listings into order updates: the rows that changed since the previous listing.
Runner feeds each update to on_order_update; a live loop and a backtest both use it.
What a caller is told: what the broker last stated about an order it still lists. An order that leaves the listing produces nothing, because the listing does not say whether it filled, was cancelled, expired or was rejected. Whether a listing can show a terminal status at all is BrokerCaps::working_orders_state_terminal (false for every shipped broker).
A change is a difference in status_, execution_.filled_quantity_, price_, trigger_price_, quantity_, order_amount_ or canceled_at_, compared as numbers whatever their decimal scale. Identity fields and fill money (average price, amounts, fees, fill time) are not compared; read them off the row. A new row is reported; two UNKNOWN statuses in a row are not a change.
Rows are matched by OrderRef (both parts). A row with an empty reference is counted in untracked_rows() and never reported; a runner's reservation row (WorkingOrder::reserved_) is skipped.
| Broker | The broker tag. |
Definition at line 97 of file order_updates.hpp.
|
inline |
Takes a listing as the baseline without reporting anything (such as the startup read, which appears in Portfolio::working_ instead).
| rows | The complete listing. |
Definition at line 119 of file order_updates.hpp.
|
inline |
Compares a listing with the previous one and returns the rows that changed.
A row not seen before is returned. Rows missing from rows are forgotten, so an order that leaves and returns is reported again as new. An order listed twice with disagreeing readings is not reported and is counted in contradicted_rows().
| rows | The complete listing, every page; a partial listing makes orders appear and disappear. The shipped adapters return complete listings. |
Definition at line 110 of file order_updates.hpp.
|
inlinenoexcept |
Returns how many times a listing stated one order twice with disagreeing readings (and so it was not reported).
Definition at line 141 of file order_updates.hpp.
|
inlinenoexcept |
Returns how many orders the watch is tracking.
Definition at line 134 of file order_updates.hpp.
|
inlinenoexcept |
Returns how many rows had an empty reference, and so were never reported.
Definition at line 127 of file order_updates.hpp.