Lean
$LEAN_TAG$
|
Provides an implementation of a risk parity portfolio optimizer that calculate the optimal weights with the weight range from 0 to 1 and equalize the risk carried by each asset More...
Public Member Functions | |
RiskParityPortfolioOptimizer (double? lower=null, double? upper=null) | |
Initialize a new instance of RiskParityPortfolioOptimizer More... | |
double[] | Optimize (double[,] historicalReturns, double[] budget=null, double[,] covariance=null) |
Perform portfolio optimization for a provided matrix of historical returns and an array of expected returns More... | |
Protected Member Functions | |
double[] | RiskParityNewtonMethodOptimization (int numberOfVariables, double[,] covariance, double[] budget, double tolerance=1e-11, int maximumIteration=15000) |
Newton method of minimization More... | |
Provides an implementation of a risk parity portfolio optimizer that calculate the optimal weights with the weight range from 0 to 1 and equalize the risk carried by each asset
Definition at line 27 of file RiskParityPortfolioOptimizer.cs.
QuantConnect.Algorithm.Framework.Portfolio.RiskParityPortfolioOptimizer.RiskParityPortfolioOptimizer | ( | double? | lower = null , |
double? | upper = null |
||
) |
Initialize a new instance of RiskParityPortfolioOptimizer
lower | The lower bounds on portfolio weights |
upper | The upper bounds on portfolio weights |
Definition at line 37 of file RiskParityPortfolioOptimizer.cs.
double [] QuantConnect.Algorithm.Framework.Portfolio.RiskParityPortfolioOptimizer.Optimize | ( | double | historicalReturns[,], |
double[] | budget = null , |
||
double | covariance[,] = null |
||
) |
Perform portfolio optimization for a provided matrix of historical returns and an array of expected returns
historicalReturns | Matrix of annualized historical returns where each column represents a security and each row returns for the given date/time (size: K x N). |
budget | Risk budget vector (size: K x 1). |
covariance | Multi-dimensional array of double with the portfolio covariance of annualized returns (size: K x K). |
Implements QuantConnect.Algorithm.Framework.Portfolio.IPortfolioOptimizer.
Definition at line 50 of file RiskParityPortfolioOptimizer.cs.
|
protected |
Newton method of minimization
numberOfVariables | The number of variables (size of weight vector). |
covariance | Covariance matrix (size: K x K). |
budget | The risk budget (size: K x 1). |
tolerance | Tolerance level of objective difference with previous steps to accept minimization result. |
maximumIteration | Maximum iteration per optimization. |
Definition at line 79 of file RiskParityPortfolioOptimizer.cs.