'inconsistent time intervals on historical spot prices

I am working with Coinbase API v2. I'm trying to request and parse historical spot price data for my application, examples:

https://api.coinbase.com/v2/prices/BTC-EUR/historic?period=hour    
https://api.coinbase.com/v2/prices/BTC-EUR/historic?period=day

Each of these API calls returns a JSON array as expected, with each object in the array containing "price" and "time" nodes. Great; so far, so good.

As I worked with and examined the data being returned from the API calls, however, I noted that the time intervals between the JSON objects in the response JsonArray are inconsistent.

For example, in the first request above, multiple JSON objects representing the price info per minute are included in the response, some 20 seconds apart, some 30, some 40, some 50 etc...

The same issue appears to affect the second request above; again the JsonArray response contains multiple price info JSON objects per hour, but with some being 10 minutes apart, some 15, some 20 etc.

Further, this inconsistency is itself inconsistent between repeat requests; the intervals between JSON objects in the response are not the same in each execution.

Is this really just a tragic limitation of the Coinbase API?

What I'm actually trying to do is query asset prices for 10 minutes ago, 30 minutes ago, 1 hour ago, 2 hours ago, 6 hours ago, 12 hours ago etc... I've been struggling with this for some time now; the documentation relating to the actual API endpoints isn't great. Is this actually possible with the Coinbase API??



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source