atreadw1492 / yahoo_fin

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

Problem in get_earnings_history #100

Open derekfunguk opened 1 year ago

derekfunguk commented 1 year ago

The following is my python code -

import yahoo_fin.stock_info as si import pandas as pd import pandas_datareader.data as pddata from datetime import datetime, date, timedelta from functools import reduce today = datetime.today().strftime('%Y-%m-%d') ticker=input().upper() stock_earnings_hist = si.get_earnings_history(ticker)

And the following is the error message: /usr/local/lib/python3.8/dist-packages/yahoo_fin/stock_info.py in get_earnings_history(ticker) 836 result = _parse_earnings_json(url) 837 --> 838 return result["context"]["dispatcher"]["stores"]["ScreenerResultsStore"]["results"]["rows"] 839 840

TypeError: string indices must be integers

Can anyone help?

udank23 commented 1 year ago

Hi,

Did you solve this? Any advice on how to access earning history for a given ticker?

Thanks

vanitoz commented 7 months ago

This Issue not solved yet. I'm getting the same error. Problem is that this library works trough scraping data from yahoo. When Yahoo change their web page structure yahoo_fin need to change their script also to scrape data.