Aan de slagGa gratis aan de slag

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.

Deze oefening maakt deel uit van de cursus

Quantitative Risk Management in Python

Cursus bekijken

Praktische interactieve oefening

Probeer deze oefening eens door deze voorbeeldcode in te vullen.

# 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)
Code bewerken en uitvoeren