Argument | Type | Description | Options | Default |
---|---|---|---|---|
pair | Character | Trading pair | None | None |
api | Character | Reference API | spot, fapi, dapi, eapi | spot |
interval | Character | Time interval for klines data | 1s, 1m, 3m, 5m, 15m, 30m, 1h, 2h, 4h, 6h, 8h, 12h, 1d, 3d, 1w, 1M | 1d |
from | Character | Start time for historical data | None | None |
to | Character | End time for historical data | None | `Sys.time()-lubridate::minutes(10)` |
contract_type | Character | Used only if `api` is "fapi" or "dapi" | perpetual, current_quarter, next_quarter | `Sys.time()` |
uiKlines | Logical | If TRUE return data in UIklines format | TRUE/FALSE | FALSE |
as_xts | Logical | If TRUE convert the data into an `xts` object | TRUE/FALSE | FALSE |
quiet | Logical | If TRUE suppress informational and warnings | TRUE/FALSE | FALSE |
binance_klines
Get klines data for a trading pair with Binance API.
- Github function here.
Example: Spot (spot)
Get 1-day OHLC data for BTCUSDT
Get 1-hour OHLC data for BTCUSDT
Get 1-minutes OHLC data for BTCUSDT
Get 1-second OHLC data for BTCUSDT
Examples: Futures USD-m (fapi)
Get 1-day OHLC data for BTCUSDT
Get 1-hour OHLC data for BTCUSDT
Get 1-minutes OHLC data for BTCUSDT
Examples: Futures COIN-m (dapi)
Get 1-day OHLC data for BTCUSDT
Get 1-hour OHLC data for BTCUSD_PERP
Get 1-minutes OHLC data for BTCUSD_PERP
Examples: Options (eapi)
BTC-240628-30000-P
is a Put contract with strike price 30000 and expiry date on 28-06-2024
.
Get 1-day OHLC data for BTC-240628-30000-P
Get 1-hour OHLC data for BTC-240628-30000-P
Get 1-minutes OHLC data for BTC-240628-30000-P
Citation
BibTeX citation:
@online{sartini2024,
author = {Sartini, Beniamino},
date = {2024-06-18},
url = {https://cryptoverser.org/binancer-docs/binance_klines.html},
langid = {en}
}
For attribution, please cite this work as:
Sartini, Beniamino. 2024. June 18, 2024. https://cryptoverser.org/binancer-docs/binance_klines.html.