GEV risk estimation
Suppose that you were holding € 1,000,000 of GE stock on January 1, 2010. You would like to cover the expected maximum losses that might occur over the next week, based upon available data from the previous two years, 2008 - 2009. You assume that maximum weekly losses for GE are distributed according to a Generalized Extreme Value (GEV) distribution.
To model expected losses you'll estimate the CVaR at the 99% confidence level for the GEV distribution, and use it to compute the amount needed in reserve to cover the expected maximum weekly loss over January, 2010.
The genextreme distribution from scipy.stats is available in your workspace, as is GE's losses for the 2008 - 2009 period.
Diese Übung ist Teil des Kurses
Quantitative Risk Management in Python
Anleitung zur Übung
- Find the maxima of GE's asset price for a one week block length.
 - Fit the GEV distribution 
genextremeto theweekly_maximadata. - Compute the 99% VaR, and use it to find the 99% CVaR estimate.
 - Compute the reserve amount needed to cover the expected maximum weekly loss.
 
Interaktive Übung
Vervollständige den Beispielcode, um diese Übung erfolgreich abzuschließen.
# Compute the weekly block maxima for GE's stock
weekly_maxima = losses.____("W").____()
# Fit the GEV distribution to the maxima
p = genextreme.____(____)
# Compute the 99% VaR (needed for the CVaR computation)
VaR_99 = genextreme.____(____, *p)
# Compute the 99% CVaR estimate
CVaR_99 = (1 / (1 - 0.99)) * genextreme.____(lambda x: x, 
           args=(p[0],), loc = p[1], scale = p[2], lb = ____)
# Display the covering loss amount
print("Reserve amount: ", 1000000 * CVaR_99)