Why can't I get the portfolio variance by doing this instead?
(np.dot((sec_returns.std()*250**0.5), weights)) ** 2
Hi Marcus!
Thanks for reaching out.
Do you obtain the same values once you use the code provided in the lectures vis-à-vis the one you've provided here, in this question?
Looking forward to your answer.
Best,
Martin
No I do not. I expect to though, but I don't and am wondering why not.
Hi Martin, any idea why this is so? Looking forward to your answer, thank you.
Hi Marcus!
Thanks for your reply.
If Calculating Portfolio Risk is the one you are referring to, then it seems that you are referring to the standard deviation of the returns object, as opposed to the covariance obtained from its values. In other words, you need to refer to the .cov()
method as opposed to .std()
.
Hope this helps.
Best regards,
Martin