algotradelib 0.0.0.9000
C++ header-only library for algorithmic trading
Loading...
Searching...
No Matches
algotradelib::strategy::Fill Struct Reference

One execution of an order the strategy placed, delivered to on_fill. More...

#include <algotradelib/src/strategy/event.hpp>

Collaboration diagram for algotradelib::strategy::Fill:

Public Attributes

std::string order_id_
 The id of the order that traded: the broker's, or in a backtest the replay's.
InstrumentId instrument_
 The instrument traded.
OrderSide side_ {OrderSide::BUY}
 The side of the order.
Decimal64 quantity_
 The quantity of this execution, not the order's running total.
Decimal64 price_
 The execution price.
std::string tag_
 The tag of the intent that produced the order.
std::chrono::system_clock::time_point at_ {}
 When the execution happened.

Detailed Description

One execution of an order the strategy placed, delivered to on_fill.

Each execution is its own event, so a partial fill arrives as several; quantity_ is this execution's quantity, and the order's running total is in the portfolio. order_id_ names the order that traded: by the broker's id where the source states one, and in a Backtester by the id the replay issued the order, the one its on_order_update events carry. A replay's fill can come with no update at all (an order placed and filled between two observations), so the id joins a fill to its order, not necessarily to an update. A replay's ids are its own: another replay restarts them, so a chained result (backtest::chain_results) can repeat one across folds. A fill from backtest::NextBarFillModel::decide called directly has none, and live, on_fill does not fire (Runner::on_fill_never_fires). Look orders up in ctx.portfolio().

Warning
A backtest delivers fills, but the shipped live loop never does: no broker inquiry produces a Fill. A strategy that reacts to fills in on_fill (for example, to set a stop) does nothing live. Live, executions show up through on_order_update and the portfolio.

Definition at line 886 of file event.hpp.

Member Data Documentation

◆ at_

std::chrono::system_clock::time_point algotradelib::strategy::Fill::at_ {}

When the execution happened.

Definition at line 900 of file event.hpp.

Referenced by algotradelib::backtest::NextBarFillModel::decide().

◆ instrument_

InstrumentId algotradelib::strategy::Fill::instrument_

The instrument traded.

Definition at line 890 of file event.hpp.

Referenced by algotradelib::backtest::NextBarFillModel::decide().

◆ order_id_

std::string algotradelib::strategy::Fill::order_id_

The id of the order that traded: the broker's, or in a backtest the replay's.

Definition at line 888 of file event.hpp.

◆ price_

Decimal64 algotradelib::strategy::Fill::price_

The execution price.

Definition at line 896 of file event.hpp.

Referenced by algotradelib::backtest::NextBarFillModel::decide().

◆ quantity_

Decimal64 algotradelib::strategy::Fill::quantity_

The quantity of this execution, not the order's running total.

Definition at line 894 of file event.hpp.

Referenced by algotradelib::backtest::NextBarFillModel::decide().

◆ side_

OrderSide algotradelib::strategy::Fill::side_ {OrderSide::BUY}

The side of the order.

Definition at line 892 of file event.hpp.

Referenced by algotradelib::backtest::NextBarFillModel::decide().

◆ tag_

std::string algotradelib::strategy::Fill::tag_

The tag of the intent that produced the order.

Definition at line 898 of file event.hpp.

Referenced by algotradelib::backtest::NextBarFillModel::decide().


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