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.0a1.tar.gz (18.9 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.0a1-py3-none-any.whl (19.5 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: connectedness-0.1.0a1.tar.gz
  • Upload date:
  • Size: 18.9 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.0a1.tar.gz
Algorithm Hash digest
SHA256 a656e524932c2e1d7e74d7f1369b11695bf2637265641cdd27d4b6f4bc6f5869
MD5 96adca51d1458bce945f33e717907c57
BLAKE2b-256 c2b942fbafd87499095ba4c84806b77c843de1dc40f526ce8a8bc9e33da08ed4

See more details on using hashes here.

Provenance

The following attestation bundles were made for connectedness-0.1.0a1.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.0a1-py3-none-any.whl.

File metadata

  • Download URL: connectedness-0.1.0a1-py3-none-any.whl
  • Upload date:
  • Size: 19.5 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.0a1-py3-none-any.whl
Algorithm Hash digest
SHA256 cad83c3b1a76b5f1d1afe521858cda2a7191b2305025fe6f5c924b0b2a296e46
MD5 36c79cad5a085599d7acba9138bd10e6
BLAKE2b-256 2e02c5d5623a146ef9702663bb64588c64f9483560a05fb3bc9ab96932dc135b

See more details on using hashes here.

Provenance

The following attestation bundles were made for connectedness-0.1.0a1-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