Incomplete candles data

Hi,

I’m trying to get candles between two timestamp with a granularity of 1 minute but I’m having an incomplete response.

When I do a get request on https://api.exchange.coinbase.com/products/USDT-EUR/candles?granularity=60&start=1688649744&end=1688650044

I got the following response

[
    [
        1688650020,
        0.91877,
        0.91908,
        0.91908,
        0.91888,
        10000
    ]
]

From my understanding, I should have 5 candles since start is 1688649744 (Thursday, July 6, 2023 1:22:24 PM GMT) and end is 1688650044 (Thursday, July 6, 2023 1:27:24 PM GMT) so the timespan is 5 minutes and since I ask a resolution of 60 seconds, I should have 5 candles.

The response candle has a timestamp at 1688650020 (Thursday, July 6, 2023 1:27:00 PM GMT), which is indeed into the asked interval, however I should get more data.

Why do I only get a single candle and not five ?

hi @arkaik

Thank you for using Coinbase forum, we are happy to help you.

To get the five candles you are expecting, you need to make sure that the start and end timestamps are aligned with the granularity you are requesting. In this case, you need to make sure that the start timestamp is a multiple of 60 seconds (e.g. 1688649740) and the end timestamp is a multiple of 60 seconds plus 59 seconds (e.g. 1688650099). This will ensure that you get the five candles you are expecting.

Hope this helps, have good day.