How can i limit the assets selected in a portfolio optimisation
2 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Hello,
I am working on a portfolio optimization using the function fmincon. In particular I have the following problem:
%value of lambda (coefficient of risk aversion)
lambda=[0.01];
%initial weights guess (i have a vector of initial assets weights)
x0=Weights';
%equality constraint Aeq * x = beq such that the sum of weights must be 1
Aeq=[repmat(ones,1,size(Weights,1))];
beq=[1];
%lower and upper bound (lower bound 0 and upper bound 1)
lb=repmat(zeros,size(Weights,1),1);
ub=repmat(ones,size(Weights,1),1);
%set the objective function (maximize the investor utility function as: Weights*Returns - Lambda*Weights'*VarianceCovariance*Weights)
fun= @(x) -((x*Returns)-(lambda*x*(VarianceCovariance)*x'));
%optimize
result=fmincon(fun,x0,A,b,Aeq,beq,lb,ub);
So far I have only one constraint, namely that the sum of weights must be equal to one. Hower i would like to add another one, in particular i want to limit the number selected to a specific number. My universe is composed by 2000 stocks, but i want only 100 of them. As you can see the universe is too large in order to apply an eventually combination formula (even because my intention is to put this optimization in a loop because i want to solving this for a different level of lambda).
Could someone help me?
0 comentarios
Respuestas (1)
Mary Fenelon
el 19 de Jun. de 2019
Adding a constraint on the number of stocks (a cardinality constraint) requires you to use integer variables. There is an example of a portfolio problem with a cardinality constraint and minimum investment levels here. You might find it easier to work with the problem-based version, here. The Finance Toolbox can also solve this type of problem using its Portfolio object, see here.
2 comentarios
Mary Fenelon
el 25 de Jun. de 2019
MaxNumAsset is implemented similarly to how the cardinality constraint is implemented in the Optimization Toolbox example that I referenced.
Ver también
Categorías
Más información sobre Portfolio Optimization and Asset Allocation en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!