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

2 views (last 30 days)
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 Comment
Neelanshu
Neelanshu on 27 Sep 2023
I want to confirm if you are looking for a way to include target risk and target return as constraints while using MaxSharpeRatio estimation.

Sign in to comment.

Answers (1)

Shivam Lahoti
Shivam Lahoti on 9 Jan 2024
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.

Categories

Find more on Portfolio Optimization and Asset Allocation in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!