From a24c0e1391957f7dc21032e8936185fbf21db311 Mon Sep 17 00:00:00 2001 From: steven9909 Date: Sun, 9 Apr 2023 23:30:51 -0400 Subject: [PATCH] fix tzinfo missing attribute tzinfo does not have a localize attribute so it is replaced with timestamp in UTC --- yfinance/base.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/yfinance/base.py b/yfinance/base.py index 10332be44..47c8ed157 100644 --- a/yfinance/base.py +++ b/yfinance/base.py @@ -196,7 +196,7 @@ def history(self, period="1mo", interval="1d", get_fn = self._data.get if end is not None: end_dt = _pd.Timestamp(end, unit='s').tz_localize("UTC") - dt_now = end_dt.tzinfo.localize(_datetime.datetime.utcnow()) + dt_now = _pd.Timestamp.utcnow() data_delay = _datetime.timedelta(minutes=30) if end_dt+data_delay <= dt_now: # Date range in past so safe to fetch through cache: