Have you had issues with the Python yfinance library recently? Python stock market scripts built on yfinance have been breaking since Yahoo Finance's February 2025 website redesign that introduced new quotas and a different HTML schema for tables.
This video shows you how to swap in Stooq, a longstanding data service that offers decades of stock ticker history and delayed 5-minute and 60-minute intraday bars for free, without an API key.
This short tutorial covers the basics of Stooq for quant finance, highlights how it compares to the yfinance Python library in pulling OHLCV stock data (open, high, low, close, and volume) and demonstrates how to do a data pull in just 5 lines of code with the pandas library.
Want to do AI-Powered Technical Analysis direclty inside of Google Sheets?
Check out the FREE AI for Charts Google Sheets Add On: https://workspace.google.com/marketplace/app/ai_for_charts/21420672275
Env Setup
pip install pandas
Full Code
import pandas as pd
from datetime import datetime, timedelta
ticker = "nvda.us" # Stooq wants the .us suffix for U.S. stocks
end = datetime.today()
start = end - timedelta(days=5*365)
url = f"https://stooq.com/q/d/l/?s={ticker}&d1={start:%Y%m%d}&d2={end:%Y%m%d}&i=d"
nvda = (pd.read_csv(url, parse_dates=["Date"])
.set_index("Date")
.sort_index()) # chronological order
nvda
Learn more about AI for Charts: https://aiforcharts.com/
Subscribe to the Deep Charts YouTube Channel for more informative AI and Machine Learning Tutorials.