# Market Data Operations Runbook Prepared: 2026-07-02 UTC ## Standard PMData Extension Flow 1. Download new PMData dates. ```bash python3 scripts/download_pmdata.py \ --start-date 2026-04-01 \ --end-date 2026-04-07 \ --series btc-5m \ --data-type poly_l2 \ --data-type polygon_trades \ --manifest reports/pmdata_btc_5m_20260401_20260407_download_manifest.json ``` 2. Audit the new range. ```bash python3 scripts/audit_pmdata_range.py \ --start-date 2026-04-01 \ --end-date 2026-04-07 \ --series btc-5m \ --out reports/pmdata_btc_5m_20260401_20260407_audit.json ``` 3. Rebuild the global catalog. ```bash python3 scripts/build_dataset_catalog.py ``` 4. Upload to Hugging Face. ```bash python3 scripts/upload_market_data_to_hf.py \ --repo-id / \ --start-date 2026-04-01 \ --end-date 2026-04-07 \ --token-stdin ``` 5. Verify the remote by downloading only one day into `/tmp`. ```bash python3 scripts/download_hf_pmdata_range.py \ --repo-id / \ --start-date 2026-04-01 \ --end-date 2026-04-01 \ --data-type poly_l2 \ --out-dir /tmp/pmdata_hf_verify \ --include-metadata ``` ## Quality Rules - Every downloaded range gets a manifest and audit JSON. - Every upload must include refreshed catalog files. - Short archives are allowed only if they are documented in `pmdata_missing_windows.csv`. - Backtests must use the missing-window mask; do not silently forward-fill missing L2 windows. - Keep Hugging Face datasets private unless redistribution rights are confirmed. - Never write PMData or Hugging Face API keys into scripts, docs, manifests, or shell history. ## Local Space Management The local PMData folder is a cache, not the permanent source of truth after upload: ```text data/pmdata/btc-5m/YYYY-MM-DD/ ``` After a successful upload and remote spot-check, old local date ranges can be removed if space is needed. Keep the catalogs and reports. ## Backtester Integration Rule For execution-quality strategy runs: - PMData `poly_l2`: primary source. - PMData `polygon_trades`: audit/reconciliation source. - DOME: baseline and fallback source. Every run should record whether a window was: - `pmdata_complete` - `pmdata_missing_excluded` - `dome_fallback` - `mixed_or_patched` This prevents mixed data quality from being hidden inside a single PnL result.