diff --git a/yfinance/scrapers/history.py b/yfinance/scrapers/history.py index 0b3cf1f70..2702f1285 100644 --- a/yfinance/scrapers/history.py +++ b/yfinance/scrapers/history.py @@ -210,7 +210,7 @@ def history(self, period="1mo", interval="1d", quotes = utils.parse_quotes(data["chart"]["result"][0]) # Yahoo bug fix - it often appends latest price even if after end date if end and not quotes.empty: - endDt = pd.to_datetime(_datetime.datetime.utcfromtimestamp(end)) + endDt = pd.Timestamp(end, unit="s") if quotes.index[quotes.shape[0] - 1] >= endDt: quotes = quotes.iloc[0:quotes.shape[0] - 1] except Exception: