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

Exercise

Monte Carlo Simulation

You can use Monte Carlo simulation of the 2005-2010 investment bank portfolio assets to find the 95% VaR.

The mean asset losses are in the Numpy array mu. The efficient covariance matrix is e_cov (note that here we're using the daily, not annualized variance as in previous exercises). You'll use these to create sample paths for asset losses over one day, to simulate the daily portfolio loss.

Using the covariance matrix e_cov allows asset paths to be correlated, which is a realistic assumption.

The simulation total_steps is set to 1440, as in the video. The number of runs N is set to 10000.

For each run you'll compute the cumulative losses, and then apply the np.quantile() function to find the 95% VaR.

Portfolio weights and scipy.stats's norm distribution are available.

Instructions 1/4

undefined XP
    1
    2
    3
    4
  • Initialize the one-day cumulative daily_loss matrix--this will eventually be used to sum up simulated minute-by-minute losses for all 4 assets.