Search icon
Arrow left icon
All Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletters
Free Learning
Arrow right icon
Python for Finance Cookbook

You're reading from  Python for Finance Cookbook

Product type Book
Published in Jan 2020
Publisher Packt
ISBN-13 9781789618518
Pages 432 pages
Edition 1st Edition
Languages
Author (1):
Eryk Lewinson Eryk Lewinson
Profile icon Eryk Lewinson

Table of Contents (12) Chapters

Preface Financial Data and Preprocessing Technical Analysis in Python Time Series Modeling Multi-Factor Models Modeling Volatility with GARCH Class Models Monte Carlo Simulations in Finance Asset Allocation in Python Identifying Credit Default with Machine Learning Advanced Machine Learning Models in Finance Deep Learning in Finance Other Books You May Enjoy

Modeling Volatility with GARCH Class Models

In Chapter 3, Time Series Modeling, we looked at various approaches to modeling time series. However, models such as ARIMA (Autoregressive Integrated Moving Average) cannot account for volatility that is not constant over time (heteroskedastic). We have already explained that some transformations (such as log or Box-Cox transformations) can be used to adjust for modest changes in volatility, but we would like to go a step further, and model it.

In this chapter, we focus on conditional heteroskedasticity, which is a phenomenon caused when an increase in volatility is correlated with a further increase in volatility. An example might help to understand this concept. Imagine the price of an asset going down significantly—due to some breaking news related to the company. Such a sudden price drop could trigger certain risk management...

Explaining stock returns' volatility with ARCH models

In this recipe, we approach the problem of explaining the conditional volatility of stock returns, with the Autoregressive Conditional Heteroskedasticity (ARCH) model.

The logic of the ARCH method can be represented by the following equations:

The first equation represents the return series as a combination of the expected return μ and the unexpected return t. The latter one is also known as the mean-corrected return, error term, or innovations. t has white noise properties—the conditional mean equal to zero and the time-varying conditional variance . Error terms are serially uncorrelated but do not need to be serially independent, as they can exhibit conditional heteroskedasticity.

A zero mean process implies that the returns are only described by the residuals, rt = t. Other popular options include constant...

Explaining stock returns' volatility with GARCH models

In this recipe, we present how to work with an extension of the ARCH model, namely the Generalized Autoregressive Conditional Heteroskedasticity (GARCH) model. GARCH can be considered an ARMA model applied to the variance of a time series—the AR component was already expressed in the ARCH model, while GARCH additionally adds the moving average part. In other words, the ARCH model specifies the conditional variance as a linear function of past sample variances, while the GARCH model adds lagged conditional variances to the specification.

The equation of the GARCH model can be presented as:

While the interpretation is very similar to the ARCH model presented in the previous recipe, the difference lies in the last equation, where there is an additional component. Parameters are constrained to meet the following...

Implementing a CCC-GARCH model for multivariate volatility forecasting

In this chapter, we have already considered multiple univariate conditional volatility models. That is why in this recipe, we move to the multivariate setting. As a starting point, we consider Bollerslev's Constant Conditional Correlation GARCH (CCC-GARCH) model. The idea behind it is quite simple. The model consists of N univariate GARCH models, related to each other via a constant conditional correlation matrix R.

Like before, we start with the model's specification:

In the first equation, we represent the return series. The key difference between this representation and the one presented in previous recipes is the fact that, this time, we are considering multivariate returns, so rt is actually a vector of returns . The mean and error terms are represented analogically. To highlight this...

Forecasting the conditional covariance matrix using DCC-GARCH

In this recipe, we cover an extension of the CCC-GARCH model: Engle's Dynamic Conditional Correlation GARCH (DCC-GARCH) model. The main difference between the two is that in the latter, the conditional correlation matrix is not constant over time—we have Rt instead of R.

There are some nuances in terms of estimation, but the outline is similar to the CCC-GARCH model:

  • Estimate the univariate GARCH models for conditional volatility
  • Estimate the DCC model for conditional correlations

In the second step of estimating the DCC model, we use a new matrix Qt, representing a proxy correlation process.

The first equation describes the relationship between the conditional correlation matrix Rt and the proxy process Qt. The second equation represents the dynamics of the proxy process. The last equation shows...

lock icon The rest of the chapter is locked
You have been reading a chapter from
Python for Finance Cookbook
Published in: Jan 2020 Publisher: Packt ISBN-13: 9781789618518
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $15.99/month. Cancel anytime}