I'm creating a script that takes stock data from csv (name of the stock , start date , end date) and create a candlestick chart , then add some lines to analyse it all with plotly example in this screenshot url
example of chart code :
import yfinance as yf
import plotly.graph_objects as go
df = yf.download(stock, start="2022-04-15", end="2022-07-15",interval="1h")
fig = go.Figure(data=[go.Candlestick(x=df.index,
open=df['Open'],
high=df['High'],
low=df['Low'],
close=df['Close'],name=stock)])
v = df['Volume'].values
tp = (df['Low'] + df['Close'] + df['High']).div(3).values
df = df.assign(vwap=((tp * v).cumsum() / v.cumsum()))
fig.add_trace(go.Scatter(
x=df.index,
y=df['vwap'],
mode='lines',
name='vwap',
line=dict(color='royalblue',width=2)
))
I made a loop to create multiple plots , but I can only show them one at a different page. I want to show them in same page vertically. I tried various method to create subplots and I failed . please kind help