IniziaInizia gratis

Asset covariance and portfolio volatility

Now that you've examined the return of the portfolio of investment banks, it's time to assess the riskiness of the portfolio using the covariance matrix to determine the portfolio's volatility.

First you'll compute the covariance between the asset_returns and identify which of the banks had the highest volatility during the 2008-2009 crisis period.

Then, given the weights of an equal-weighted portfolio, you'll find the portfolio's annualized volatility for that period using portfolio_returns.

Finally, you'll use a 30-day window to create a time series of the volatility, and visualize this with a plot.

Questo esercizio fa parte del corso

Quantitative Risk Management in Python

Visualizza il corso

Esercizio pratico interattivo

Prova a risolvere questo esercizio completando il codice di esempio.

# Generate the covariance matrix from portfolio asset's returns
covariance = asset_returns.____

# Annualize the covariance using 252 trading days per year
covariance = covariance * ____

# Display the covariance matrix
print(covariance)
Modifica ed esegui il codice