To associate a slider to this animation https://community.plotly.com/t/cumulative-lines-animation-in-python/25707/2 you must
give a name to each frame, because the slider is connected to the frames, via their names.
Hence the frame definition will be:
frames = [dict(data= [dict(type='scatter',
x=df.Date[:k+1],
y=low[:k+1]),
dict(type='scatter',
x=df.Date[:k+1],
y=high[:k+1])],
traces= [0, 1],
name = f'frame{k+1}'
)for k in range(1, len(low)-1)]
Then define the slider as follow:
sliders = [dict(steps = [dict(method= 'animate',
args= [[f'frame{k+1}'], #HERE IS THE k^th FRAME NAME
dict(mode= 'immediate',
frame= dict(duration=3, redraw= False),
transition=dict(duration= 0))
],
label=f'{k+1}' #label for each frame marked on the slider
) for k in range(1, len(low)-1)],
active=1,
transition= dict(duration= 0 ),
x=0, # slider starting position
y=0,
currentvalue=dict(font=dict(size=12),
prefix='frame: ',
visible=True,
xanchor= 'center'
),
len=1.0) #slider length
]
fig.update_layout(sliders=sliders)