How to add a constraint in CVaR optimization code in Matlab?

261 views Asked by At

I want to find the optimal weights in an multi-asset portfolio by minimizing the VaR. This is the code that gives a minimum risk for a target return.

p = PortfolioCVaR('ProbabilityLevel', .99, 'AssetNames', names);
p = p.setScenarios(R);  % R= asset returns
p = p.setDefaultConstraints();
wts = p.estimateFrontier(20);
portRisk = p.estimatePortRisk(wts); 
portRet = p.estimatePortReturn(wts);

clf
visualizeFrontier(p, portRisk, portRet);

%% Compute portfolio with given level of return
tic;
wt = p.estimateFrontierByReturn(.05/100);
toc;
pRisk = p.estimatePortRisk(wt);
pRet = p.estimatePortReturn(wt);

The sum of weights = 1 .. My question is how to add a constraint such that no asset can have a weight of greater than 60%. Thank you for any help you could provide

1

There are 1 answers

0
Phil Goddard On BEST ANSWER

Use the object's setBounds property,

>> p = setBounds(p,LowerBoundsVector,UpperBoundsVector);

See

>> doc setBounds

for more info.