Hi Everyone,
I’m having a bug in my candle graph, and I was hoping I could get some help!
When I change the time frame from my graph the old data will sometimes overlap the new data.
Ex:
Old data at time frame H6:
New data at time frame H8 with overlapped data from H6 graph:
Note: This is not a consistent error sometimes it will display the data properly but it all depends on the previous time frame that was selected.
my code is as follows:
app.layout = html.Div(children=[
dcc.Graph(
id='ask-live-trade-view',
animate=False,
figure=forexAPI.GetFigure(),
),
dcc.Slider(
id="time-picker",
min=1,
max=13,
step=None,
marks={
1: 'm1',
2: 'm5',
3: 'm15',
4: 'm30',
5: 'H1',
6: 'H2',
7: 'H3',
8: 'H4',
9: 'H6',
10: 'H8',
11: 'D1',
12: 'W1',
13: 'M1',
},
value=5
),
html.Div(id='hidden-div', style={'display':'none'}),
dcc.Interval(
id='graph-interval',
interval= .5*1000, # in milliseconds
n_intervals=0,
),
])
#Updates the graph
@app.callback(Output('ask-live-trade-view', 'figure'),
[Input('graph-interval', 'n_intervals')])
def update_graph_live(n):
data = forexAPI.GetFigure()
return go.Figure(data=data)
#there is a hidden output because this has to have an output
@app.callback(
Output('hidden-div', 'children'),
[Input('time-picker', 'value')])
def update_output(value):
forexAPI.ChangeTimeFrame(getPeriod(value), getTime(value))
Thank you so much for the help!