knitr::opts_chunk$set( collapse = TRUE, comment = "#>" )
library(krakenR)
This package interfaces with the kraken API. Currently only for the the GET functions and not all are implemented. It is a work in progress.
Interogate the API for information on the existing assets. Output returned as a list with two elements: error and result. The error element is empty if no error occured. The result element is empty if an error occured. Currently default settings so returns information on all assets:
ast_inf <- get_asset_info() ast_inf$error ast_inf$result[[1]]
Get market history OHLC data for a specified asset pair. Time frame interval
is specifed in minutes: 1 (default), 5, 15, 30, 60, 240, 1440, 10080, 21600.
Since can also be provided in Unix long form. Output returned as a list with
two elements: error and result. The error element is empty if no error occured. The result element is empty if an error occured. Result contains two elements:
the returned OHLC data and the 'last' date in the data set. The default since
is 0 (earliest). Data returned:
time; open; high; low; close; vwap; volume; count
ohlc <- get_ohlc_data(pair = "BCHEUR", interval = 30, since = 0) ohlc$error head(ohlc$result$BCHEUR) ohlc$result$last
Return the current bid and ask orders for a specific asset. Output returned as
a list with two elements: error and result. The error element is empty if no
error occured. The result element is empty if an error occured. Result contains
two elements: asks; bids. Optional to pass 'count', the maximum number of
asks/bids (not implemented). Data returned as:
price; volume; timestamp
ord <- get_order_book("BCHEUR") ord$error head(ord$result$BCHEUR$asks) head(ord$result$BCHEUR$bids)
Returns the recent spread data for a specified asset from a specified since. Output returned as a list with two elements: error and result. The error element is empty if no error occured. The result element is empty if an error occured. Result contains two elements: the spread entries for the asset; last, the id to be used as since when polling for new spread data. Data returned as: time; bid; ask
sprd <- get_recent_spread("BCHEUR", since = "1530876860") sprd$error head(sprd$result$BCHEUR) sprd$result$last
Returns the recent trades for a specified asset from a specified since (default is zero). Output returned as a list with two elements: error and result. The error element is empty if no error occured. The result element is empty if an error occured. Result contains two elements: the trade data for the specified asset over the specified period; last, the id to be used as since when polling for new trade data. Data returned as: price; volume; time; buy/sell; market/limit; miscellaneous
trd <- get_recent_trades("BCHEUR", since = "1501605300157840478") trd$error head(trd$result$BCHEUR) trd$result$last
Returns a unix timestamp and an RFC 1123 time format. This is to aid in approximating the skew time between server and client.
get_server_time()
Returns the ticker info for a comma seperated list of assets. Output returned as a list with two elements: error and result. The error element is empty if no error occured. The result element is empty if an error occured. Data returned for each pair:
pair_list <- paste("BCHEUR", "XBTEUR", sep = ",") tick <- get_ticker_info(pair_list) tick$error tick$result$BCHEUR
Returns the requested information for a comma seperated list of tradeable asset pairs. Information requested can be: "info": all info (default); "leverage": leverage info; fees: fees schedule; margin: margin info.Output returned as a list with two elements: error and result. The error element is empty if no error occured. The result element is empty if an error occured. Data returned is:
tap <- get_tradable_asset_pair(info = "margin", pair_list = "BCHEUR, XBTEUR") tap$error tap$result$BCHEUR
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.