'Error triggers when scraping historical data from stock that only has 1 day of historical data
I'm getting data using yahoo_fin. Im Getting the last 100 days from current date. The list tickers_sp500() works but when I try using list tickers_nasdaq(). It keeps throwing timestamp error. I found that it triggers the error when it gets to AGBR from Nasdaq list which only has one row in historical data. In this example Its getting all the data and not just the last 100 but I still get the error. Error is "KeyError: 'timestamp'"
import yahoo_fin.stock_info as si
lists=si.tickers_nasdaq()
#lists=si.tickera_sp500()
prices={}
for ticker in lists:
prices[ticker]=si.get_data(ticker)
print(prices[ticker])
That code works with sp500. So my question is how can I get the code to skip tickers that don't have historical data more than 100 or is there a way to ignore that error so i can still get the data even though it's less than 100 rows.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
