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

前端 未结 9 624
孤街浪徒
孤街浪徒 2020-11-27 04:49

I am trying to import matplotlib.finance module in python so that I can make a Candlestick OCHL graph. My matplotlib.pyplot version is 2.00. I\'ve

9条回答
  •  無奈伤痛
    2020-11-27 05:08

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

    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.

    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!

提交回复
热议问题