Skip to main content

Intelligent time-series caching with Parquet and gap-aware incremental downloads

Project description

stockstash

Intelligent local caching for time-series APIs using Parquet

stockstash provides incremental, gap-aware caching for time-series data. It avoids re-downloading overlapping date ranges and stores data using Parquet.

This library is especially useful for financial data APIs such as yfinance, so that you dont need to download same data again.


✨ Features

  • 📦 Local persistent cache using Parquet
  • 🧠 Intelligent gap detection (downloads only missing dates)
  • 🔌 Provider abstraction (yfinance included)
  • 🗂 One file per symbol (simple & scalable)
  • ♻ Reusable across sessions

📦 Installation

pip install stockstash

🚀 Quick Start

Take a look at the example:

python examples/yfinance_example.py
from stockstash import TimeSeriesCache, ParquetStore, YFinanceProvider

cache = TimeSeriesCache(
    store=ParquetStore("./data"),
    provider=YFinanceProvider(),
)

df = cache.load(
    key="BTC-USD",
    start="2023-01-01",
    end="2023-12-31",
)

print(df.tail())

On subsequent runs, only missing dates are downloaded.

🧠 How It Works

Cached data is loaded from a local Parquet file

Missing date ranges are automatically detected

Only missing ranges are fetched from the API

New data is merged and deduplicated

Cache is updated on disk

📁 Cache Layout

data/
└── AAPL.parquet
└── ETH-USD.parquet

Each file contains a Pandas DataFrame indexed by DatetimeIndex.

🔌 Supported Providers

yfinance (built-in) from stockstash import YFinanceProvider

You can add your own provider by implementing:

class Provider:
    def fetch(self, key: str, start, end):
        ...

Project details


Release history Release notifications | RSS feed

This version

0.1

Download files

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

Source Distribution

stockstash-0.1.tar.gz (3.9 kB view details)

Uploaded Source

Built Distribution

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

stockstash-0.1-py3-none-any.whl (4.7 kB view details)

Uploaded Python 3

File details

Details for the file stockstash-0.1.tar.gz.

File metadata

  • Download URL: stockstash-0.1.tar.gz
  • Upload date:
  • Size: 3.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.0

File hashes

Hashes for stockstash-0.1.tar.gz
Algorithm Hash digest
SHA256 2f0bc5c93b2e59213410be32a086dce01a5a76a9122bfedc071dc43a4f1f611e
MD5 f56871e86bfc13c64620af7e5708b1b1
BLAKE2b-256 0348c2154091a759ffdada52e6c447c423eb864777a9cee46f8c470ba76457b7

See more details on using hashes here.

File details

Details for the file stockstash-0.1-py3-none-any.whl.

File metadata

  • Download URL: stockstash-0.1-py3-none-any.whl
  • Upload date:
  • Size: 4.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.0

File hashes

Hashes for stockstash-0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 60d22d96418d5f3cce45fd2e768b6801a457007b28d15e402b36709fe866d69c
MD5 b58fab4a1fea80b4c50215e35e499d26
BLAKE2b-256 e3194c8061ec3830a3de73f292f47dbf67d56064a8f3f16174ec215c785d77ee

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