0
votes

I’m trying to plot live bitcoin price but I keep getting a callback error that says

updated_btc_2h() takes 1 positional argument but 2 were given

If I’m making an error elsewhere when trying to plot the candles live, please feel free to let me know!

Code is here.

1

1 Answers

1
votes

Here is your problem:

@app.callback(
    Output('btc_chart', 'figure'),
    [Input('btc_update', 'n_intervals')],
    [State('btc_update', 'figure')]
)
def updated_btc_2h(n_interval):

You only put one parameter in the function definition, but you're trying to pass it an Input and a State. Just update your function signature to something like:

def updated_btc_2h(n_interval, figure_state):

and it should resolve your error.