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

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

mvgarch-2.0.2-py3-none-any.whl (8.9 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: mvgarch-2.0.2.tar.gz
  • Upload date:
  • Size: 7.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.11.26 {"installer":{"name":"uv","version":"0.11.26","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for mvgarch-2.0.2.tar.gz
Algorithm Hash digest
SHA256 dbf5ec54b55af9d4176f905925c926440c9ed243fc437b7c2d55ff16364a0bab
MD5 8af12f87d296d03adfbe3fc9604f03ab
BLAKE2b-256 976c1099d93786e861b04e481b778bf791ce4cb8b62ad42362089b11a2cf5d0f

See more details on using hashes here.

File details

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

File metadata

  • Download URL: mvgarch-2.0.2-py3-none-any.whl
  • Upload date:
  • Size: 8.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.11.26 {"installer":{"name":"uv","version":"0.11.26","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for mvgarch-2.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 1e203fff31a864df8bf922c3aab6cbf2c7fe38dcdb243f86398a1775626d5150
MD5 0224957ebf9e6bf7bc06c7866b9c5923
BLAKE2b-256 bc7ca439de99b112b548d3590341ac3a458c0b7c2fa44248e64cc172e0305a4e

See more details on using hashes here.

Supported by

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