Download controller/candlestick_viewer.py from al6ert/nodding: direct link, hf CLI and curl.
- Browser
- Download file 619 Bytes
-
https://huggingface.co/spaces/al6ert/nodding/resolve/main/controller/candlestick_viewer.py
- Command line
-
hf download hf://spaces/al6ert/nodding/controller/candlestick_viewer.py
-
curl -L -o candlestick_viewer.py https://huggingface.co/spaces/al6ert/nodding/resolve/main/controller/candlestick_viewer.py
619 Bytes
| 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 | |