Changing VaR and CVaR quantiles
VaR quantiles often used are 90%, 95%, and 99%, corresponding to the worst 10%, 5%, and 1% of cases respectively. These same quantiles are also often used for CVaR. Note that CVaR will always be a more extreme estimate when compared with VaR for the same quantile.
Compare the VaR vs CVaR values for USO ETF returns below.
Returns data is available (in percent) in StockReturns_perc
. We also calculated var_95
, cvar_95
, var_99
, cvar_99
and defined a function plot_hist()
that compares several quantiles for you.
This exercise is part of the course
Introduction to Portfolio Risk Management in Python
Exercise instructions
- Calculate the VaR(90) for
StockReturns_perc
and save the result invar_90
. - Calculate the CVaR(90) for
StockReturns_perc
and save the result incvar_90
.
Hands-on interactive exercise
Have a go at this exercise by completing this sample code.
# Historical VaR(90) quantiles
var_90 = ____(StockReturns_perc, ____)
print(var_90)
# Historical CVaR(90) quantiles
cvar_90 = ____
print(cvar_90)
# Plot to compare
plot_hist()