Since matplotlib.finance has been deprecated, how can I use the new mpl_finance module? Since matplotlib.finance has been deprecated, how can I use the new mpl_finance module? python-3.x python-3.x

Since matplotlib.finance has been deprecated, how can I use the new mpl_finance module?


What this warning tells you is that the finance module will be removed at some point.

At the moment you don't need to worry about this warning. It will only affect you when you update to a yet to be released version 2.2 of matplotlib, in which case you'll need to change your imports.

If you already want to be compatible with future versions now, you can download the mpl_finance module fromhttps://github.com/matplotlib/mpl_finance .

After having downloaded the files, you may install in the usual way,

python setup.py install

Alternatively you may try installing through pip,

pip install https://github.com/matplotlib/mpl_finance/archive/master.zip

The reason for this is that the people at matplotlib want to keep their code clean and not maintain a specialized sidepackage like this in the main code. They probably also do not want to maintain the package and spend resources on it, which can be better used in the core development.


I've 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 106 candles.

Here's a small example:

import yfinance as yfimport finplot as fpltdf = 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()

Examples included show SMA, EMA, Bollinger bands, Accumulation/Distribution, Heikin Ashi, on balance volume, RSI, TD sequential, MACD, scatter plot indicators, heat maps, histograms, real-time updating charts and interactive measurements; all with sensible defaults ready for use.

MACD S&P 500 example

I do dogfooding every day, drop me a note or a pull request if there is something you want. Hope you take it for a spin!