Optimal weights in portfolio optimization
2 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
Hi guys!
I'm trying to calculate the optimal weights for 2 riskt assets and a riskfree asset. I would like to do this based on a volatility timing strategy, which means that the weigths should only vary based on the conditional volatility. I have calculated the conditional covariance between the two risky assets and the sample means of the risky assets returns. For each day I should solve the following quadratic program:
Min. wt'SIGMAwt
S.T. wt'ut + (1-wt'1)Rf = up
were SIGMA is the 2x2 conditional covariance matrix, ut is the 2x1 risky asset returns, up is the expected return on the portfolio and wt is the 2x1 weight matrix. I have tried to set up a loop based on the quadratic optimization routine provided by Matlab, which plugs in the relevant conditional covariance matrix. Since the weights are determined solely on the conditional covariance, I assume that the expected return of the assets are constant and equal to the sample mean. My problem is that i'm not sure if I have written the code correctly or if there is a easier way to tackle the overall problem.
My code so far looks like the following:
for i=1:10
aeg = Dagligeafkast(1,1:2); beg = r;
lb = zeros(2,1); ub = ones (2,1);
c = zeros(2,1);
options = optimoptions('quadprog', 'algorithm','interior-point-convex');
options = optimoptions(options, 'Display', 'iter', 'tolfun',1e-10);
tic
[x1] = quadprog(Betingetkovariansmatricedaglige(i:i+1,i:i+1), c, aeg,beg,lb,ub);
toc
Plotportfdemostandardmodel(x1);
end
I know that my constrain in this setting is equivalent to wt'ut = up, but I just thought that the weight in the riskless asset should be 1-wt'1.
I have searched around and not been able to find something useful, so I would really appreciate to hear your thoughts about my approach to this problem.
Best regards,
Kristian
0 Commenti
Risposte (0)
Vedere anche
Categorie
Scopri di più su Quadratic Programming and Cone Programming in Help Center e File Exchange
Prodotti
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!