quantlab.portfolio.predefined.approximate.covariance.ledoit_wolf#

quantlab.portfolio.predefined.approximate.covariance.ledoit_wolf(config, panel, volatility=None)[source]#

Every bar’s Ledoit-Wolf estimate, as LedoitWolfEstimator.estimate gives it on the bar’s context.

The same coverage rule (every return of the window finite, not all equal, staleness within max_stale_bars, and with volatility a finite positive one), on the bar’s return window and staleness as the panel gives them; a I + U U' with a the shrinkage coefficient times the mean variance and U the covered symbols’ demeaned window scaled by sqrt((1 - shrinkage) / lookback_bars). The bars are read in batches, so the windows held at once stay bounded. With volatility the covered symbols’ volatilities are replaced (LowRankCovariance.with_volatility).