How To Optimize Portfolio With Target Risk And Return Constraints With Weight Constraints Together

2 次查看(过去 30 天)
symbol=timur.Properties.VariableNames(1:end)
monthlyReturn=timur(2:end,1:end)
P=Portfolio('AssetList',symbol,'RiskFreeRate',0.0008)
P=estimateAssetMoments(P,monthlyReturn)
P=setDefaultConstraints(P)
targetRetn = 0.15;
pwgt = estimateFrontierByReturn(P, targetRetn)
targetRisk = 0.10;
pwgt=estimateFrontierByRisk(P,targetRisk)
P = setMinMaxNumAssets(P, 1, 3)
disp(P.NumAssets)
disp(P.bInequality)
LowerBound = [0.1; 0.1; 0.1]
UpperBound= [0.5; 0.5; 0.5]
P = setBounds(P, LowerBound, UpperBound)
optimalweight=estimateMaxSharpeRatio(P)
[optrisk,optret]=estimatePortMoments(P,optimalweight)
display=(optret)
My code is working but we get 2 solutions first solution is withuot target risk and return optimization second one just target risk and return optimization without other constraints . Target risk and return not working with MaxSharpeRatio estimation.

回答(1 个)

Shivam Lahoti
Shivam Lahoti 2024-1-9
Hi Mahir,
I understand that you want to optimize your portfolio while keeping constraints like target risk return constraints along with keeping weight constraints intact.
The code provided by you uses ‘estimateMaxSharpeRatio’ to get the weights of assets in the portfolio. Though it is a powerful function for portfolio optimization, it does not allow for the direct inclusion of target return or target risk constraints. To incorporate such constraints, you would need to use a more general optimization function that MATLAB provides. Please have a look at the below documentation to understand different approaches.
Apart from this, if you want to narrow down the constraint to one parameter, you shall consider using ‘estimateFrontierByReturn’ and ‘estimateFrontierByRisk’. These functions estimate points on the efficient frontier corresponding to a target return or risk. Please find the documentation for these functions below:
I hope this was helpful.
Regards,
Shivam Lahoti.

类别

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