Multivariate GARCH modelling in Python
Project description
mvgarch
Multivariate GARCH modelling in Python
Description
This project performs a basic multivariate GARCH modelling exercise in Python. Such approaches are available in other environments such as R, but there is yet to exist a tractable framework for performing the same tasks in Python. This package should help alleviate such limitations and allow Python users to deploy multivariate GARCH models easily.
Installation
$ pip install mvgarch
Usage
# get return data
# returns = pd.DataFrame() of periodic returns of shape (n_periods, n_assets)
# import modules
from mvgarch.mgarch import DCCGARCH
from mvgarch.ugarch import UGARCH
# FIT UNIVARIATE GARCH MODEL
# get one of the return series
asset = returns.iloc[:, 0]
# fit a gjr-garch(1, 1) model to the first return series
garch = UGARCH(order=(1, 1))
garch.spec(returns=asset)
garch.fit()
# FIT MULTIVARIATE DCC GARCH MODEL
# make a list of garch(1, 1) objects
garch_specs = [UGARCH(order=(1, 1)) for _ in range(n_tickers)]
# fit DCCGARCH to the return data
dcc = DCCGARCH()
dcc.spec(ugarch_objs=garch_specs, returns=returns)
dcc.fit()
# forecast 4 weeks ahead
dcc.forecast(n_ahead=4)
Contributing
Pull requests are welcome.
License
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
mvgarch-1.0.0.tar.gz
(8.2 kB
view details)
Built Distribution
File details
Details for the file mvgarch-1.0.0.tar.gz
.
File metadata
- Download URL: mvgarch-1.0.0.tar.gz
- Upload date:
- Size: 8.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.0 CPython/3.11.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7755f8aab838345563182c6983401658a6b779673ef265c8c4231dd7a87de15f |
|
MD5 | 47af676bd09794e9a1ff663c3dcfac37 |
|
BLAKE2b-256 | 6bad2c0e76dc57d5f856a740e632f3520c8a3cc588f7283e1e744daf6d04f048 |
File details
Details for the file mvgarch-1.0.0-py3-none-any.whl
.
File metadata
- Download URL: mvgarch-1.0.0-py3-none-any.whl
- Upload date:
- Size: 9.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.0 CPython/3.11.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 28676cb156b2879960c3010a00d301921e01b4e414e40f22b079f3671b5a7367 |
|
MD5 | c72aef49e03a30e59a3afd7d8da3fa44 |
|
BLAKE2b-256 | 5ae6eb636c80555d99806928ebd9473f0ea51d94558e05717c55b788228ad678 |