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 Center および File ExchangePortfolio 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