yfinance icon indicating copy to clipboard operation
yfinance copied to clipboard

History returns one additional row after the end date, if time interval specified is less than 1d

Open manjunathmayya opened this issue 3 years ago • 3 comments

History returns one additional row after the end date, if time interval specified is less than 1d

Code used:

import yfinance as yf
symbol = yf.Ticker('SPY')
symbol_history = symbol.history(start='2022-02-01', end='2022-02-03', interval='30m', action=False)
print(symbol_history)

image

Here you can see the last row is from 14th Feb. But the end date is 3rd Feb.

The issue is not seen, if interval is not specified, or if the interval is 1d or more. See below code and result.

symbol_history = symbol.history(start='2022-02-01', end='2022-02-03', interval='1d', action=False)

image

manjunathmayya avatar Feb 15 '22 02:02 manjunathmayya

I found that adding 'adjust=False' fixes the problem (start='2022-02-09', end='2022-02-10', interval='5m', action=False, adjust=False)

PTruong9090 avatar Feb 15 '22 19:02 PTruong9090

Thanks for your reply. But all of a sudden, the same code seems to be working now.

Below is the result from the same code which had issue when I posted. symbol.history(start='2022-02-01', end='2022-02-03', interval='30m', action=False)

image

manjunathmayya avatar Feb 16 '22 09:02 manjunathmayya

PR https://github.com/ranaroussi/yfinance/pull/1026 should have fixed it. Close issue if solved.

ValueRaider avatar Aug 15 '22 15:08 ValueRaider