Skip to main content

Diebold-Yilmaz connectedness and volatility spillover indices in Python.

Project description

connectedness

PyPI Python License: MIT

Diebold-Yilmaz connectedness and volatility spillover indices in Python.

connectedness turns a panel of asset prices into a fully reproducible spillover analysis: realized covariance and semicovariance matrices, optional PIT normality transform, MHAR-LASSO dynamics, generalized FEVD (Koop-Pesaran-Shin), and the static and rolling-window spillover indices of Diebold and Yilmaz.

Status

Alpha. The API may change before 1.0.0.

Installation

pip install connectedness            # core
pip install connectedness[plots]     # + matplotlib helpers
pip install connectedness[parallel]  # + joblib/tqdm for rolling windows
pip install connectedness[io]        # + pyarrow for parquet I/O

Quickstart

import pandas as pd
from connectedness import SpilloverPipeline

# wide DataFrame: DatetimeIndex (intraday) × markets
prices = pd.read_parquet("prices.parquet")

result = (
    SpilloverPipeline(prices)
    .compute_returns()
    .compute_realized_measures()
    .auto_pit()
    .fit_static()
    .fit_rolling(window=365)
    .run()
)

print(result.tsi)              # total spillover index (%)
print(result.directional_to)   # contributions TO others
print(result.directional_from) # contributions FROM others
print(result.rolling_tsi)      # rolling TSI time series

For the underlying primitives:

from connectedness import (
    simple_returns,
    realized_covariance,
    realized_semicov,
    pit_transform,
    static_spillover,
    rolling_spillover,
)

Methodology

See docs/methodology.md for the formal definitions of realized (semi)covariance, the MHAR-LASSO specification, the generalized variance decomposition, and the Diebold-Yilmaz total / directional / net spillover indices.

Related Packages and References

connectedness focuses on an end-to-end realized-measure pipeline: intraday returns to realized covariance and semicovariance, optional PIT normalization, MHAR-LASSO dynamics, generalized FEVD, and static or rolling Diebold-Yilmaz indices. For a lighter-weight package focused on generalized FEVD and connectedness tables from supplied VAR inputs, see diebold-yilmaz.

Selected references:

  • Diebold, F. X. and Yilmaz, K. (2012). Better to give than to receive: Predictive directional measurement of volatility spillovers. International Journal of Forecasting 28(1), 57-66.
  • Diebold, F. X. and Yilmaz, K. (2014). On the network topology of variance decompositions: Measuring the connectedness of financial firms. Journal of Econometrics 182(1), 119-134.
  • Diebold, F. X. and Yilmaz, K. (2023). On the past, present, and future of the Diebold-Yilmaz approach to dynamic network connectedness. Journal of Econometrics 234(S), 115-120.
  • Koop, G., Pesaran, M. H. and Potter, S. M. (1996). Impulse response analysis in nonlinear multivariate models. Journal of Econometrics 74(1), 119-147.
  • Pesaran, M. H. and Shin, Y. (1998). Generalized impulse response analysis in linear multivariate models. Economics Letters 58, 17-29.
  • Corsi, F. (2009). A simple approximate long-memory model of realized volatility. Journal of Financial Econometrics 7(2), 174-196.
  • Audrino, F. and Knaus, S. D. (2016). Lassoing the HAR model: A model selection perspective on realized volatility dynamics. Econometric Reviews 35(8-10), 1485-1521.
  • Bollerslev, T., Li, J., Patton, A. J. and Quaedvlieg, R. (2020). Realized semicovariances. Econometrica 88(4), 1515-1551.
  • Chanatasig-Niza, E., Ciarreta, A. and Zarraga, A. (2022). A volatility spillover analysis with realized semi(co)variances in Australian electricity markets. Energy Economics 111, 106076.
  • Apergis, N., Barunik, J. and Lau, M. C. K. (2017). Good volatility, bad volatility: What drives the asymmetric connectedness of Australian electricity markets? Energy Economics 66, 108-115.
  • Lyu, C., Do, H. X., Nepal, R. and Jamasb, T. (2024). Volatility spillovers and carbon price in the Nordic wholesale electricity markets. Energy Economics 134, 107559.

Citation

@software{connectedness,
  author  = {Rolotti, Francisco},
  title   = {connectedness: Diebold-Yilmaz spillover indices in Python},
  year    = {2026},
  url     = {https://github.com/franrolotti/connectedness}
}

See also CITATION.cff.

License

MIT. See 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

connectedness-0.1.0a2.tar.gz (19.2 kB view details)

Uploaded Source

Built Distribution

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

connectedness-0.1.0a2-py3-none-any.whl (19.7 kB view details)

Uploaded Python 3

File details

Details for the file connectedness-0.1.0a2.tar.gz.

File metadata

  • Download URL: connectedness-0.1.0a2.tar.gz
  • Upload date:
  • Size: 19.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for connectedness-0.1.0a2.tar.gz
Algorithm Hash digest
SHA256 7568675a3aba70213b52492e9631694df17f802321c18b37378e708e9ffe6d97
MD5 12733b83aea2e31d3038d3259204b0b2
BLAKE2b-256 3a9cd730ded5712feef57c24e85d914c0ad26eba97bb7cdbe842e11cb2bdea2f

See more details on using hashes here.

Provenance

The following attestation bundles were made for connectedness-0.1.0a2.tar.gz:

Publisher: publish.yml on franrolotti/connectedness

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file connectedness-0.1.0a2-py3-none-any.whl.

File metadata

  • Download URL: connectedness-0.1.0a2-py3-none-any.whl
  • Upload date:
  • Size: 19.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for connectedness-0.1.0a2-py3-none-any.whl
Algorithm Hash digest
SHA256 75dbd036b683c6cf7ba521401555721e837e38be3cdad92f5f8ed1838289d69d
MD5 82007524e3cdca300cc1b9c794b5063d
BLAKE2b-256 70040836d8b9c4f047588bdc863136710c37397f4e797b45856fb1108b3d75f4

See more details on using hashes here.

Provenance

The following attestation bundles were made for connectedness-0.1.0a2-py3-none-any.whl:

Publisher: publish.yml on franrolotti/connectedness

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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