ranaroussi / yfinance

Download market data from Yahoo! Finance's API
https://aroussi.com/post/python-yahoo-finance
Apache License 2.0
14.67k stars 2.44k forks source link

Save errors as list when performing bulk ticker downloads #183

Closed AndrewJCB closed 3 years ago

AndrewJCB commented 4 years ago

I'd like to be able to save the tickers that fail to download as a list so that I can update my list of tickers for stocks daily rather than having to copy the console output of the data function and clean the data - is there a way to include this functionality in yfinance? Attempting to download all ASX listed stocks produces this list but fails to remove them from 'data'. Is there a way to automatically remove the failed downloads from data or to have it as a variable say data.errors()?

[*100%***] 2189 of 2189 completed

178 Failed downloads:

HartBlanc commented 4 years ago

I'm accessing the failed tickers as in the example below. Not sure if this resolves your issue?

import yfinance as yf
data = yf.download(tickers, start_date)
missing = list(yf.shared._ERRORS.keys())