In [72]:
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import matplotlib as mpl
from arch import arch_model
In [75]:
mpl.rcParams["figure.figsize"] = [10, 5]
In [130]:
vix = pd.read_csv("data/vix.csv", usecols=(0,5), index_col=0, parse_dates=[0], na_values="null", dtype=np.float32)
vix = 100* vix.pct_change().dropna()
In [131]:
vix.plot()
plt.show()
In [132]:
am = arch_model(vix)
In [133]:
res = am.fit(update_freq=5)
In [134]:
res.summary()
Out[134]:
In [135]:
res.plot(annualize="D")
plt.show()
In [136]:
forecasts = res.forecast(horizon=5, method='simulation')
In [137]:
forecasts.variance.tail()
Out[137]:
In [ ]: