admin 發表於 2023-4-8 15:57:13

Python from mplfinance import candlestick2 ohlc

import mpl_finance as mpf>import mplfinance as mpf candlestick2_ohlcWARNING: `mpl_finance` is deprecated:

    Please use `mplfinance` instead (no hyphen, no underscore).

    To install: `pip install --upgrade mplfinance`

some stopped using mpl_finance (and plotly) since they are too slow.
Instead I've written an optimized finance plotting library, finplot, which I use to backtest up to 107 candles.

Here's a small example:
import yfinance as yf
import finplot as fplt

df = yf.download('SPY',start='2018-01-01', end = '2020-04-29')
fplt.candlestick_ochl(df[['Open','Close','High','Low']])
fplt.plot(df.Close.rolling(50).mean())
fplt.plot(df.Close.rolling(200).mean())
fplt.show()
頁: [1]
查看完整版本: Python from mplfinance import candlestick2 ohlc