GARCH Models in Python
Chelsea Yang
Data Science Instructor
If two asset returns have correlation $\rho$ and time-varying volatility of $\sigma_1$ and $\sigma_2$ :
$Covariance = \rho \cdot \sigma_1 \cdot \sigma_2$
covariance = correlation * garch_vol1 * garch_vol2
Step 1: Fit GARCH models and obtain volatility for each return series
# gm_eur, gm_cad are fitted GARCH models
vol_eur = gm_eur.conditional_volatility
vol_cad = gm_cad.conditional_volatility
Step 2: Compute standardized residuals from the fitted GARCH models
resid_eur = gm_eur.resid/vol_eur
resid_cad = gm_cad.resid/vol_cad
Step 3: Compute $\rho$ as simple correlation of standardized residuals
corr = np.corrcoef(resid_eur, resid_cad)[0,1]
Step 4: Compute GARCH covariance by multiplying the correlation and volatility.
covariance = corr * vol_eur * vol_cad
_W1$*$ Variance1 + W2$*$ Variance2 + 2$*$W1$*$W2$*$Covariance _
Risk can be reduced in a portfolio by pairing assets that have a negative covariance
GARCH Models in Python