I'm trying to resample by daily data to 5 Day periods instead where it will give me a tickers price each 5 days instead of each day (like it shows in my csv file).
I'm aware how to do this with the old 'from matplotlib.finance import candlestick_ohlc' however I'm not sure how to do this with the new mplfinance module?
Essentially I want to replicate this code;
df = pd.read_csv('tsla.csv', parse_dates=True, index_col=0)
df_ohlc = df['Adj Close'].resample('5D').ohlc()
df_volume = df['Volume'].resample('5D').sum()
df_ohlc.reset_index(inplace=True)
df_ohlc['Date'] = df_ohlc['Date'].map(mdates.date2num)
ax1 = plt.subplot2grid((6,1), (0,0), rowspan=4, colspan=1)
ax2 = plt.subplot2grid((6,1), (5,0), rowspan=1, colspan=1, sharex=ax1)
ax1.xaxis_date()
candlestick_ohlc(ax1, df_ohlc.values, width=2, colorup='g')
ax2.fill_between(df_volume.index.map(mdates.date2num), df_volume.values, 0)
plt.show()
This is what I have so far;
mpf.plot(df, type='candle', mav=100, volume=True, style='yahoo')
Thanks for your help!