IniziaInizia gratis

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.

Questo esercizio fa parte del corso

Introduction to Portfolio Risk Management in Python

Visualizza il corso

Istruzioni dell'esercizio

  • 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.

Esercizio pratico interattivo

Prova a risolvere questo esercizio completando il codice di esempio.

# Import norm from scipy.stats
____

# Estimate the average daily return
mu = ____(StockReturns)

# Estimate the daily volatility
vol = ____(StockReturns)

# Set the VaR confidence level
confidence_level = ____

# Calculate Parametric VaR
var_95 = ____
print('Mean: ', str(mu), '\nVolatility: ', str(vol), '\nVaR(95): ', str(var_95))
Modifica ed esegui il codice