How can i limit the assets selected in a portfolio optimisation

조회 수: 6 (최근 30일)
Arm
Arm 2019년 6월 17일
댓글: Mary Fenelon 2019년 6월 25일
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