Skip to main content

Python module for loading time series data.

Project description

Python module for downloading time series data

This repository gets data from the Alpha Vantage API: https://www.alphavantage.co/. You need an API key in order to use the utilities in this repo.

You can retrieve price data from many stocks traded in stock markets.

Load Data

To use this module, you will need to have your own Alpha Vantage API key.

from loaders import loader

data_loader = loader.LoaderAlphaV(symbol="AAPL", interval=1)

df = data_loader.ts_intraday()

df_ext = data_loader.ts_intraday_extended(interval='5min&slice=year1month5')

Preprocess

This module is focused on producing data that is ingestible by pytorch models. The results is to return a Dataloader iteratior that can easily be used by the pytorch-framework. The preprocess module contains code for preprocessing of time series data.

The following steps are recommended for time series data:

  1. Split in train-valid-test sets
  2. Separate continous from categorical data
  3. Make sequential data
  4. Normalize data, where X(t) = x(t -1 , ..., t - n); X(t - 1) = x(t - 2), ..., x(t - n); y(t) = x(t); y(t - 1) = x(t - 1), etc.
  5. Transform to pytorch tensors.

There might be other options for the preprocessing that are equally well suited for your problem.

The class ContCatSplit can be used on a financial time series. It can create date-features and then we can split data in time series and date features.

Packaging

For details on packaging and folder structure, see the link https://packaging.python.org/en/latest/tutorials/packaging-projects/

On windows, install latest version of pip:

py -m pip install --ugrade pip

Create distribution package, make sure you have latest PyPA's build installed

py -m pip install --upgrade build

Build

py -m build

You need to have Twine installed:

py -m pip install --upgrade twine

To publish on PyPi do the following:

twine upload dist/*

Install your newly created packege with:

python3 -m pip install [your-package]

For publishing in Test PyPI do the following:

py -m pip install --index-url https://test.pypi.org/simple/ --no-deps example-package-YOUR-USERNAME-HERE

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

financial_ts-0.1.39.tar.gz (7.4 kB view details)

Uploaded Source

Built Distribution

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

financial_ts-0.1.39-py3-none-any.whl (8.1 kB view details)

Uploaded Python 3

File details

Details for the file financial_ts-0.1.39.tar.gz.

File metadata

  • Download URL: financial_ts-0.1.39.tar.gz
  • Upload date:
  • Size: 7.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/32.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.7 tqdm/4.62.3 importlib-metadata/4.10.0 keyring/21.8.0 rfc3986/1.5.0 colorama/0.4.4 CPython/3.9.5

File hashes

Hashes for financial_ts-0.1.39.tar.gz
Algorithm Hash digest
SHA256 4e536f55c45d6abfebf4d92f68f77fa40887444095ac64c640ac773b46cb7158
MD5 2df617920d2ad241923579c8d64d9ffb
BLAKE2b-256 0dd351514d2b9e3e72a6c1d299cb32819dd9a6da17a0a4d4a792434b701669c0

See more details on using hashes here.

File details

Details for the file financial_ts-0.1.39-py3-none-any.whl.

File metadata

  • Download URL: financial_ts-0.1.39-py3-none-any.whl
  • Upload date:
  • Size: 8.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/32.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.7 tqdm/4.62.3 importlib-metadata/4.10.0 keyring/21.8.0 rfc3986/1.5.0 colorama/0.4.4 CPython/3.9.5

File hashes

Hashes for financial_ts-0.1.39-py3-none-any.whl
Algorithm Hash digest
SHA256 40da50c5346c9ac05c5296bfebd407d25834aac6296feb1c2a8a5bb601e366e6
MD5 4746fd0d9a5b3c5fa201dc191b6cafb0
BLAKE2b-256 81303c11e8ddb09d82cb8c9de8e7633e25d074214e24a8be793f5eb333e52843

See more details on using hashes here.

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