Pandas and Finance: Make Candlestick Plot

What will we cover in this tutorial?

A quick way to make a candlestick plot using the mplfinance library on financial data in Pandas DataFrames.

The code

It is straight forward to achieve by using the new matplotlib finance API. The data can be collected by using Pandas-datareader with the open Yahoo! Finance API.

import pandas_datareader as pdr
import datetime as dt
import mplfinance as mpf

df = pdr.get_data_yahoo("AAPL", dt.datetime(2020,6,1),
mpf.plot(df, type='candle', style='charles',

The mav-argument is the Moving Averages, I have also included the 1, which is the actual price.