I'm trying to retrieve historical data for coinbase products. According to their documentation, it should be sufficient to perform a request like this one:
curl "https://api.pro.coinbase.com/products/BCH-EUR/candles?granularity=60&start=2018-10-05T14:00:00.000z&stop=2018-10-05T14:10:00.000z"
I've set following parameters:
granularity
to 60 (seconds)start
to 2018-10-05T14:00:00.000z
(iso 8601)end
to 2018-10-05T14:10:00.000z
(iso 8601)I'm asking data for 10 minutes, with a granularity of 60 seconds, so I was expecting ten candles data.
Instead I obtain a set of 300 candles, that's the maximum, and the timestamps are also wrong. For example the first value is:
[
[
1624119060,
484.31,
484.31,
484.31,
484.31,
0.11766122
],
...
]
The timestamp is the first value, and according to an epoch converter, it's equal to Saturday, 19 June 2021 16:11:00
, that's the day in which I performed the request, not the timestamp that I was expenting for that candle data according to start date that I've set.
I don't know what I'm doing wrong. What should I do in order to retrieve data correctly?
It should be end
, not stop
. You quote the doc correctly, but the param itself is incorrect. Already voted to close this one as typo-based. :)
What's funny about their API is that if one of the params is omitted, another is just ignored. That's why you end up having incorrect timestamps in your response.