I receive ohlc data from Kraken with EPOCH time in ms. Es: 1599651300
When I plot the data, I see the epoch number, but I would like to see a date (es: 10-Sep-2020 12:23).
How can I do it?
ohlc, last = k.get_ohlc_data("BCHEUR", 5)
# plot candlestick chart
candle = go.Candlestick(
    x = ohlc['time'],
    open = ohlc['open'],
    close = ohlc['close'],
    high = ohlc['high'],
    low = ohlc['low'],
    name = "Candlesticks")
data = [candle]
# style and display
layout = go.Layout()
fig = go.Figure(data = data, layout = layout)
plot(fig)

For this answer, I am assuming that ohlc is a dataframe. In that case, before plotting you can convert  ohlc['time'] to regular readable datetime as the following:
ohlc['time'] = pd.to_datetime(ohlc['time'],unit='s')
Or
ohlc['time'] = ohlc['time'].map(lambda x : pd.Timestamp(x, unit='s'))
Input :
>>> ohlc
         time
0  1599651300
Output :
>>> ohlc
                 time
0 2020-09-09 11:35:00
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With