|
Lean
$LEAN_TAG$
|
Provides an implementation of a minimum variance portfolio optimizer that calculate the optimal weights with the weight range from -1 to 1 and minimize the portfolio variance with a target return of 2% More...
Public Member Functions | |
| MinimumVariancePortfolioOptimizer (double lower=-1, double upper=1, double targetReturn=0.02) | |
| Initialize a new instance of MinimumVariancePortfolioOptimizer More... | |
| double[] | Optimize (double[,] historicalReturns, double[] expectedReturns=null, double[,] covariance=null) |
| Perform portfolio optimization for a provided matrix of historical returns and an array of expected returns More... | |
Protected Member Functions | |
| LinearConstraint | GetBudgetConstraint (int size) |
| Sum of all weight is one: 1^T w = 1 / Σw = 1 More... | |
| IEnumerable< LinearConstraint > | GetBoundaryConditions (int size) |
| Boundary constraints on weights: lw ≤ w ≤ up More... | |
Provides an implementation of a minimum variance portfolio optimizer that calculate the optimal weights with the weight range from -1 to 1 and minimize the portfolio variance with a target return of 2%
The budged constrain is scaled down/up to ensure that the sum of the absolute value of the weights is 1.
Definition at line 29 of file MinimumVariancePortfolioOptimizer.cs.
| QuantConnect.Algorithm.Framework.Portfolio.MinimumVariancePortfolioOptimizer.MinimumVariancePortfolioOptimizer | ( | double | lower = -1, |
| double | upper = 1, |
||
| double | targetReturn = 0.02 |
||
| ) |
Initialize a new instance of MinimumVariancePortfolioOptimizer
| lower | Lower bound |
| upper | Upper bound |
| targetReturn | Target return |
Definition at line 41 of file MinimumVariancePortfolioOptimizer.cs.
|
protected |
Sum of all weight is one: 1^T w = 1 / Σw = 1
| size | number of variables |
Definition at line 53 of file MinimumVariancePortfolioOptimizer.cs.
|
protected |
Boundary constraints on weights: lw ≤ w ≤ up
| size | number of variables |
Definition at line 68 of file MinimumVariancePortfolioOptimizer.cs.
| double [] QuantConnect.Algorithm.Framework.Portfolio.MinimumVariancePortfolioOptimizer.Optimize | ( | double | historicalReturns[,], |
| double[] | expectedReturns = 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). |
| expectedReturns | Array of double with the portfolio annualized expected returns (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 94 of file MinimumVariancePortfolioOptimizer.cs.