A package for time series data processing and modeling using ARIMA and GARCH models
This project has been archived.
The maintainers of this project have marked this project as archived. No new releases are expected.
Project description
Generalized Timeseries
▗▄▄▖▗▄▄▄▖▗▖ ▗▖▗▄▄▄▖▗▄▄▖ ▗▄▖ ▗▖ ▗▄▄▄▖▗▄▄▄▄▖▗▄▄▄▖▗▄▄▄
▐▌ ▐▌ ▐▛▚▖▐▌▐▌ ▐▌ ▐▌▐▌ ▐▌▐▌ █ ▗▞▘▐▌ ▐▌ █
▐▌▝▜▌▐▛▀▀▘▐▌ ▝▜▌▐▛▀▀▘▐▛▀▚▖▐▛▀▜▌▐▌ █ ▗▞▘ ▐▛▀▀▘▐▌ █
▝▚▄▞▘▐▙▄▄▖▐▌ ▐▌▐▙▄▄▖▐▌ ▐▌▐▌ ▐▌▐▙▄▄▖▗▄█▄▖▐▙▄▄▄▖▐▙▄▄▖▐▙▄▄▀
▗▄▄▄▖▗▄▄▄▖▗▖ ▗▖▗▄▄▄▖ ▗▄▄▖▗▄▄▄▖▗▄▄▖ ▗▄▄▄▖▗▄▄▄▖ ▗▄▄▖
█ █ ▐▛▚▞▜▌▐▌ ▐▌ ▐▌ ▐▌ ▐▌ █ ▐▌ ▐▌
█ █ ▐▌ ▐▌▐▛▀▀▘ ▝▀▚▖▐▛▀▀▘▐▛▀▚▖ █ ▐▛▀▀▘ ▝▀▚▖
█ g▄█▄m▐▌ ▐▌▐▙▄▄▖▗▄▄▞▘▐▙▄▄▖▐▌ ▐▌▗▄█▄▖▐▙▄▄▖▗▄▄▞▘
A Python package for timeseries data processing and modeling using ARIMA and GARCH models with both univariate and bivariate capabilities.
TODO: Add C4 diagrams for levels 2-4.
TODO: Reformat README in accordance with other repos.
Architecture and Design Decisions
This package follows best development practices:
- Modular Design: Extracted from a larger thesis replication project to increase maintainability and reusability, published on pypi as package
- Modern Build System: Uses
pyproject.tomlinstead of legacysetup.pyfor more robust dependency management and packaging.requirements.txtallows users to easily constructvenvvirtual environments. - Self-Documenting Code: Extensive docstrings and type hints allow automated documentation generation via Sphinx and publication on readthedocs.io. Variable annotations (
myvar: int = 5) are just too visually distracting, and are not used - Test Coverage: Comprehensive unit tests with pytest with goal of 70%+ code coverage, as indicated by Codecov dashboard
- CI/CD Pipeline: Automated testing, documentation, package publishing and Docker image building
- Cross-Platform: OS-agnostic design with automated testing across OS environments
- Multi-Version Support: Compatible with Python 3.11+ with automated testing across language versions
- Containerization: Docker support with optimized multi-stage builds for reproducible environments
- Code Quality: OOP, DRY, secure programming practices are followed, resulting in high code quality score
- Minimal reinvention: Relies on well-maintained libraries instead of DIY solutions
Features
- Price series generation for single and multiple assets
- Data preprocessing with configurable missing data handling and scaling options
- Stationarity testing and transformation for time series analysis
- ARIMA modeling for time series forecasting
- GARCH modeling for volatility forecasting and risk assessment
- Bivariate GARCH modeling with both Constant Conditional Correlation (CCC) and Dynamic Conditional Correlation (DCC) methods
- EWMA covariance calculation for dynamic correlation analysis
- Portfolio risk assessment using volatility and correlation matrices
Installation
Install from PyPI (recommended):
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate
pip install generalized-timeseries
Install from GitHub (latest development version):
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate
pip install git+https://github.com/garthmortensen/generalized-timeseries.git
Quick Start
For univariate time series analysis:
python -m generalized_timeseries.examples.example_univariate_garch
For bivariate GARCH analysis (correlation between two assets):
python -m generalized_timeseries.examples.example_bivariate_garch
Docker Support
Run with Docker for isolated environments:
# build the image
docker build -t generalized-timeseries:latest ./
# Run the univariate example
docker run -it generalized-timeseries:latest /app/generalized_timeseries/examples/example_univariate_garch.py
# Run the bivariate example
docker run -it generalized-timeseries:latest /app/generalized_timeseries/examples/example_bivariate_garch.py
# Get into interactive shell
docker run -it --entrypoint /bin/bash generalized-timeseries:latest
Development
Environment Setup
Option 1 (recommended):
mkdir generalized-timeseries
cd generalized-timeseries
# create and activate virtual environment
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate
pip install generalized-timeseries
Option 2
# clone the repository
git clone https://github.com/garthmortensen/generalized-timeseries.git
cd generalized-timeseries
# create and activate virtual environment
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate
pip install -e ".[dev]"
Testing
pytest --cov=generalized_timeseries
Tag & Publish
Iirc, much of the CI/CD actions are gated not behind pushed branches, but pushed tags. It will fail if you don't version += 1
- Bump version in
README.mdandpyproject.toml(e.g.,v0.1.21) - Commit and tag:
git add pyproject.toml README.md git commit -m "version bump" git tag v0.1.21 git push && git push --tags
Overall Process
- Triggers: Runs when code is pushed to branches
mainordev pytest: Validates code across multiple Python versions and OS- The following are gated behind all tests passing:
- Building: Creates package distributions and documentation
- Publishing: Deploys to PyPI, Docker Hub and ReadTheDocs.
Documentation
Full documentation is available at generalized-timeseries.readthedocs.io.
License
Released under the MIT License.
glhf...
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file generalized_timeseries-0.1.21.tar.gz.
File metadata
- Download URL: generalized_timeseries-0.1.21.tar.gz
- Upload date:
- Size: 26.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5ef6a814cd0388c2f2a64bfc1a173ce607ad27431b00cca46a50201e3160ab0d
|
|
| MD5 |
3de3316a980e49bb168ee67d29b12ead
|
|
| BLAKE2b-256 |
319a7649896bc78eba51f0cfcf3c944dd971aabf3c80e0dd5819d2f4102b1220
|
Provenance
The following attestation bundles were made for generalized_timeseries-0.1.21.tar.gz:
Publisher:
cicd.yml on garthmortensen/generalized-timeseries
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
generalized_timeseries-0.1.21.tar.gz -
Subject digest:
5ef6a814cd0388c2f2a64bfc1a173ce607ad27431b00cca46a50201e3160ab0d - Sigstore transparency entry: 192656120
- Sigstore integration time:
-
Permalink:
garthmortensen/generalized-timeseries@4007e5ce581830fc06c9558537ed14d12690e088 -
Branch / Tag:
refs/heads/dev - Owner: https://github.com/garthmortensen
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
cicd.yml@4007e5ce581830fc06c9558537ed14d12690e088 -
Trigger Event:
push
-
Statement type:
File details
Details for the file generalized_timeseries-0.1.21-py3-none-any.whl.
File metadata
- Download URL: generalized_timeseries-0.1.21-py3-none-any.whl
- Upload date:
- Size: 29.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
00d6b6dbb4c6ce783d7fdf64fab7fc11bd3d2bf397ccceb1681ceefadbe42d12
|
|
| MD5 |
6f25933bc0e51a234f928337870cae43
|
|
| BLAKE2b-256 |
490a9f3280fde123c0505e739d235d71ad5007f3d91678a6215961631d461073
|
Provenance
The following attestation bundles were made for generalized_timeseries-0.1.21-py3-none-any.whl:
Publisher:
cicd.yml on garthmortensen/generalized-timeseries
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
generalized_timeseries-0.1.21-py3-none-any.whl -
Subject digest:
00d6b6dbb4c6ce783d7fdf64fab7fc11bd3d2bf397ccceb1681ceefadbe42d12 - Sigstore transparency entry: 192656122
- Sigstore integration time:
-
Permalink:
garthmortensen/generalized-timeseries@4007e5ce581830fc06c9558537ed14d12690e088 -
Branch / Tag:
refs/heads/dev - Owner: https://github.com/garthmortensen
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
cicd.yml@4007e5ce581830fc06c9558537ed14d12690e088 -
Trigger Event:
push
-
Statement type: