Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

To modify the datetime format in mplfinance, you can use the date_format parameter in the plot method.

For example, to display the date in the format "Month Day, Year", you can use the following code:

import pandas as pd
import mplfinance as mpf

# load data
data = pd.read_csv('data.csv', index_col='Date', parse_dates=True)

# create plot
mpf.plot(data, type='candle', mav=(10,20), volume=True, show_nontrading=True, date_format='%b %d, %Y')

In this example, the date_format parameter is set to '%b %d, %Y', which specifies the date format as "Month Day, Year". You can modify this parameter to display the datetime in any other desired format.