atreadw1492 / yahoo_fin

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

Added exceptions for cases in which no balance sheet data is returned #37

Closed ilDon closed 3 years ago

ilDon commented 3 years ago

get_balance_sheet was not working anymore with some tickers. The problem is that the APIs are no longer returning any data if there is no data for a given company. Try for example AACQ or ACIA The issue can be generated at two different stages: when parsing JSON, because the key QuoteSummaryStore does not exist (see ACIA), or because empty data is passed to _parse_table (see AACQ).

EDIT

Added checks for empty data also on get_dividends and get_earnings.

In get_dividends when no dividends are found instead of the exception can we simply return an empty DataFrame? This makes it easier to use get_dividends inside a "loop"