qf_lib.common.utils.volatility.get_volatility.get_volatility(qf_series: QFSeries, frequency: Optional[Frequency] = None, annualise: bool = True) float[source]

Calculates a volatility for the given series of returns or prices. If a PricesSeries is given, the calculation window is shorter by 1 due to the initial conversion into returns.

  • qf_series (QFSeries) – series of prices/returns (as numbers, e.g. 0.5 corresponds to 50% return)

  • frequency (Frequency) – the frequency of samples in the returns series; it is only obligatory to specify frequency if the annualise parameter is set to True, which is a default value

  • annualise (bool) – True if the volatility values should be annualised; False otherwise. If it is set to True, then it is obligatory to specify a frequency of the returns series.


volatility for the whole series.

Return type: