![]() |
algotradelib 0.0.0.9000
C++ header-only library for algorithmic trading
|
Calls a strategy's handlers, skipping the ones it does not declare. More...
Functions | |
| template<typename S, typename Ctx> | |
| void | start (S &strategy, Ctx &context) |
| Calls strategy.on_start(context) if the strategy declares on_start; otherwise does nothing. | |
| template<typename S, typename Ctx> | |
| void | stop (S &strategy, Ctx &context) |
| Calls strategy.on_stop(context) if the strategy declares on_stop; otherwise does nothing. | |
| template<typename S, typename Ctx> | |
| void | bar (S &strategy, Ctx &context, const BarEvent &event) |
| Calls strategy.on_bar(context, event) if the strategy declares on_bar; otherwise does nothing. | |
| template<typename S, typename Ctx> | |
| void | bars (S &strategy, Ctx &context, const BarSlice &slice) |
| Calls strategy.on_bars(context, slice) if the strategy declares on_bars; otherwise does nothing. | |
| template<typename S, typename Ctx> | |
| void | quote (S &strategy, Ctx &context, const QuoteEvent &event) |
| Calls strategy.on_quote(context, event) if the strategy declares on_quote; otherwise does nothing. | |
| template<typename S, typename Ctx> | |
| void | fill (S &strategy, Ctx &context, const Fill &event) |
| Calls strategy.on_fill(context, event) if the strategy declares on_fill; otherwise does nothing. | |
| template<typename S, typename Ctx> | |
| void | order_update (S &strategy, Ctx &context, const OrderSnapshot &event) |
| Calls strategy.on_order_update(context, event) if the strategy declares on_order_update; otherwise does nothing. | |
| template<typename S, typename Ctx> | |
| void | phase (S &strategy, Ctx &context, const MarketPhase &event) |
| Calls strategy.on_phase(context, event) if the strategy declares on_phase; otherwise does nothing. | |
Calls a strategy's handlers, skipping the ones it does not declare.
A handler the strategy declares is always called; if its signature does not fit the call (a non-const event, a missing event, a context taken by value), compilation fails here rather than the handler being skipped. A wrapper strategy that forwards to an inner strategy through these functions gets the same check for the inner one.
| void algotradelib::strategy::dispatch::bar | ( | S & | strategy, |
| Ctx & | context, | ||
| const BarEvent & | event ) |
Calls strategy.on_bar(context, event) if the strategy declares on_bar; otherwise does nothing.
Does not compile for a strategy that declares on_bars: its bars go through bars, so a path that still delivers one BarEvent at a time fails to build instead of skipping the strategy in silence.
| S | The strategy type; a class that is not final. |
| Ctx | The context type. |
| strategy | The strategy. |
| context | The context passed to the handler. |
| event | The event passed to the handler. |
Definition at line 191 of file concept.hpp.
Referenced by bar().
| void algotradelib::strategy::dispatch::bars | ( | S & | strategy, |
| Ctx & | context, | ||
| const BarSlice & | slice ) |
Calls strategy.on_bars(context, slice) if the strategy declares on_bars; otherwise does nothing.
| S | The strategy type; a class that is not final. |
| Ctx | The context type. |
| strategy | The strategy. |
| context | The context passed to the handler. |
| slice | The slice passed to the handler. |
Definition at line 218 of file concept.hpp.
Referenced by bars().
| void algotradelib::strategy::dispatch::fill | ( | S & | strategy, |
| Ctx & | context, | ||
| const Fill & | event ) |
Calls strategy.on_fill(context, event) if the strategy declares on_fill; otherwise does nothing.
| S | The strategy type; a class that is not final. |
| Ctx | The context type. |
| strategy | The strategy. |
| context | The context passed to the handler. |
| event | The event passed to the handler. |
Definition at line 261 of file concept.hpp.
Referenced by fill().
| void algotradelib::strategy::dispatch::order_update | ( | S & | strategy, |
| Ctx & | context, | ||
| const OrderSnapshot & | event ) |
Calls strategy.on_order_update(context, event) if the strategy declares on_order_update; otherwise does nothing.
| S | The strategy type; a class that is not final. |
| Ctx | The context type. |
| strategy | The strategy. |
| context | The context passed to the handler. |
| event | The event passed to the handler. |
Definition at line 282 of file concept.hpp.
Referenced by order_update().
| void algotradelib::strategy::dispatch::phase | ( | S & | strategy, |
| Ctx & | context, | ||
| const MarketPhase & | event ) |
Calls strategy.on_phase(context, event) if the strategy declares on_phase; otherwise does nothing.
| S | The strategy type; a class that is not final. |
| Ctx | The context type. |
| strategy | The strategy. |
| context | The context passed to the handler. |
| event | The new phase, passed as a const reference. |
Definition at line 304 of file concept.hpp.
Referenced by phase().
| void algotradelib::strategy::dispatch::quote | ( | S & | strategy, |
| Ctx & | context, | ||
| const QuoteEvent & | event ) |
Calls strategy.on_quote(context, event) if the strategy declares on_quote; otherwise does nothing.
| S | The strategy type; a class that is not final. |
| Ctx | The context type. |
| strategy | The strategy. |
| context | The context passed to the handler. |
| event | The event passed to the handler. |
Definition at line 240 of file concept.hpp.
Referenced by quote().
| void algotradelib::strategy::dispatch::start | ( | S & | strategy, |
| Ctx & | context ) |
Calls strategy.on_start(context) if the strategy declares on_start; otherwise does nothing.
| S | The strategy type; a class that is not final. |
| Ctx | The context type. |
| strategy | The strategy. |
| context | The context passed to the handler. |
Definition at line 149 of file concept.hpp.
Referenced by start().
| void algotradelib::strategy::dispatch::stop | ( | S & | strategy, |
| Ctx & | context ) |
Calls strategy.on_stop(context) if the strategy declares on_stop; otherwise does nothing.
| S | The strategy type; a class that is not final. |
| Ctx | The context type. |
| strategy | The strategy. |
| context | The context passed to the handler. |
Definition at line 168 of file concept.hpp.
Referenced by stop().