![]() |
algotradelib 0.0.0.9000
C++ header-only library for algorithmic trading
|
Holds a long position sized so its value volatility per bar matches a risk budget. More...
#include <algotradelib/src/strategy/vanilla/sizing.hpp>
Classes | |
| struct | Params |
| The strategy's settings. More... | |
Public Member Functions | |
| std::size_t | warmup_bars () const |
| Returns how many bars to load before the first live bar. | |
| template<class Ctx> | |
| void | on_bar (Ctx &ctx, const BarEvent &bar) |
| States the volatility-sized target position on each bar of the instrument. | |
Public Attributes | |
| Params | params_ |
| The settings. | |
Holds a long position sized so its value volatility per bar matches a risk budget.
The target is q = budget / (price * s), where s is the sample standard deviation of the last window_ returns of the bars it is fed, capped at max_quantity_. The volatility is per bar of whatever interval arrives (a minute bar gives per-minute volatility); nothing converts it to a daily figure. Nothing is stated while the window is incomplete or flat. The budget is in currency, not a fraction of equity.
Definition at line 28 of file sizing.hpp.
|
inline |
States the volatility-sized target position on each bar of the instrument.
| Ctx | The runner's context type. |
| ctx | The context. |
| bar | The new bar. |
Definition at line 59 of file sizing.hpp.
|
inline |
Returns how many bars to load before the first live bar.
Definition at line 50 of file sizing.hpp.
| Params algotradelib::strategy::vanilla::VolatilityTargetSizing::params_ |