1. Learn
  2. /
  3. Courses
  4. /
  5. Introduction to Portfolio Risk Management in Python

Exercise

Parametric VaR

Value at Risk can also be computed parametrically using a method known as variance/co-variance VaR. This method allows you to simulate a range of possibilities based on historical return distribution properties rather than actual return values. You can calculate the parametric VaR(90) using:

# Import norm from scipy.stats
from scipy.stats import norm

# Calculate Parametric VaR
norm.ppf(confidence_level=0.10, mu, vol)

where mu and vol are the mean and volatility, respectively.

Returns data is available (in decimals) in the variable StockReturns.

Instructions

100 XP
  • Import norm from scipy.stats.
  • Calculate the mean and volatility of StockReturns and assign them to mu and vol, respectively.
  • Set the confidence_level for VaR(95).
  • Calculate VaR(95) using the norm.ppf() function, passing in the confidence level as the first parameter, with mu and vol as the second and third parameters.