From afb41524d44943154f7a889166f7b44671ae0ca6 Mon Sep 17 00:00:00 2001 From: Joshua Brown Date: Sun, 26 Apr 2026 15:56:53 +0100 Subject: [PATCH] Update download_historical_prices.py Rewrote some code so that it works with the yfinance libarary not the outdated yahoo_finance. So that if the file "_KeyStats" is present the code works as intended --- download_historical_prices.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/download_historical_prices.py b/download_historical_prices.py index af433056..fb5b7852 100644 --- a/download_historical_prices.py +++ b/download_historical_prices.py @@ -1,9 +1,7 @@ import os -from pandas_datareader import data as pdr import pandas as pd -import fix_yahoo_finance as yf +import yfinance as yf -yf.pdr_override() START_DATE = "2003-08-01" END_DATE = "2015-01-01" @@ -25,7 +23,7 @@ def build_stock_dataset(start=START_DATE, end=END_DATE): # Get all Adjusted Close prices for all the tickers in our list, # between START_DATE and END_DATE - all_data = pdr.get_data_yahoo(ticker_list, start, end) + all_data = all_data = yf.download(ticker_list, start=start, end=end) stock_data = all_data["Adj Close"] # Remove any columns that hold no data, and print their tickers.