highfestiva / finplot

Performant and effortless finance plotting for Python
MIT License
935 stars 187 forks source link

[BUG] x-labels has +1 hour than the real data #458

Closed alexgiul closed 11 months ago

alexgiul commented 1 year ago

Requirements (place an x in each of the [ ])**

Code to reproduce

import finplot as fplt
import pandas as pd

fplt.autoviewrestore()
ax = fplt.create_plot('beyond_horizon',init_zoom_periods=100, yscale='log')
ax.showGrid(True, True)

df = pd.read_csv(f'./eurusd.csv', parse_dates=['date'], delimiter=',')
df.index = pd.DatetimeIndex(df['date'])  # convert to datetimeindex

price = df['open close high low'.split()]
ax.reset()  # remove previous plots
fplt.candlestick_ochl(price)

Describe the bug

My last point of data is 2023-11-01 13:17:00,1.0532,1.05324,1.05313,1.05318,130 but when I plot, the data is moved ahead of 1-hour.

EURUSD.csv

Expected behavior

I should see my last bar at 13:17:00 and not at 14:17:00

Screenshots

finplot_error

Reproducible in:

OS: Windows finplot version: 1.9.2 pyqtgraph version: 0.13.3 pyqt version:6.4.2

highfestiva commented 1 year ago

See https://github.com/highfestiva/finplot/wiki/Snippets#time-zone.