Back to Community
portfolio volatility formula

Can someone please help me to understand this line for portfolio annualized volatility:

portfolio_std = np.sqrt(,, weights))) * np.sqrt(252)  

what i have understood:

  • in order to understand portfolio volatility one cannot just sum the volatility of each stock multiplyed by weigths because correlations between them has to be taken in consideration
  • portfolio standard deviation is equal to square root of portfolio variance so np.sqrt(ptf_variance)
  • in the covariance matrix i have the variance of each stock in the diagonal

what i have not understood:
the double matrix multiplication between the transpose of weigths and the covariance matrix,, weights) what does it mean this double .dot and whay should it return the portfolio variance?

1 response

The portfolio standard deviation depends on three things: weights of the assets, standard deviation of them, and the degree of correlation that its assets have.
The formula for computing the portfolio standard deviation is in the next link with an explanation [1]. Since it is done with a sum of coefficients, the fastest and optimal way for calculate this is with matrixes, thats why you need to work with matrixes algebra and transpose them to apply vectorial products.