atreadw1492 / yahoo_fin

Scrape stock price history from new (Spring 2017) Yahoo Finance layout
MIT License
292 stars 125 forks source link

Error with get_data for indicators (ex: ^QMI) #31

Closed schustan235 closed 3 years ago

schustan235 commented 3 years ago

Seems to be an issue with line 89 in stock_info in the get_data function. Result is "KeyError: 'adjclose'" which implies that adjclose is not a feature of that dataset. I tried removing the 'adjclose' element, but a new issue appeared: "KeyError: 'timestamp'" within the temp_time line.

RekaCodes commented 3 years ago

I get the same "KeyError: 'adjclose'" when running get_data on a list of S&P500 tickers. I think I narrowed the issue to a specific ticker "BF.B" (Brown-Foreman). Could the issue be the special characters?

Script runs fine on AAPL. si.get_data("AAPL", start_date="01/01/2020", end_date="01/03/2020", interval="1d")

Same script results in "KeyError: 'adjclose'" for BF.B si.get_data("BF.B", start_date="01/01/2020", end_date="01/03/2020", interval="1d")

atreadw1492 commented 3 years ago

The BF.B issue is because the ticker should be BF-B. This will be corrected in the next release (hopefully in the next two weeks). I just tried "^QMI" and did not have an issue. I'll investigate this further.