Skip to content

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

@rinkef

Description

@rinkef

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'

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions