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

CI/CD readthedocs.io Docker Hub

codecov Codacy Badge

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

Features

  • Price series generation for simulation.
  • Data preprocessing including missing data handling and scaling.
  • Stationarity testing and transformation.
  • ARIMA and GARCH models for time series forecasting.

Installation

Install from pypi:

python -m venv venv
source venv/bin/activate
pip install generalized-timeseries

Install from github:

python -m venv venv
source venv/bin/activate
pip install git+https://github.com/garthmortensen/generalized-timeseries.git

Usage

from generalized_timeseries import data_generator, data_processor, stats_model

# generate price series data
price_series = data_generator.generate_price_series(length=1000)

# preprocess the data
processed_data = data_processor.preprocess_data(price_series)

# fit ARIMA model
arima_model = stats_model.fit_arima(processed_data)

# fit GARCH model
garch_model = stats_model.fit_garch(processed_data)

# forecast using ARIMA model
arima_forecast = stats_model.forecast_arima(arima_model, steps=10)

# forecast using GARCH model
garch_forecast = stats_model.forecast_garch(garch_model, steps=10)

print("ARIMA Forecast:", arima_forecast)
print("GARCH Forecast:", garch_forecast)

Alternatively,

python generalized_timeseries/examples/example.py

Publishing Maintenance

Reminder on how to manually push to pypi. This step, along with autodoc build, is automated with CI/CD.

Steps

  1. bump version in pyproject.toml to v0.1.11

  2. git add, commit:

    git add pyproject.toml
    git commit -m "Ver: bump"
    git tag v0.1.11
    git push && git push --tags
    

pypi

pip install --upgrade build
pip install --upgrade twine
python -m build  # build the package
twine check dist/  # check it works
twine upload dist/

rm -rf dist build *.egg-info # restart if needed

Design Decisions

Package project

This package was created in order to carve out code from a larger thesis remake project. Doing so increased modularity. pyproject.toml is used instead of setup.py to achieve a modern build process for publishing to pypi. It also supports direct pip installation via github clone.

Self documenting code

To achieve self-documenting code, docstrings are used.

Due to there being a fair amount of modules, classes and functions, type hints are used. Variable annotations (myvar: int = 5) are just too visually distracting, and are not used.

Sphinx converts all this metadata into .html and hosted on readthedocs.io.

Test covereage

Unit tests cover the majority of the codebase, to ensure code changes don't break existing functionality. Codecov.io is used to analyze code coverage.

Code quality

Codacy is used to analyze code quality, and highly any insecure programming issues.

Branching

Branches were used early on in the project for the sake of purity, but eventually pragmatism took over.

venv

Virtual environments and requirements.txt enable sandboxed development.

OS support

The code is OS-agnostic, and tested across ubuntu and mac-os. Due to the slow spin-up times of testing on a Windows build, it's been excluded from testing since v0.1.7.

CI/CD

A Github Actions workflow automates the labor involved with pytest, package build (wheels included), pypi distribution, producing sphinx autodocs, publishing docs to readthedocs.io, and publishing to docker hub.

Docker

TODO: Add Docker pull commands

In addition to venv, docker encapsulates the app and dependencies. This helps run it across different environments.

docker build -t generalized-timeseries:latest ./
docker run -it generalized-timeseries:latest /app/generalized_timeseries/examples/example.py  # run example pipeline
docker run -it --entrypoint /bin/bash generalized-timeseries:latest  # interactive shell in container

Makefile

Inspired by deepseek repos makefiles, I want to add a makefile.

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.12.tar.gz (21.5 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.12-py3-none-any.whl (23.3 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: generalized_timeseries-0.1.12.tar.gz
  • Upload date:
  • Size: 21.5 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.12.tar.gz
Algorithm Hash digest
SHA256 a841b7c13176e3fddfd9b48b19e21c12eeef580040b68d082319e0f5ea48f9ac
MD5 33bea4e2d2d8e62d0b3f06bab945334a
BLAKE2b-256 9066d2f22107be9511aa094f291bc64032a86ff910218d3d8ecb6e06df372cf3

See more details on using hashes here.

Provenance

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

Publisher: execute_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.12-py3-none-any.whl.

File metadata

File hashes

Hashes for generalized_timeseries-0.1.12-py3-none-any.whl
Algorithm Hash digest
SHA256 b1c05cad31b998efb5eeb2ef95bdc78f1f61cd1a57955e333eb240e7a5322429
MD5 4a19fe873f04ea3f5049041aa2771e7e
BLAKE2b-256 fb93510897ede10c8ee1956e69921bbc21214234e78abc9a1941393d067bb596

See more details on using hashes here.

Provenance

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

Publisher: execute_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