VolatilityManager¶
-
class
qf_lib.common.utils.volatility.volatility_manager.
VolatilityManager
(series: qf_lib.containers.series.qf_series.QFSeries, frequency: qf_lib.common.enums.frequency.Frequency = <Frequency.DAILY: 252>)[source]¶ Bases:
object
VolatilityManager uses rolling window to asses the historical volatility of a series. It is then using the results to find appropriate weights to be held in time in order to keep the volatility constant over time.
- Parameters
Methods
get_managed_series
(vol_level, window_size, …)- param vol_level
volatility level to be maintained expressed in number. for example 0.2 means 20% volatility
-
get_managed_series
(vol_level: float, window_size: int = 20, lag: int = 1, min_leverage: float = 0.25, max_leverage: float = 1) → qf_lib.containers.series.simple_returns_series.SimpleReturnsSeries[source]¶ - Parameters
vol_level (float) – volatility level to be maintained expressed in number. for example 0.2 means 20% volatility
window_size (int) – length of the window to asses the volatility
lag (int) – how many periods do we need in order to implement the reallocation. 1 means that already on close of the current day we adjust for the realised volatility of that day
min_leverage (float) – min leverage the the function is allowed to apply
max_leverage (float) – max leverage the the function is allowed to apply
- Returns
SimpleReturnsSeries containing returns of the series based on the input series passed in the constructor that is volatility managed according to the above parameters
- Return type