Skip to content

Instantly share code, notes, and snippets.

@fhirschmann
Created January 25, 2016 18:40
Show Gist options
  • Save fhirschmann/d341f04bea239dfc1858 to your computer and use it in GitHub Desktop.
Save fhirschmann/d341f04bea239dfc1858 to your computer and use it in GitHub Desktop.
library(jsonlite)
library(httr)
library(digest)
api.poloniex <- function(key, secret, command, args = list()) {
req <- c(list(
command = command,
nonce = round(as.numeric(Sys.time()) * 1e4, 0)),
args)
ret <- POST("https://poloniex.com/tradingApi",
add_headers(key=key, sign=hmac(secret, httr:::compose_query(req), "sha512")),
body = req,
encode = "form")
stop_for_status(ret)
content(ret)
}
api.poloniex(exchanges$poloniex$key, exchanges$poloniex$secret, "returnTradeHistory", list(currencyPair = "all"))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment