algotradelib 0.0.0.9000
C++ header-only library for algorithmic trading
Loading...
Searching...
No Matches
fill.hpp File Reference

The backtest fill model: whether a queued order trades against the next bar, and at what price and cost. More...

#include "./cost.hpp"
#include "./ledger.hpp"
#include "../strategy/event.hpp"
#include "../strategy/reconcile.hpp"
#include <algotradelib/core>
#include <functional>
#include <optional>
#include <stdexcept>
#include <string>
#include <utility>
Include dependency graph for fill.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  algotradelib::backtest::FillDecision
 What NextBarFillModel::decide concluded about one order and one bar. More...
struct  algotradelib::backtest::MarketPriceInput
 What a market-price rule is given (see NextBarFillModel::with_market_price). More...
struct  algotradelib::backtest::SellTax
 A tax on sales, stated by the caller; see NextBarFillModel::with_sell_tax. More...
class  algotradelib::backtest::NextBarFillModel
 The fill model: market orders at the next bar's open, limit orders when the next bar's range reaches them, stop-limit orders once released. More...

Namespaces

namespace  algotradelib
 The library: broker-neutral types (core), and the modules below.
namespace  algotradelib::backtest
 Replays a strategy over stored bars: fill and cost models, the replay ledger, and the report.

Typedefs

using algotradelib::backtest::MarketPriceFunction = std::function<std::optional<Decimal64>(const MarketPriceInput&)>
 A market-price rule: the price a market order trades at against next_, before slippage, or nothing when it does not trade against that bar.

Enumerations

enum class  algotradelib::backtest::MarketPrice { algotradelib::backtest::NEXT_OPEN , algotradelib::backtest::DECISION_CLOSE , algotradelib::backtest::NEXT_CLOSE }
 A market-price rule the library ships; see NextBarFillModel::with_market_price(MarketPrice). More...

Detailed Description

The backtest fill model: whether a queued order trades against the next bar, and at what price and cost.

An order is always filled against the bar after the one that produced it, so a backtest cannot fill from a bar the strategy has just seen.

Definition in file fill.hpp.