The QuantFig class allows you to create a graph object that maintains state, enabling you to add technical analysis studies or modify parameters incrementally before plotting.
Basic Usage
Initialize QuantFig with a DataFrame and then call methods like add_bollinger_bands() before calling .iplot().
Adding Technical Analysis Studies
You can add various studies to a QuantFig instance:
add_sma(periods, width, color, legendgroup): Simple Moving Average.add_rsi(periods, color): Relative Strength Index.add_bollinger_bands(periods, boll_std, colors, fill): Bollinger Bands.add_volume(): Add volume bars.add_macd(): Moving Average Convergence Divergence.
df=cf.datagen.ohlc()
qf=cf.QuantFig(df,title='First Quant Figure',legend='top',name='GS')
qf.add_bollinger_bands()
qf.iplot()
# Adding more studies
qf.add_sma([10,20],width=2,color=['green','lightgreen'],legendgroup=True)
qf.add_rsi(periods=20,color='java')
qf.add_bollinger_bands(periods=20,boll_std=2,colors=['magenta','grey'],fill=True)
qf.add_volume()
qf.add_macd()
qf.iplot()