A powerful financial data module used for pulling data from Yahoo Finance. This module can pull fundamental and technical data for stocks, indexes, currencies, cryptos, ETFs, Mutual Funds, U.S. Treasuries, and commodity futures.
This is my code -
from yahoofinancials import YahooFinancials
yahoo_financials = YahooFinancials('VOD')
pd = yahoo_financials.get_stock_price_data(reformat=True)
print(pd)
It runs fine in Python3.8 under Mint20, but when I run it in Python3.7 on a Raspberry Pi I get an error -
Traceback (most recent call last):
File "test.py", line 5, in
pd = yahoo_financials.get_stock_price_data(reformat=True)
File "/home/pi/.local/lib/python3.7/site-packages/yahoofinancials/init.py", line 604, in get_stock_price_data
return self.get_clean_data(self.get_stock_tech_data('price'), 'price')
File "/home/pi/.local/lib/python3.7/site-packages/yahoofinancials/init.py", line 492, in get_stock_tech_data
return self.get_stock_data(tech_type=tech_type)
File "/home/pi/.local/lib/python3.7/site-packages/yahoofinancials/init.py", line 474, in get_stock_data
dict_ent = self._create_dict_ent(self.ticker, statement_type, tech_type, report_name, hist_obj)
File "/home/pi/.local/lib/python3.7/site-packages/yahoofinancials/init.py", line 407, in _create_dict_ent
re_data = self._scrape_data(YAHOO_URL, tech_type, statement_type)
File "/home/pi/.local/lib/python3.7/site-packages/yahoofinancials/init.py", line 154, in _scrape_data
self._cache[url] = loads(re.search("root.App.main\s+=\s+({.*})", script).group(1))
AttributeError: 'NoneType' object has no attribute 'group'
Is it the Python version which causes the error or have I missed something here?
Thanks Mick
This is my code - from yahoofinancials import YahooFinancials yahoo_financials = YahooFinancials('VOD') pd = yahoo_financials.get_stock_price_data(reformat=True) print(pd)
It runs fine in Python3.8 under Mint20, but when I run it in Python3.7 on a Raspberry Pi I get an error -
Traceback (most recent call last): File "test.py", line 5, in
pd = yahoo_financials.get_stock_price_data(reformat=True)
File "/home/pi/.local/lib/python3.7/site-packages/yahoofinancials/init.py", line 604, in get_stock_price_data
return self.get_clean_data(self.get_stock_tech_data('price'), 'price')
File "/home/pi/.local/lib/python3.7/site-packages/yahoofinancials/init.py", line 492, in get_stock_tech_data
return self.get_stock_data(tech_type=tech_type)
File "/home/pi/.local/lib/python3.7/site-packages/yahoofinancials/init.py", line 474, in get_stock_data
dict_ent = self._create_dict_ent(self.ticker, statement_type, tech_type, report_name, hist_obj)
File "/home/pi/.local/lib/python3.7/site-packages/yahoofinancials/init.py", line 407, in _create_dict_ent
re_data = self._scrape_data(YAHOO_URL, tech_type, statement_type)
File "/home/pi/.local/lib/python3.7/site-packages/yahoofinancials/init.py", line 154, in _scrape_data
self._cache[url] = loads(re.search("root.App.main\s+=\s+({.*})", script).group(1))
AttributeError: 'NoneType' object has no attribute 'group'
Is it the Python version which causes the error or have I missed something here? Thanks Mick