Title: | API Client to 'Binance' |
---|---|
Description: | R client to the 'Binance' Public Rest API for data collection on cryptocurrencies, portfolio management and trading: <https://github.com/binance/binance-spot-api-docs/blob/master/rest-api.md>. |
Authors: | Gergely Daróczi [aut, cre], David Andel [aut] |
Maintainer: | Gergely Daróczi <[email protected]> |
License: | AGPL |
Version: | 1.2.0 |
Built: | 2024-10-26 03:24:39 UTC |
Source: | https://github.com/daroczig/binancer |
Get current general Binance account information, without balances
binance_account()
binance_account()
data.table
Fetch all orders from the Binance account
binance_all_orders(symbol, order_id, start_time, end_time, limit)
binance_all_orders(symbol, order_id, start_time, end_time, limit)
symbol |
string |
order_id |
optional number |
start_time |
optional POSIX timestamp |
end_time |
optional POSIX timestamp |
limit |
optional int |
data.table
## Not run: binance_all_orders('ARKETH') binance_all_orders('ARKBTC', order_id = '123456') ## End(Not run)
## Not run: binance_all_orders('ARKETH') binance_all_orders('ARKBTC', order_id = '123456') ## End(Not run)
Get current average price for a symbol
binance_avg_price(symbol)
binance_avg_price(symbol)
symbol |
string |
data.table
Get current Binance balances in a nice table
binance_balances(threshold = -1, usdt = FALSE)
binance_balances(threshold = -1, usdt = FALSE)
threshold |
optional show assets with greater number of coins |
usdt |
optional to include balance in USDT too |
data.table
Cancel order on the Binance account
binance_cancel_order(symbol, order_id, client_order_id)
binance_cancel_order(symbol, order_id, client_order_id)
symbol |
string |
order_id |
optional number |
client_order_id |
optional string |
data.table
## Not run: binance_cancel_order('ARKETH', order_id = 123456) binance_cancel_order('ARKBTC', client_order_id = 'myOrder7') ## End(Not run)
## Not run: binance_cancel_order('ARKETH', order_id = 123456) binance_cancel_order('ARKBTC', client_order_id = 'myOrder7') ## End(Not run)
Get all currently valid coin names from Binance
binance_coins()
binance_coins()
character vector of coin names
Get all currently valid coin names from Binance along with the USDT prices
binance_coins_prices(unit = "USDT")
binance_coins_prices(unit = "USDT")
unit |
to set quote asset |
data.table
with symbol
and usd
columns
Sets the API key and secret to interact with the Binance API
binance_credentials(key, secret)
binance_credentials(key, secret)
key |
string |
secret |
string |
No return values, setting config in the package namespace.
## Not run: binance_credentials('foo', 'bar') ## End(Not run)
## Not run: binance_credentials('foo', 'bar') ## End(Not run)
Get orderbook depth data from Binance
binance_depth(symbol, limit)
binance_depth(symbol, limit)
symbol |
string |
limit |
int optional |
data.table
## Not run: binance_depth('ETHUSDT') binance_depth('ETHUSDT', limit = 1000) ## End(Not run)
## Not run: binance_depth('ETHUSDT') binance_depth('ETHUSDT', limit = 1000) ## End(Not run)
Get exchangeInfo from Binance
binance_exchange_info()
binance_exchange_info()
list
Get current filters for a symbol
binance_filters(symbol)
binance_filters(symbol)
symbol |
string |
data.table
Get kline/candlestick data from Binance
binance_klines( symbol, interval = c("1m", "3m", "5m", "15m", "30m", "1h", "2h", "4h", "6h", "8h", "12h", "1d", "3d", "1w", "1M"), limit, start_time, end_time )
binance_klines( symbol, interval = c("1m", "3m", "5m", "15m", "30m", "1h", "2h", "4h", "6h", "8h", "12h", "1d", "3d", "1w", "1M"), limit, start_time, end_time )
symbol |
string |
interval |
enum |
limit |
optional int |
start_time |
optional POSIX timestamp |
end_time |
optional POSIX timestamp |
data.table
with open-high-low-close values
## Not run: binance_klines('ETHUSDT') binance_klines('ETHUSDT', interval = '1h', limit = 24*7) binance_klines('ETHUSDT', interval = '1h', start_time = '2018-01-01', end_time = '2018-01-08') ## End(Not run)
## Not run: binance_klines('ETHUSDT') binance_klines('ETHUSDT', interval = '1h', limit = 24*7) binance_klines('ETHUSDT', interval = '1h', start_time = '2018-01-01', end_time = '2018-01-08') ## End(Not run)
Get trades for a specific symbol on the Binance account
binance_mytrades(symbol, limit, from_id, start_time, end_time)
binance_mytrades(symbol, limit, from_id, start_time, end_time)
symbol |
string |
limit |
optional int number of trades to fetch |
from_id |
optional trade id to fetch from |
start_time |
optional POSIX timestamp |
end_time |
optional POSIX timestamp |
data.table
## Not run: binance_mytrades('ARKETH') binance_mytrades(c('ARKBTC', 'ARKETH')) ## End(Not run)
## Not run: binance_mytrades('ARKETH') binance_mytrades(c('ARKBTC', 'ARKETH')) ## End(Not run)
Open new order on the Binance account
binance_new_order( symbol, side = c("BUY", "SELL"), type = c("LIMIT", "MARKET", "STOP_LOSS", "STOP_LOSS_LIMIT", "TAKE_PROFIT", "TAKE_PROFIT_LIMIT", "LIMIT_MAKER"), time_in_force = c("GTC", "IOC", "FOK"), quantity, price, stop_price, iceberg_qty, test = TRUE )
binance_new_order( symbol, side = c("BUY", "SELL"), type = c("LIMIT", "MARKET", "STOP_LOSS", "STOP_LOSS_LIMIT", "TAKE_PROFIT", "TAKE_PROFIT_LIMIT", "LIMIT_MAKER"), time_in_force = c("GTC", "IOC", "FOK"), quantity, price, stop_price, iceberg_qty, test = TRUE )
symbol |
string |
side |
enum |
type |
enum |
time_in_force |
optional enum |
quantity |
number |
price |
optional number |
stop_price |
optional number |
iceberg_qty |
optional number |
test |
bool |
data.table
## Not run: binance_new_order('ARKETH', side = 'BUY', type = 'MARKET', quantity = 1) binance_new_order('ARKBTC', side = 'BUY', type = 'LIMIT', quantity = 1, price = 0.5, time_in_force = 'GTC') ## End(Not run)
## Not run: binance_new_order('ARKETH', side = 'BUY', type = 'MARKET', quantity = 1) binance_new_order('ARKBTC', side = 'BUY', type = 'LIMIT', quantity = 1, price = 0.5, time_in_force = 'GTC') ## End(Not run)
Fetch open orders from the Binance account
binance_open_orders(symbol)
binance_open_orders(symbol)
symbol |
optional string |
data.table
## Not run: binance_open_orders('ARKETH') binance_open_orders() # all symbols - binance.weight 40 ## End(Not run)
## Not run: binance_open_orders('ARKETH') binance_open_orders() # all symbols - binance.weight 40 ## End(Not run)
Test connectivity to the Rest API
binance_ping()
binance_ping()
"OK" string on success
Query order on the Binance account
binance_query_order(symbol, order_id, client_order_id)
binance_query_order(symbol, order_id, client_order_id)
symbol |
string |
order_id |
optional number |
client_order_id |
optional string |
data.table
## Not run: binance_query_order('ARKETH') binance_query_order('ARKBTC', client_order_id = 'myOrder7') ## End(Not run)
## Not run: binance_query_order('ARKETH') binance_query_order('ARKBTC', client_order_id = 'myOrder7') ## End(Not run)
Get all currently valid symbol names from Binance
binance_symbols(all = FALSE)
binance_symbols(all = FALSE)
all |
optional bool include non-trading symbols |
character vector of symbol names
24 hour rolling window price change statistics
binance_ticker_24hr(symbol)
binance_ticker_24hr(symbol)
symbol |
optional string |
data.table
## Not run: binance_ticker_24hr('ARKETH') binance_ticker_24hr() # all symbols - binance.weight 40 ## End(Not run)
## Not run: binance_ticker_24hr('ARKETH') binance_ticker_24hr() # all symbols - binance.weight 40 ## End(Not run)
Get latest Binance bids and asks on all symbol pairs
binance_ticker_all_books()
binance_ticker_all_books()
data.table
Get latest Binance conversion rates and USD prices on all symbol pairs
binance_ticker_all_prices()
binance_ticker_all_prices()
data.table
Get last bids and asks for a symbol or all symbols
binance_ticker_book(symbol)
binance_ticker_book(symbol)
symbol |
optional string |
data.table
Get last price for a symbol or all symbols
binance_ticker_price(symbol)
binance_ticker_price(symbol)
symbol |
optional string |
data.table
Get tick data from Binance
binance_ticks(symbol, from_id, start_time, end_time, limit)
binance_ticks(symbol, from_id, start_time, end_time, limit)
symbol |
string |
from_id |
optional number |
start_time |
optional POSIX timestamp |
end_time |
optional POSIX timestamp |
limit |
optional int |
data.table
## Not run: binance_ticks('ETHUSDT') binance_ticks('ETHUSDT', start_time = '2018-01-01 00:00:00', end_time = '2018-01-01 01:00:00') ## End(Not run)
## Not run: binance_ticks('ETHUSDT') binance_ticks('ETHUSDT', start_time = '2018-01-01 00:00:00', end_time = '2018-01-01 01:00:00') ## End(Not run)
Get the current server time from Binance
binance_time()
binance_time()
POSIXct
Get last trades from Binance
binance_trades(symbol, limit)
binance_trades(symbol, limit)
symbol |
string |
limit |
optional int |
data.table
## Not run: binance_trades('ETHUSDT') binance_trades('ETHUSDT', limit = 1000) ## End(Not run)
## Not run: binance_trades('ETHUSDT') binance_trades('ETHUSDT', limit = 1000) ## End(Not run)