BaşlayınÜcretsiz Başlayın

The co-variance matrix

You can easily compute the co-variance matrix of a DataFrame of returns using the .cov() method.

The correlation matrix doesn't really tell you anything about the variance of the underlying assets, only the linear relationships between assets. The co-variance (a.k.a. variance-covariance) matrix, on the other hand, contains all of this information, and is very useful for portfolio optimization and risk management purposes.

Bu egzersiz

Introduction to Portfolio Risk Management in Python

kursunun bir parçasıdır
Kursu Görüntüle

Egzersiz talimatları

  • Calculate the co-variance matrix of the StockReturns DataFrame.
  • Annualize the co-variance matrix by multiplying it with 252, the number of trading days in a year.

Uygulamalı interaktif egzersiz

Bu örnek kodu tamamlayarak bu egzersizi bitirin.

# Calculate the covariance matrix
cov_mat = StockReturns.____

# Annualize the co-variance matrix
cov_mat_annual = ____

# Print the annualized co-variance matrix
____
Kodu Düzenle ve Çalıştır