quantlab.portfolio.predefined.approximate.covariance.factor_risk#

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

Every bar’s factor risk forecast, B F B' + diag(D) per bar, with array operations over all bars.

B is the model’s exposure_matrix of every bar’s exposures on the panel’s symbols (one call over all bars), F the estimate rows’ factor covariance and D the squared specific risks, on the model’s factors in their order, so every bar shares one factor axis. The coverage is a simplified version of FactorRiskModel.forecast’s:

  • a factor is kept at a bar when its variance there is finite; a dropped factor has zero exposures and a zero row and column of F, and a symbol exposed to it is not covered there, as in forecast;

  • a missing covariance between two kept factors is taken as 0, where forecast drops factors (covered_factors) until the block is finite, and leaves out the symbols exposed to them;

  • a symbol is covered when exposure_matrix covers it and it has a finite specific risk and finite exposures on the kept factors, as in forecast.

A bar the estimate store has no row at is refused, as the per-bar estimator refuses it. volatility is refused: the optimiser refuses volatility_label with a factor risk model when it is constructed.