JECSand / yahoofinancials

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.
https://pypi.python.org/pypi/yahoofinancials
MIT License
896 stars 214 forks source link

get_historical_price_data() error #186

Open jmalbornoz opened 3 months ago

jmalbornoz commented 3 months ago

Here's what I am trying to do:

from yahoofinancials import YahooFinancials
ticker = 'MSFT'
yahoo_financials = YahooFinancials(ticker)
data = yahoo_financials.get_historical_price_data("2024-03-01", "2024-03-26", "daily")

After a long wait of some 20 minutes I get the following error message:


TypeError Traceback (most recent call last) Cell In[4], line 1 ----> 1 data = yahoo_financials.get_historical_price_data("2024-03-01", "2024-03-26", "daily")

File D:\Programs\Anaconda3\envs\quant\lib\site-packages\yahoofinancials\yf.py:163, in YahooFinancials.get_historical_price_data(self, start_date, end_date, time_interval) 161 end = self.format_date(end_date) 162 hist_obj = {'start': start, 'end': end, 'interval': interval_code} --> 163 return self.get_stock_data('history', hist_obj=hist_obj)

File D:\Programs\Anaconda3\envs\quant\lib\site-packages\yahoofinancials\data.py:631, in YahooFinanceData.get_stock_data(self, statement_type, tech_type, report_name, hist_obj) 629 if isinstance(self.ticker, str): 630 dict_ent = self._retry_create_dict_ent(self.ticker, statement_type, tech_type, report_name, hist_obj) --> 631 data.update(dict_ent) 632 else: 633 if self.concurrent:

TypeError: 'NoneType' object is not iterable

I have tried other tickers and the result is the same.

rhandley1231 commented 2 months ago

I've been having the same issue with this code. I'm taking a Quantitative Analytics Course and am encountering this issue when trying to retrieve data with this call.

2021Anson2016 commented 2 weeks ago

Here's what I am trying to do:

from yahoofinancials import YahooFinancials
ticker = 'MSFT'
yahoo_financials = YahooFinancials(ticker)
data = yahoo_financials.get_historical_price_data("2024-03-01", "2024-03-26", "daily")

After a long wait of some 20 minutes I get the following error message:

TypeError Traceback (most recent call last) Cell In[4], line 1 ----> 1 data = yahoo_financials.get_historical_price_data("2024-03-01", "2024-03-26", "daily")

File D:\Programs\Anaconda3\envs\quant\lib\site-packages\yahoofinancials\yf.py:163, in YahooFinancials.get_historical_price_data(self, start_date, end_date, time_interval) 161 end = self.format_date(end_date) 162 hist_obj = {'start': start, 'end': end, 'interval': interval_code} --> 163 return self.get_stock_data('history', hist_obj=hist_obj)

File D:\Programs\Anaconda3\envs\quant\lib\site-packages\yahoofinancials\data.py:631, in YahooFinanceData.get_stock_data(self, statement_type, tech_type, report_name, hist_obj) 629 if isinstance(self.ticker, str): 630 dict_ent = self._retry_create_dict_ent(self.ticker, statement_type, tech_type, report_name, hist_obj) --> 631 data.update(dict_ent) 632 else: 633 if self.concurrent:

TypeError: 'NoneType' object is not iterable

I have tried other tickers and the result is the same.

I have met the same problem.