Python 75.9%
TeX 24%
1#!/usr/bin/env python32"""3================================================================4Auteur : Simon-Pierre Boucher5Contact : contact@spboucher.ai6Projet : Prévision de volatilité réalisée multi-actifs7 (HAR-RV vs GARCH vs Machine Learning)8Fichier : 01_download_data.py9Description : Étape 01 — Téléchargement des barres 1-min et daily10 pour tout l'univers (cache parquet data/raw).11Usage : python scripts/01_download_data.py [--refresh]12================================================================13"""1415from __future__ import annotations1617import argparse18import logging19import sys20from pathlib import Path2122sys.path.insert(0, str(Path(__file__).resolve().parents[1] / "src"))2324from wp12 import config, data_pipeline # noqa: E40225from wp12.api_client import HFMarketDataClient # noqa: E4022627logger = logging.getLogger("01_download")282930def main() -> None:31 """Download 1-min and daily bars for every instrument in the universe."""32 ap = argparse.ArgumentParser()33 ap.add_argument("--refresh", action="store_true", help="force re-download")34 args = ap.parse_args()3536 config.setup_logging()37 logging.getLogger("urllib3").setLevel(logging.WARNING)38 client = HFMarketDataClient()39 todo = config.universe(include_predictors=True)40 for i, inst in enumerate(todo, 1):41 logger.info("[%d/%d] %s (%s)", i, len(todo), inst["ticker"], inst["asset"])42 bars = data_pipeline.download_instrument(client, inst, refresh=args.refresh)43 for tf, df in bars.items():44 logger.info(" %s: %d rows", tf, len(df))454647if __name__ == "__main__":48 main()49