Binance
Binance-only functions
Binance Spot
The names of the functions related to the Binance spot start with privateAPI.binance_
.
1. Get Account Information
Get an account information, including the balance, fee rate, and etc.
Arguments
None
Response
Same as the response in the API documentation.
2. Get Asset Balance
Get the tradable amount(free
) and locked amount(locked
) of the asset in the Binance spot account.
This function filters the elements of the balance
value in the response of the binance_account_info().
Arguments
asset
: (string) The name of the asset to get the balance.
Response
asset
: (string) The name of the asset.free
: (string) The tradable amount of the asset.locked
: (string) The amount of locked asset.
3. Market Order by Amount
Create a new market order. In this function, the currency of the amount is a base asset. For example, If the symbol = 'BTCUSDT'
(base asset = BTC, quote asset = USDT) and amount=0.15
, then it creates an order of size 0.15 BTC.
Arguments
amount
: (float) The amount of the order.symbol
: (string) The name of the symbol to trade.orderside
: (string) To buy, set it as'buy'
, or'sell'
to sell.
Response
Same as the response in the API documentation.
4. Market Order by Quote Asset Quantity
Create a new market order by the amount of the order in the quote asset. In this function, the currency of the amount is a quote asset. For example, If the symbol = 'BTCUSDT'
(base asset = BTC, quote asset = USDT) and quoteqty=120
, then it creates an order of size 120 USDT.
Arguments
quoteqty
: (float) The amount of the order in quote asset.symbol
: (string) The name of the symbol to trade.orderside
: (string) To buy, set it as'buy'
, or'sell'
to sell.
Response
Same as the response in the API documentation.
5. Limit Order by Amount
Create a new limit order. In this function, the currency of the amount is a base asset.
Arguments
amount
: (float) The amount of the order.price
: (float) The price for the order to be filled.symbol
: (string) The name of the symbol to trade.orderside
: (string) To buy, set it as'buy'
, or'sell'
to sell.
Response
Same as the response in the API documentation.
6. Cancel Orders on Symbol
Cancel all open orders of the symbol.
Arguments
symbol
: (string) The name of the symbol to cancel.
Response
Same as the response in the API documentation.
Binance USDⓈ-M Futures
The names of the functions related to the Binance USDⓈ-M futures start with privateAPI.binance_futures_
.
1. Get Account Balance
Get the balance of the assets in the Binance USD-M futures account.
Arguments
None
Response
Same as the response in the API documentation.
2. Get Account Information
Get the account information of the Binance USDⓈ-M futures account.
Arguments
None
Response
Same as the response in the API documentation.
3. Get Position Information
Get the open position information of the Binance USDⓈ-M futures account.
Arguments
None
Response
Same as the response in the API documentation.
4. Market Order
Set the leverage of the symbol and create a market order.
Arguments
leverage
: (int) The leverage value to set.symbol
: (string) The name of the symbol.side
: (string)'BUY'
to open long & close short position, or'SELL'
to open short & close long position.qty
: (float) The contract size to set order. In most case, it is the amount in base asset. For instance,symbol=ETHUSDT
, andqty=0.12
will create an order of contract size 0.12 ETH.
Response
Same as the response in the API documentation.
5. Limit Order
Set the leverage of the symbol and create a limit order.
Arguments
leverage
: (int) The leverage value to set.symbol
: (string) The name of the symbol.side
: (string)'BUY'
to open long & close short position, or'SELL'
to open short & close long position.qty
: (float) The contract size to set order. In most case, it is the amount in base asset. For instance,symbol=ETHUSDT
andqty=0.12
will create an order of contract size 0.12 ETH.price
: (float) The price for the order to be filled.
Response
Same as the response in the API documentation.
6. Cancel Orders on Symbol
Cancel all open orders of the symbol.
Arguments
symbol
: (string) The name of the symbol to cancel.
Response
Same as the response in the API documentation.
Binance COIN-M Futures
The names of the functions related to the Binance COIN-M futures start with privateAPI.binance_cm_futures_
.
1. Get Account Information
Get the account information in the Binance COIN-M Futures account.
Arguments
None
Response
Same as the response in the API documentation.
2. Get Position Information
Get the open position information in the Binance COIN-M Futures account.
Arguments
None
Response
Same as the response in the API documentation.
3. Market Order
Set the leverage of the symbol and create a market order.
Arguments
leverage
: (int) The leverage value to set.symbol
: (string) The name of the symbol.side
: (string)'BUY'
to open long & close short position, or'SELL'
to open short & close long position.qty
: (float) The size of the contract(=CONT) to set order. In most case, 1 CONT is a size of 10 USD, while some symbols such as BTCUSD have 1 CONT as 100 USD. For instance,symbol=ETHUSD
andqty=20
will create an order of ETHUSD with the contract size 200 USD, butsymbol=BTCUSD
andqty=20
will create an order of BTCUSD with the contract size 2000 USD.
Response
Same as the response in the API documentation.
4. Limit Order
Set the leverage of the symbol and create a limit order.
Arguments
leverage
: (int) The leverage value to set.symbol
: (string) The name of the symbol.side
: (string)'BUY'
to open long & close short position, or'SELL'
to open short & close long position.qty
: (float) The size of the contract(=CONT) to set order. In most case, 1 CONT is a size of 10 USD, while some symbols such as BTCUSD have 1 CONT as 100 USD. For instance,symbol=ETHUSD
andqty=20
will create an order of ETHUSD with the contract size 200 USD, butsymbol=BTCUSD
andqty=20
will create an order of BTCUSD with the contract size 2000 USD.price
: (float) The price for the order to be filled.
Response
Same as the response in the API documentation.
5. Cancel Orders on Symbol
Cancel all open orders of the symbol.
Arguments
symbol
: (string) The name of the symbol to cancel.
Response
Same as the response in the API documentation.
Last updated