Skip to main content

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

Python Versions PyPI Docker Hub

CI/CD codecov Codacy Badge

readthedocs.io

 ▗▄▄▖▗▄▄▄▖▗▖  ▗▖▗▄▄▄▖▗▄▄▖  ▗▄▖ ▗▖   ▗▄▄▄▖▗▄▄▄▄▖▗▄▄▄▖▗▄▄▄ 
▐▌   ▐▌   ▐▛▚▖▐▌▐▌   ▐▌ ▐▌▐▌ ▐▌▐▌     █     ▗▞▘▐▌   ▐▌  █
▐▌▝▜▌▐▛▀▀▘▐▌ ▝▜▌▐▛▀▀▘▐▛▀▚▖▐▛▀▜▌▐▌     █   ▗▞▘  ▐▛▀▀▘▐▌  █
▝▚▄▞▘▐▙▄▄▖▐▌  ▐▌▐▙▄▄▖▐▌ ▐▌▐▌ ▐▌▐▙▄▄▖▗▄█▄▖▐▙▄▄▄▖▐▙▄▄▖▐▙▄▄▀
     ▗▄▄▄▖▗▄▄▄▖▗▖  ▗▖▗▄▄▄▖ ▗▄▄▖▗▄▄▄▖▗▄▄▖ ▗▄▄▄▖▗▄▄▄▖ ▗▄▄▖
       █    █  ▐▛▚▞▜▌▐▌   ▐▌   ▐▌   ▐▌ ▐▌  █  ▐▌   ▐▌
       █    █  ▐▌  ▐▌▐▛▀▀▘ ▝▀▚▖▐▛▀▀▘▐▛▀▚▖  █  ▐▛▀▀▘ ▝▀▚▖
       █  g▄█▄m▐▌  ▐▌▐▙▄▄▖▗▄▄▞▘▐▙▄▄▖▐▌ ▐▌▗▄█▄▖▐▙▄▄▖▗▄▄▞▘

A Python package for timeseries data processing and modeling using ARIMA and GARCH models.

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.toml instead of legacy setup.py for more robust dependency management and packaging. requirements.txt allows users to easily construct venv virtual 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
  • 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

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 a near-complete working example:

python -m generalized_timeseries.examples.example

Docker Support

Run with Docker for isolated environments:

# build the image
docker build -t generalized-timeseries:latest ./

# R\run the example pipeline
docker run -it generalized-timeseries:latest /app/generalized_timeseries/examples/example.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

  1. Bump version in README.md and pyproject.toml (e.g., v0.1.17)
  2. Commit and tag:
    git add pyproject.toml README.md
    git commit -m "version bump"
    git tag v0.1.17
    git push && git push --tags  # push branch and tag at once
    

Overall Process

  • Triggers: Runs when code is pushed to branches main or dev
  • 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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

generalized_timeseries-0.1.17.tar.gz (22.3 kB view details)

Uploaded Source

Built Distribution

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

generalized_timeseries-0.1.17-py3-none-any.whl (23.8 kB view details)

Uploaded Python 3

File details

Details for the file generalized_timeseries-0.1.17.tar.gz.

File metadata

  • Download URL: generalized_timeseries-0.1.17.tar.gz
  • Upload date:
  • Size: 22.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for generalized_timeseries-0.1.17.tar.gz
Algorithm Hash digest
SHA256 6490f8b8e9eb8836038a43f401ea9dfe6039a0a46e8d3e702d9c4614a5c76e94
MD5 75fa3ee5b6edc743ee825eff1c2eb2ce
BLAKE2b-256 03a6b99d31aa72b5745c25e10defcd73b4fcc8e394f15d94287cec6d644fe095

See more details on using hashes here.

Provenance

The following attestation bundles were made for generalized_timeseries-0.1.17.tar.gz:

Publisher: cicd.yml on garthmortensen/generalized-timeseries

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

File details

Details for the file generalized_timeseries-0.1.17-py3-none-any.whl.

File metadata

File hashes

Hashes for generalized_timeseries-0.1.17-py3-none-any.whl
Algorithm Hash digest
SHA256 e57c5584c0247485bf4de68593f27aaaa771441f2ec7904059b7700050f1a40c
MD5 3171d3ec09ebd14dedc93ed81e7ca617
BLAKE2b-256 d9a4eb6054d359267e6b015e4955364fba672fdb54bbd0b1667aa4a70aac2443

See more details on using hashes here.

Provenance

The following attestation bundles were made for generalized_timeseries-0.1.17-py3-none-any.whl:

Publisher: cicd.yml on garthmortensen/generalized-timeseries

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