1. Learn
  2. /
  3. Courses
  4. /
  5. Quantitative Risk Management in Python

Exercise

Historical Simulation

Historical simulation of VaR assumes that the distribution of historical losses is the same as the distribution of future losses. We'll test if this is true for our investment bank portfolio by comparing the 95% VaR from 2005 - 2006 to the 95% VaR from 2007 - 2009.

The list asset_returns has been created for you, which contains asset returns for each of the two periods. You'll use this list to create portfolio_returns with the available weights, and use this to derive portfolio losses.

Then you'll use the np.quantile() function to find the 95% VaR for each period. If the loss distributions are the same, then the 95% VaR estimate should be about the same for both periods. Otherwise the distribution might have changed as the global financial crisis took hold.

Instructions

100 XP
  • Create a Numpy array of portfolio_returns for the two periods, from the list of asset_returns and portfolio weights.
  • Generate the array of losses from portfolio_returns.
  • Compute the historical simulation of the 95% VaR for both periods using np.quantile().
  • Display the list of 95% VaR estimates.