HdW Stock Data
First draft of hdw-stock-data 0.1.0: retrieve stock observations directly
from Yahoo's chart HTTP endpoint, normalize OHLCV, preserve timestamp instants,
and optionally write an atomic CSV snapshot. It uses requests, not yfinance.
This project is independent of hdw-crypto-data.
Install
Python 3.11 or newer is required. From the repository root:
py -3.13 -m venv .venv
.\.venv\Scripts\Activate.ps1
python -m pip install -e ".[dev]"
Use
from hdw_stock_data import YahooStockLoader
result = YahooStockLoader().load(
"^GSPC", interval="1h", days=730,
preferred_tz="Europe/Amsterdam", save_to="snapshots",
)
sp500 = result.dataframe["close"].rename("sp500")
print(result.descriptor)
print(result.filepath, result.warnings)
Only 1h is validated for this release. Both client and loader default to
730 days and reject longer ranges before retrieval. This is a tested capability
limit, not a guarantee that every symbol has 730 days of observations.
At the 730-day limit, the client moves the requested start forward by five
minutes to provide a margin inside Yahoo's rolling cutoff. Shorter requests
retain their full duration.
Data contract
The frame has a sorted, unique, timezone-aware DatetimeIndex named dt and
numeric open, high, low, close, volume columns. Missing OHLC rows are
removed; missing volume is retained. The last valid duplicate is kept. Invalid
OHLC relationships, negative volume, nonfinite values, and invalid timestamps
are rejected. No shifts, resampling, or gap filling are applied.
number_of_trades contains pd.NA with nullable Float64 dtype for chart
compatibility. Trade counts are unavailable, not zero. This additional column
is optional to the market-data validator. result.data aliases dataframe.
The descriptor records actual normalized bounds and count, currency and exchange
when available, provider yahoo, and output timezone. adjusted=False means
the package performs no price adjustment; source adjustments are not undone.
Verification
py -3.13 -m unittest discover -s tests -v
py -3.13 -m build
py -3.13 -m twine check dist/*
Tests use mocked HTTP responses and local files. Live requests are opt-in:
py -3.13 -m examples.fetch_stock AAPL --days 5
Run the initial stock and index smoke test (AAPL, ASML.AS, ^GSPC, ^VIX):
py -3.13 -m examples.test_assets
py -3.13 -m examples.test_assets --days 5 --save-to snapshots
This retrieves hourly bars, prints actual bounds and the latest five rows for
each symbol, and exits with status 1 if any retrieval fails. The default output
timezone is Europe/Amsterdam; override it with --timezone UTC. You can also
provide a different list of symbols as positional arguments.
See architecture, API, and testing plan, and showcase setup. No live-provider coverage is claimed by the offline test suite.
Release files for hdw-stock-data 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| hdw_stock_data-0.1.0.tar.gz | 340.3 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| hdw_stock_data-0.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 353.1 kB
Release files / hdw_stock_data-0.1.0.tar.gz
| Download URL | hdw_stock_data-0.1.0.tar.gz |
|---|---|
| Size | 340.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
811cb220f9be4eb629d22d1eed3f6001abd7055a4e2e70c5dc0fb9e6c3cdb0ce
|
|
BLAKE2b-256 checksum How to use checksums |
7f26be52c83f771c3efe6199de7f01c1b9ac71edcdee700ed10398e40990170e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.13
|
Release files / hdw_stock_data-0.1.0-py3-none-any.whl
| Download URL | hdw_stock_data-0.1.0-py3-none-any.whl |
|---|---|
| Size | 12.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
c86b9a449212567a045c81ba0fb002a83c724767e1fab8fc79fd4bc685873fc2
|
|
BLAKE2b-256 checksum How to use checksums |
a7a3c617775bdd4105e6d194c63751c59e6f43c12b6ca6773208b95f38899534
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.13
|