I used the following code:
import yfinance as yf
import pandas as pd
data = yf.download(tickers='EL',period='1d',interval='5m')
print(data.tail())
And the results I got:
[*********************100%%**********************] 1 of 1 completed
Open High Low Close Adj Close Volume
Datetime
2023-12-22 15:35:00-05:00 144.110001 144.270004 144.054596 144.100006 144.100006 19665
2023-12-22 15:40:00-05:00 144.000000 144.160004 143.925003 144.160004 144.160004 25930
2023-12-22 15:45:00-05:00 144.220001 144.240005 144.057007 144.070007 144.070007 33270
2023-12-22 15:50:00-05:00 144.130005 144.479996 144.119995 144.470001 144.470001 57425
2023-12-22 15:55:00-05:00 144.460007 144.529999 144.339996 144.429993 144.429993 133693
The last 5min data is missing. And if I try to download data for multi-days, the last 5 min data is missing for every day.
How to fix this? Thanks!
The code is above. I am new to python.
The next data point is classified as the next day, hour, or whatever you’re sorting by. If that next five minutes was included, it would technically be data from the next day. You would have to query for the next (hour, day, etc.) to get that data point.