Open Abdullah-Jannadi opened 1 year ago
2 things going on here - 1 my fault, 2nd appears Yahoo's fault.
1) When prepost=False
(default), then yfinance
uses the trading schedule returned by Yahoo to remove any pre/post data. Yahoo thinks Saudi regular trading ending at 3pm, so data was being removed. Easy to fix ...
2) ... but after fixing yfinance
, volume for 3pm is 0, so Yahoo may have fundamental problem with 3pm interval.
Date | Close | Volume |
---|---|---|
2023-07-06 14:00:00+03:00 | 32.250000 | 1450407 |
2023-07-06 15:00:00+03:00 | 32.299999 | 0 |
Try the fix and report back, it's in branch fix/saudi-intraday-lost-hour
.
You'll also need branch to see schedule, I found & fixed a bug: yf.Ticker('2222.SR').history_metadata['tradingPeriods']
I'm using the yfinance library to retrieve historical data for the Saudi stock market, but I've noticed that the last hour of trade is missing from the data. Specifically, the data ends at 14:00:00+03:00 , even though the market is open until 15:20:00+03:00 , so we must have a row of data for 15:00:00+03:00
To reproduce the issue, I'm using the following code to retrieve data for ARAMCO (2222) :
And the result was:
Furthermore, I compared the total volume from yfinance with the official data from Tadawul and found that there is a discrepancy. So if we sum up all the hours' volume, the official data shows a higher total volume for the day than the yfinance data.
I would appreciate any assistance in resolving this issue.
Thank you!