BinanceAccount: Account and Funding Management
BinanceAccount: Account and Funding Management
Details
Provides methods for querying account information, balances, and trade history on Binance. Inherits from BinanceBase.
Purpose and Scope
Account Info: Retrieve balances, commission rates, and account permissions.
Trade History: Paginated trade history for any symbol with datetime conversion.
Usage
All methods require authentication (valid API key and secret set via environment variables or passed to the constructor).
Super class
binance::BinanceBase -> BinanceAccount
Methods
Inherited methods
Method get_account_info()
Get Account Information
Retrieves account metadata including commission rates, trading permissions,
and account type. For balances, use get_balances().
Official Documentation
Binance Account Information Verified: 2026-03-10
Automated Trading Usage
Commission Rates: Access maker/taker commission rates for cost analysis.
Permission Check: Confirm
can_tradeis TRUE before placing orders.
Returns
data.table (or promise<data.table> if async = TRUE) with columns:
maker_commission(integer): Maker commission rate (basis points).taker_commission(integer): Taker commission rate (basis points).buyer_commission(integer): Buyer commission rate (basis points).seller_commission(integer): Seller commission rate (basis points).commission_rates(list): Nested object withmaker,taker,buyer,selleras decimal strings.can_trade(logical): Whether the account can place trades.can_withdraw(logical): Whether the account can withdraw.can_deposit(logical): Whether the account can deposit.brokered(logical): Whether this is a brokered account.require_self_trade_prevention(logical): Whether STP is required.prevent_sor(logical): Whether smart order routing is prevented.update_time(numeric): Last account update timestamp in milliseconds.account_type(character): Account type (e.g.,"SPOT").permission(character): Account permission (one row per permission, e.g.,"SPOT","MARGIN").uid(integer): Unique account identifier.
When the account has multiple permissions, account fields are repeated on each row.
Method get_balances()
Get Account Balances
Retrieves asset balances for the account.
Official Documentation
Binance Account Information Verified: 2026-03-10
Automated Trading Usage
Balance Check: Verify available funds before placing orders.
Portfolio Overview: Get all asset balances in a single call.
Arguments
omitZeroBalancesLogical or NULL; if TRUE, omit assets with zero balance.
recvWindowInteger or NULL; max 60000.
Method get_trades()
Get Account Trade List
Retrieves trades for a specific symbol. Requires authentication.
Official Documentation
Binance Account Trade List Verified: 2026-03-10
Automated Trading Usage
Trade History: Build trade logs for P&L calculations.
Fill Analysis: Analyse execution quality across trades.
Tax Reporting: Export trade history for tax calculations.
Usage
BinanceAccount$get_trades(
symbol,
orderId = NULL,
startTime = NULL,
endTime = NULL,
fromId = NULL,
limit = NULL,
recvWindow = NULL
)Arguments
symbolCharacter; trading pair (e.g.,
"BTCUSDT").orderIdInteger or NULL; filter by order ID.
startTimeInteger or NULL; start timestamp in milliseconds.
endTimeInteger or NULL; end timestamp in milliseconds.
fromIdInteger or NULL; trade ID to fetch from.
limitInteger or NULL; max results (default 500, max 1000).
recvWindowInteger or NULL; max 60000.
Returns
data.table with one row per trade and the following columns:
symbol(character): Trading pair (e.g.,"BTCUSDT").id(integer): Unique trade identifier.order_id(integer): Order that generated this trade.order_list_id(integer): OCO order list ID;-1if not an OCO.price(character): Execution price.qty(character): Quantity traded.quote_qty(character): Quote asset amount transacted.commission(character): Commission charged.commission_asset(character): Asset used for commission (e.g.,"BNB").is_buyer(logical):TRUEif you were the buyer.is_maker(logical):TRUEif you were the maker.is_best_match(logical):TRUEif this was the best price match.time(POSIXct): Trade execution time converted fromtime.
Examples
if (FALSE) { # \dontrun{
# Synchronous
account <- BinanceAccount$new()
info <- account$get_account_info()
print(info)
balances <- account$get_balances()
print(balances)
# Asynchronous
account_async <- BinanceAccount$new(async = TRUE)
main <- coro::async(function() {
info <- await(account_async$get_account_info())
print(info)
})
main()
while (!later::loop_empty()) later::run_now()
} # }
## ------------------------------------------------
## Method `BinanceAccount$get_account_info`
## ------------------------------------------------
if (FALSE) { # \dontrun{
account <- BinanceAccount$new()
info <- account$get_account_info()
print(info[, .(maker_commission, taker_commission, can_trade, account_type)])
} # }
## ------------------------------------------------
## Method `BinanceAccount$get_balances`
## ------------------------------------------------
if (FALSE) { # \dontrun{
account <- BinanceAccount$new()
balances <- account$get_balances()
print(balances[free != "0.00000000"])
} # }
## ------------------------------------------------
## Method `BinanceAccount$get_trades`
## ------------------------------------------------
if (FALSE) { # \dontrun{
account <- BinanceAccount$new()
trades <- account$get_trades("BTCUSDT", limit = 50)
print(trades[, .(id, price, qty, commission, time)])
} # }