I've been using Yfinance to download and analyze historic data for a few months now. I noticed recently that when I try to download historic data, I get the following error message:
I couldn't get the script above to work at all until I referenced this source: yfinance not working - receiving json.decoder.JSONDecodeError
But even after updating yfinance and pandas_datareader, I am still getting the json decode error. If I run the script with only 50 tickers, I don't end up getting any error and it works fine, but when I try to run it on ~2000 tickers, it fails. So I wonder if it has something to do with too many requests?
Also, if I continue to let it run despite the error messages, it stops at 99% and won't finish:
Full script:
import datetime
start = datetime.datetime(2021,7,10)
end = datetime.datetime(2021,8,5)
#Short list of tickers, usually around 2000 here.
schwab_list = ['MX', 'ADVM', 'TALO', 'DAC', 'SIL', 'AGRO', 'CRIS', 'AMRX', 'STNG', 'HUTMF']
import yfinance as yf
from pandas_datareader import data as pdr, wb
import pandas as pd
import numpy as np
import random
# for scraping faster
yf.pdr_override() # <== that's all it takes :-)
sample = yf.download(schwab_list, start=start, end=end, threads=True)
Any help appreciated!
Upgrade to version 0.1.63 using:
pip install yfinance --upgrade --no-cache-dir