-
Notifications
You must be signed in to change notification settings - Fork 657
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
Bug Report: Bug on treating timestamp with timezone info #236
Comments
The plotter plots whatever time your data has. Please post your data as well as your code that you used to make this plot, and i will take a look. If your data contains timezone information, and if mplfinace is not handling that information correctly, then the only way i will be able to debug it is to have both the data and the code. Thank you. |
df.data.zip
notice the pandas dataframe index is from 04:00:00 to 19:59:00
|
A similar finding on my end: pandas timestamps in eastern, mpf.plot x axis in UTC timestamps were localized from broker data as follows: and kwargs for the mpf.plot call:
|
@2young-2simple-sometimes-naive
when I try to print it, And if I try to call Perhaps use package |
Here you go. |
@2young-2simple-sometimes-naive It appears that if I plot the data using Pandas, it either ignores the time zone information, or converts it, to local time; but at any rate it displays the times as you are expecting (without adding the 4 hours). If I plot the data using Matplotlib directly however, it does what mplfinance is doing. I'm going to play around with this a little more to see what is happening. |
It appears that Pandas itself is converting the times when taking the values from the index:
However
|
It appears that Matplotlib https://matplotlib.org/3.3.0/_modules/matplotlib/dates.html#date2num https://github.com/matplotlib/matplotlib/blob/master/lib/matplotlib/dates.py#L287-L305 |
@justinjabate |
@DanielGoldfarb thank you for your work on this library |
New handling of volume exponent; and assorted scratch_pad additions: This PR is primarily to implement a new way to handle the volume exponent; the new way avoids calling `.draw()` which in turn eliminates the bug mentioned in issue #296, and also mentioned/described in a previous email from S.G. ([commit 2c88663](2c88663)) This PR also includes a lot of scratch_pad work for investigations of various issues (#282, #236, #241), and for an mplfinance presentation: including comparison of old and new api's, intraday animation with volumes, generation of animation gifs, etc.
This is released now. To get the newest code: If anyone was depending on the old behavior (that used time zone info, if present in the datetime index, to convert to UTC) they can access that old behavior by setting kwarg The new behavior is to ignore tzinfo in the datetime index and always plot according to the local time in the datetime index. |
Describe the bug

I am plotting a pandas dataframe, with timestamp as index. The plotter plot x-bar as zulu time, instead of my local time
Screenshots
Desktop (please complete the following information):
The text was updated successfully, but these errors were encountered: