LoslegenKostenlos loslegen

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.

Diese Übung ist Teil des Kurses

Quantitative Risk Management in Python

Kurs anzeigen

Interaktive Übung

Vervollständige den Beispielcode, um diese Übung erfolgreich abzuschließen.

# 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 bearbeiten und ausführen