yfinance
yfinance copied to clipboard
Hourly Data Missing Hour 23:00
Hi,
I am currently using yfinance version 0.1.67
I was downloading the hourly price of BTC-USD from 2021-01-01 00:00:00 to 2021-12-01 00:00:00, when I noticed that returned values between 2021-03-29 to 2021-10-30 are missing the hour 23 for every single days.
I tried to do smaller date range calls but the hour 23 is still missing in the dataframe.
df = yfinance.download ("BTC-USD", interval = "1h", start = datetime(2021,1,1,0,0,0), end = datetime(2021,12,1,0,0,0))
Thank you
Vincent
I have the same issue, did you find already a solution?
I also have this issue, anyone found a solution?
This should fix it: https://github.com/ValueRaider/yfinance/tree/fix/timezone
It's a fork, just download it and load like this:
import sys
sys.path.insert(0, "path/to/my/fork/of/yfinance")
import yfinance as yf
print(yf) # Confirm you have loaded my fork
I'd appreciate knowing what OS you have as I've only tested on Linux, it has tiny potential to break on Windows/Mac
@ProgrammingDao I see you assisting in issues so I assume you use yfinance
- can you field-test some bug fixes for me? Just in case there are edge cases where it blows up or messes with data. They fix issues around timezones and weekly data, all in this branch: https://github.com/ValueRaider/yfinance/tree/integrate
Hi @ValueRaider, I have tried to run with your branch the query and also didn't get the 23h price data over the specified period. Besides the initial issue, I also get an exception saying that the Dividends and Stock Splits columns are missing. Hope it helps.
For the initial issue, it might be coming from yahoo finance I believe as by looking at the raw query results at : https://query2.finance.yahoo.com/v8/finance/chart/BTC-USD?period1=1616976000&period2=1617580800&interval=1h&includePrePost=False&events=div%2Csplits , there are missing values as can be seen with the nulls.
The url corresponds to yf.download("BTC-USD", interval = "1h", start = datetime(2021,3,29,0,0,0), end = datetime(2021,4,5,0,0,0))
Good spot @ProgrammingDao. I assumed it was a timezone bug.
When Yahoo is missing data there's little yfinance
can do. I suppose the open and close could be inferred, but high and low will be a mystery (except capped by daily high/low).
That exception is fixed now.