CommencerCommencer gratuitement

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.

Cet exercice fait partie du cours

Quantitative Risk Management in Python

Afficher le cours

Exercice interactif pratique

Essayez cet exercice en complétant cet exemple de code.

# Initialize daily cumulative loss for the 4 assets, across N runs
daily_loss = np.zeros((____ , N))
Modifier et exécuter le code