How can i limit the assets selected in a portfolio optimisation

3 Ansichten (letzte 30 Tage)
Arm
Arm am 17 Jun. 2019
Kommentiert: Mary Fenelon am 25 Jun. 2019
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?

Antworten (1)

Mary Fenelon
Mary Fenelon am 19 Jun. 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 Kommentare
Arm
Arm am 23 Jun. 2019
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 am 25 Jun. 2019
MaxNumAsset is implemented similarly to how the cardinality constraint is implemented in the Optimization Toolbox example that I referenced.

Melden Sie sich an, um zu kommentieren.

Kategorien

Mehr zu Portfolio Optimization and Asset Allocation finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by