Skip to content
GeneratedAssembled automatically from moduleDocs.ts. No human has reviewed this page.

cla

Markowitz’s Critical Line Algorithm in the Bailey-Lopez de Prado formulation: the exact solution to the constrained mean-variance problem with inequality bounds on every weight. Rather than calling a general quadratic solver it walks the efficient frontier from the maximum-return corner, computing each turning point where an asset enters or leaves the free set. That yields the whole frontier rather than one point on it, and it terminates — which quadratic solvers on near-singular covariance matrices frequently do not.

Use it when you need the full efficient frontier, when weight bounds are binding, or when a general optimiser is returning unstable or non-converging weights on an ill-conditioned covariance. If you only want one portfolio and the covariance is well behaved, portfolio_optimization is the shorter path. If the covariance itself is the problem, prefer hrp, which never inverts it. CLA still needs expected returns, so it inherits their estimation error.

minw  12wTΣwλμTw\min_w\;\frac{1}{2}w^T\Sigma w-\lambda\mu^T w

1Tw=1\mathbf{1}^T w=1

use nalgebra::DMatrix;
use openquant::cla::covariance;
let returns = DMatrix::from_row_slice(3, 2, &[0.01, 0.02, -0.01, 0.01, 0.015, 0.03]);
let sigma = covariance(&returns);
  • cla.allocate_cla
  • CLA
  • covariance
  • ReturnsEstimation
  • CLA behavior depends on weight bounds and return estimates.
  • Use robust covariance estimators when sample size is small.