How can i limit the assets selected in a portfolio optimisation

5 次查看(过去 30 天)
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?

回答(1 个)

Mary Fenelon
Mary Fenelon 2019-6-19
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 个评论
Arm
Arm 2019-6-23
Thank you for your answer.
Actually i have already read that examples, but i don't know how can i implement this cardinality constraint in my problem.
In particular i would like to understand how the MaxNumAsset in Portfolio object works, namely how will change the constraint matrix once i take in account the maxnum assets.
Do you have any hint?
Mary Fenelon
Mary Fenelon 2019-6-25
MaxNumAsset is implemented similarly to how the cardinality constraint is implemented in the Optimization Toolbox example that I referenced.

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Portfolio Optimization and Asset Allocation 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by