Exposes the GET /api/v3/klines endpoint.

market_klines(
  symbol,
  interval = "1m",
  start_time = NULL,
  end_time = NULL,
  limit = 500,
  volume = FALSE
)

Arguments

symbol

Symbol.

interval

Time interval. One of 1m, 3m, 5m, 15m, 30m, 1h, 2h, 4h, 6h, 8h, 12h, 1d, 3d, 1w or 1M where m = minutes, h = hours, d = days, w = weeks and M = months.

start_time

Start time. Something that can be coerced to POSIXct.

end_time

End time. Something that can be coerced to POSIXct.

limit

Maximum number of records in result. Default is 500 and maximum is 1000.

volume

Whether to include volume data in output.

Value

A data frame.

Examples

market_klines("BTCUSDT")
#> # A tibble: 500 × 9
#>    symbol  open_time           close_time            open   high    low  close
#>    <chr>   <dttm>              <dttm>               <dbl>  <dbl>  <dbl>  <dbl>
#>  1 BTCUSDT 2022-07-19 20:25:00 2022-07-19 20:25:59 23346. 23360. 23322. 23324.
#>  2 BTCUSDT 2022-07-19 20:26:00 2022-07-19 20:26:59 23324. 23325. 23310  23318.
#>  3 BTCUSDT 2022-07-19 20:27:00 2022-07-19 20:27:59 23317. 23334. 23291. 23291.
#>  4 BTCUSDT 2022-07-19 20:28:00 2022-07-19 20:28:59 23283. 23294. 23273. 23285.
#>  5 BTCUSDT 2022-07-19 20:29:00 2022-07-19 20:29:59 23285. 23320. 23283. 23301.
#>  6 BTCUSDT 2022-07-19 20:30:00 2022-07-19 20:30:59 23301. 23303. 23277. 23283.
#>  7 BTCUSDT 2022-07-19 20:31:00 2022-07-19 20:31:59 23283. 23298. 23283. 23289.
#>  8 BTCUSDT 2022-07-19 20:32:00 2022-07-19 20:32:59 23289. 23312. 23288. 23312.
#>  9 BTCUSDT 2022-07-19 20:33:00 2022-07-19 20:33:59 23312. 23332. 23306. 23306.
#> 10 BTCUSDT 2022-07-19 20:34:00 2022-07-19 20:34:59 23306. 23332. 23236. 23249.
#> # … with 490 more rows, and 2 more variables: volume <dbl>, trades <int>
#> # ℹ Use `print(n = ...)` to see more rows, and `colnames()` to see all variable names