quantlab.portfolio.predefined.approximate.black_litterman#

The approximate backtest’s Black-Litterman: the posterior per bar ahead of the mean-variance kernels.

The implementation quantlab.portfolio.approximate.implementation chooses for a BlackLittermanOptimizer: the approximate mean-variance (mean_variance.decide) with a posterior that replaces each bar’s mu, covariance and candidates as the per-bar rule’s posterior does. On each bar it hands the rule’s moments (the arithmetic the per-bar rule runs, so every view type, omega and user view is the per-bar rule’s) the bar’s covariance from estimate_all in factor form on the covered symbols and the factors with a variance there, the market’s weights there (market_weight at the bar, NaN as 0, renormalised) and the symbol views (the expected return model’s mu on the predicted selectable symbols); the posterior covariance goes to the kernels as the factor form they read, rank 2K (the forecast’s factors and their posterior copies; the user’s views are folded into the posterior factor covariance), and every selectable symbol becomes a candidate. A bar the per-bar rule refuses (the market has no weight on the covered symbols, or the user’s views cannot be blended) holds, as a backtest run holds it.

Each bar’s posterior is a K x K solve plus products over its covered symbols in numpy, a loop over the bars: no dense symbol-by-symbol matrix and no compiled code beyond the kernels the mean-variance solve already uses.

Functions

decide

Return every bar's Black-Litterman weights of a decision panel.