[ yfinance limitations for backtesting ]

A yfinance alternative is useful once a notebook becomes a repeatable research pipeline.

[ Where yfinance fits ]

yfinance is free, ubiquitous, and convenient for exploring a handful of symbols. It is a Python wrapper around Yahoo Finance web endpoints, not a documented market-data service with stable bulk files.

[ Where it breaks down ]

  • Yahoo can change or rate-limit endpoints unpredictably.
  • History varies by ticker, with gaps and inconsistencies common.
  • Delisted tickers are often missing or incomplete.
  • Bulk downloads are ticker-by-ticker instead of one file per trading day.

[ Cache a reproducible Parquet input ]

  import pandas as pd

  # Once downloaded, the same Parquet file gives the same backtest input.
  df = pd.read_parquet("stock_daily_2024-01-15.parquet")
  universe = df[df.symbol.isin(["AAPL", "MSFT", "SPY"])]
  print(universe[["symbol", "date", "close", "volume"]].head())

[ Related ]

stock data hub · browse stock daily · pricing · delisted stock data · DuckDB guide