I get a weird plot. So when I use 1 minute data as follows
symbols = [‘NVDA’, ‘AMD’]
data = yf.download(symbols, period=‘5d’, interval=‘1m’)
data=data[‘Adj Close’]
data=(data-data.iloc[0])/data.iloc[0]
data.index=data.index.tz_convert(‘US/Eastern’)
import plotly.express as px
fig = px.line(data.melt(value_name=‘Close’, ignore_index=False), color=‘Ticker’)
fig.update_xaxes(rangebreaks=[dict(bounds=[“sat”, “mon”]),
dict(bounds=[16, 9.5], pattern=“hour”)] # hide hours from 4pm to 9:30am
) # Hide weekends
fig.show()
I get
but when I change it to using interval = ‘5m’ instead of ‘1m’ i.e.
data = yf.download(symbols, period=‘5d’, interval=‘5m’)
for some reason it plots nicely? Any thoughts?