| 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 | |