Metadata-Version: 2.4
Name: connectedness
Version: 0.1.0a2
Summary: Diebold-Yilmaz connectedness and volatility spillover indices in Python.
Project-URL: Homepage, https://github.com/franrolotti/connectedness
Project-URL: Repository, https://github.com/franrolotti/connectedness
Project-URL: Issues, https://github.com/franrolotti/connectedness/issues
Author: Francisco Rolotti
License: MIT License
        
        Copyright (c) 2026 Francisco Rolotti
        
        Permission is hereby granted, free of charge, to any person obtaining a copy
        of this software and associated documentation files (the "Software"), to deal
        in the Software without restriction, including without limitation the rights
        to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
        copies of the Software, and to permit persons to whom the Software is
        furnished to do so, subject to the following conditions:
        
        The above copyright notice and this permission notice shall be included in all
        copies or substantial portions of the Software.
        
        THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
        IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
        FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
        AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
        LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
        OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
        SOFTWARE.
License-File: LICENSE
Keywords: connectedness,diebold-yilmaz,econometrics,mhar,realized-covariance,spillovers,volatility
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Science/Research
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Topic :: Scientific/Engineering
Requires-Python: >=3.10
Requires-Dist: numpy>=1.26
Requires-Dist: pandas>=2.1
Requires-Dist: scikit-learn>=1.4
Requires-Dist: scipy>=1.11
Requires-Dist: statsmodels>=0.14
Provides-Extra: dev
Requires-Dist: hypothesis>=6.100; extra == 'dev'
Requires-Dist: mypy>=1.10; extra == 'dev'
Requires-Dist: pre-commit>=3.7; extra == 'dev'
Requires-Dist: pyarrow>=15; extra == 'dev'
Requires-Dist: pytest-cov>=5; extra == 'dev'
Requires-Dist: pytest>=8; extra == 'dev'
Requires-Dist: ruff>=0.6; extra == 'dev'
Provides-Extra: docs
Requires-Dist: mkdocs-material>=9.5; extra == 'docs'
Requires-Dist: mkdocs>=1.6; extra == 'docs'
Requires-Dist: mkdocstrings[python]>=0.25; extra == 'docs'
Provides-Extra: io
Requires-Dist: pyarrow>=15; extra == 'io'
Provides-Extra: parallel
Requires-Dist: joblib>=1.3; extra == 'parallel'
Requires-Dist: tqdm>=4.66; extra == 'parallel'
Provides-Extra: plots
Requires-Dist: matplotlib>=3.8; extra == 'plots'
Description-Content-Type: text/markdown

# connectedness

[![PyPI](https://img.shields.io/pypi/v/connectedness?include_prereleases)](https://pypi.org/project/connectedness/)
[![Python](https://img.shields.io/pypi/pyversions/connectedness)](https://pypi.org/project/connectedness/)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](LICENSE)

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

```bash
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

```python
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:

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

## Methodology

See [`docs/methodology.md`](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`](https://pypi.org/project/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

```bibtex
@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`](LICENSE).
