Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

GDAX api - Get Historic Rates returning inconsistent results

Tags:

coinbase-api

While using GDAX api for calling historic prices using the following:

https://api.gdax.com/products/ETH-EUR/candles?start=2017-07-02T15:25:00.00000Z&end=2017-07-02T16:12:00.00000Z&granularity=30

I always get a 200 code responde, but sometimes it returns :

[]

and other times :

[[1499011890,234.98,235,234.98,235,7.582868079999999],[1499011830,234.4,235,234.4,235,17.7272481],[1499011680,233.71,233.71,233.71,233.71,1.61151688],[1499011650,233.71,233.71,233.71,233.71,0.85362734],[1499011350,233.71,233.71,233.71,233.71,1.5],[1499011320,233.48,233.67,233.48,233.67,5.22588745],[1499011290,233.48,233.48,233.48,233.48,1.11358574],[1499011200,233.48,233.48,233.48,233.48,1.70893649],[1499010990,233.44,233.47,233.44,233.47,8.34642375],[1499010270,230.11,233,231,233,9.30791793],[1499010240,231,231,231,231,10],[1499009850,233.02,233.02,233.02,233.02,0.0000428],[1499009640,230.26,231.64,231.64,230.26,10.81225691],[1499009250,231,231.55,231.55,231,15], [1499009100,231,231.92,231.92,231,20]]

Can anyone explain this behavior?

I was expecting "429 Too Many Requests" if it was a situation where limits were reached, which I'm pretty sure this isn't the case.

like image 644
SysHex Avatar asked Jul 03 '17 13:07

SysHex


1 Answers

According to your URL the granularity seems to be invalid. As stated here valid granularities are {60, 300, 900, 3600, 21600, 86400} you have a granularity of 30.

This query https://api.gdax.com/products/ETH-EUR/candles?start=2017-07-02T15:25:00.00000Z&end=2017-07-02T16:12:00.00000Z&granularity=3600 returns consistent data for me.

[[1499011200,232.16,239.58,233.48,235.25,334.9886663100001]]

I created a tool where you can check the url parameters, make changes and try different ways. I found that the returned data is pretty consistent if the request is correct.

https://gdaxurl.surge.sh/

like image 113
brklyn8900 Avatar answered Nov 15 '22 12:11

brklyn8900