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
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 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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2f0bc5c93b2e59213410be32a086dce01a5a76a9122bfedc071dc43a4f1f611e
|
|
| MD5 |
f56871e86bfc13c64620af7e5708b1b1
|
|
| BLAKE2b-256 |
0348c2154091a759ffdada52e6c447c423eb864777a9cee46f8c470ba76457b7
|
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
60d22d96418d5f3cce45fd2e768b6801a457007b28d15e402b36709fe866d69c
|
|
| MD5 |
b58fab4a1fea80b4c50215e35e499d26
|
|
| BLAKE2b-256 |
e3194c8061ec3830a3de73f292f47dbf67d56064a8f3f16174ec215c785d77ee
|