bucket_trades {bitmexr}R Documentation

Bucketed trade data

Description

bucket_trades() retrieves open high low close (OHLC) data for the specified symbol/time frame.

Usage

bucket_trades(
  binSize = "1m",
  partial = "false",
  symbol = "XBTUSD",
  count = 1000,
  reverse = "true",
  filter = NULL,
  columns = NULL,
  start = NULL,
  startTime = NULL,
  endTime = NULL,
  use_auth = FALSE
)

Arguments

binSize

character string. The time interval to bucket by, must be one of: "1m", "5m", "1h" or "1d".

partial

character string. Either "true" of "false". If "true", will send in-progress (incomplete) bins for the current time period.

symbol

a character string for the instrument symbol. Use available_symbols() to see available symbols.

count

an optional integer to specify the number of rows to return. Maximum of 1000 (the default) per request.

reverse

an optional character string. Either "true" of "false". If "true", result will be ordered with starting with the newest (defaults to "true").

filter

an optional character string for table filtering. Send JSON key/value pairs, such as "{'key':'value'}". See examples.

columns

an optional character vector of column names to return. If NULL, all columns will be returned.

start

an optional integer. Can be used to specify the starting point for results.

startTime

an optional character string. Starting date for results in the format "yyyy-mm-dd" or "yyyy-mm-dd hh-mm-ss".

endTime

an optional character string. Ending date for results in the format "yyyy-mm-dd" or "yyyy-mm-dd hh-mm-ss".

use_auth

logical. Use TRUE to enable authentication with API key.

Details

The API will only return 1000 rows per call. If the desired time frame requires more than one API call, consider using map_bucket_trades().

Value

bucket_trades() returns a data.frame containing:

References

urlhttps://www.bitmex.com/api/explorer/#!/Trade/Trade_getBucketed

Examples

## Not run: 

# Return most recent data for symbol `"ETHUSD"` for 1 hour buckets

bucket_trades(
  binSize = "1h",
  symbol = "ETHUSD",
  count = 10
)

## End(Not run)

[Package bitmexr version 0.3.1 Index]