I have data from three stock market trades in a DataFrame e.g.
df2 = pd.DataFrame(np.array([
[10:00, 11:00, 12:00],
[10:03, 11:07, 12:09],
[67093, 67010, 66000],
[67095, 67012, 66010]]),
columns=[
'time_opened',
'time_closed',
'level_opened',
'level_closed'
]
)
I have a chart with time on the x axis, level (or stock price) on the y axis. I would like to draw a line/shape that represents each trade from each time_opened/level_opened to time_closed/level_closed. i.e. From 67093 at 10:00 to 67095 at 10:03
I'm trying to do something like this:
fig.add_shape(
dict(
type='line',
x0=positions['time_opened'],
y0=positions['level_opened'],
x1=positions['time_closed'],
y1=positions['level_closed'],
line=dict(color='Black', width=3),
),
)
fig.update_shapes(xaxis='x1')
Any ideas what I'm doing wrong?