atreadw1492 / yahoo_fin

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

get_quote_tables -> ValueError: No tables found #70

Closed sethbowers97 closed 3 years ago

sethbowers97 commented 3 years ago

In efforts to write a script which will notify me of any large spikes in volume, I need to iteratively refresh the current trading volume on the day. I have been trying to do this using currentVolume = si.get_quote_table(ticker, dict_result=False).iloc[16][1] in a while loop.

However, I get the following error: File "/opt/virtualenvs/python3/lib/python3.8/site-packages/yahoo_fin/stock_info.py", line 293, in get_quote_table tables = pd.read_html(requests.get(site, headers=headers).text) File "/opt/virtualenvs/python3/lib/python3.8/site-packages/pandas/util/_decorators.py", line 311, in wrapper return func(*args, **kwargs) File "/opt/virtualenvs/python3/lib/python3.8/site-packages/pandas/io/html.py", line 1098, in read_html return _parse( File "/opt/virtualenvs/python3/lib/python3.8/site-packages/pandas/io/html.py", line 926, in _parse raise retained File "/opt/virtualenvs/python3/lib/python3.8/site-packages/pandas/io/html.py", line 906, in _parse tables = p.parse_tables() File "/opt/virtualenvs/python3/lib/python3.8/site-packages/pandas/io/html.py", line 222, in parse_tables tables = self._parse_tables(self._build_doc(), self.match, self.attrs) File "/opt/virtualenvs/python3/lib/python3.8/site-packages/pandas/io/html.py", line 552, in _parse_tables raise ValueError("No tables found") ValueError: No tables found

This continually crashes the code. Is anyone else having this issue? I'm not sure why it would be unable to find the quote table.

sethbowers97 commented 3 years ago

Sincerest apologies if this is a novice-level question. I'm new to the API. Feel free to make any suggestions at all.

atreadw1492 commented 3 years ago

@sethbowers97, do you mind sharing the ticker that's causing the problem?

sethbowers97 commented 3 years ago

Thanks for your time, I realized that the issue was elsewhere in the code, nothing to do with yahoo_fin. Sorry for the waste of time, and thank you for making this library open source!