Skip to contents

Class that implements the API methods for the Binance Spot API.

Super class

binance::Binance -> BinanceSpot

Methods

Inherited methods


Method new()

Usage

BinanceSpot$new(testnet = FALSE)

Arguments

testnet

(logical) whether to use the testnet. Default is FALSE. Compressed/Aggregate Trades List

Get compressed, aggregate trades. Trades that fill at the time, from the same order, with the same price will have the quantity aggregated.


Method aggregate_trades_list()

Usage

BinanceSpot$aggregate_trades_list(
  symbol,
  from_id = NULL,
  start_time = NULL,
  end_time = NULL,
  limit = 500
)

Arguments

symbol

(character) the trading symbol.

from_id

(numeric) trade id to fetch from. Default is NULL.

start_time

(numeric) the start time for the klines in epoch milliseconds.

end_time

(numeric) the end time for the klines in epoch milliseconds.

limit

(integer) the number of results to return. Default is 500; max is 1000.

Returns

(tibble) a tibble with the aggregate trades data. UIKlines

The request is similar to klines having the same parameters and response. `uiKlines`` return modified kline data, optimized for presentation of candlestick charts.


Method get_ui_kline_data()

Usage

BinanceSpot$get_ui_kline_data(
  symbol,
  interval,
  start_time = NULL,
  end_time = NULL,
  time_zone = "0",
  limit = 500
)

Arguments

symbol

(character) the trading symbol.

interval

(character) the interval for the klines.

start_time

(numeric) the start time for the klines in epoch milliseconds.

end_time

(numeric) the end time for the klines in epoch milliseconds.

time_zone

(character) the time zone. Default is "0" (UTC).

limit

(integer) the number of results to return. Default is 500; max is 1000.

Returns

(tibble) a tibble with the kline data. Current Average Price

Current average price for a symbol.


Method get_current_avg_price()

Usage

BinanceSpot$get_current_avg_price(symbol)

Arguments

symbol

(character) the trading symbol.

Returns

(tibble) a tibble with the average price data. 24hr Ticker Price Change Statistics

24 hour rolling window price change statistics. Careful when accessing this with no symbol.


Method trading_day_ticker()

Usage

BinanceSpot$trading_day_ticker(symbols)

Arguments

symbols

(character) the trading symbols.

Returns

(tibble) a tibble with the price change statistics. Symbol Price Ticker

Best price/qty on the order book for a symbol or symbols.


Method order_book_ticker()

Usage

BinanceSpot$order_book_ticker(symbols)

Arguments

symbols

(character) the trading symbols.

Returns

(tibble) a tibble with the price ticker data. Rolling window price change statistics

Note: This method is different from the ticker_stats_24hr method. The window used to compute statistics will be no more than 59999ms from the requested windowSize. openTime for this method always starts on a minute, while the closeTime is the current time of the request. As such, the effective window will be up to 59999ms wider than windowSize. E.g. If the closeTime is 1641287867099 (January 04, 2022 09:17:47:099 UTC), and the windowSize is 1d. the openTime will be: 1641201420000 (January 3, 2022, 09:17:00 UTC)


Method price_change_stats()

Usage

BinanceSpot$price_change_stats(symbols, window_size = "1d", type = "FULL")

Arguments

symbols

(character) the trading symbols.

window_size

(character) the window size for the statistics. Default is "1d". Supported windowSize values: 1m,2m....59m for minutes 1h, 2h....23h - for hours 1d...7d - for days Units cannot be combined (e.g. 1d2h is not allowed).

type

(character) the type of statistics. Default is "FULL"; Supported values are "FULL" or "MINI".


Method clone()

The objects of this class are cloneable with this method.

Usage

BinanceSpot$clone(deep = FALSE)

Arguments

deep

Whether to make a deep clone.