GARCH Models in Python
Chelsea Yang
Data Science Instructor
Rule No.1: Never lose money
Rule No.2 Never forget Rule No.1
-- Warren Buffett
VaR stands for Value at Risk
Three ingredients:
_1-day 5% VaR of $1 million _
5% probability the portfolio will fall in value by 1 million dollars or more over a 1-day period
10-day 1% VaR of $9 million
1% probability the portfolio will fall in value by 9 million dollars or more over a 10-day period
More realistic VaR estimation with GARCH
VaR = mean + (GARCH vol) * quantile
VaR = mean_forecast.values + np.sqrt(variance_forecast).values * quantile
# Specify and fit a GARCH model
basic_gm = arch_model(bitcoin_data['Return'], p = 1, q = 1,
mean = 'constant', vol = 'GARCH', dist = 't')
gm_result = basic_gm.fit()
# Make variance forecast
gm_forecast = gm_result.forecast(start = '2019-01-01')
Step 2: Use GARCH model to obtain forward-looking mean and volatility
mean_forecast = gm_forecast.mean['2019-01-01':]
variance_forecast = gm_forecast.variance['2019-01-01':]
Step 3: Obtain the quantile according to a confidence level
Estimate quantiles based on GARCH assumed distribution of the standardized residuals
# Assume a Student's t-distribution
# ppf(): Percent point function
q_parametric = garch_model.distribution.ppf(0.05, nu)
Estimate quantiles based on the observed distribution of the GARCH standardized residuals
q_empirical = std_resid.quantile(0.05)
GARCH Models in Python