How to constrain this optimisation to be long-only?

조회 수: 2 (최근 30일)
Luciano Lilloy Fedele
Luciano Lilloy Fedele 2018년 6월 11일
편집: Luciano Lilloy Fedele 2018년 6월 11일
Hi everyone, I'm using a library that optimise a portfolio based in past information and my views on best stocks. However, I need the final weights to be long-only (i.e. positives). Any idea if this is possible? See below the code:
function Allocation = DecisionBayesParameters(Market,InvestorProfile,Prior)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% estimate market parameters
Exp_LinRets_Hat=mean(Market.LinRetsSeries)';
Cov_LinRets_Hat=cov(Market.LinRetsSeries);
T=Market.T;
T_1=Prior.T_0+T;
Exp_LinRets_Post=(Prior.LinRets_EV*Prior.T_0+Exp_LinRets_Hat*T)/T_1;
Nu_1=Prior.Nu_0+T;
Cov_LinRets_Post=(Prior.LinRets_Cov*Prior.Nu_0+Cov_LinRets_Hat*T+(Exp_LinRets_Hat-Prior.LinRets_EV)*(Exp_LinRets_Hat-Prior.LinRets_EV)'*Prior.T_0*T/T_1)/Nu_1;
Exp_Prices_Hat=diag(Market.CurrentPrices)*(1+Exp_LinRets_Post);
Cov_Prices_Hat=diag(Market.CurrentPrices)*Cov_LinRets_Post*diag(Market.CurrentPrices);
% compute allocation
S=inv(Cov_Prices_Hat);
A_Hat=Market.CurrentPrices'*S*Market.CurrentPrices;
B_Hat=Market.CurrentPrices'*S*Exp_Prices_Hat;
Gamma = (InvestorProfile.Budget - InvestorProfile.RiskPropensity*B_Hat)/A_Hat;
Allocation = InvestorProfile.RiskPropensity*S*Exp_Prices_Hat + Gamma*S*Market.CurrentPrices;
This is the library: https://uk.mathworks.com/matlabcentral/fileexchange/9061-risk-and-asset-allocation

답변 (0개)

카테고리

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