Dynamic covariance in portfolio optimization

GARCH Models in Python

Chelsea Yang

Data Science Instructor

What is covariance

  • Describe the relationship between movement of two variables
  • Positive covariance: move together
  • Negative covariance; move in the opposite directions

Covariance example

GARCH Models in Python

Dynamic covariance with GARCH

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
GARCH Models in Python

Calculate GARCH covariance in Python

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
GARCH Models in Python

Calculate GARCH covariance in Python (cont.)

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
GARCH Models in Python

Modern portfolio theory (MPT)

  • Pioneered by Harry Markowitz in his paper "Portfolio Selection"(1952)
  • Take advantage of the diversification effect
  • The optimal portfolio can yield the maximum return with the minimum risk
GARCH Models in Python

MPT intuition

  • Variance of a simple two-asset portfolio:

_W1$*$ Variance1 + W2$*$ Variance2 + 2$*$W1$*$W2$*$Covariance _

 

  • Diversification effect:

Risk can be reduced in a portfolio by pairing assets that have a negative covariance

GARCH Models in Python

Let's practice!

GARCH Models in Python

Preparing Video For Download...