How can i limit the assets selected in a portfolio optimisation
조회 수: 2 (최근 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?
댓글 수: 0
답변 (1개)
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
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 Center 및 File 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!