hf Module

The hf module provides functions for synchronization of asynchronously observed multivariate time series and observation noise cancelling. When possible, functions are parallelized and accelerated via JIT compilation with Numba. By default all cores of your machine are used. If your pipeline allows for parallelization on a higher level, it is preferable to do so. You may manually set the number of cores used by setting numba.set_num_threads(n). Every estimator takes tick_series_list as the first argument. This is a list of pd.Series (one for each asset) containing tick log-prices with pandas.DatetimeIndex. If you want to comute the covariance of residuals after predictions are subtracted from log-returnsjust cumsum the residuals. The output is the integrated covariance matrix estimate as a 2d numpy.ndarray.

Functions

ensemble(estimates, var_weights, cov_weights)

Ensemble multiple covariance matrix estimates with weights given by var_weights and cov_weights for the diagonal and off-diagonal elements, respectively.

gamma(data, h)

The h-th realized autocovariance.

get_bandwidth(n, var_ret, var_noise, kernel)

Compute the optimal bandwidth parameter $H$ for krvm() according to Barndorff-Nielsen et al.

get_cumu_demeaned_resid(price[, y_hat])

From a pd.Series of tick prices and predictions get a pd.Series of tick log-prices with zero-mean returns, i.e.

hayashi_yoshida(tick_series_list[, theta, k])

The (pairwise) Hayashi-Yoshida estimator of Hayashi and Yoshida (2005).

krvm(tick_series_list, H[, pairwise, kernel])

The kernel realized volatility matrix estimator (KRVM) of Barndorff-Nielsen et al.

mrc(tick_series_list[, theta, g, …])

The modulated realised covariance (MRC) estimator of Christensen et al.

msrc(tick_series_list[, M, N, pairwise])

The multi-scale realized volatility (MSRV) estimator of Zhang (2006).

parzen_kernel(x)

The Parzen weighting function used in the kernel realized volatility matrix estimator (krvm()) of Barndorff-Nielsen et al.

preaverage(data[, K, g, return_K])

The preaveraging scheme of Podolskij and Vetter (2009).

quadratic_spectral_kernel(x)

The Quadratic Spectral weighting function used in the kernel realized volatility matrix estimator (krvm()) of Barndorff-Nielsen et.

refresh_time(tick_series_list)

The all-refresh time scheme of Barndorff-Nielsen et al.

tsrc(tick_series_list[, J, K])

The two-scales realized volatility (TSRV) of Zhang et al.