map_bucket_trades() uses purrr::map_dfr to execute multiple API calls. This is useful when the data you want to return exceeds the maximum 1000 row response limit, but do not want to have to manually call bucket_trades() repeatedly.

  start_date = "2015-09-25 13:00:00",
  end_date = now(tzone = "UTC"),
  binSize = "1d",
  symbol = "XBTUSD",
  partial = "false",
  filter = NULL,
  use_auth = FALSE,
  verbose = FALSE



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


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


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


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


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


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


logical. Use TRUE to enable authentication with API key.


logical. If TRUE, will print information to the console. Useful for long running requests.


map_bucket_trades returns a data.frame containing:

  • timestamp: POSIXct. Date and time of trade.

  • symbol: character. Instrument ticker.

  • open: numeric. Opening price for the bucket.

  • high: numeric. Highest price in the bucket.

  • low: numeric. Lowest price in the bucket.

  • close: numeric. Closing price of the bucket.

  • trades: numeric. Number of trades executed within the bucket.

  • volume: numeric. Volume in USD.

  • vwap: numeric. Volume weighted average price.

  • lastSize: numeric. Size of the last trade executed.

  • turnover: numeric. How many satoshi were exchanged.

  • homeNotional: numeric. BTC value of the bucket.

  • foreignNotional: numeric. USD value of the bucket.


map_bucket_trades() takes a start and end date, and creates a sequence of start dates which are passed in to the `startTime`` parameter in bucket_trades().

The length of time between each start time in each API call is determined by the binSize. For example, "1d" is chosen as the binSize the length of time between start dates will be 1000 days. If "1h" is chosen, it will be 1000 hours etc.

The function will print the number of API calls being sent and provides a progress bar in the console

Public API requests are limited to 30 per minute. Consequently, map_bucket_trades() uses purrr::slowly to restrict how often the function is called.



if (FALSE) { # Get hourly bucketed trade data between 2020-01-01 and 2020-02-01 map_bucket_trades( start_date = "2020-01-01", end_date = "2020-02-01", binSize = "1h" ) }