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.
This exercise is part of the course
Quantitative Risk Management in Python
Exercise instructions
- Create a Numpy array of
portfolio_returns
for the two periods, from the list ofasset_returns
and portfolioweights
. - Generate the array of
losses
fromportfolio_returns
. - Compute the historical simulation of the 95% VaR for both periods using
np.quantile()
. - Display the list of 95% VaR estimates.
Hands-on interactive exercise
Have a go at this exercise by completing this sample code.
# Create portfolio returns for the two sub-periods using the list of asset returns
portfolio_returns = np.array([ x.____(weights) for x in asset_returns])
# Derive portfolio losses from portfolio returns
losses = - ____
# Find the historical simulated VaR estimates
VaR_95 = [____(x, 0.95) for x in ____]
# Display the VaR estimates
print("VaR_95, 2005-2006: ", VaR_95[0], '; VaR_95, 2007-2009: ', VaR_95[1])