DriftIndependentVolatility

class qf_lib.common.utils.volatility.drift_independent_volatility.DriftIndependentVolatility[source]

Bases: object

Methods:

get_volatility(ohlc[, frequency, annualise, ...])

Implementation of the algorithm described in 'Drift Independent Volatility Estimation Based on High, Low, Open and Close Prices', developed by Dennis Yang and Qiang Zhang, published in June 2000 issue of Journal of Business.

static get_volatility(ohlc: PricesDataFrame, frequency: Optional[Frequency] = None, annualise: bool = True, alpha: Optional[float] = None) float[source]

Implementation of the algorithm described in ‘Drift Independent Volatility Estimation Based on High, Low, Open and Close Prices’, developed by Dennis Yang and Qiang Zhang, published in June 2000 issue of Journal of Business. The new estimator has the following nice properties:

  • unbiased in the continuous limit,

  • independent of the drift,

  • dealing with opening price jumps in a consistent way,

  • smallest variance among all estimators with the similar properties.

Parameters:
  • ohlc (PricesDataFrame) – QFDataFrame consisting of four QFPricesSeries: open, high, low, close

  • 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.

  • alpha (float) – expectation of u(u-c)+d(d-c) squared, values in range of (1.331, 1.5); authors of the algorithm suggest 1.34 in practice

Returns:

Drift Independent Volatility of type float

Return type:

float