OHLCV data fetching and processing tool
Project description
ohlcv-hub
A small dataset builder for US stocks and ETFs: fetch daily OHLCV bars from Alpaca, optionally resample to weekly, validate, and export to Parquet or CSV with a validation report (missing days, duplicates, OHLC sanity).
Features
- Daily bars (1d): Fetch historical daily bars from Alpaca Market Data API; normalize, validate, and export.
- Weekly bars (1w): Resample daily bars to weekly (Monday 00:00 UTC); same validation and export.
- Validation: Duplicate detection, monotonic timestamps, OHLC sanity, volume checks; missing trading days (NYSE calendar).
- Output: Parquet (default) or CSV; optional
validation_report.json. - Rate limiting: Proactive throttling and 429 retry with backoff; optional
--verbosedebug logging.
Quickstart
Install
From PyPI (once published):
pip install ohlcv-hub
For local development:
pip install -e ".[dev]"
Environment
Set your Alpaca credentials:
ALPACA_API_KEY— requiredALPACA_API_SECRET— requiredALPACA_DATA_BASE_URL— optional (default:https://data.alpaca.markets)
Example commands
# Check configuration
ohlcv-hub doctor
# Fetch daily bars (default feed: iex)
ohlcv-hub fetch --symbols SPY,QQQ --start 2024-01-01 --end 2024-02-01 --tf 1d --out ./data
# Fetch weekly bars (resampled from daily)
ohlcv-hub fetch --symbols SPY --start 2024-01-01 --end 2024-02-01 --tf 1w --out ./data
# Use a different feed: --feed iex | sip | boats | otc
ohlcv-hub fetch --symbols SPY --start 2024-01-01 --end 2024-01-10 --tf 1d --out ./data --feed sip
Output
- Daily:
<out>/ohlcv_1d_<YYYYMMDD>_<YYYYMMDD>.parquet(or.csv) - Weekly:
<out>/ohlcv_1w_<YYYYMMDD>_<YYYYMMDD>.parquet(or.csv) - Report (if
--report):<out>/validation_report.json(missing days, issues summary)
Schema
| Column | Description |
|---|---|
| symbol | Ticker (e.g. SPY) |
| timeframe | 1d or 1w |
| ts | Bar timestamp (UTC) |
| open, high, low, close | OHLC |
| volume | Volume |
| source | Data source |
| currency | Currency (e.g. USD) |
| adjustment | Adjustment (e.g. raw) |
Notes / Limitations (MVP)
- No intraday: Daily and weekly bars only; no minute or realtime data.
- No strategies: Fetch, validate, and export only; no backtesting or signals.
- Alpaca: Requires an Alpaca account and data subscription. Free tier often includes IEX; SIP may require a paid plan. Use
--feed iex(default) or--feed sipas appropriate.
Development
pip install -e ".[dev]"
pytest -q
bandit -r ohlcv_hub -x tests -q
For dependency auditing (Python 3.10+): pip install -e ".[audit]" then pip-audit.
Internal release and security notes live under docs/internal/.
License
MIT
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 ohlcv_hub-0.1.2.tar.gz.
File metadata
- Download URL: ohlcv_hub-0.1.2.tar.gz
- Upload date:
- Size: 23.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
16cc8cb8233e5ba8b382fc70d45e576e2a7667e2ae573ad5ff37a39f10d44365
|
|
| MD5 |
b50485a23db5b8fc46cb18d5a5867235
|
|
| BLAKE2b-256 |
50662b53378dac524097c4e943afc41f1c1e8a36977961be95d2c98548a350c8
|
Provenance
The following attestation bundles were made for ohlcv_hub-0.1.2.tar.gz:
Publisher:
publish.yml on Vallehtelia/ohlcv-hub
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
ohlcv_hub-0.1.2.tar.gz -
Subject digest:
16cc8cb8233e5ba8b382fc70d45e576e2a7667e2ae573ad5ff37a39f10d44365 - Sigstore transparency entry: 975815567
- Sigstore integration time:
-
Permalink:
Vallehtelia/ohlcv-hub@65ddc57c3d1e4676d235b904faecb3783d4851a5 -
Branch / Tag:
refs/tags/v0.1.2 - Owner: https://github.com/Vallehtelia
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@65ddc57c3d1e4676d235b904faecb3783d4851a5 -
Trigger Event:
push
-
Statement type:
File details
Details for the file ohlcv_hub-0.1.2-py3-none-any.whl.
File metadata
- Download URL: ohlcv_hub-0.1.2-py3-none-any.whl
- Upload date:
- Size: 19.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
bb4227964c951431c477f42e821bd97c7e9dc6775c4c073cb652e69008a935a7
|
|
| MD5 |
8e19fdbebeab5dfc649c5caf8e849536
|
|
| BLAKE2b-256 |
8b34cbd96d802900cb0467d741ceccb3aca89e33ac079726b4651ce886e14ef0
|
Provenance
The following attestation bundles were made for ohlcv_hub-0.1.2-py3-none-any.whl:
Publisher:
publish.yml on Vallehtelia/ohlcv-hub
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
ohlcv_hub-0.1.2-py3-none-any.whl -
Subject digest:
bb4227964c951431c477f42e821bd97c7e9dc6775c4c073cb652e69008a935a7 - Sigstore transparency entry: 975815568
- Sigstore integration time:
-
Permalink:
Vallehtelia/ohlcv-hub@65ddc57c3d1e4676d235b904faecb3783d4851a5 -
Branch / Tag:
refs/tags/v0.1.2 - Owner: https://github.com/Vallehtelia
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@65ddc57c3d1e4676d235b904faecb3783d4851a5 -
Trigger Event:
push
-
Statement type: