pytafast.plotting module

class pytafast.plotting.Chart(df, date_col='Date', open_col='Open', high_col='High', low_col='Low', close_col='Close', vol_col='Volume')[source]

Bases: object

A quantmod-inspired chaining chart builder for pytafast using Plotly.

THEMES = {'dark': 'plotly_dark', 'ggplot2': 'ggplot2', 'light': 'plotly_white', 'seaborn': 'seaborn', 'simple': 'simple_white'}
add_adx(n=14, height=0.2)[source]
add_alma(n=9, offset=0.85, sigma=6.0)[source]
add_aroon(n=14, height=0.2)[source]
add_atr(n=14, height=0.15)[source]
add_bbands(n=20, sd=2.0, color='rgba(173, 216, 230, 0.15)')[source]
add_candlestick(name='Price')[source]
add_cci(n=14, height=0.2)[source]
add_chaikin_osc(fast=3, slow=10, height=0.2)[source]
add_clv(height=0.15)[source]
add_cmf(n=20, height=0.2)[source]
add_cmo(n=14, height=0.2)[source]
add_dema(n=20, color='#e31a1c')[source]
add_donchian(n=10)[source]
add_dpo(n=10, height=0.2)[source]
add_ema(n=20, color='#5d62b5')[source]
add_emv(n=9, height=0.2)[source]
add_envelope(n=20, p=2.5, color='rgba(0, 0, 255, 0.1)')[source]

Add Moving Average Envelope around SMA.

add_evwma(n=30)[source]
add_hline(y, color='gray', dash='dash')[source]

Add a horizontal line to the main chart.

add_hma(n=20, color='#b15928')[source]
add_ichimoku(n1=9, n2=26, n3=52)[source]

Add Ichimoku Kinko Hyo (Cloud) to the main chart.

add_kama(n=20, color='#6a3d9a')[source]
add_keltner(n=20, mult=2.0)[source]
add_kst(height=0.2)[source]
add_last(color='red')[source]

Add a horizontal line at the last closing price.

add_line(name='Close Price', color=None)[source]
add_macd(f=12, s=26, sig=9, height=0.2)[source]
add_mfi(n=14, height=0.2)[source]
add_momentum(n=10, height=0.2)[source]
add_obv(height=0.15)[source]
add_patterns()[source]

Automatically find and label all recognized candlestick patterns.

add_points(x, y, name='Points', color='black', symbol='circle', size=8)[source]

Add custom scatter points to the main chart.

add_roc(n=10, height=0.2)[source]
add_rsi(n=14, height=0.2)[source]
add_sar(accel=0.02, max_step=0.2)[source]
add_shading(start, end, color='rgba(128, 128, 128, 0.2)')[source]

Highlight a vertical time region (start/end can be dates or indices).

add_sma(n=20, color='#f29d4b')[source]
add_smi(n=13, nFast=2, nSlow=25, nSig=9, height=0.2)[source]
add_stoch(k=5, d=3, height=0.2)[source]
add_tdi(n=13, rsi_ma1=2, rsi_ma2=7, bb_n=34, bb_sd=1.6185, height=0.25)[source]

Traders Dynamic Index (TDI).

add_tema(n=20, color='#fb9a99')[source]
add_text(x, y, text, color='black', position='top center')[source]

Add custom text annotations to the main chart.

add_trix(n=30, height=0.2)[source]
add_vline(x, color='gray', dash='dash')[source]

Add a vertical line to the main chart.

add_volatility(n=10, height=0.2)[source]

Chaikin Volatility: percent change in EMA of (High-Low) range.

add_volume(height=0.15)[source]
add_willr(n=14, height=0.2)[source]
add_wma(n=20, color='#33a02c')[source]
add_zigzag(change=5.0, percent=True)[source]
add_zlema(n=30)[source]
render()[source]
save_html(filename='chart.html')[source]
save_image(filename='chart.png', w=1200, h=800)[source]

Renders and saves the chart to a static image (PNG, JPG, PDF, SVG). Requires ‘kaleido’ package (pip install kaleido).

set_theme(theme_name)[source]

Set the chart theme (light, dark, ggplot2, seaborn).

show()[source]