File size: 619 Bytes
85a54f3 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 | import mplfinance as mpf
class CandlestickViewer:
def __init__(self):
pass
def show_candlestick_chart(self, data):
# Crear el gráfico de velas
fig, axlist = mpf.plot(
data,
type='line', #'candle',
mav=(10, 20),
volume=True,
show_nontrading=True,
figscale=1.5,
returnfig=True
) # Agregar el argumento returnfig=True para obtener la figura
ax = axlist[0]
ax.set_yscale('log')
# Configurar el tamaño de la figura y habilitar el desplazamiento horizontal
fig.set_size_inches(30, 10)
fig.subplots_adjust(bottom=0.2)
return fig
|