dpguthrie / dpguthrie/yahooquery

Unable to retrieve historical data due to unexpected keyword argument 'tz'

Open
#169 13 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
920
Forks
164
PR merge metrics
No merged PRs in 30d

Description

Hi, when trying to get historical data using Ticker I get the following error:

**fromtimestamp() got an unexpected keyword argument 'tz'**

Something seems to be going wrong with the timestamp in the pandas module.
Upgrading the pandas module and the yahooquery module does not help.

Hence I can't extract historical data.

I am using Python 3.9

**My very simple script**

from yahooquery import Ticker
aapl = Ticker('AAPL')
data = aapl.history()
print(data.head())

What am I missing here?

**Full error:**
Traceback (most recent call last):

File ~\Miniconda3\lib\site-packages\spyder_kernels\py3compat.py:356 in compat_exec
exec(code, globals, locals)

File c:\data\python\git\personal-finance\yahooquery_test.py:14
data = aapl.history()

File ~\Miniconda3\lib\site-packages\yahooquery\ticker.py:1291 in history
for i in range(len(dates) - 1):

File ~\Miniconda3\lib\site-packages\yahooquery\ticker.py:1320 in _historical_data_to_dataframe
df["splits"].fillna(0, inplace=True)

File ~\Miniconda3\lib\site-packages\yahooquery\utils\__init__.py:198 in _history_dataframe
tz = data["meta"]["exchangeTimezoneName"]

File ~\Miniconda3\lib\site-packages\yahooquery\utils\__init__.py:125 in _get_daily_index
last_trade = pd.Timestamp.fromtimestamp(timestamp)

File pandas\_libs\tslibs\timestamps.pyx:1129 in pandas._libs.tslibs.timestamps.Timestamp.fromtimestamp

TypeError: fromtimestamp() got an unexpected keyword argument 'tz'

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.