Hugging Face Dataset Layout
Prepared: 2026-07-02 UTC
Goal
The Hugging Face dataset must support modular upload and modular download. The main use case is:
- upload new PMData dates as they are downloaded;
- preserve exact audit/catalog metadata;
- download only a requested date range, such as March 1-10 or the full month of March;
- avoid cloning the full repository on machines with limited disk space.
Canonical Remote Layout
The upload script writes PMData ZIPs to:
pmdata/
series=btc-5m/
date=2026-03-16/
btc-5m_poly_l2_2026-03-16.zip
btc-5m_polygon_trades_2026-03-16.zip
date=2026-03-17/
btc-5m_poly_l2_2026-03-17.zip
btc-5m_polygon_trades_2026-03-17.zip
Metadata and documentation are stored separately:
README.md
docs/
catalog/
reports/
tools/
This structure is intentionally date-partitioned. It makes allow_patterns downloads practical through huggingface_hub.snapshot_download.
Download Only A Date Range
Use the helper:
python3 scripts/download_hf_pmdata_range.py \
--repo-id <owner>/<dataset-name> \
--series btc-5m \
--start-date 2026-03-01 \
--end-date 2026-03-10 \
--data-type poly_l2 \
--out-dir /tmp/pmdata_march_1_10
Download both L2 and polygon trades:
python3 scripts/download_hf_pmdata_range.py \
--repo-id <owner>/<dataset-name> \
--series btc-5m \
--start-date 2026-03-01 \
--end-date 2026-03-31 \
--out-dir /tmp/pmdata_march
Print the exact Hugging Face allow_patterns without downloading:
python3 scripts/download_hf_pmdata_range.py \
--repo-id <owner>/<dataset-name> \
--series btc-5m \
--start-date 2026-03-01 \
--end-date 2026-03-10 \
--data-type poly_l2 \
--print-patterns
Upload New Dates
After downloading and auditing new PMData dates, rebuild the catalog:
python3 scripts/build_dataset_catalog.py
Upload a specific range:
python3 scripts/upload_market_data_to_hf.py \
--repo-id <owner>/<dataset-name> \
--start-date 2026-04-01 \
--end-date 2026-04-07 \
--token-stdin
Upload only L2:
python3 scripts/upload_market_data_to_hf.py \
--repo-id <owner>/<dataset-name> \
--start-date 2026-04-01 \
--end-date 2026-04-07 \
--data-type poly_l2 \
--token-stdin
The uploader creates or updates a private dataset repo by default. Use --public only if redistribution is allowed.
Why Not Git Clone Everything?
Full Git or LFS clone is the wrong default for this workflow because the data will grow month by month. Use the Hugging Face Hub API with date-specific paths instead. Keep local data disposable:
- Download only the dates needed for a backtest.
- Run the backtest.
- Delete the local date range.
- Re-download later from the archive if needed.
Catalog Files
The catalog is the source of truth for what exists:
catalog/coverage_summary.md
catalog/market_data_catalog.json
catalog/pmdata_inventory.csv
catalog/pmdata_missing_windows.csv
catalog/dome_inventory.csv
pmdata_inventory.csv is the date log. It records series, date, data type, local path, Hugging Face path, ZIP size, row count, parquet count, and missing-file counts.
pmdata_missing_windows.csv records exact missing market files from short archives.