OHLC Hover Value is Zero

I’m trying out a tutorial and my OHLC values is 0

image

trace = go.Ohlc(x=binance_price().index[:],
open = binance_price()[‘Open’],
close = binance_price()[‘Close’],
high = binance_price()[‘High’],
low = binance_price()[‘Low’])

This is the code did I miss something here my other tracers works fine and produce some values when I hover it around

Could you share the data and layout you used to create this graph to help us debug?

Data Gather
def binance_price():
candles = client.get_klines(symbol=‘BNBBTC’,interval=Client.KLINE_INTERVAL_30MINUTE)

candles_data_frame = df(candles)
#candles_data_frame[:2]

candles_data_frame_date = candles_data_frame[0]

Convert Date Time Into Time Stamp

final_date = []

for time in candles_data_frame_date.unique():
readable = datetime.fromtimestamp(int(time/1000))
final_date.append(readable)

Will delete Old Time Stamp Column 0 and Ignored Data Column 11

candles_data_frame.pop(0)
candles_data_frame.pop(11)

Create a data frame for final_date and name the column header as Date

date_data_frame = df(final_date)
date_data_frame.columns = [‘Date’]

We will be using our fixed data frame and we will include our fixed TimeStamp

final_dataframe = candles_data_frame.join (date_data_frame)

Arranging and Putting Labels on all Headers. Check API Response of candle Kline

final_dataframe.set_index(‘Date’,inplace=True) ## Move Into as our Starting Column
final_dataframe.columns = [‘Open’ , ‘High’ , ‘Low’ , ‘Close’ , ‘Volume’, ‘Close time’ , ‘Quote Asset Volume’ , ‘# of Trades’, ‘Taker Buy Asset Volume’,‘Taker Buy Quotes Asset Volume’]
return final_dataframe

print(binance_price())

Candle Plotting

table_trace = go.Table(
domain=dict(x=[0,0.5],
y=[0,1.0]),
columnwidth=[30] + [33,35,33],
columnorder=[0,1,2,3,4],
header=dict(height=50,
values = [[‘Date’],[‘Open Price’],[‘High Price’],[‘Low Price’],[‘Close Price’],[‘Volume’],[’# of Trades’]] ,
line = dict(color=‘rgb(50,50,50)’),
align= [‘left’]*5,
font=dict(color=[‘rgb(45,45,45)’]*5,size=14),
fill = dict(color = ‘rgb(135,193,238)’)
),
cells = dict(values=[binance_price().index[:], binance_price()[‘Open’], binance_price()[‘High’], binance_price()[‘Low’], binance_price()[‘Close’], binance_price()[‘Volume’], binance_price()[’# of Trades’]],
line = dict(color=’#106784’),
align= [‘left’] * 5,
font = dict(color=[‘rgb(40,40,40)’]*5,size=12),
format = [None] + [’, .2f’] * 2 + [’, .4f’],
prefix = [None] * 2 + [’$’,u’\u20BF’],
suffix = [None] * 4,
height = 27,
fill = dict(color=[‘rgb(135,193,238)’,‘rgba(128,222,249,0.65)’]))
)

Plotly Function for OHLC

trace = go.Ohlc(x=binance_price().index[:],
open = binance_price()[‘Open’],
close = binance_price()[‘Close’],
high = binance_price()[‘High’],
low = binance_price()[‘Low’])

Plotly Function for Scatter

trace2 = go.Scatter(
x=binance_price().index[:],
y=binance_price()[‘Volume’],
xaxis = ‘x2’,
yaxis = ‘y2’,
line = dict(width=2, color=‘purple’),
name = ‘volume’
)

Plotly Function for Scatter

trace3 = go.Scatter(
x=binance_price().index[:],
y=binance_price()[’# of Trades’],
xaxis = ‘x3’,
yaxis = ‘y3’,
line = dict(width=2, color=‘green’),
name = ‘# of trades’
)

Plotly Funtion

axis = dict(
showline = True,
zeroline=False,
showgrid=True,
mirror=True,
ticklen=4,
gridcolor=’#ffffff’,
tickfont=(dict(size=10))

)

Plotly Function

layout = dict(
width=950,
height=800,
autosize=False,
title=‘Trade Data’,
margin=dict(t=100),
showlegend=False,
xaxis1=dict(axis,** dict(domain=[0.55,1],anchor=‘y1’,showticklabels=False)),
xaxis2=dict(axis,** dict(domain=[0.55,1],anchor=‘y2’,showticklabels=False)),
xaxis3=dict(axis,** dict(domain=[0.55,1],anchor=‘y1’,showticklabels=False)),
yaxis1=dict(axis,** dict(domain=[0.66,1],anchor=‘x1’,hoverformat=’.2f’)),
yaxis2=dict(axis,** dict(domain=[0.3 + 0.03,0.63],anchor=‘x2’,tickprefix=’$’,hoverformat=’.2f’)),
yaxis3=dict(axis,** dict(domain=[0.0,0.3],anchor=‘x3’,tickprefix=’\u20BF’,hoverformat=’.2f’)),

)

#Output
fig = dict(data = [table_trace , trace, trace2, trace3], layout=layout)
py.plot(fig,filename=‘table.html’)

IPython.display.HTML(filename=’/content/table.html’)