Skip to content

Instantly share code, notes, and snippets.

@munair
Forked from fhirschmann/poloniex.R
Created January 10, 2018 00:42
Show Gist options
  • Save munair/fcc13a754dec6c1d801a9da4ba5456e1 to your computer and use it in GitHub Desktop.
Save munair/fcc13a754dec6c1d801a9da4ba5456e1 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