So I have a data set list already in format of
[dataq["date"], dataq["open"], dataq["low"], dataq["high"], dataq["close"]], dataq["volume"]]
and I want to plot these,
I'm not using csv or any other file read, these are just loaded with api,
and I want to plot with new library,
how can I print thhem? it is always complaining about pandas time index,
for dataq in datalist:
ohlc.append([pd.Timestamp(dataq["date"]), dataq["open"],
dataq["low"], dataq["high"], dataq["close"]])
ohlc = pd.DataFrame(ohlc)
ohlc.index.name = 'Date'
mplfinance.plot(ohlc)
I tried adding conversion to timestamp of panda but it didn't help
Reza,
I am assuming that ohlc is a list. Maybe try this:
ohlc = []
dates = []
for dataq in datalist:
ohlc.append( [dataq["open"], dataq["low"], dataq["high"], dataq["close"]] )
dates.append( pd.Timestamp( dataq["date"] ) )
dtix = pd.DatetimeIndex(dates)
ohlc = pd.DataFrame(ohlc, index=dtix, columns=['Open','Low','High','Close'] )
ohlc.index.name = 'Date'
mplfinance.plot(ohlc)
Let me know if that works. Thanks. --Daniel
Yes, it is works
Good to know. Thanks.
Most helpful comment
Reza,
I am assuming that
ohlcis a list. Maybe try this:Let me know if that works. Thanks. --Daniel