Learn R Programming

PoloniexR (version 0.0.1)

ReturnTradeHistory,PoloniexPublicAPI-method: Returns the past 200 trades for a given market, or up to 50,000 trades inside a specified input date range interval.

Description

Returns the past 200 trades for a given market, or up to 50,000 trades inside a specified input date range interval.

Usage

# S4 method for PoloniexPublicAPI
ReturnTradeHistory(theObject, pair = "USDT_BTC",
  from = NULL, to = NULL)

Arguments

theObject

The public client API object on which the function should be called.

pair

length-one character vector - The currencypair for which trade history information should be fetched.

from

POSIXct (or NULL) - starting timestamp for optional date range interval. if from != NULL: from must be < 'to' & from must be >= (to - 1 year)

to

POSIXct (or NULL) - ending timestamp for optional date range interval.

Value

an xts object containing historical trade information

Rows - Information for one specific trade. Columns - globalTradeID, tradeID, type, rate, amount, total

if from == NULL: Receive information for last 200 trades before 'to' if to == NULL: Ending timestamp for daterange will be set to Sys.time()

Examples

Run this code
# NOT RUN {
Sys.setenv(tz = "UTC")
poloniex.public <- PoloniexPublicAPI()
pair   <- "BTC_NXT"
from   <- as.POSIXct("2017-07-04 00:00:00 UTC")
to     <- as.POSIXct("2017-07-05 00:00:00 UTC")

trades.data <- ReturnTradeHistory(theObject = poloniex.public,
                                  pair      = pair,
                                  from      = from,
                                  to        = to)

# }

Run the code above in your browser using DataLab