-
-
Notifications
You must be signed in to change notification settings - Fork 2.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Wrong time stamp for 1h time frame for versions after 0.2.44 #2155
Comments
Look at the time-zone part of the times. First line from version 0.2.44 says |
Recent versions standardised the handling of timezones: Lines 47 to 50 in 0c89fcd
|
@indra5534 don't need to repost the screenshots. One option is localizing to the most common timezone. |
For 1h time frame api gives generalized time zone. For other time frames like 15m, 30m it gives localized time zone. I was trying to get data from user input time frame. But due to this I am unable to do so. For 1h it needs conversations to to localized time zone, for other time frame it doesn't need so. Please help. |
Here's the problem Line 109 in 0c89fcd
|
That isn't obviously a yfinance error. Comprehend what Pandas is saying. |
Ok fixed. thanks. If possible please remove default time zones for future versions. like 1h time frame has UTC time zone. and all other time frame dont have any default time zones. Its hard for me to adjust my code for every versions released. |
This isn't fixed. My last message referred to a different error that you deleted. |
Sorry I meant to say, I removed time zones from that code that fixed it, it is wrong to ask you guys to Debug my code. If you can standardize time zone for future updates that would be great. We don't have to localize or remove time zones from time stamps for various timeframes that makes accessing mutiple time frame at onec easier. That's it. |
Describe bug
Whenever I am trying to download stock data for 1h time frame it shows wrong time frame. This problem was not present in 0.2.44 and previous versions. It was easier to use when it used to give output in local time frames
Simple code that reproduces your problem
import yfinance as yf
print("\nyfinance version:", yf.version)
ticker = 'AAPL'
interval = '1h'
data = yf.download(ticker, period='1mo', interval=interval)
print("\nLast 7 Close Prices:")
print(data['Close'].tail(7))
Debug log
I downloaded stock data of AAPL in 0.2.44 version this is the print out.
Last 7 Close Prices:
Datetime
2024-11-25 11:30:00-05:00 230.206802
2024-11-25 12:30:00-05:00 230.414993
2024-11-25 13:30:00-05:00 230.684998
2024-11-25 14:30:00-05:00 230.520004
2024-11-25 15:30:00-05:00 232.880005
2024-11-26 09:30:00-05:00 234.360001
2024-11-26 10:30:00-05:00 235.139999
But when I downloaded stock data of AAPL in 0.2.50 version this is the print out.
Ticker AAPL
Datetime
2024-11-25 16:30:00+00:00 230.206802
2024-11-25 17:30:00+00:00 230.414993
2024-11-25 18:30:00+00:00 230.684998
2024-11-25 19:30:00+00:00 230.520004
2024-11-25 20:30:00+00:00 232.880005
2024-11-26 14:30:00+00:00 234.360001
2024-11-26 15:30:00+00:00 235.313507
Bad data proof
yfinance
version0.2.50
Python version
3.10
Operating system
No response
The text was updated successfully, but these errors were encountered: