I'm trying to retrieve 3 months history of 30-minute candles from Kraken using the REST API: https://www.kraken.com/help/api
Following the documentation, I made this POST request to URL: https://api.kraken.com/0/public/OHLC
passing the following parameters in JSON format:
{
"pair":"EOSETH",
"interval":30,
"since":1514404800
}
where 1514404800 corresponds to the timestamp (in seconds) to the date:
27/10/2017 20H00m UTC
This is not clear from the API documentation, they call it an 'ID', but I came to this conclusion by looking to the returned values.
So I was expecting returned response with entries starting on this date. Then I would fetch subsequent entries using the last id returned.
However the first entry I get corresponds exactly to 15 days ago. Actually, if I don't pass the parameter 'since' at all, I get exactly the same result, so it seems the parameter is being ignored completely.
Maybe Kraken changed the API and this parameter 'since' was replaced by some other?
Or I missunderstood the syntax of this parameter and I'm doing something wrong?
They call it an 'ID' but you are right this is the UNIX TimeStamp.
I agree that it is not clear from the API documentation.
There is a limit in the number of results returned, see https://support.kraken.com/hc/en-us/articles/218198197-How-to-pull-all-trade-data-using-the-Kraken-REST-API
With an interval of 30 minutes you get all data from 15 days ago : https://api.kraken.com/0/public/OHLC?pair=EOSETH&since=0&interval=30
If you change the interval to 60 minutes you get data from 1 month ago : https://api.kraken.com/0/public/OHLC?pair=EOSETH&since=0&interval=60
With an interval of 1 minute you got data from less than 1 day (as stated in the article above) : https://api.kraken.com/0/public/OHLC?pair=EOSETH&since=0&interval=30
I tried and indeed you cannot get all 30 min data from 27/10/2017.
It seems the since
parameter is useless once you reach the limit.
It works great if not (i.e. data from yesterday https://api.kraken.com/0/public/OHLC?pair=EOSETH&since=1517774700&interval=30).
As soon as you reach the limit the count starts from today to the past and you get only last 15 days data...
Maybe a solution is, as stated in the article, to build your own OHLC from trades data...
Try to contact the support to clarify this point (I already contacted them for another problem and they reply pretty fast).
(I'm writing this as an answer because too much text the for a comment, sorry if it does not answer your question)
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