Skip to main content

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

MIT

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.2.2.tar.gz (10.9 kB view details)

Uploaded Source

Built Distribution

mvgarch-1.2.2-py3-none-any.whl (9.5 kB view details)

Uploaded Python 3

File details

Details for the file mvgarch-1.2.2.tar.gz.

File metadata

  • Download URL: mvgarch-1.2.2.tar.gz
  • Upload date:
  • Size: 10.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.1.1 CPython/3.12.7

File hashes

Hashes for mvgarch-1.2.2.tar.gz
Algorithm Hash digest
SHA256 3f01362132f1511b8198d5543168e3b212d8d0260ccdac20e3ab2292f0609394
MD5 18b1ddbcef420a0719bc26181394f9ce
BLAKE2b-256 9400b7c0bde9c59e242b41db23989c3029ed4ee7fbefc19fa9c7d102874fa456

See more details on using hashes here.

Provenance

The following attestation bundles were made for mvgarch-1.2.2.tar.gz:

Publisher: python-package.yml on jack-tobin/mvgarch

Attestations:

File details

Details for the file mvgarch-1.2.2-py3-none-any.whl.

File metadata

  • Download URL: mvgarch-1.2.2-py3-none-any.whl
  • Upload date:
  • Size: 9.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.1.1 CPython/3.12.7

File hashes

Hashes for mvgarch-1.2.2-py3-none-any.whl
Algorithm Hash digest
SHA256 acac756fd07e0da8b617fa170cf0c53b94640cee0e5bb7cccdd47cfb22cab1da
MD5 8df18db9084bcebe8a64dd7efc35fb59
BLAKE2b-256 0b4e0edeb19ae3e247a2a49669220e14feeaf846ed54bdec1dbf666893ac2760

See more details on using hashes here.

Provenance

The following attestation bundles were made for mvgarch-1.2.2-py3-none-any.whl:

Publisher: python-package.yml on jack-tobin/mvgarch

Attestations:

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page