Loading...

Free R

Accessing Kraken API Data With R

Accessing Kraken API Data With R

After several requests, we have re-produced the Kraken Python tutorial into R for users. This R script will access the Kraken API for a given cryptocurrency pair, return the historical Open, High, Low, Close, Volume, VWAP, and TradeCount; then enrich with Volume in USD terms and a user-readable datatime before saving to a CSV file.
(*Please note that Kraken's API has terms of service and market data usage that may have restrictions not covered here, and so you should consult with Kraken directly if you have any questions concerning their API - this tutorial is not officially endorsed by Kraken, and CDD is not affiliated with the Kraken exchange. This tutorial should be used for your personal informational purposes*).
The R script uses these 3 libraries: jsonlite, glue, and anytime. jsonlite library helps read the data received via the API. glue library helps to format string variables in our function and other places. The anytime library makes it easy to convert unix timestamps into UTC or other timezones. This code is very similar to the function we wrote for the Coinbase API, but requires a few extra modifications for Kraken's API.

Live codebase R