Binance API
Client module
- class binance.client.Client(api_key: str | None = None, api_secret: str | None = None, requests_params: Dict[str, Any] | None = None, tld: str = 'com', base_endpoint: str = '', testnet: bool = False, demo: bool = False, private_key: str | Path | None = None, private_key_pass: str | None = None, ping: bool | None = True, time_unit: str | None = None, verbose: bool = False)[source]
Bases:
BaseClient- __init__(api_key: str | None = None, api_secret: str | None = None, requests_params: Dict[str, Any] | None = None, tld: str = 'com', base_endpoint: str = '', testnet: bool = False, demo: bool = False, private_key: str | Path | None = None, private_key_pass: str | None = None, ping: bool | None = True, time_unit: str | None = None, verbose: bool = False)[source]
Binance API Client constructor
- Parameters:
api_key (str.) – Api Key
api_secret (str.) – Api Secret
requests_params (dict.) – optional - Dictionary of requests params to use for all calls
testnet (bool) – Use testnet environment - only available for vanilla options at the moment
private_key (optional - str or Path) – Path to private key, or string of file contents
private_key_pass (optional - str) – Password of private key
time_unit (optional - str) – Time unit to use for requests. Supported values: “MILLISECOND”, “MICROSECOND”
verbose (bool) – Enable verbose logging for debugging
- aggregate_trade_iter(symbol: str, start_str=None, last_id=None)[source]
Iterate over aggregate trade data from (start_time or last_id) to the end of the history so far.
If start_time is specified, start with the first trade after start_time. Meant to initialise a local cache of trade data.
If last_id is specified, start with the trade after it. This is meant for updating a pre-existing local trade data cache.
Only allows start_str or last_id—not both. Not guaranteed to work right if you’re running more than one of these simultaneously. You will probably hit your rate limit.
See dateparser docs for valid start and end string formats http://dateparser.readthedocs.io/en/latest/
If using offset strings for dates add “UTC” to date string e.g. “now UTC”, “11 hours ago UTC”
- Parameters:
symbol (str) – Symbol string e.g. ETHBTC
start_str – Start date string in UTC format or timestamp in milliseconds. The iterator will
return the first trade occurring later than this time. :type start_str: str|int :param last_id: aggregate trade ID of the last known aggregate trade. Not a regular trade ID. See https://binance-docs.github.io/apidocs/spot/en/#compressed-aggregate-trades-list
- Returns:
an iterator of JSON objects, one per trade. The format of
each object is identical to Client.aggregate_trades().
- cancel_all_open_margin_orders(**params)[source]
Cancels all active orders on a symbol for margin account.
https://developers.binance.com/docs/margin_trading/trade/Margin-Account-Cancel-All-Open-Orders
- Parameters:
symbol (str) – required
isIsolated (str) – set to ‘TRUE’ for isolated margin (default ‘FALSE’)
recvWindow (int) – the number of milliseconds the request is valid for
- Returns:
API response
- Raises:
BinanceRequestException, BinanceAPIException
- cancel_all_open_orders(**params)[source]
Cancel all open orders on a symbol.
- Parameters:
symbol (str) – required
- Returns:
API response
- cancel_margin_oco_order(**params)[source]
Cancel an entire Order List for a margin account.
https://developers.binance.com/docs/margin_trading/trade/Margin-Account-Cancel-OCO
- Parameters:
symbol (str) – required
isIsolated – for isolated margin or not, “TRUE”, “FALSE”,default “FALSE”
orderListId (int) – Either orderListId or listClientOrderId must be provided
listClientOrderId (str) – Either orderListId or listClientOrderId must be provided
newClientOrderId (str) – Used to uniquely identify this cancel. Automatically generated by default.
recvWindow (int) – the number of milliseconds the request is valid for
- Returns:
API response
{ "orderListId": 0, "contingencyType": "OCO", "listStatusType": "ALL_DONE", "listOrderStatus": "ALL_DONE", "listClientOrderId": "C3wyj4WVEktd7u9aVBRXcN", "transactionTime": 1574040868128, "symbol": "LTCBTC", "isIsolated": false, // if isolated margin "orders": [ { "symbol": "LTCBTC", "orderId": 2, "clientOrderId": "pO9ufTiFGg3nw2fOdgeOXa" }, { "symbol": "LTCBTC", "orderId": 3, "clientOrderId": "TXOvglzXuaubXAaENpaRCB" } ], "orderReports": [ { "symbol": "LTCBTC", "origClientOrderId": "pO9ufTiFGg3nw2fOdgeOXa", "orderId": 2, "orderListId": 0, "clientOrderId": "unfWT8ig8i0uj6lPuYLez6", "price": "1.00000000", "origQty": "10.00000000", "executedQty": "0.00000000", "cummulativeQuoteQty": "0.00000000", "status": "CANCELED", "timeInForce": "GTC", "type": "STOP_LOSS_LIMIT", "side": "SELL", "stopPrice": "1.00000000" }, { "symbol": "LTCBTC", "origClientOrderId": "TXOvglzXuaubXAaENpaRCB", "orderId": 3, "orderListId": 0, "clientOrderId": "unfWT8ig8i0uj6lPuYLez6", "price": "3.00000000", "origQty": "10.00000000", "executedQty": "0.00000000", "cummulativeQuoteQty": "0.00000000", "status": "CANCELED", "timeInForce": "GTC", "type": "LIMIT_MAKER", "side": "SELL" } ] }
- cancel_margin_order(**params)[source]
Cancel an active order for margin account.
Either orderId or origClientOrderId must be sent.
https://developers.binance.com/docs/margin_trading/trade/Margin-Account-Cancel-Order
- Parameters:
symbol (str) – required
isIsolated (str) – set to ‘TRUE’ for isolated margin (default ‘FALSE’)
orderId (str)
origClientOrderId (str)
newClientOrderId (str) – Used to uniquely identify this cancel. Automatically generated by default.
recvWindow (int) – the number of milliseconds the request is valid for
- Returns:
API response
- {
“symbol”: “LTCBTC”, “orderId”: 28, “origClientOrderId”: “myOrder1”, “clientOrderId”: “cancelMyOrder1”, “transactTime”: 1507725176595, “price”: “1.00000000”, “origQty”: “10.00000000”, “executedQty”: “8.00000000”, “cummulativeQuoteQty”: “8.00000000”, “status”: “CANCELED”, “timeInForce”: “GTC”, “type”: “LIMIT”, “side”: “SELL”
}
- Raises:
BinanceRequestException, BinanceAPIException
- cancel_order(**params)[source]
Cancel an active order. Either orderId or origClientOrderId must be sent.
- Parameters:
symbol (str) – required
orderId (int) – The unique order id
origClientOrderId (str) – optional
newClientOrderId (str) – Used to uniquely identify this cancel. Automatically generated by default.
recvWindow (int) – the number of milliseconds the request is valid for
- Returns:
API response
{ "symbol": "LTCBTC", "origClientOrderId": "myOrder1", "orderId": 1, "clientOrderId": "cancelMyOrder1" }
- Raises:
BinanceRequestException, BinanceAPIException
- cancel_replace_order(**params)[source]
Cancels an existing order and places a new order on the same symbol.
Filters and Order Count are evaluated before the processing of the cancellation and order placement occurs.
A new order that was not attempted (i.e. when newOrderResult: NOT_ATTEMPTED), will still increase the order count by 1.
- Parameters:
symbol (str) – required
side (enum) – required
type (enum) – required
cancelReplaceMode (enum) – required - STOP_ON_FAILURE or ALLOW_FAILURE
timeInForce (enum) – optional
quantity (decimal) – optional
quoteOrderQty (decimal) – optional
price (decimal) – optional
cancelNewClientOrderId (str) – optional - Used to uniquely identify this cancel. Automatically generated by default.
cancelOrigClientOrderId (str) – optional - Either the cancelOrigClientOrderId or cancelOrderId must be provided. If both are provided, cancelOrderId takes precedence.
cancelOrderId (long) – optional - Either the cancelOrigClientOrderId or cancelOrderId must be provided. If both are provided, cancelOrderId takes precedence.
newClientOrderId (str) – optional - Used to identify the new order.
strategyId (int) – optional
strategyType (int) – optional - The value cannot be less than 1000000.
stopPrice (decimal) – optional
trailingDelta (long) – optional
icebergQty (decimal) – optional
newOrderRespType (enum) – optional - ACK, RESULT or FULL. MARKET and LIMIT orders types default to FULL; all other orders default to ACK
selfTradePreventionMode (enum) – optional - EXPIRE_TAKER, EXPIRE_MAKER, EXPIRE_BOTH or NONE.
cancelRestrictions (enum) – optional - ONLY_NEW or ONLY_PARTIALLY_FILLED
recvWindow (int) – optional - The value cannot be greater than 60000
- Returns:
API response
//Both the cancel order placement and new order placement succeeded. { "cancelResult": "SUCCESS", "newOrderResult": "SUCCESS", "cancelResponse": { "symbol": "BTCUSDT", "origClientOrderId": "DnLo3vTAQcjha43lAZhZ0y", "orderId": 9, "orderListId": -1, "clientOrderId": "osxN3JXAtJvKvCqGeMWMVR", "transactTime": 1684804350068, "price": "0.01000000", "origQty": "0.000100", "executedQty": "0.00000000", "cummulativeQuoteQty": "0.00000000", "status": "CANCELED", "timeInForce": "GTC", "type": "LIMIT", "side": "SELL", "selfTradePreventionMode": "NONE" }, "newOrderResponse": { "symbol": "BTCUSDT", "orderId": 10, "orderListId": -1, "clientOrderId": "wOceeeOzNORyLiQfw7jd8S", "transactTime": 1652928801803, "price": "0.02000000", "origQty": "0.040000", "executedQty": "0.00000000", "cummulativeQuoteQty": "0.00000000", "status": "NEW", "timeInForce": "GTC", "type": "LIMIT", "side": "BUY", "workingTime": 1669277163808, "fills": [], "selfTradePreventionMode": "NONE" } }
Similar to POST /api/v3/order, additional mandatory parameters are determined by type.
Response format varies depending on whether the processing of the message succeeded, partially succeeded, or failed.
- Raises:
BinanceRequestException, BinanceAPIException
- change_fixed_activity_to_daily_position(**params)[source]
Change Fixed/Activity Position to Daily Position
- convert_accept_quote(**params)[source]
Accept the offered quote by quote ID.
https://developers.binance.com/docs/convert/trade/Accept-Quote
- Parameters:
quoteId (str) – required - 457235734584567
recvWindow (int) – optional
- Returns:
API response
- convert_request_quote(**params)[source]
Request a quote for the requested token pairs
https://developers.binance.com/docs/convert/trade
- Parameters:
fromAsset (str) – required - Asset to convert from - BUSD
toAsset (str) – required - Asset to convert to - BTC
fromAmount (decimal) – EITHER - When specified, it is the amount you will be debited after the conversion
toAmount (decimal) – EITHER - When specified, it is the amount you will be credited after the conversion
recvWindow (int) – optional
- Returns:
API response
- create_isolated_margin_account(**params)[source]
Create isolated margin account for symbol
https://binance-docs.github.io/apidocs/spot/en/#create-isolated-margin-account-margin
- Parameters:
base (str) – Base asset of symbol
quote (str) – Quote asset of symbol
pair_details = client.create_isolated_margin_account(base='USDT', quote='BTC')
- Returns:
API response
{ "success": true, "symbol": "BTCUSDT" }
- Raises:
BinanceRequestException, BinanceAPIException
- create_margin_loan(**params)[source]
Apply for a loan in cross-margin or isolated-margin account.
https://binance-docs.github.io/apidocs/spot/en/#margin-account-borrow-margin
- Parameters:
asset (str) – name of the asset
amount (str) – amount to transfer
isIsolated (str) – set to ‘TRUE’ for isolated margin (default ‘FALSE’)
symbol (str) – Isolated margin symbol (default blank for cross-margin)
recvWindow (int) – the number of milliseconds the request is valid for
transaction = client.margin_create_loan(asset='BTC', amount='1.1') transaction = client.margin_create_loan(asset='BTC', amount='1.1', isIsolated='TRUE', symbol='ETHBTC')
- Returns:
API response
{ "tranId": 100000001 }
- Raises:
BinanceRequestException, BinanceAPIException
- create_margin_oco_order(**params)[source]
Post a new OCO trade for margin account.
https://developers.binance.com/docs/margin_trading/trade/Margin-Account-New-OCO
- Parameters:
symbol (str) – required
isIsolated – for isolated margin or not, “TRUE”, “FALSE”,default “FALSE”
listClientOrderId (str) – A unique id for the list order. Automatically generated if not sent.
side (str) – required
quantity (decimal) – required
limitClientOrderId (str) – A unique id for the limit order. Automatically generated if not sent.
price (str) – required
limitIcebergQty (decimal) – Used to make the LIMIT_MAKER leg an iceberg order.
stopClientOrderId (str) – A unique Id for the stop loss/stop loss limit leg. Automatically generated if not sent.
stopPrice (str) – required
stopLimitPrice (str) – If provided, stopLimitTimeInForce is required.
stopIcebergQty (decimal) – Used with STOP_LOSS_LIMIT leg to make an iceberg order.
stopLimitTimeInForce (str) – Valid values are GTC/FOK/IOC.
newOrderRespType (str) – Set the response JSON. ACK, RESULT, or FULL; default: RESULT.
sideEffectType (str) – NO_SIDE_EFFECT, MARGIN_BUY, AUTO_REPAY; default NO_SIDE_EFFECT.
recvWindow (int) – the number of milliseconds the request is valid for
- Returns:
API response
{ "orderListId": 0, "contingencyType": "OCO", "listStatusType": "EXEC_STARTED", "listOrderStatus": "EXECUTING", "listClientOrderId": "JYVpp3F0f5CAG15DhtrqLp", "transactionTime": 1563417480525, "symbol": "LTCBTC", "marginBuyBorrowAmount": "5", // will not return if no margin trade happens "marginBuyBorrowAsset": "BTC", // will not return if no margin trade happens "isIsolated": false, // if isolated margin "orders": [ { "symbol": "LTCBTC", "orderId": 2, "clientOrderId": "Kk7sqHb9J6mJWTMDVW7Vos" }, { "symbol": "LTCBTC", "orderId": 3, "clientOrderId": "xTXKaGYd4bluPVp78IVRvl" } ], "orderReports": [ { "symbol": "LTCBTC", "orderId": 2, "orderListId": 0, "clientOrderId": "Kk7sqHb9J6mJWTMDVW7Vos", "transactTime": 1563417480525, "price": "0.000000", "origQty": "0.624363", "executedQty": "0.000000", "cummulativeQuoteQty": "0.000000", "status": "NEW", "timeInForce": "GTC", "type": "STOP_LOSS", "side": "BUY", "stopPrice": "0.960664" }, { "symbol": "LTCBTC", "orderId": 3, "orderListId": 0, "clientOrderId": "xTXKaGYd4bluPVp78IVRvl", "transactTime": 1563417480525, "price": "0.036435", "origQty": "0.624363", "executedQty": "0.000000", "cummulativeQuoteQty": "0.000000", "status": "NEW", "timeInForce": "GTC", "type": "LIMIT_MAKER", "side": "BUY" } ] }
- Raises:
BinanceRequestException, BinanceAPIException, BinanceOrderException, BinanceOrderMinAmountException, BinanceOrderMinPriceException, BinanceOrderMinTotalException, BinanceOrderUnknownSymbolException, BinanceOrderInactiveSymbolException
- create_margin_order(**params)[source]
Post a new order for margin account.
https://developers.binance.com/docs/margin_trading/trade/Margin-Account-New-Order
- Parameters:
symbol (str) – required
isIsolated (str) – set to ‘TRUE’ for isolated margin (default ‘FALSE’)
side (str) – required
type (str) – required
quantity (decimal) – required
price (str) – required
stopPrice (str) – Used with STOP_LOSS, STOP_LOSS_LIMIT, TAKE_PROFIT, and TAKE_PROFIT_LIMIT orders.
timeInForce (str) – required if limit order GTC,IOC,FOK
newClientOrderId (str) – A unique id for the order. Automatically generated if not sent.
icebergQty (str) – Used with LIMIT, STOP_LOSS_LIMIT, and TAKE_PROFIT_LIMIT to create an iceberg order.
newOrderRespType (str) – Set the response JSON. ACK, RESULT, or FULL; MARKET and LIMIT order types default to FULL, all other orders default to ACK.
recvWindow (int) – the number of milliseconds the request is valid for
- Returns:
API response
Response ACK:
{ "symbol": "BTCUSDT", "orderId": 28, "clientOrderId": "6gCrw2kRUAF9CvJDGP16IP", "transactTime": 1507725176595 }
Response RESULT:
{ "symbol": "BTCUSDT", "orderId": 28, "clientOrderId": "6gCrw2kRUAF9CvJDGP16IP", "transactTime": 1507725176595, "price": "1.00000000", "origQty": "10.00000000", "executedQty": "10.00000000", "cummulativeQuoteQty": "10.00000000", "status": "FILLED", "timeInForce": "GTC", "type": "MARKET", "side": "SELL" }
Response FULL:
{ "symbol": "BTCUSDT", "orderId": 28, "clientOrderId": "6gCrw2kRUAF9CvJDGP16IP", "transactTime": 1507725176595, "price": "1.00000000", "origQty": "10.00000000", "executedQty": "10.00000000", "cummulativeQuoteQty": "10.00000000", "status": "FILLED", "timeInForce": "GTC", "type": "MARKET", "side": "SELL", "fills": [ { "price": "4000.00000000", "qty": "1.00000000", "commission": "4.00000000", "commissionAsset": "USDT" }, { "price": "3999.00000000", "qty": "5.00000000", "commission": "19.99500000", "commissionAsset": "USDT" }, { "price": "3998.00000000", "qty": "2.00000000", "commission": "7.99600000", "commissionAsset": "USDT" }, { "price": "3997.00000000", "qty": "1.00000000", "commission": "3.99700000", "commissionAsset": "USDT" }, { "price": "3995.00000000", "qty": "1.00000000", "commission": "3.99500000", "commissionAsset": "USDT" } ] }
- Raises:
BinanceRequestException, BinanceAPIException, BinanceOrderException, BinanceOrderMinAmountException, BinanceOrderMinPriceException, BinanceOrderMinTotalException, BinanceOrderUnknownSymbolException, BinanceOrderInactiveSymbolException
- create_oco_order(**params)[source]
Send in an one-cancels-the-other (OCO) pair, where activation of one order immediately cancels the other.
An OCO has 2 orders called the above order and below order. One of the orders must be a LIMIT_MAKER/TAKE_PROFIT/TAKE_PROFIT_LIMIT order and the other must be STOP_LOSS or STOP_LOSS_LIMIT order.
Price restrictions: If the OCO is on the SELL side:
LIMIT_MAKER/TAKE_PROFIT_LIMIT price > Last Traded Price > STOP_LOSS/STOP_LOSS_LIMIT stopPrice TAKE_PROFIT stopPrice > Last Traded Price > STOP_LOSS/STOP_LOSS_LIMIT stopPrice
- If the OCO is on the BUY side:
LIMIT_MAKER/TAKE_PROFIT_LIMIT price < Last Traded Price < stopPrice TAKE_PROFIT stopPrice < Last Traded Price < STOP_LOSS/STOP_LOSS_LIMIT stopPrice
Weight: 1
- Parameters:
symbol (str) – required
listClientOrderId (str) – Arbitrary unique ID among open order lists. Automatically generated if not sent.
side (str) – required - BUY or SELL
quantity (decimal) – required - Quantity for both orders of the order list
aboveType (str) – required - STOP_LOSS_LIMIT, STOP_LOSS, LIMIT_MAKER, TAKE_PROFIT, TAKE_PROFIT_LIMIT
aboveClientOrderId (str) – Arbitrary unique ID among open orders for the above order
aboveIcebergQty (decimal) – Note that this can only be used if aboveTimeInForce is GTC
abovePrice (decimal) – Can be used if aboveType is STOP_LOSS_LIMIT, LIMIT_MAKER, or TAKE_PROFIT_LIMIT
aboveStopPrice (decimal) – Can be used if aboveType is STOP_LOSS, STOP_LOSS_LIMIT, TAKE_PROFIT, TAKE_PROFIT_LIMIT
aboveTrailingDelta (int) – See Trailing Stop order FAQ
aboveTimeInForce (str) – Required if aboveType is STOP_LOSS_LIMIT or TAKE_PROFIT_LIMIT
aboveStrategyId (int) – Arbitrary numeric value identifying the above order within an order strategy
aboveStrategyType (int) – Arbitrary numeric value identifying the above order strategy (>= 1000000)
belowType (str) – required - STOP_LOSS, STOP_LOSS_LIMIT, TAKE_PROFIT, TAKE_PROFIT_LIMIT
belowClientOrderId (str) – Arbitrary unique ID among open orders for the below order
belowIcebergQty (decimal) – Note that this can only be used if belowTimeInForce is GTC
belowPrice (decimal) – Can be used if belowType is STOP_LOSS_LIMIT, LIMIT_MAKER, or TAKE_PROFIT_LIMIT
belowStopPrice (decimal) – Can be used if belowType is STOP_LOSS, STOP_LOSS_LIMIT, TAKE_PROFIT or TAKE_PROFIT_LIMIT
belowTrailingDelta (int) – See Trailing Stop order FAQ
belowTimeInForce (str) – Required if belowType is STOP_LOSS_LIMIT or TAKE_PROFIT_LIMIT
belowStrategyId (int) – Arbitrary numeric value identifying the below order within an order strategy
belowStrategyType (int) – Arbitrary numeric value identifying the below order strategy (>= 1000000)
newOrderRespType (str) – Select response format: ACK, RESULT, FULL
selfTradePreventionMode (str) – The allowed enums is dependent on what is configured on the symbol
recvWindow (int) – The value cannot be greater than 60000
timestamp (int) – required
- Returns:
API response
- {
“orderListId”: 1, “contingencyType”: “OCO”, “listStatusType”: “EXEC_STARTED”, “listOrderStatus”: “EXECUTING”, “listClientOrderId”: “lH1YDkuQKWiXVXHPSKYEIp”, “transactionTime”: 1710485608839, “symbol”: “LTCBTC”, “orders”: [
- {
“symbol”: “LTCBTC”, “orderId”: 10, “clientOrderId”: “44nZvqpemY7sVYgPYbvPih”
}, {
”symbol”: “LTCBTC”, “orderId”: 11, “clientOrderId”: “NuMp0nVYnciDiFmVqfpBqK”
}
], “orderReports”: [
- {
“symbol”: “LTCBTC”, “orderId”: 10, “orderListId”: 1, “clientOrderId”: “44nZvqpemY7sVYgPYbvPih”, “transactTime”: 1710485608839, “price”: “1.00000000”, “origQty”: “5.00000000”, “executedQty”: “0.00000000”, “origQuoteOrderQty”: “0.000000”, “cummulativeQuoteQty”: “0.00000000”, “status”: “NEW”, “timeInForce”: “GTC”, “type”: “STOP_LOSS_LIMIT”, “side”: “SELL”, “stopPrice”: “1.00000000”, “workingTime”: -1, “icebergQty”: “1.00000000”, “selfTradePreventionMode”: “NONE”
}, {
”symbol”: “LTCBTC”, “orderId”: 11, “orderListId”: 1, “clientOrderId”: “NuMp0nVYnciDiFmVqfpBqK”, “transactTime”: 1710485608839, “price”: “3.00000000”, “origQty”: “5.00000000”, “executedQty”: “0.00000000”, “origQuoteOrderQty”: “0.000000”, “cummulativeQuoteQty”: “0.00000000”, “status”: “NEW”, “timeInForce”: “GTC”, “type”: “LIMIT_MAKER”, “side”: “SELL”, “workingTime”: 1710485608839, “selfTradePreventionMode”: “NONE”
}
]
}
- Raises:
BinanceRequestException, BinanceAPIException, BinanceOrderException, BinanceOrderMinAmountException, BinanceOrderMinPriceException, BinanceOrderMinTotalException, BinanceOrderUnknownSymbolException, BinanceOrderInactiveSymbolException
- create_order(**params)[source]
Send in a new order
Any order with an icebergQty MUST have timeInForce set to GTC.
https://developers.binance.com/docs/binance-spot-api-docs/rest-api/trading-endpoints#new-order-trade
- Parameters:
symbol (str) – required
side (str) – required
type (str) – required
timeInForce (str) – required if limit order
quantity (decimal) – required
quoteOrderQty (decimal) – amount the user wants to spend (when buying) or receive (when selling) of the quote asset, applicable to MARKET orders
price (str) – required
newClientOrderId (str) – A unique id for the order. Automatically generated if not sent.
icebergQty (decimal) – Used with LIMIT, STOP_LOSS_LIMIT, and TAKE_PROFIT_LIMIT to create an iceberg order.
newOrderRespType (str) – Set the response JSON. ACK, RESULT, or FULL; default: RESULT.
recvWindow (int) – the number of milliseconds the request is valid for
- Returns:
API response
Response ACK:
{ "symbol":"LTCBTC", "orderId": 1, "clientOrderId": "myOrder1" # Will be newClientOrderId "transactTime": 1499827319559 }
Response RESULT:
{ "symbol": "BTCUSDT", "orderId": 28, "clientOrderId": "6gCrw2kRUAF9CvJDGP16IP", "transactTime": 1507725176595, "price": "0.00000000", "origQty": "10.00000000", "executedQty": "10.00000000", "cummulativeQuoteQty": "10.00000000", "status": "FILLED", "timeInForce": "GTC", "type": "MARKET", "side": "SELL" }
Response FULL:
{ "symbol": "BTCUSDT", "orderId": 28, "clientOrderId": "6gCrw2kRUAF9CvJDGP16IP", "transactTime": 1507725176595, "price": "0.00000000", "origQty": "10.00000000", "executedQty": "10.00000000", "cummulativeQuoteQty": "10.00000000", "status": "FILLED", "timeInForce": "GTC", "type": "MARKET", "side": "SELL", "fills": [ { "price": "4000.00000000", "qty": "1.00000000", "commission": "4.00000000", "commissionAsset": "USDT" }, { "price": "3999.00000000", "qty": "5.00000000", "commission": "19.99500000", "commissionAsset": "USDT" }, { "price": "3998.00000000", "qty": "2.00000000", "commission": "7.99600000", "commissionAsset": "USDT" }, { "price": "3997.00000000", "qty": "1.00000000", "commission": "3.99700000", "commissionAsset": "USDT" }, { "price": "3995.00000000", "qty": "1.00000000", "commission": "3.99500000", "commissionAsset": "USDT" } ] }
- Raises:
BinanceRequestException, BinanceAPIException, BinanceOrderException, BinanceOrderMinAmountException, BinanceOrderMinPriceException, BinanceOrderMinTotalException, BinanceOrderUnknownSymbolException, BinanceOrderInactiveSymbolException
- create_sub_account_futures_transfer(**params)[source]
Execute sub-account Futures transfer
https://developers.binance.com/docs/sub_account/asset-management/Sub-account-Futures-Asset-Transfer
- Parameters:
fromEmail (str) – required - Sender email
toEmail (str) – required - Recipient email
futuresType (int) – required
asset (str) – required
amount (decimal) – required
recvWindow (int) – optional
- Returns:
API response
{ "success":true, "txnId":"2934662589" }
- Raises:
BinanceRequestException, BinanceAPIException
- create_test_order(**params)[source]
Test new order creation and signature/recvWindow long. Creates and validates a new order but does not send it into the matching engine.
- Parameters:
symbol (str) – required
side (str) – required
type (str) – required
timeInForce (str) – required if limit order
quantity (decimal) – required
price (str) – required
newClientOrderId (str) – A unique id for the order. Automatically generated if not sent.
icebergQty (decimal) – Used with iceberg orders
newOrderRespType (str) – Set the response JSON. ACK, RESULT, or FULL; default: RESULT.
recvWindow (int) – The number of milliseconds the request is valid for
- Returns:
API response
{}- Raises:
BinanceRequestException, BinanceAPIException, BinanceOrderException, BinanceOrderMinAmountException, BinanceOrderMinPriceException, BinanceOrderMinTotalException, BinanceOrderUnknownSymbolException, BinanceOrderInactiveSymbolException
- disable_fast_withdraw_switch(**params)[source]
Disable Fast Withdraw Switch
https://binance-docs.github.io/apidocs/spot/en/#disable-fast-withdraw-switch-user_data
- Parameters:
recvWindow (int) – optional
- Returns:
API response
- Raises:
BinanceRequestException, BinanceAPIException
- disable_isolated_margin_account(**params)[source]
Disable isolated margin account for a specific symbol. Each trading pair can only be deactivated once every 24 hours.
https://developers.binance.com/docs/margin_trading/account/Disable-Isolated-Margin-Account
- Parameters:
symbol
- Returns:
API response
{ "success": true, "symbol": "BTCUSDT" }
- enable_fast_withdraw_switch(**params)[source]
Enable Fast Withdraw Switch
https://binance-docs.github.io/apidocs/spot/en/#enable-fast-withdraw-switch-user_data
- Parameters:
recvWindow (int) – optional
- Returns:
API response
- Raises:
BinanceRequestException, BinanceAPIException
- enable_isolated_margin_account(**params)[source]
Enable isolated margin account for a specific symbol.
https://developers.binance.com/docs/margin_trading/account/Enable-Isolated-Margin-Account
- Parameters:
symbol
- Returns:
API response
{ "success": true, "symbol": "BTCUSDT" }
- enable_subaccount_futures(**params)[source]
Enable Futures for Sub-account (For Master Account)
https://developers.binance.com/docs/sub_account/account-management/Enable-Futures-for-Sub-account
- Parameters:
email (str) – required - Sub account email
recvWindow (int) – optional
- Returns:
API response
{ "email":"123@test.com", "isFuturesEnabled": true // true or false }
- Raises:
BinanceRequestException, BinanceAPIException
- enable_subaccount_margin(**params)[source]
Enable Margin for Sub-account (For Master Account)
https://binance-docs.github.io/apidocs/spot/en/#enable-margin-for-sub-account-for-master-account
- Parameters:
email (str) – required - Sub account email
recvWindow (int) – optional
- Returns:
API response
{ "email":"123@test.com", "isMarginEnabled": true }
- Raises:
BinanceRequestException, BinanceAPIException
- exchange_small_liability_assets(**params)[source]
Cross Margin Small Liability Exchange
https://developers.binance.com/docs/margin_trading/trade/Small-Liability-Exchange
- Parameters:
assetNames (array) – The assets list of small liability exchange
- Returns:
API response
none
- funding_wallet(**params)[source]
Query Funding Wallet
https://developers.binance.com/docs/wallet/asset/funding-wallet
- futures_account_config(**params)[source]
Get futures account configuration https://developers.binance.com/docs/derivatives/usds-margined-futures/account/rest-api/Account-Config
- futures_account_transfer(**params)[source]
Execute transfer between spot account and futures account.
https://binance-docs.github.io/apidocs/futures/en/#new-future-account-transfer
- futures_aggregate_trades(**params)[source]
Get compressed, aggregate trades. Trades that fill at the time, from the same order, with the same price will have the quantity aggregated.
- futures_api_trading_status(**params)[source]
Get quantitative trading rules for order placement, such as Unfilled Ratio (UFR), Good-Til-Canceled Ratio (GCR), Immediate-or-Cancel (IOC) & Fill-or-Kill (FOK) Expire Ratio (IFER), among others. https://www.binance.com/en/support/faq/binance-futures-trading-quantitative-rules-4f462ebe6ff445d4a170be7d9e897272
- Parameters:
symbol (str) – optional
- Returns:
API response
{ "indicators": { // indicator: quantitative rules indicators, value: user's indicators value, triggerValue: trigger indicator value threshold of quantitative rules. "BTCUSDT": [ { "isLocked": true, "plannedRecoverTime": 1545741270000, "indicator": "UFR", // Unfilled Ratio (UFR) "value": 0.05, // Current value "triggerValue": 0.995 // Trigger value }, { "isLocked": true, "plannedRecoverTime": 1545741270000, "indicator": "IFER", // IOC/FOK Expiration Ratio (IFER) "value": 0.99, // Current value "triggerValue": 0.99 // Trigger value }, { "isLocked": true, "plannedRecoverTime": 1545741270000, "indicator": "GCR", // GTC Cancellation Ratio (GCR) "value": 0.99, // Current value "triggerValue": 0.99 // Trigger value }, { "isLocked": true, "plannedRecoverTime": 1545741270000, "indicator": "DR", // Dust Ratio (DR) "value": 0.99, // Current value "triggerValue": 0.99 // Trigger value } ], "ETHUSDT": [ { "isLocked": true, "plannedRecoverTime": 1545741270000, "indicator": "UFR", "value": 0.05, "triggerValue": 0.995 }, { "isLocked": true, "plannedRecoverTime": 1545741270000, "indicator": "IFER", "value": 0.99, "triggerValue": 0.99 }, { "isLocked": true, "plannedRecoverTime": 1545741270000, "indicator": "GCR", "value": 0.99, "triggerValue": 0.99 } { "isLocked": true, "plannedRecoverTime": 1545741270000, "indicator": "DR", "value": 0.99, "triggerValue": 0.99 } ] }, "updateTime": 1545741270000 }
- Raises:
BinanceRequestException, BinanceAPIException
- futures_basis(**params)[source]
Get future basis of a specific symbol
https://developers.binance.com/docs/derivatives/usds-margined-futures/market-data/rest-api/Basis
- futures_cancel_algo_order(**params)[source]
Cancel an active algo order.
- Parameters:
symbol (str) – required
algoId (int) – optional - Either algoId or clientAlgoId must be sent
clientAlgoId (str) – optional - Either algoId or clientAlgoId must be sent
recvWindow (int) – optional - the number of milliseconds the request is valid for
- Returns:
API response
- futures_cancel_all_algo_open_orders(**params)[source]
Cancel all open algo orders
- Parameters:
symbol (str) – required
recvWindow (int) – optional - the number of milliseconds the request is valid for
- Returns:
API response
- futures_cancel_all_open_orders(**params)[source]
Cancel all open futures orders
- Parameters:
conditional (bool) – optional - Set to True to cancel algo/conditional orders
- futures_cancel_order(**params)[source]
Cancel an active futures order.
https://developers.binance.com/docs/derivatives/usds-margined-futures/trade/rest-api/Cancel-Order
- Parameters:
conditional (bool) – optional - Set to True to cancel algo/conditional order
algoId (int) – optional - Algo order ID (for conditional orders)
clientAlgoId (str) – optional - Client algo order ID (for conditional orders)
- futures_change_multi_assets_mode(multiAssetsMargin: bool)[source]
Change user’s Multi-Assets mode (Multi-Assets Mode or Single-Asset Mode) on Every symbol
- futures_coin_account_order_history_download(**params)[source]
Get Download Id For Futures Order History
- Parameters:
startTime (int) – required - Start timestamp in ms
endTime (int) – required - End timestamp in ms
recvWindow (int) – optional
- Returns:
API response
{ "avgCostTimestampOfLast30d": 7241837, # Average time taken for data download in the past 30 days "downloadId": "546975389218332672" }
- Note:
Request Limitation is 10 times per month, shared by front end download page and rest api
The time between startTime and endTime can not be longer than 1 year
- Raises:
BinanceRequestException, BinanceAPIException
- futures_coin_account_trade_history_download(**params)[source]
Get Download Id For Futures Trade History (USER_DATA)
- Parameters:
startTime (int) – required - Start timestamp in ms
endTime (int) – required - End timestamp in ms
- Returns:
API response
{ "avgCostTimestampOfLast30d": 7241837, # Average time taken for data download in the past 30 days "downloadId": "546975389218332672" }
- Note:
Request Limitation is 5 times per month, shared by front end download page and rest api
The time between startTime and endTime can not be longer than 1 year
- Raises:
BinanceRequestException, BinanceAPIException
- futures_coin_account_trade_history_download_link(**params)[source]
Get futures trade download link by Id
- Parameters:
downloadId (str) – required - Download ID obtained from futures_coin_trade_download_id
- Returns:
API response
{ "downloadId": "545923594199212032", "status": "completed", # Enum:completed,processing "url": "www.binance.com", # The link is mapped to download id "notified": true, # ignore "expirationTimestamp": 1645009771000, # The link would expire after this timestamp "isExpired": null } # OR (Response when server is processing) { "downloadId": "545923594199212032", "status": "processing", "url": "", "notified": false, "expirationTimestamp": -1, "isExpired": null }
- Note:
Download link expiration: 24h
- Raises:
BinanceRequestException, BinanceAPIException
- futures_coin_accout_order_history_download_link(**params)[source]
Get futures order history download link by Id
- Parameters:
downloadId (str) – required - Download ID obtained from futures_coin_download_id
recvWindow (int) – optional
- Returns:
API response
{ "downloadId": "545923594199212032", "status": "completed", # Enum:completed,processing "url": "www.binance.com", # The link is mapped to download id "notified": true, # ignore "expirationTimestamp": 1645009771000, # The link would expire after this timestamp "isExpired": null } # OR (Response when server is processing) { "downloadId": "545923594199212032", "status": "processing", "url": "", "notified": false, "expirationTimestamp": -1, "isExpired": null }
- Note:
Download link expiration: 24h
- Raises:
BinanceRequestException, BinanceAPIException
- futures_coin_aggregate_trades(**params)[source]
Get compressed, aggregate trades. Trades that fill at the time, from the same order, with the same price will have the quantity aggregated.
- futures_coin_basis(**params)[source]
Get future basis of a specific symbol
https://developers.binance.com/docs/derivatives/coin-margined-futures/market-data/rest-api/Basis
- futures_coin_cancel_order(**params)[source]
Cancel an active futures order.
https://developers.binance.com/docs/derivatives/coin-margined-futures/trade/rest-api/Cancel-Order
- futures_coin_change_leverage(**params)[source]
Change user’s initial leverage of specific symbol market
- futures_coin_change_position_mode(**params)[source]
Change user’s position mode (Hedge Mode or One-way Mode ) on EVERY symbol
- futures_coin_continous_klines(**params)[source]
Kline/candlestick bars for a specific contract type. Klines are uniquely identified by their open time.
- futures_coin_countdown_cancel_all(**params)[source]
Cancel all open orders of the specified symbol at the end of the specified countdown.
- Parameters:
symbol (str) – required
countdownTime (int) – required
recvWindow (int) – optional - the number of milliseconds the request is valid for
- Returns:
API response
- {
“symbol”: “BTCUSDT”, “countdownTime”: “100000”
}
- futures_coin_create_order(**params)[source]
Send in a new order.
https://developers.binance.com/docs/derivatives/coin-margined-futures/trade/rest-api
- futures_coin_get_all_orders(**params)[source]
Get all futures account orders; active, canceled, or filled.
https://developers.binance.com/docs/derivatives/coin-margined-futures/trade/rest-api/All-Orders
- futures_coin_get_order(**params)[source]
Check an order’s status.
https://developers.binance.com/docs/derivatives/coin-margined-futures/trade/rest-api/Query-Order
- futures_coin_get_position_mode(**params)[source]
Get user’s position mode (Hedge Mode or One-way Mode ) on EVERY symbol
- futures_coin_global_longshort_ratio(**params)[source]
Get present long to short ratio for top positions of a specific symbol.
- futures_coin_index_price_klines(**params)[source]
Kline/candlestick bars for the index price of a pair..
- futures_coin_klines(**params)[source]
Kline/candlestick bars for a symbol. Klines are uniquely identified by their open time.
- futures_coin_mark_price_klines(**params)[source]
Kline/candlestick bars for the index price of a pair..
- futures_coin_modify_order(**params)[source]
Modify an existing order. Currently only LIMIT order modification is supported.
https://developers.binance.com/docs/derivatives/coin-margined-futures/trade/rest-api/Modify-Order
- futures_coin_open_interest_hist(**params)[source]
Get open interest statistics of a specific symbol.
- futures_coin_orderbook_ticker(**params)[source]
Best price/qty on the order book for a symbol or symbols.
- futures_coin_ping()[source]
Test connectivity to the Rest API
https://developers.binance.com/docs/derivatives/coin-margined-futures/market-data/rest-api
- futures_coin_place_batch_order(**params)[source]
Send in new orders.
To avoid modifying the existing signature generation and parameter order logic, the url encoding is done on the special query param, batchOrders, in the early stage.
Kline/candlestick bars for the index price of a pair..
- futures_coin_taker_buy_sell_volume(**params)[source]
Get present long to short ratio for top positions of a specific symbol.
- futures_coin_top_longshort_account_ratio(**params)[source]
Get present long to short ratio for top positions of a specific symbol.
- futures_coin_top_longshort_position_ratio(**params)[source]
Get present long to short ratio for top positions of a specific symbol.
- futures_coin_v1_get_adl_quantile(**params)[source]
Placeholder function for GET /dapi/v1/adlQuantile. Note: This function was auto-generated. Any issue please open an issue on GitHub.
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- futures_coin_v1_get_commission_rate(**params)[source]
Placeholder function for GET /dapi/v1/commissionRate. Note: This function was auto-generated. Any issue please open an issue on GitHub.
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- futures_coin_v1_get_funding_info(**params)[source]
Placeholder function for GET /dapi/v1/fundingInfo. Note: This function was auto-generated. Any issue please open an issue on GitHub.
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- futures_coin_v1_get_income_asyn(**params)[source]
Placeholder function for GET /dapi/v1/income/asyn. Note: This function was auto-generated. Any issue please open an issue on GitHub.
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- futures_coin_v1_get_income_asyn_id(**params)[source]
Placeholder function for GET /dapi/v1/income/asyn/id. Note: This function was auto-generated. Any issue please open an issue on GitHub.
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- futures_coin_v1_get_order_amendment(**params)[source]
Placeholder function for GET /dapi/v1/orderAmendment. Note: This function was auto-generated. Any issue please open an issue on GitHub.
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- futures_coin_v1_get_pm_account_info(**params)[source]
Placeholder function for GET /dapi/v1/pmAccountInfo. Note: This function was auto-generated. Any issue please open an issue on GitHub.
https://developers.binance.com/docs/derivatives/coin-margined-futures/portfolio-margin-endpoints
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- futures_coin_v1_put_batch_orders(**params)[source]
Placeholder function for PUT /dapi/v1/batchOrders. Note: This function was auto-generated. Any issue please open an issue on GitHub.
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- futures_coin_v1_put_order(**params)[source]
Placeholder function for PUT /dapi/v1/order. Note: This function was auto-generated. Any issue please open an issue on GitHub.
https://developers.binance.com/docs/derivatives/coin-margined-futures/trade/rest-api/Modify-Order
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- futures_commission_rate(**params)[source]
Get Futures commission rate
- Parameters:
symbol (str) – required
- Returns:
API response
{ "symbol": "BTCUSDT", "makerCommissionRate": "0.0002", // 0.02% "takerCommissionRate": "0.0004" // 0.04% }
- Raises:
BinanceRequestException, BinanceAPIException
- futures_continuous_klines(**params)[source]
Kline/candlestick bars for a specific contract type. Klines are uniquely identified by their open time.
- futures_countdown_cancel_all(**params)[source]
Cancel all open orders of the specified symbol at the end of the specified countdown.
- Parameters:
symbol (str) – required
countdownTime (int) – required
recvWindow (int) – optional - the number of milliseconds the request is valid for
- Returns:
API response
- {
“symbol”: “BTCUSDT”, “countdownTime”: “100000”
}
- futures_create_algo_order(**params)[source]
Send in a new algo order (conditional order).
https://developers.binance.com/docs/derivatives/usds-margined-futures/trade/rest-api/New-Algo-Order
- Parameters:
algoType (str) – required - Only support CONDITIONAL
symbol (str) – required
side (str) – required - BUY or SELL
positionSide (str) – optional - Default BOTH for One-way Mode; LONG or SHORT for Hedge Mode
type (str) – required - STOP_MARKET/TAKE_PROFIT_MARKET/STOP/TAKE_PROFIT/TRAILING_STOP_MARKET
timeInForce (str) – optional - IOC or GTC or FOK or GTX, default GTC
quantity (decimal) – optional - Cannot be sent with closePosition=true
price (decimal) – optional
triggerPrice (decimal) – optional - Used with STOP, STOP_MARKET, TAKE_PROFIT, TAKE_PROFIT_MARKET
workingType (str) – optional - triggerPrice triggered by: MARK_PRICE, CONTRACT_PRICE. Default CONTRACT_PRICE
priceMatch (str) – optional - only available for LIMIT/STOP/TAKE_PROFIT order
closePosition (str) – optional - true, false; Close-All, used with STOP_MARKET or TAKE_PROFIT_MARKET
priceProtect (str) – optional - “TRUE” or “FALSE”, default “FALSE”
reduceOnly (str) – optional - “true” or “false”, default “false”
activatePrice (decimal) – optional - Used with TRAILING_STOP_MARKET orders
callbackRate (decimal) – optional - Used with TRAILING_STOP_MARKET orders, min 0.1, max 10
clientAlgoId (str) – optional - A unique id among open orders
newOrderRespType (str) – optional - “ACK”, “RESULT”, default “ACK”
selfTradePreventionMode (str) – optional - EXPIRE_TAKER, EXPIRE_MAKER, EXPIRE_BOTH, default NONE
goodTillDate (long) – optional - order cancel time for timeInForce GTD
recvWindow (int) – optional - the number of milliseconds the request is valid for
- Returns:
API response
result = client.futures_create_algo_order( algoType='CONDITIONAL', symbol='BNBUSDT', side='SELL', type='TAKE_PROFIT', quantity='0.01', price='750.000', triggerPrice='750.000', timeInForce='GTC' )
- futures_create_order(**params)[source]
Send in a new order.
https://developers.binance.com/docs/derivatives/usds-margined-futures/trade/rest-api
Note: After 2025-12-09, conditional order types (STOP, STOP_MARKET, TAKE_PROFIT, TAKE_PROFIT_MARKET, TRAILING_STOP_MARKET) are automatically routed to the algo order endpoint.
- futures_create_test_order(**params)[source]
Testing order request, this order will not be submitted to matching engine
https://developers.binance.com/docs/derivatives/usds-margined-futures/trade/rest-api/New-Order-Test
- futures_get_algo_order(**params)[source]
Check an algo order’s status.
- Parameters:
symbol (str) – required
algoId (int) – optional - Either algoId or clientAlgoId must be sent
clientAlgoId (str) – optional - Either algoId or clientAlgoId must be sent
recvWindow (int) – optional - the number of milliseconds the request is valid for
- Returns:
API response
- futures_get_all_algo_orders(**params)[source]
Get all algo account orders; active, canceled, or filled.
- Parameters:
symbol (str) – required
startTime (int) – optional
endTime (int) – optional
limit (int) – optional - Default 100; max 100
recvWindow (int) – optional - the number of milliseconds the request is valid for
- Returns:
API response
- futures_get_all_orders(**params)[source]
Get all futures account orders; active, canceled, or filled.
https://developers.binance.com/docs/derivatives/usds-margined-futures/trade/rest-api/All-Orders
- Parameters:
conditional (bool) – optional - Set to True to query algo/conditional orders
- futures_get_multi_assets_mode()[source]
Get user’s Multi-Assets mode (Multi-Assets Mode or Single-Asset Mode) on Every symbol
https://binance-docs.github.io/apidocs/futures/en/#get-current-multi-assets-mode-user_data
- futures_get_open_algo_orders(**params)[source]
Get all open algo orders on a symbol.
- Parameters:
symbol (str) – optional
recvWindow (int) – optional - the number of milliseconds the request is valid for
- Returns:
API response
- futures_get_open_orders(**params)[source]
Get all open orders on a symbol.
- Parameters:
conditional (bool) – optional - Set to True to query algo/conditional orders
- futures_get_order(**params)[source]
Check an order’s status.
https://developers.binance.com/docs/derivatives/usds-margined-futures/trade/rest-api/Query-Order
- Parameters:
conditional (bool) – optional - Set to True to query algo/conditional order
algoId (int) – optional - Algo order ID (for conditional orders)
clientAlgoId (str) – optional - Client algo order ID (for conditional orders)
- futures_get_position_mode(**params)[source]
Get position mode for authenticated account
https://binance-docs.github.io/apidocs/futures/en/#get-current-position-mode-user_data
- futures_global_longshort_ratio(**params)[source]
Get present global long to short ratio of a specific symbol.
- futures_historical_data_link(**params)[source]
Get Future TickLevel Orderbook Historical Data Download Link.
https://developers.binance.com/docs/derivatives/futures-data/market-data
- Parameters:
symbol (str) – STRING - Required - Symbol name, e.g. BTCUSDT or BTCUSD_PERP
dataType (str) – ENUM - Required - Data type: - T_DEPTH for ticklevel orderbook data - S_DEPTH for orderbook snapshot data
startTime (int) – LONG - Required - Start time in milliseconds
endTime (int) – LONG - Required - End time in milliseconds
recvWindow (int) – LONG - Optional - Number of milliseconds after timestamp the request is valid for
timestamp (int) – LONG - Required - Current timestamp in milliseconds
- Returns:
API response
{ "data": [ { "day": "2023-06-30", "url": "" } ] }
- Raises:
BinanceRequestException, BinanceAPIException
- Notes:
The span between startTime and endTime can’t be more than 7 days
The download link will be valid for 1 day
Only VIP users can query this endpoint
Weight: 200
- futures_historical_klines(symbol: str, interval: str, start_str, end_str=None, limit=None)[source]
Get historical futures klines from Binance
- Parameters:
symbol (str) – Name of symbol pair e.g. BNBBTC
interval (str) – Binance Kline interval
start_str (str|int) – Start date string in UTC format or timestamp in milliseconds
end_str (str|int) – optional - end date string in UTC format or timestamp in milliseconds (default will fetch everything up to now)
limit (int) – Default None (fetches full range in batches of max 1000 per request). To limit the number of rows, pass an integer.
- Returns:
list of OHLCV values (Open time, Open, High, Low, Close, Volume, Close time, Quote asset volume, Number of trades, Taker buy base asset volume, Taker buy quote asset volume, Ignore)
- futures_historical_klines_generator(symbol, interval, start_str, end_str=None)[source]
Get historical futures klines generator from Binance
- Parameters:
symbol (str) – Name of symbol pair e.g. BNBBTC
interval (str) – Binance Kline interval
start_str (str|int) – Start date string in UTC format or timestamp in milliseconds
end_str (str|int) – optional - end date string in UTC format or timestamp in milliseconds (default will fetch everything up to now)
- Returns:
generator of OHLCV values
- futures_historical_mark_price_klines(symbol: str, interval: str, start_str, end_str=None, limit=None)[source]
Get historical futures mark price klines from Binance
- Parameters:
symbol (str) – Name of symbol pair e.g. BNBBTC
interval (str) – Binance Kline interval
start_str (str|int) – Start date string in UTC format or timestamp in milliseconds
end_str (str|int) – optional - end date string in UTC format or timestamp in milliseconds (default will fetch everything up to now)
limit (int) – Default None (fetches full range in batches of max 1000 per request). To limit the number of rows, pass an integer.
- Returns:
list of OHLCV values (Open time, Open, High, Low, Close, Volume, Close time, Quote asset volume, Number of trades, Taker buy base asset volume, Taker buy quote asset volume, Ignore)
- futures_index_price_klines(**params)[source]
Kline/candlestick bars for the index price of a symbol. Klines are uniquely identified by their open time.
- futures_klines(**params)[source]
Kline/candlestick bars for a symbol. Klines are uniquely identified by their open time.
- futures_limit_buy_order(**params)[source]
Send in a new futures limit buy order.
https://developers.binance.com/docs/derivatives/usds-margined-futures/trade/rest-api
- futures_limit_order(**params)[source]
Send in a new futures limit order.
https://developers.binance.com/docs/derivatives/usds-margined-futures/trade/rest-api
- futures_limit_sell_order(**params)[source]
Send in a new futures limit sell order.
https://developers.binance.com/docs/derivatives/usds-margined-futures/trade/rest-api
- futures_mark_price_klines(**params)[source]
Kline/candlestick bars for the mark price of a symbol. Klines are uniquely identified by their open time.
- futures_market_buy_order(**params)[source]
Send in a new futures market buy order.
https://developers.binance.com/docs/derivatives/usds-margined-futures/trade/rest-api
- futures_market_order(**params)[source]
Send in a new futures market order.
https://developers.binance.com/docs/derivatives/usds-margined-futures/trade/rest-api
- futures_market_sell_order(**params)[source]
Send in a new futures market sell order.
https://developers.binance.com/docs/derivatives/usds-margined-futures/trade/rest-api
- futures_modify_order(**params)[source]
Modify an existing order. Currently only LIMIT order modification is supported.
https://developers.binance.com/docs/derivatives/usds-margined-futures/trade/rest-api/Modify-Order
- futures_orderbook_ticker(**params)[source]
Best price/qty on the order book for a symbol or symbols.
- futures_ping()[source]
Test connectivity to the Rest API
https://developers.binance.com/docs/derivatives/usds-margined-futures/market-data/rest-api
- futures_place_batch_order(**params)[source]
Send in new orders.
To avoid modifying the existing signature generation and parameter order logic, the url encoding is done on the special query param, batchOrders, in the early stage.
Premium index kline bars of a symbol.l. Klines are uniquely identified by their open time.
- futures_rpi_depth(**params)[source]
Get RPI Order Book with Retail Price Improvement orders
- Parameters:
symbol (str) – required
limit (int) – Default 1000; Valid limits:[1000]
- Returns:
API response
{ "lastUpdateId": 1027024, "E": 1589436922972, // Message output time "T": 1589436922959, // Transaction time "bids": [ [ "4.00000000", // PRICE "431.00000000" // QTY ] ], "asks": [ [ "4.00000200", "12.00000000" ] ] }
- Raises:
BinanceRequestException, BinanceAPIException
- futures_symbol_adl_risk(**params)[source]
Query the symbol-level ADL (Auto-Deleveraging) risk rating
The ADL risk rating measures the likelihood of ADL during liquidation. Rating can be: high, medium, low. Updated every 30 minutes.
- Parameters:
symbol (str) – optional - if not provided, returns ADL risk for all symbols
- Returns:
API response
# Single symbol { "symbol": "BTCUSDT", "adlRisk": "low", "updateTime": 1597370495002 } # All symbols (when symbol not provided) [ { "symbol": "BTCUSDT", "adlRisk": "low", "updateTime": 1597370495002 }, { "symbol": "ETHUSDT", "adlRisk": "high", "updateTime": 1597370495004 } ]
- Raises:
BinanceRequestException, BinanceAPIException
- futures_symbol_config(**params)[source]
Get current account symbol configuration https://developers.binance.com/docs/derivatives/usds-margined-futures/account/rest-api/Symbol-Config
- futures_taker_longshort_ratio(**params)[source]
Get taker buy to sell volume ratio of a specific symbol
- futures_top_longshort_account_ratio(**params)[source]
Get present long to short ratio for top accounts of a specific symbol.
- futures_top_longshort_position_ratio(**params)[source]
Get present long to short ratio for top positions of a specific symbol.
- futures_v1_delete_batch_order(**params)[source]
Placeholder function for DELETE /fapi/v1/batchOrder. Note: This function was auto-generated. Any issue please open an issue on GitHub.
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- futures_v1_get_asset_index(**params)[source]
Placeholder function for GET /fapi/v1/assetIndex. Note: This function was auto-generated. Any issue please open an issue on GitHub.
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- futures_v1_get_convert_exchange_info(**params)[source]
Placeholder function for GET /fapi/v1/convert/exchangeInfo. Note: This function was auto-generated. Any issue please open an issue on GitHub.
https://developers.binance.com/docs/derivatives/usds-margined-futures/convert
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- futures_v1_get_convert_order_status(**params)[source]
Placeholder function for GET /fapi/v1/convert/orderStatus. Note: This function was auto-generated. Any issue please open an issue on GitHub.
https://developers.binance.com/docs/derivatives/usds-margined-futures/convert/Order-Status
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- futures_v1_get_fee_burn(**params)[source]
Placeholder function for GET /fapi/v1/feeBurn. Note: This function was auto-generated. Any issue please open an issue on GitHub.
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- futures_v1_get_funding_info(**params)[source]
Placeholder function for GET /fapi/v1/fundingInfo. Note: This function was auto-generated. Any issue please open an issue on GitHub.
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- futures_v1_get_income_asyn(**params)[source]
Placeholder function for GET /fapi/v1/income/asyn. Note: This function was auto-generated. Any issue please open an issue on GitHub.
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- futures_v1_get_income_asyn_id(**params)[source]
Placeholder function for GET /fapi/v1/income/asyn/id. Note: This function was auto-generated. Any issue please open an issue on GitHub.
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- futures_v1_get_open_order(**params)[source]
Placeholder function for GET /fapi/v1/openOrder. Note: This function was auto-generated. Any issue please open an issue on GitHub.
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- futures_v1_get_order_amendment(**params)[source]
Placeholder function for GET /fapi/v1/orderAmendment. Note: This function was auto-generated. Any issue please open an issue on GitHub.
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- futures_v1_get_order_asyn(**params)[source]
Placeholder function for GET /fapi/v1/order/asyn. Note: This function was auto-generated. Any issue please open an issue on GitHub.
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- futures_v1_get_order_asyn_id(**params)[source]
Placeholder function for GET /fapi/v1/order/asyn/id. Note: This function was auto-generated. Any issue please open an issue on GitHub.
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- futures_v1_get_pm_account_info(**params)[source]
Placeholder function for GET /fapi/v1/pmAccountInfo. Note: This function was auto-generated. Any issue please open an issue on GitHub.
https://developers.binance.com/docs/derivatives/usds-margined-futures/portfolio-margin-endpoints
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- futures_v1_get_rate_limit_order(**params)[source]
Placeholder function for GET /fapi/v1/rateLimit/order. Note: This function was auto-generated. Any issue please open an issue on GitHub.
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- futures_v1_get_trade_asyn(**params)[source]
Placeholder function for GET /fapi/v1/trade/asyn. Note: This function was auto-generated. Any issue please open an issue on GitHub.
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- futures_v1_get_trade_asyn_id(**params)[source]
Placeholder function for GET /fapi/v1/trade/asyn/id. Note: This function was auto-generated. Any issue please open an issue on GitHub.
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- futures_v1_post_batch_order(**params)[source]
Placeholder function for POST /fapi/v1/batchOrder. Note: This function was auto-generated. Any issue please open an issue on GitHub.
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- futures_v1_post_convert_accept_quote(**params)[source]
Placeholder function for POST /fapi/v1/convert/acceptQuote. Note: This function was auto-generated. Any issue please open an issue on GitHub.
https://developers.binance.com/docs/derivatives/usds-margined-futures/convert/Accept-Quote
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- futures_v1_post_convert_get_quote(**params)[source]
Placeholder function for POST /fapi/v1/convert/getQuote. Note: This function was auto-generated. Any issue please open an issue on GitHub.
https://developers.binance.com/docs/derivatives/usds-margined-futures/convert/Send-quote-request
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- futures_v1_post_fee_burn(**params)[source]
Placeholder function for POST /fapi/v1/feeBurn. Note: This function was auto-generated. Any issue please open an issue on GitHub.
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- futures_v1_put_batch_order(**params)[source]
Placeholder function for PUT /fapi/v1/batchOrder. Note: This function was auto-generated. Any issue please open an issue on GitHub.
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- futures_v1_put_batch_orders(**params)[source]
Placeholder function for PUT /fapi/v1/batchOrders. Note: This function was auto-generated. Any issue please open an issue on GitHub.
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- get_account(**params)[source]
Get current account information.
- Parameters:
recvWindow (int) – the number of milliseconds the request is valid for
- Returns:
API response
{ "makerCommission": 15, "takerCommission": 15, "buyerCommission": 0, "sellerCommission": 0, "canTrade": true, "canWithdraw": true, "canDeposit": true, "balances": [ { "asset": "BTC", "free": "4723846.89208129", "locked": "0.00000000" }, { "asset": "LTC", "free": "4763368.68006011", "locked": "0.00000000" } ] }
- Raises:
BinanceRequestException, BinanceAPIException
- get_account_api_permissions(**params)[source]
Fetch api key permissions.
https://developers.binance.com/docs/wallet/account/api-key-permission
- Parameters:
recvWindow (int) – the number of milliseconds the request is valid for
- Returns:
API response
{ "ipRestrict": false, "createTime": 1623840271000, "enableWithdrawals": false, // This option allows you to withdraw via API. You must apply the IP Access Restriction filter in order to enable withdrawals "enableInternalTransfer": true, // This option authorizes this key to transfer funds between your master account and your sub account instantly "permitsUniversalTransfer": true, // Authorizes this key to be used for a dedicated universal transfer API to transfer multiple supported currencies. Each business's own transfer API rights are not affected by this authorization "enableVanillaOptions": false, // Authorizes this key to Vanilla options trading "enableReading": true, "enableFutures": false, // API Key created before your futures account opened does not support futures API service "enableMargin": false, // This option can be adjusted after the Cross Margin account transfer is completed "enableSpotAndMarginTrading": false, // Spot and margin trading "tradingAuthorityExpirationTime": 1628985600000 // Expiration time for spot and margin trading permission }
- get_account_api_trading_status(**params)[source]
Fetch account api trading status detail.
https://developers.binance.com/docs/wallet/account/account-api-trading-status
- Parameters:
recvWindow (int) – the number of milliseconds the request is valid for
- Returns:
API response
{ "data": { // API trading status detail "isLocked": false, // API trading function is locked or not "plannedRecoverTime": 0, // If API trading function is locked, this is the planned recover time "triggerCondition": { "GCR": 150, // Number of GTC orders "IFER": 150, // Number of FOK/IOC orders "UFR": 300 // Number of orders }, "indicators": { // The indicators updated every 30 seconds "BTCUSDT": [ // The symbol { "i": "UFR", // Unfilled Ratio (UFR) "c": 20, // Count of all orders "v": 0.05, // Current UFR value "t": 0.995 // Trigger UFR value }, { "i": "IFER", // IOC/FOK Expiration Ratio (IFER) "c": 20, // Count of FOK/IOC orders "v": 0.99, // Current IFER value "t": 0.99 // Trigger IFER value }, { "i": "GCR", // GTC Cancellation Ratio (GCR) "c": 20, // Count of GTC orders "v": 0.99, // Current GCR value "t": 0.99 // Trigger GCR value } ], "ETHUSDT": [ { "i": "UFR", "c": 20, "v": 0.05, "t": 0.995 }, { "i": "IFER", "c": 20, "v": 0.99, "t": 0.99 }, { "i": "GCR", "c": 20, "v": 0.99, "t": 0.99 } ] }, "updateTime": 1547630471725 } }
- get_account_snapshot(**params)[source]
Get daily account snapshot of specific type.
https://developers.binance.com/docs/wallet/account/daily-account-snapshoot
- Parameters:
type (string) – required. Valid values are SPOT/MARGIN/FUTURES.
startTime (int) – optional
endTime (int) – optional
limit (int) – optional
recvWindow (int) – optional
- Returns:
API response
{ "code":200, // 200 for success; others are error codes "msg":"", // error message "snapshotVos":[ { "data":{ "balances":[ { "asset":"BTC", "free":"0.09905021", "locked":"0.00000000" }, { "asset":"USDT", "free":"1.89109409", "locked":"0.00000000" } ], "totalAssetOfBtc":"0.09942700" }, "type":"spot", "updateTime":1576281599000 } ] }
OR
{ "code":200, // 200 for success; others are error codes "msg":"", // error message "snapshotVos":[ { "data":{ "marginLevel":"2748.02909813", "totalAssetOfBtc":"0.00274803", "totalLiabilityOfBtc":"0.00000100", "totalNetAssetOfBtc":"0.00274750", "userAssets":[ { "asset":"XRP", "borrowed":"0.00000000", "free":"1.00000000", "interest":"0.00000000", "locked":"0.00000000", "netAsset":"1.00000000" } ] }, "type":"margin", "updateTime":1576281599000 } ] }
OR
{ "code":200, // 200 for success; others are error codes "msg":"", // error message "snapshotVos":[ { "data":{ "assets":[ { "asset":"USDT", "marginBalance":"118.99782335", "walletBalance":"120.23811389" } ], "position":[ { "entryPrice":"7130.41000000", "markPrice":"7257.66239673", "positionAmt":"0.01000000", "symbol":"BTCUSDT", "unRealizedProfit":"1.24029054" } ] }, "type":"futures", "updateTime":1576281599000 } ] }
- Raises:
BinanceRequestException, BinanceAPIException
- get_account_status(version=1, **params)[source]
Get account status detail.
https://binance-docs.github.io/apidocs/spot/en/#account-status-sapi-user_data https://developers.binance.com/docs/wallet/account/account-status :param version: the api version :param version: int :param recvWindow: the number of milliseconds the request is valid for :type recvWindow: int
- Returns:
API response
{ "data": "Normal" }
- get_aggregate_trades(**params) Dict[source]
Get compressed, aggregate trades. Trades that fill at the time, from the same order, with the same price will have the quantity aggregated.
- Parameters:
symbol (str) – required
fromId (str) – ID to get aggregate trades from INCLUSIVE.
startTime (int) – Timestamp in ms to get aggregate trades from INCLUSIVE.
endTime (int) – Timestamp in ms to get aggregate trades until INCLUSIVE.
limit (int) – Default 500; max 1000.
- Returns:
API response
[ { "a": 26129, # Aggregate tradeId "p": "0.01633102", # Price "q": "4.70443515", # Quantity "f": 27781, # First tradeId "l": 27781, # Last tradeId "T": 1498793709153, # Timestamp "m": true, # Was the buyer the maker? "M": true # Was the trade the best price match? } ]
- Raises:
BinanceRequestException, BinanceAPIException
- get_all_coins_info(**params)[source]
Get information of coins (available for deposit and withdraw) for user.
https://developers.binance.com/docs/wallet/capital
- Parameters:
recvWindow (int) – optional
- Returns:
API response
{ "coin": "BTC", "depositAllEnable": true, "withdrawAllEnable": true, "name": "Bitcoin", "free": "0", "locked": "0", "freeze": "0", "withdrawing": "0", "ipoing": "0", "ipoable": "0", "storage": "0", "isLegalMoney": false, "trading": true, "networkList": [ { "network": "BNB", "coin": "BTC", "withdrawIntegerMultiple": "0.00000001", "isDefault": false, "depositEnable": true, "withdrawEnable": true, "depositDesc": "", "withdrawDesc": "", "specialTips": "Both a MEMO and an Address are required to successfully deposit your BEP2-BTCB tokens to Binance.", "name": "BEP2", "resetAddressStatus": false, "addressRegex": "^(bnb1)[0-9a-z]{38}$", "memoRegex": "^[0-9A-Za-z-_]{1,120}$", "withdrawFee": "0.0000026", "withdrawMin": "0.0000052", "withdrawMax": "0", "minConfirm": 1, "unLockConfirm": 0 }, { "network": "BTC", "coin": "BTC", "withdrawIntegerMultiple": "0.00000001", "isDefault": true, "depositEnable": true, "withdrawEnable": true, "depositDesc": "", "withdrawDesc": "", "specialTips": "", "name": "BTC", "resetAddressStatus": false, "addressRegex": "^[13][a-km-zA-HJ-NP-Z1-9]{25,34}$|^(bc1)[0-9A-Za-z]{39,59}$", "memoRegex": "", "withdrawFee": "0.0005", "withdrawMin": "0.001", "withdrawMax": "0", "minConfirm": 1, "unLockConfirm": 2 } ] }
- Raises:
BinanceRequestException, BinanceAPIException
- get_all_isolated_margin_symbols(**params)[source]
Query isolated margin symbol info for all pairs
https://developers.binance.com/docs/margin_trading/market-data/Get-All-Isolated-Margin-Symbol
pair_details = client.get_all_isolated_margin_symbols()
- Returns:
API response
[ { "base": "BNB", "isBuyAllowed": true, "isMarginTrade": true, "isSellAllowed": true, "quote": "BTC", "symbol": "BNBBTC" }, { "base": "TRX", "isBuyAllowed": true, "isMarginTrade": true, "isSellAllowed": true, "quote": "BTC", "symbol": "TRXBTC" } ]
- Raises:
BinanceRequestException, BinanceAPIException
- get_all_margin_orders(**params)[source]
Query all margin accounts orders
If orderId is set, it will get orders >= that orderId. Otherwise most recent orders are returned.
For some historical orders cummulativeQuoteQty will be < 0, meaning the data is not available at this time.
https://developers.binance.com/docs/margin_trading/trade/Query-Margin-Account-All-Orders
- Parameters:
symbol (str) – required
isIsolated (str) – set to ‘TRUE’ for isolated margin (default ‘FALSE’)
orderId (str) – optional
startTime (str) – optional
endTime (str) – optional
limit (int) – Default 500; max 1000
recvWindow (int) – the number of milliseconds the request is valid for
- Returns:
API response
- [
- {
“id”: 43123876, “price”: “0.00395740”, “qty”: “4.06000000”, “quoteQty”: “0.01606704”, “symbol”: “BNBBTC”, “time”: 1556089977693
}, {
”id”: 43123877, “price”: “0.00395740”, “qty”: “0.77000000”, “quoteQty”: “0.00304719”, “symbol”: “BNBBTC”, “time”: 1556089977693
}, {
”id”: 43253549, “price”: “0.00428930”, “qty”: “23.30000000”, “quoteQty”: “0.09994069”, “symbol”: “BNBBTC”, “time”: 1556163963504
}
]
- Raises:
BinanceRequestException, BinanceAPIException
- get_all_orders(**params)[source]
Get all account orders; active, canceled, or filled.
- Parameters:
symbol (str) – required
orderId (int) – The unique order id
startTime (int) – optional
endTime (int) – optional
limit (int) – Default 500; max 1000.
recvWindow (int) – the number of milliseconds the request is valid for
- Returns:
API response
[ { "symbol": "LTCBTC", "orderId": 1, "clientOrderId": "myOrder1", "price": "0.1", "origQty": "1.0", "executedQty": "0.0", "status": "NEW", "timeInForce": "GTC", "type": "LIMIT", "side": "BUY", "stopPrice": "0.0", "icebergQty": "0.0", "time": 1499827319559 } ]
- Raises:
BinanceRequestException, BinanceAPIException
- get_all_tickers() List[Dict[str, str]][source]
Latest price for all symbols.
- Returns:
List of market tickers
[ { "symbol": "LTCBTC", "price": "4.00000200" }, { "symbol": "ETHBTC", "price": "0.07946600" } ]
- Raises:
BinanceRequestException, BinanceAPIException
- get_allocations(**params)[source]
Retrieves allocations resulting from SOR order placement.
- Parameters:
symbol (str) – required
startTime (int) – optional
endTime (int) – optional
fromAllocationId (int) – optional
orderId (int) – optional
limit (int) – optional, Default: 500; Max: 1000
recvWindow (int) – the number of milliseconds the request is valid for
- Returns:
API response
- get_asset_balance(asset=None, **params)[source]
Get current asset balance.
- Parameters:
asset (str) – optional - the asset to get the balance of
recvWindow (int) – the number of milliseconds the request is valid for
- Returns:
dictionary or None if not found
{ "asset": "BTC", "free": "4723846.89208129", "locked": "0.00000000" }
- Raises:
BinanceRequestException, BinanceAPIException
- get_asset_details(**params)[source]
Fetch details on assets.
https://developers.binance.com/docs/wallet/asset
- Parameters:
asset (str) – optional
recvWindow (int) – the number of milliseconds the request is valid for
- Returns:
API response
{ "CTR": { "minWithdrawAmount": "70.00000000", //min withdraw amount "depositStatus": false,//deposit status (false if ALL of networks' are false) "withdrawFee": 35, // withdraw fee "withdrawStatus": true, //withdraw status (false if ALL of networks' are false) "depositTip": "Delisted, Deposit Suspended" //reason }, "SKY": { "minWithdrawAmount": "0.02000000", "depositStatus": true, "withdrawFee": 0.01, "withdrawStatus": true } }
- get_asset_dividend_history(**params)[source]
Query asset dividend record.
https://developers.binance.com/docs/wallet/asset/assets-divided-record
- Parameters:
asset (str) – optional
startTime (long) – optional
endTime (long) – optional
recvWindow (int) – the number of milliseconds the request is valid for
result = client.get_asset_dividend_history()
- Returns:
API response
{ "rows":[ { "amount":"10.00000000", "asset":"BHFT", "divTime":1563189166000, "enInfo":"BHFT distribution", "tranId":2968885920 }, { "amount":"10.00000000", "asset":"BHFT", "divTime":1563189165000, "enInfo":"BHFT distribution", "tranId":2968885920 } ], "total":2 }
- Raises:
BinanceRequestException, BinanceAPIException
- get_avg_price(**params)[source]
Current average price for a symbol.
- Parameters:
symbol (str)
- Returns:
API response
{ "mins": 5, "price": "9.35751834" }
- get_bnb_burn_spot_margin(**params)[source]
Get BNB Burn Status
https://developers.binance.com/docs/margin_trading/account/Get-BNB-Burn-Status
status = client.get_bnb_burn_spot_margin()
- Returns:
API response
{ "spotBNBBurn":true, "interestBNBBurn": false }
- Raises:
BinanceRequestException, BinanceAPIException
- get_c2c_trade_history(**params)[source]
Get C2C Trade History
https://binance-docs.github.io/apidocs/spot/en/#get-c2c-trade-history-user_data
- Parameters:
tradeType (str) – required - BUY, SELL
startTimestamp – optional
endTimestamp (int) – optional
page (int) – optional - default 1
rows (int) – optional - default 100, max 100
recvWindow (int) – optional
- Returns:
API response
- {
“code”: “000000”, “message”: “success”, “data”: [
- {
“orderNumber”:”20219644646554779648”, “advNo”: “11218246497340923904”, “tradeType”: “SELL”, “asset”: “BUSD”, “fiat”: “CNY”, “fiatSymbol”: “¥”, “amount”: “5000.00000000”, // Quantity (in Crypto) “totalPrice”: “33400.00000000”, “unitPrice”: “6.68”, // Unit Price (in Fiat) “orderStatus”: “COMPLETED”, // PENDING, TRADING, BUYER_PAYED, DISTRIBUTING, COMPLETED, IN_APPEAL, CANCELLED, CANCELLED_BY_SYSTEM “createTime”: 1619361369000, “commission”: “0”, // Transaction Fee (in Crypto) “counterPartNickName”: “ab***”, “advertisementRole”: “TAKER”
}
], “total”: 1, “success”: true
}
- get_convert_trade_history(**params)[source]
Get C2C Trade History
https://developers.binance.com/docs/convert/trade/Get-Convert-Trade-History
- Parameters:
startTime (int) – required - Start Time - 1593511200000
endTime (int) – required - End Time - 1593511200000
limit (int) – optional - default 100, max 100
recvWindow (int) – optional
- Returns:
API response
- get_cross_margin_collateral_ratio(**params)[source]
https://developers.binance.com/docs/margin_trading/market-data
:param none
- Returns:
API response
- get_cross_margin_data(**params)[source]
Query Cross Margin Fee Data (USER_DATA)
https://developers.binance.com/docs/margin_trading/account/Query-Cross-Margin-Fee-Data
- Parameters:
vipLevel (int) – User’s current specific margin data will be returned if vipLevel is omitted
:param coin :type coin: str :param recvWindow: the number of milliseconds the request is valid for :type recvWindow: int :returns: API response (example):
- [
- {
“vipLevel”: 0, “coin”: “BTC”, “transferIn”: true, “borrowable”: true, “dailyInterest”: “0.00026125”, “yearlyInterest”: “0.0953”, “borrowLimit”: “180”, “marginablePairs”: [
“BNBBTC”, “TRXBTC”, “ETHBTC”, “BTCUSDT”
]
}
]
- get_current_order_count(**params)[source]
Displays the user’s current order count usage for all intervals.
- Returns:
API response
- get_deposit_address(coin: str, network: str | None = None, **params)[source]
Fetch a deposit address for a symbol
https://developers.binance.com/docs/wallet/capital/deposite-address
- Parameters:
coin (str) – required
network (str) – optional
recvWindow (int) – the number of milliseconds the request is valid for
- Returns:
API response
{ "address": "1HPn8Rx2y6nNSfagQBKy27GB99Vbzg89wv", "coin": "BTC", "tag": "", "url": "https://btc.com/1HPn8Rx2y6nNSfagQBKy27GB99Vbzg89wv" }
- Raises:
BinanceRequestException, BinanceAPIException
- get_deposit_history(**params)[source]
Fetch deposit history.
https://developers.binance.com/docs/wallet/capital/deposite-history
- Parameters:
coin (str) – optional
startTime (long) – optional
endTime (long) – optional
offset (long) – optional - default:0
limit (long) – optional
recvWindow (int) – the number of milliseconds the request is valid for
- Returns:
API response
[ { "amount":"0.00999800", "coin":"PAXG", "network":"ETH", "status":1, "address":"0x788cabe9236ce061e5a892e1a59395a81fc8d62c", "addressTag":"", "txId":"0xaad4654a3234aa6118af9b4b335f5ae81c360b2394721c019b5d1e75328b09f3", "insertTime":1599621997000, "transferType":0, "confirmTimes":"12/12" }, { "amount":"0.50000000", "coin":"IOTA", "network":"IOTA", "status":1, "address":"SIZ9VLMHWATXKV99LH99CIGFJFUMLEHGWVZVNNZXRJJVWBPHYWPPBOSDORZ9EQSHCZAMPVAPGFYQAUUV9DROOXJLNW", "addressTag":"", "txId":"ESBFVQUTPIWQNJSPXFNHNYHSQNTGKRVKPRABQWTAXCDWOAKDKYWPTVG9BGXNVNKTLEJGESAVXIKIZ9999", "insertTime":1599620082000, "transferType":0, "confirmTimes":"1/1" } ]
- Raises:
BinanceRequestException, BinanceAPIException
- get_dust_assets(**params)[source]
Get assets that can be converted into BNB
https://developers.binance.com/docs/wallet/asset/assets-can-convert-bnb
- Returns:
API response
{ "details": [ { "asset": "ADA", "assetFullName": "ADA", "amountFree": "6.21", //Convertible amount "toBTC": "0.00016848", //BTC amount "toBNB": "0.01777302", //BNB amount(Not deducted commission fee) "toBNBOffExchange": "0.01741756", //BNB amount(Deducted commission fee) "exchange": "0.00035546" //Commission fee } ], "totalTransferBtc": "0.00016848", "totalTransferBNB": "0.01777302", "dribbletPercentage": "0.02" //Commission fee }
- get_dust_log(**params)[source]
Get log of small amounts exchanged for BNB.
https://developers.binance.com/docs/wallet/asset/dust-log
- Parameters:
startTime (int) – optional
endTime (int) – optional
recvWindow (int) – the number of milliseconds the request is valid for
- Returns:
API response
{ "total": 8, //Total counts of exchange "userAssetDribblets": [ { "totalTransferedAmount": "0.00132256", // Total transfered BNB amount for this exchange. "totalServiceChargeAmount": "0.00002699", //Total service charge amount for this exchange. "transId": 45178372831, "userAssetDribbletDetails": [ //Details of this exchange. { "transId": 4359321, "serviceChargeAmount": "0.000009", "amount": "0.0009", "operateTime": 1615985535000, "transferedAmount": "0.000441", "fromAsset": "USDT" }, { "transId": 4359321, "serviceChargeAmount": "0.00001799", "amount": "0.0009", "operateTime": "2018-05-03 17:07:04", "transferedAmount": "0.00088156", "fromAsset": "ETH" } ] }, { "operateTime":1616203180000, "totalTransferedAmount": "0.00058795", "totalServiceChargeAmount": "0.000012", "transId": 4357015, "userAssetDribbletDetails": [ { "transId": 4357015, "serviceChargeAmount": "0.00001" "amount": "0.001", "operateTime": 1616203180000, "transferedAmount": "0.00049", "fromAsset": "USDT" }, { "transId": 4357015, "serviceChargeAmount": "0.000002" "amount": "0.0001", "operateTime": 1616203180000, "transferedAmount": "0.00009795", "fromAsset": "ETH" } ] } ] }
- get_enabled_isolated_margin_account_limit(**params)[source]
Query enabled isolated margin account limit.
- Returns:
API response
- get_exchange_info() Dict[source]
Return rate limits and list of symbols
- Returns:
list - List of product dictionaries
{ "timezone": "UTC", "serverTime": 1508631584636, "rateLimits": [ { "rateLimitType": "REQUESTS", "interval": "MINUTE", "limit": 1200 }, { "rateLimitType": "ORDERS", "interval": "SECOND", "limit": 10 }, { "rateLimitType": "ORDERS", "interval": "DAY", "limit": 100000 } ], "exchangeFilters": [], "symbols": [ { "symbol": "ETHBTC", "status": "TRADING", "baseAsset": "ETH", "baseAssetPrecision": 8, "quoteAsset": "BTC", "quotePrecision": 8, "orderTypes": ["LIMIT", "MARKET"], "icebergAllowed": false, "filters": [ { "filterType": "PRICE_FILTER", "minPrice": "0.00000100", "maxPrice": "100000.00000000", "tickSize": "0.00000100" }, { "filterType": "LOT_SIZE", "minQty": "0.00100000", "maxQty": "100000.00000000", "stepSize": "0.00100000" }, { "filterType": "MIN_NOTIONAL", "minNotional": "0.00100000" } ] } ] }
- Raises:
BinanceRequestException, BinanceAPIException
- get_fiat_deposit_withdraw_history(**params)[source]
Get Fiat Deposit/Withdraw History
https://binance-docs.github.io/apidocs/spot/en/#get-fiat-deposit-withdraw-history-user_data
- Parameters:
transactionType (str) – required - 0-deposit,1-withdraw
beginTime (int) – optional
endTime (int) – optional
page (int) – optional - default 1
rows (int) – optional - default 100, max 500
recvWindow (int) – optional
- get_fiat_payments_history(**params)[source]
Get Fiat Payments History
https://binance-docs.github.io/apidocs/spot/en/#get-fiat-payments-history-user_data
- Parameters:
transactionType (str) – required - 0-buy,1-sell
beginTime (int) – optional
endTime (int) – optional
page (int) – optional - default 1
rows (int) – optional - default 100, max 500
recvWindow (int) – optional
- get_fixed_activity_project_list(**params)[source]
Get Fixed and Activity Project List
https://binance-docs.github.io/apidocs/spot/en/#get-fixed-and-activity-project-list-user_data
- Parameters:
asset (str) – optional
type (str) – required - “ACTIVITY”, “CUSTOMIZED_FIXED”
status (str) – optional - “ALL”, “SUBSCRIBABLE”, “UNSUBSCRIBABLE”; default “ALL”
sortBy (str) – optional - “START_TIME”, “LOT_SIZE”, “INTEREST_RATE”, “DURATION”; default “START_TIME”
current (int) – optional - Currently querying page. Start from 1. Default:1
size (int) – optional - Default:10, Max:100
recvWindow (int) – the number of milliseconds the request is valid for
- Returns:
API response
[ { "asset": "USDT", "displayPriority": 1, "duration": 90, "interestPerLot": "1.35810000", "interestRate": "0.05510000", "lotSize": "100.00000000", "lotsLowLimit": 1, "lotsPurchased": 74155, "lotsUpLimit": 80000, "maxLotsPerUser": 2000, "needKyc": False, "projectId": "CUSDT90DAYSS001", "projectName": "USDT", "status": "PURCHASING", "type": "CUSTOMIZED_FIXED", "withAreaLimitation": False } ]
- Raises:
BinanceRequestException, BinanceAPIException
- get_future_hourly_interest_rate(**params)[source]
Get user the next hourly estimate interest
https://developers.binance.com/docs/margin_trading/borrow-and-repay
- Parameters:
assets (str) – List of assets, separated by commas, up to 20
isIsolated (bool) – for isolated margin or not, “TRUE”, “FALSE”
- Returns:
API response
- get_historical_klines(symbol, interval, start_str=None, end_str=None, limit=None, klines_type: HistoricalKlinesType = HistoricalKlinesType.SPOT)[source]
Get Historical Klines from Binance
https://developers.binance.com/docs/binance-spot-api-docs/rest-api/market-data-endpoints#klinecandlestick-data https://developers.binance.com/docs/derivatives/option/market-data/Kline-Candlestick-Data https://developers.binance.com/docs/derivatives/usds-margined-futures/market-data/rest-api/Kline-Candlestick-Data https://developers.binance.com/docs/derivatives/usds-margined-futures/market-data/rest-api/Index-Price-Kline-Candlestick-Data https://developers.binance.com/docs/derivatives/usds-margined-futures/market-data/rest-api/Mark-Price-Kline-Candlestick-Data https://developers.binance.com/docs/derivatives/usds-margined-futures/market-data/rest-api/Premium-Index-Kline-Data https://developers.binance.com/docs/derivatives/coin-margined-futures/market-data/rest-api/Kline-Candlestick-Data https://developers.binance.com/docs/derivatives/coin-margined-futures/market-data/rest-api/Index-Price-Kline-Candlestick-Data https://developers.binance.com/docs/derivatives/coin-margined-futures/market-data/rest-api/Mark-Price-Kline-Candlestick-Data https://developers.binance.com/docs/derivatives/coin-margined-futures/market-data/rest-api/Premium-Index-Kline-Data
- Parameters:
symbol (str) – Name of symbol pair e.g. BNBBTC
interval (str) – Binance Kline interval
start_str (str|int) – optional - start date string in UTC format or timestamp in milliseconds
end_str (str|int) – optional - end date string in UTC format or timestamp in milliseconds (default will fetch everything up to now)
limit (int) – Default 1000; max 1000.
klines_type (HistoricalKlinesType) – Historical klines type: SPOT or FUTURES
- Returns:
list of OHLCV values (Open time, Open, High, Low, Close, Volume, Close time, Quote asset volume, Number of trades, Taker buy base asset volume, Taker buy quote asset volume, Ignore)
- get_historical_klines_generator(symbol, interval, start_str=None, end_str=None, limit=None, klines_type: HistoricalKlinesType = HistoricalKlinesType.SPOT)[source]
Get Historical Klines generator from Binance
https://developers.binance.com/docs/binance-spot-api-docs/rest-api/market-data-endpoints#klinecandlestick-data https://developers.binance.com/docs/derivatives/option/market-data/Kline-Candlestick-Data https://developers.binance.com/docs/derivatives/usds-margined-futures/market-data/rest-api/Kline-Candlestick-Data https://developers.binance.com/docs/derivatives/usds-margined-futures/market-data/rest-api/Index-Price-Kline-Candlestick-Data https://developers.binance.com/docs/derivatives/usds-margined-futures/market-data/rest-api/Mark-Price-Kline-Candlestick-Data https://developers.binance.com/docs/derivatives/usds-margined-futures/market-data/rest-api/Premium-Index-Kline-Data https://developers.binance.com/docs/derivatives/coin-margined-futures/market-data/rest-api/Kline-Candlestick-Data https://developers.binance.com/docs/derivatives/coin-margined-futures/market-data/rest-api/Index-Price-Kline-Candlestick-Data https://developers.binance.com/docs/derivatives/coin-margined-futures/market-data/rest-api/Mark-Price-Kline-Candlestick-Data https://developers.binance.com/docs/derivatives/coin-margined-futures/market-data/rest-api/Premium-Index-Kline-Data
- Parameters:
symbol (str) – Name of symbol pair e.g. BNBBTC
interval (str) – Binance Kline interval
start_str (str|int) – optional - Start date string in UTC format or timestamp in milliseconds
end_str (str|int) – optional - end date string in UTC format or timestamp in milliseconds (default will fetch everything up to now)
limit (int) – amount of candles to return per request (default 1000)
klines_type (HistoricalKlinesType) – Historical klines type: SPOT or FUTURES
- Returns:
generator of OHLCV values
- get_historical_trades(**params) Dict[source]
Get older trades.
- Parameters:
symbol (str) – required
limit (int) – Default 500; max 1000.
fromId (str) – TradeId to fetch from. Default gets most recent trades.
- Returns:
API response
[ { "id": 28457, "price": "4.00000100", "qty": "12.00000000", "time": 1499865549590, "isBuyerMaker": true, "isBestMatch": true } ]
- Raises:
BinanceRequestException, BinanceAPIException
- get_isolated_margin_account(**params)[source]
Query isolated margin account details
https://developers.binance.com/docs/margin_trading/account/Query-Isolated-Margin-Account-Info
- Parameters:
symbols – optional up to 5 margin pairs as a comma separated string
account_info = client.get_isolated_margin_account() account_info = client.get_isolated_margin_account(symbols="BTCUSDT,ETHUSDT")
- Returns:
API response
If "symbols" is not sent: { "assets":[ { "baseAsset": { "asset": "BTC", "borrowEnabled": true, "borrowed": "0.00000000", "free": "0.00000000", "interest": "0.00000000", "locked": "0.00000000", "netAsset": "0.00000000", "netAssetOfBtc": "0.00000000", "repayEnabled": true, "totalAsset": "0.00000000" }, "quoteAsset": { "asset": "USDT", "borrowEnabled": true, "borrowed": "0.00000000", "free": "0.00000000", "interest": "0.00000000", "locked": "0.00000000", "netAsset": "0.00000000", "netAssetOfBtc": "0.00000000", "repayEnabled": true, "totalAsset": "0.00000000" }, "symbol": "BTCUSDT" "isolatedCreated": true, "marginLevel": "0.00000000", "marginLevelStatus": "EXCESSIVE", // "EXCESSIVE", "NORMAL", "MARGIN_CALL", "PRE_LIQUIDATION", "FORCE_LIQUIDATION" "marginRatio": "0.00000000", "indexPrice": "10000.00000000" "liquidatePrice": "1000.00000000", "liquidateRate": "1.00000000" "tradeEnabled": true } ], "totalAssetOfBtc": "0.00000000", "totalLiabilityOfBtc": "0.00000000", "totalNetAssetOfBtc": "0.00000000" } If "symbols" is sent: { "assets":[ { "baseAsset": { "asset": "BTC", "borrowEnabled": true, "borrowed": "0.00000000", "free": "0.00000000", "interest": "0.00000000", "locked": "0.00000000", "netAsset": "0.00000000", "netAssetOfBtc": "0.00000000", "repayEnabled": true, "totalAsset": "0.00000000" }, "quoteAsset": { "asset": "USDT", "borrowEnabled": true, "borrowed": "0.00000000", "free": "0.00000000", "interest": "0.00000000", "locked": "0.00000000", "netAsset": "0.00000000", "netAssetOfBtc": "0.00000000", "repayEnabled": true, "totalAsset": "0.00000000" }, "symbol": "BTCUSDT" "isolatedCreated": true, "marginLevel": "0.00000000", "marginLevelStatus": "EXCESSIVE", // "EXCESSIVE", "NORMAL", "MARGIN_CALL", "PRE_LIQUIDATION", "FORCE_LIQUIDATION" "marginRatio": "0.00000000", "indexPrice": "10000.00000000" "liquidatePrice": "1000.00000000", "liquidateRate": "1.00000000" "tradeEnabled": true } ] }
- get_isolated_margin_fee_data(**params)[source]
Get isolated margin fee data collection with any vip level or user’s current specific data as https://www.binance.com/en/margin-fee
https://developers.binance.com/docs/margin_trading/account/Query-Isolated-Margin-Fee-Data
- Parameters:
vipLevel (int) – User’s current specific margin data will be returned if vipLevel is omitted
symbol (str) – optional
- Returns:
API response
- get_isolated_margin_symbol(**params)[source]
Query isolated margin symbol info
https://binance-docs.github.io/apidocs/spot/en/#query-isolated-margin-symbol-user_data
- Parameters:
symbol (str) – name of the symbol pair
pair_details = client.get_isolated_margin_symbol(symbol='BTCUSDT')
- Returns:
API response
{ "symbol":"BTCUSDT", "base":"BTC", "quote":"USDT", "isMarginTrade":true, "isBuyAllowed":true, "isSellAllowed":true }
- Raises:
BinanceRequestException, BinanceAPIException
- get_isolated_margin_tier_data(**params)[source]
Get isolated margin tier data collection with any tier as https://www.binance.com/en/margin-data
https://developers.binance.com/docs/margin_trading/market-data/Query-Isolated-Margin-Tier-Data
- Parameters:
symbol (str) – required
tier (int) – All margin tier data will be returned if tier is omitted
recvWindow – optional: No more than 60000
- Returns:
API response
- get_isolated_margin_tranfer_history(**params)[source]
Get transfers to isolated margin account.
https://binance-docs.github.io/apidocs/spot/en/#get-isolated-margin-transfer-history-user_data
- Parameters:
asset (str) – name of the asset
symbol (str) – pair required
transFrom – optional SPOT, ISOLATED_MARGIN
transFrom – str SPOT, ISOLATED_MARGIN
transTo – optional
transTo – str
startTime (int) – optional
endTime (int) – optional
current (str) – Currently querying page. Start from 1. Default:1
size (int) – Default:10 Max:100
recvWindow (int) – the number of milliseconds the request is valid for
transfer = client.transfer_spot_to_isolated_margin(symbol='ETHBTC')
- Returns:
API response
{ "rows": [ { "amount": "0.10000000", "asset": "BNB", "status": "CONFIRMED", "timestamp": 1566898617000, "txId": 5240372201, "transFrom": "SPOT", "transTo": "ISOLATED_MARGIN" }, { "amount": "5.00000000", "asset": "USDT", "status": "CONFIRMED", "timestamp": 1566888436123, "txId": 5239810406, "transFrom": "ISOLATED_MARGIN", "transTo": "SPOT" } ], "total": 2 }
- Raises:
BinanceRequestException, BinanceAPIException
- get_klines(**params) Dict[source]
Kline/candlestick bars for a symbol. Klines are uniquely identified by their open time.
- Parameters:
symbol (str) – required
interval (str)
limit (int) –
Default 500; max 1000.
startTime (int)
endTime (int)
- Returns:
API response
[ [ 1499040000000, # Open time "0.01634790", # Open "0.80000000", # High "0.01575800", # Low "0.01577100", # Close "148976.11427815", # Volume 1499644799999, # Close time "2434.19055334", # Quote asset volume 308, # Number of trades "1756.87402397", # Taker buy base asset volume "28.46694368", # Taker buy quote asset volume "17928899.62484339" # Can be ignored ] ]
- Raises:
BinanceRequestException, BinanceAPIException
- get_margin_account(**params)[source]
Query cross-margin account details
https://developers.binance.com/docs/margin_trading/account/Query-Cross-Margin-Account-Details
- Returns:
API response
{ "borrowEnabled": true, "marginLevel": "11.64405625", "totalAssetOfBtc": "6.82728457", "totalLiabilityOfBtc": "0.58633215", "totalNetAssetOfBtc": "6.24095242", "tradeEnabled": true, "transferEnabled": true, "userAssets": [ { "asset": "BTC", "borrowed": "0.00000000", "free": "0.00499500", "interest": "0.00000000", "locked": "0.00000000", "netAsset": "0.00499500" }, { "asset": "BNB", "borrowed": "201.66666672", "free": "2346.50000000", "interest": "0.00000000", "locked": "0.00000000", "netAsset": "2144.83333328" }, { "asset": "ETH", "borrowed": "0.00000000", "free": "0.00000000", "interest": "0.00000000", "locked": "0.00000000", "netAsset": "0.00000000" }, { "asset": "USDT", "borrowed": "0.00000000", "free": "0.00000000", "interest": "0.00000000", "locked": "0.00000000", "netAsset": "0.00000000" } ] }
- Raises:
BinanceRequestException, BinanceAPIException
- get_margin_all_assets(**params)[source]
Get All Margin Assets (MARKET_DATA)
https://developers.binance.com/docs/margin_trading/market-data/Get-All-Margin-Assets
margin_assets = client.get_margin_all_assets()
- Returns:
API response
[ { "assetFullName": "USD coin", "assetName": "USDC", "isBorrowable": true, "isMortgageable": true, "userMinBorrow": "0.00000000", "userMinRepay": "0.00000000" }, { "assetFullName": "BNB-coin", "assetName": "BNB", "isBorrowable": true, "isMortgageable": true, "userMinBorrow": "1.00000000", "userMinRepay": "0.00000000" } ]
- Raises:
BinanceRequestException, BinanceAPIException
- get_margin_all_pairs(**params)[source]
Get All Cross Margin Pairs (MARKET_DATA)
https://developers.binance.com/docs/margin_trading/market-data/Get-All-Cross-Margin-Pairs
margin_pairs = client.get_margin_all_pairs()
- Returns:
API response
[ { "base": "BNB", "id": 351637150141315861, "isBuyAllowed": true, "isMarginTrade": true, "isSellAllowed": true, "quote": "BTC", "symbol": "BNBBTC" }, { "base": "TRX", "id": 351637923235429141, "isBuyAllowed": true, "isMarginTrade": true, "isSellAllowed": true, "quote": "BTC", "symbol": "TRXBTC" } ]
- Raises:
BinanceRequestException, BinanceAPIException
- get_margin_asset(**params)[source]
Query cross-margin asset
https://binance-docs.github.io/apidocs/spot/en/#query-margin-asset-market_data
- Parameters:
asset (str) – name of the asset
asset_details = client.get_margin_asset(asset='BNB')
- Returns:
API response
{ "assetFullName": "Binance Coin", "assetName": "BNB", "isBorrowable": false, "isMortgageable": true, "userMinBorrow": "0.00000000", "userMinRepay": "0.00000000" }
- Raises:
BinanceRequestException, BinanceAPIException
- get_margin_capital_flow(**params)[source]
Get cross or isolated margin capital flow
https://developers.binance.com/docs/margin_trading/account/Query-Cross-Isolated-Margin-Capital-Flow
- Parameters:
asset (str) – optional
symbol (str) – Required when querying isolated data
type (string) – optional
startTime (long) – Only supports querying the data of the last 90 days
endTime (long) – optional
formId (long) – If fromId is set, the data with id > fromId will be returned. Otherwise the latest data will be returned
limit (long) – The number of data items returned each time is limited. Default 500; Max 1000.
- Returns:
API response
- get_margin_delist_schedule(**params)[source]
Get tokens or symbols delist schedule for cross margin and isolated margin
https://developers.binance.com/docs/margin_trading/market-data/Get-Delist-Schedule
- Parameters:
recvWindow (int) – optional - the number of milliseconds the request is valid for
- Returns:
API response
- get_margin_dust_assets(**params)[source]
Get margin assets that can be converted into BNB.
https://binance-docs.github.io/apidocs/spot/en/#margin-dustlog-user_data
- Returns:
API response
- get_margin_dustlog(**params)[source]
Query the historical information of user’s margin account small-value asset conversion BNB.
https://binance-docs.github.io/apidocs/spot/en/#margin-dustlog-user_data
- Parameters:
startTime (long) – optional
endTime (long) – optional
- Returns:
API response
- get_margin_force_liquidation_rec(**params)[source]
Get Force Liquidation Record (USER_DATA)
https://developers.binance.com/docs/margin_trading/trade
- Parameters:
startTime (str)
endTime (str)
isolatedSymbol (str) – isolated symbol (if querying isolated margin)
current (str) – Currently querying page. Start from 1. Default:1
size (int) – Default:10 Max:100
recvWindow (int) – the number of milliseconds the request is valid for
- Returns:
API response
- {
- “rows”: [
- {
“avgPrice”: “0.00388359”, “executedQty”: “31.39000000”, “orderId”: 180015097, “price”: “0.00388110”, “qty”: “31.39000000”, “side”: “SELL”, “symbol”: “BNBBTC”, “timeInForce”: “GTC”, “isIsolated”: true, “updatedTime”: 1558941374745
}
], “total”: 1
}
- get_margin_interest_history(**params)[source]
Get Interest History (USER_DATA)
https://developers.binance.com/docs/margin_trading/borrow-and-repay/Get-Interest-History
- Parameters:
asset (str)
isolatedSymbol (str) – isolated symbol (if querying isolated margin)
startTime (str)
endTime (str)
current (str) – Currently querying page. Start from 1. Default:1
size (int) – Default:10 Max:100
archived (bool) – Default: false. Set to true for archived data from 6 months ago
recvWindow (int) – the number of milliseconds the request is valid for
- Returns:
API response
- {
- “rows”:[
- {
“isolatedSymbol”: “BNBUSDT”, // isolated symbol, will not be returned for crossed margin “asset”: “BNB”, “interest”: “0.02414667”, “interestAccuredTime”: 1566813600000, “interestRate”: “0.01600000”, “principal”: “36.22000000”, “type”: “ON_BORROW”
}
], “total”: 1
}
- get_margin_loan_details(**params)[source]
Query loan record
txId or startTime must be sent. txId takes precedence.
https://binance-docs.github.io/apidocs/spot/en/#query-loan-record-user_data
- Parameters:
asset (str) – required
isolatedSymbol (str) – isolated symbol (if querying isolated margin)
txId (str) – the tranId in of the created loan
startTime (str) – earliest timestamp to filter transactions
endTime (str) – Used to uniquely identify this cancel. Automatically generated by default.
current (str) – Currently querying page. Start from 1. Default:1
size (int) – Default:10 Max:100
recvWindow (int) – the number of milliseconds the request is valid for
- Returns:
API response
- {
- “rows”: [
- {
“asset”: “BNB”, “principal”: “0.84624403”, “timestamp”: 1555056425000, //one of PENDING (pending to execution), CONFIRMED (successfully loaned), FAILED (execution failed, nothing happened to your account); “status”: “CONFIRMED”
}
], “total”: 1
}
- Raises:
BinanceRequestException, BinanceAPIException
- get_margin_oco_order(**params)[source]
Retrieves a specific OCO based on provided optional parameters
https://developers.binance.com/docs/margin_trading/trade/Query-Margin-Account-OCO
- Parameters:
isIsolated – for isolated margin or not, “TRUE”, “FALSE”,default “FALSE”
symbol (str) – mandatory for isolated margin, not supported for cross margin
orderListId (int) – Either orderListId or listClientOrderId must be provided
listClientOrderId (str) – Either orderListId or listClientOrderId must be provided
recvWindow (int) – the number of milliseconds the request is valid for
- Returns:
API response
- {
“orderListId”: 27, “contingencyType”: “OCO”, “listStatusType”: “EXEC_STARTED”, “listOrderStatus”: “EXECUTING”, “listClientOrderId”: “h2USkA5YQpaXHPIrkd96xE”, “transactionTime”: 1565245656253, “symbol”: “LTCBTC”, “isIsolated”: false, // if isolated margin “orders”: [
- {
“symbol”: “LTCBTC”, “orderId”: 4, “clientOrderId”: “qD1gy3kc3Gx0rihm9Y3xwS”
}, {
”symbol”: “LTCBTC”, “orderId”: 5, “clientOrderId”: “ARzZ9I00CPM8i3NhmU9Ega”
}
]
}
- get_margin_order(**params)[source]
Query margin accounts order
Either orderId or origClientOrderId must be sent.
For some historical orders cummulativeQuoteQty will be < 0, meaning the data is not available at this time.
https://developers.binance.com/docs/margin_trading/trade/Query-Margin-Account-Order
- Parameters:
symbol (str) – required
isIsolated (str) – set to ‘TRUE’ for isolated margin (default ‘FALSE’)
orderId (str)
origClientOrderId (str)
recvWindow (int) – the number of milliseconds the request is valid for
- Returns:
API response
- {
“clientOrderId”: “ZwfQzuDIGpceVhKW5DvCmO”, “cummulativeQuoteQty”: “0.00000000”, “executedQty”: “0.00000000”, “icebergQty”: “0.00000000”, “isWorking”: true, “orderId”: 213205622, “origQty”: “0.30000000”, “price”: “0.00493630”, “side”: “SELL”, “status”: “NEW”, “stopPrice”: “0.00000000”, “symbol”: “BNBBTC”, “time”: 1562133008725, “timeInForce”: “GTC”, “type”: “LIMIT”, “updateTime”: 1562133008725
}
- Raises:
BinanceRequestException, BinanceAPIException
- get_margin_price_index(**params)[source]
Query margin priceIndex
https://developers.binance.com/docs/margin_trading/market-data/Query-Margin-PriceIndex
- Parameters:
symbol (str) – name of the symbol pair
price_index_details = client.get_margin_price_index(symbol='BTCUSDT')
- Returns:
API response
{ "calcTime": 1562046418000, "price": "0.00333930", "symbol": "BNBBTC" }
- Raises:
BinanceRequestException, BinanceAPIException
- get_margin_repay_details(**params)[source]
Query repay record
txId or startTime must be sent. txId takes precedence.
https://binance-docs.github.io/apidocs/spot/en/#query-repay-record-user_data
- Parameters:
asset (str) – required
isolatedSymbol (str) – isolated symbol (if querying isolated margin)
txId (str) – the tranId in of the created loan
startTime (str)
endTime (str) – Used to uniquely identify this cancel. Automatically generated by default.
current (str) – Currently querying page. Start from 1. Default:1
size (int) – Default:10 Max:100
recvWindow (int) – the number of milliseconds the request is valid for
- Returns:
API response
- {
- “rows”: [
- {
//Total amount repaid “amount”: “14.00000000”, “asset”: “BNB”, //Interest repaid “interest”: “0.01866667”, //Principal repaid “principal”: “13.98133333”, //one of PENDING (pending to execution), CONFIRMED (successfully loaned), FAILED (execution failed, nothing happened to your account); “status”: “CONFIRMED”, “timestamp”: 1563438204000, “txId”: 2970933056
}
], “total”: 1
}
- Raises:
BinanceRequestException, BinanceAPIException
- get_margin_symbol(**params)[source]
Query cross-margin symbol info
https://binance-docs.github.io/apidocs/spot/en/#query-cross-margin-pair-market_data
- Parameters:
symbol (str) – name of the symbol pair
pair_details = client.get_margin_symbol(symbol='BTCUSDT')
- Returns:
API response
{ "id":323355778339572400, "symbol":"BTCUSDT", "base":"BTC", "quote":"USDT", "isMarginTrade":true, "isBuyAllowed":true, "isSellAllowed":true }
- Raises:
BinanceRequestException, BinanceAPIException
- get_margin_trades(**params)[source]
Query margin accounts trades
If fromId is set, it will get orders >= that fromId. Otherwise most recent orders are returned.
https://developers.binance.com/docs/margin_trading/trade/Query-Margin-Account-Trade-List
- Parameters:
symbol (str) – required
isIsolated (str) – set to ‘TRUE’ for isolated margin (default ‘FALSE’)
fromId (str) – optional
startTime (str) – optional
endTime (str) – optional
limit (int) – Default 500; max 1000
recvWindow (int) – the number of milliseconds the request is valid for
- Returns:
API response
- [
- {
“commission”: “0.00006000”, “commissionAsset”: “BTC”, “id”: 34, “isBestMatch”: true, “isBuyer”: false, “isMaker”: false, “orderId”: 39324, “price”: “0.02000000”, “qty”: “3.00000000”, “symbol”: “BNBBTC”, “time”: 1561973357171
- }, {
“commission”: “0.00002950”, “commissionAsset”: “BTC”, “id”: 32, “isBestMatch”: true, “isBuyer”: false, “isMaker”: true, “orderId”: 39319, “price”: “0.00590000”, “qty”: “5.00000000”, “symbol”: “BNBBTC”, “time”: 1561964645345
}
]
- Raises:
BinanceRequestException, BinanceAPIException
- get_margin_transfer_history(**params)[source]
Query margin transfer history
https://developers.binance.com/docs/margin_trading/transfer
- Parameters:
asset (str) – optional
type (str) – optional Transfer Type: ROLL_IN, ROLL_OUT
archived (str) – optional Default: false. Set to true for archived data from 6 months ago
startTime (str) – earliest timestamp to filter transactions
endTime (str) – Used to uniquely identify this cancel. Automatically generated by default.
current (str) – Currently querying page. Start from 1. Default:1
size (int) – Default:10 Max:100
recvWindow (int) – the number of milliseconds the request is valid for
- Returns:
API response
- {
- “rows”: [
- {
“amount”: “0.10000000”, “asset”: “BNB”, “status”: “CONFIRMED”, “timestamp”: 1566898617, “txId”: 5240372201, “type”: “ROLL_IN”
}, {
”amount”: “5.00000000”, “asset”: “USDT”, “status”: “CONFIRMED”, “timestamp”: 1566888436, “txId”: 5239810406, “type”: “ROLL_OUT”
}, {
”amount”: “1.00000000”, “asset”: “EOS”, “status”: “CONFIRMED”, “timestamp”: 1566888403, “txId”: 5239808703, “type”: “ROLL_IN”
}
], “total”: 3
}
- Raises:
BinanceRequestException, BinanceAPIException
- get_max_margin_loan(**params)[source]
Query max borrow amount for an asset
https://binance-docs.github.io/apidocs/spot/en/#query-max-borrow-user_data
- Parameters:
asset (str) – required
isolatedSymbol (str) – isolated symbol (if querying isolated margin)
recvWindow (int) – the number of milliseconds the request is valid for
- Returns:
API response
- {
“amount”: “1.69248805”
}
- Raises:
BinanceRequestException, BinanceAPIException
- get_max_margin_transfer(**params)[source]
Query max transfer-out amount
https://developers.binance.com/docs/margin_trading/transfer/Query-Max-Transfer-Out-Amount
- Parameters:
asset (str) – required
isolatedSymbol (str) – isolated symbol (if querying isolated margin)
recvWindow (int) – the number of milliseconds the request is valid for
- Returns:
API response
- {
“amount”: “3.59498107”
}
- Raises:
BinanceRequestException, BinanceAPIException
- get_my_trades(**params)[source]
Get trades for a specific symbol.
- Parameters:
symbol (str) – required
startTime (int) – optional
endTime (int) – optional
limit (int) – Default 500; max 1000.
fromId (int) – TradeId to fetch from. Default gets most recent trades.
recvWindow (int) – the number of milliseconds the request is valid for
- Returns:
API response
[ { "id": 28457, "price": "4.00000100", "qty": "12.00000000", "commission": "10.10000000", "commissionAsset": "BNB", "time": 1499865549590, "isBuyer": true, "isMaker": false, "isBestMatch": true } ]
- Raises:
BinanceRequestException, BinanceAPIException
- get_open_margin_oco_orders(**params)[source]
Retrieves open OCO trades
https://developers.binance.com/docs/margin_trading/trade/Query-Margin-Account-Open-OCO
- Parameters:
isIsolated – for isolated margin or not, “TRUE”, “FALSE”,default “FALSE”
symbol (str) – mandatory for isolated margin, not supported for cross margin
fromId (int) – If supplied, neither startTime or endTime can be provided
startTime (int) – optional
endTime (int) – optional
limit (int) – optional Default Value: 500; Max Value: 1000
recvWindow (int) – the number of milliseconds the request is valid for
- Returns:
API response
- [
- {
“orderListId”: 29, “contingencyType”: “OCO”, “listStatusType”: “EXEC_STARTED”, “listOrderStatus”: “EXECUTING”, “listClientOrderId”: “amEEAXryFzFwYF1FeRpUoZ”, “transactionTime”: 1565245913483, “symbol”: “LTCBTC”, “isIsolated”: true, // if isolated margin “orders”: [
- {
“symbol”: “LTCBTC”, “orderId”: 4, “clientOrderId”: “oD7aesZqjEGlZrbtRpy5zB”
}, {
”symbol”: “LTCBTC”, “orderId”: 5, “clientOrderId”: “Jr1h6xirOxgeJOUuYQS7V3”
}
]
}, {
”orderListId”: 28, “contingencyType”: “OCO”, “listStatusType”: “EXEC_STARTED”, “listOrderStatus”: “EXECUTING”, “listClientOrderId”: “hG7hFNxJV6cZy3Ze4AUT4d”, “transactionTime”: 1565245913407, “symbol”: “LTCBTC”, “orders”: [
- {
“symbol”: “LTCBTC”, “orderId”: 2, “clientOrderId”: “j6lFOfbmFMRjTYA7rRJ0LP”
}, {
”symbol”: “LTCBTC”, “orderId”: 3, “clientOrderId”: “z0KCjOdditiLS5ekAFtK81”
}
]
}
]
- get_open_margin_orders(**params)[source]
Query margin accounts open orders
If the symbol is not sent, orders for all symbols will be returned in an array (cross-margin only).
If querying isolated margin orders, both the isIsolated=’TRUE’ and symbol=symbol_name must be set.
When all symbols are returned, the number of requests counted against the rate limiter is equal to the number of symbols currently trading on the exchange.
https://developers.binance.com/docs/margin_trading/trade/Query-Margin-Account-Open-Orders
- Parameters:
symbol (str) – optional
isIsolated (str) – set to ‘TRUE’ for isolated margin (default ‘FALSE’)
recvWindow (int) – the number of milliseconds the request is valid for
- Returns:
API response
- [
- {
“clientOrderId”: “qhcZw71gAkCCTv0t0k8LUK”, “cummulativeQuoteQty”: “0.00000000”, “executedQty”: “0.00000000”, “icebergQty”: “0.00000000”, “isWorking”: true, “orderId”: 211842552, “origQty”: “0.30000000”, “price”: “0.00475010”, “side”: “SELL”, “status”: “NEW”, “stopPrice”: “0.00000000”, “symbol”: “BNBBTC”, “time”: 1562040170089, “timeInForce”: “GTC”, “type”: “LIMIT”, “updateTime”: 1562040170089
}
]
- Raises:
BinanceRequestException, BinanceAPIException
- get_open_oco_orders(**params)[source]
Get all open orders on a symbol. https://developers.binance.com/docs/binance-spot-api-docs/rest-api/account-endpoints#query-open-order-lists-user_data :param recvWindow: the number of milliseconds the request is valid for :type recvWindow: int :returns: API response .. code-block:: python
- [
- {
“orderListId”: 31, “contingencyType”: “OCO”, “listStatusType”: “EXEC_STARTED”, “listOrderStatus”: “EXECUTING”, “listClientOrderId”: “wuB13fmulKj3YjdqWEcsnp”, “transactionTime”: 1565246080644, “symbol”: “LTCBTC”, “orders”: [
- {
“symbol”: “LTCBTC”, “orderId”: 4, “clientOrderId”: “r3EH2N76dHfLoSZWIUw1bT”
}, {
“symbol”: “LTCBTC”, “orderId”: 5, “clientOrderId”: “Cv1SnyPD3qhqpbjpYEHbd2”
}
]
}
]
- Raises:
BinanceRequestException, BinanceAPIException
- get_open_orders(**params)[source]
Get all open orders on a symbol.
- Parameters:
symbol (str) – optional
recvWindow (int) – the number of milliseconds the request is valid for
- Returns:
API response
[ { "symbol": "LTCBTC", "orderId": 1, "clientOrderId": "myOrder1", "price": "0.1", "origQty": "1.0", "executedQty": "0.0", "status": "NEW", "timeInForce": "GTC", "type": "LIMIT", "side": "BUY", "stopPrice": "0.0", "icebergQty": "0.0", "time": 1499827319559 } ]
- Raises:
BinanceRequestException, BinanceAPIException
- get_order(**params)[source]
Check an order’s status. Either orderId or origClientOrderId must be sent.
- Parameters:
symbol (str) – required
orderId (int) – The unique order id
origClientOrderId (str) – optional
recvWindow (int) – the number of milliseconds the request is valid for
- Returns:
API response
{ "symbol": "LTCBTC", "orderId": 1, "clientOrderId": "myOrder1", "price": "0.1", "origQty": "1.0", "executedQty": "0.0", "status": "NEW", "timeInForce": "GTC", "type": "LIMIT", "side": "BUY", "stopPrice": "0.0", "icebergQty": "0.0", "time": 1499827319559 }
- Raises:
BinanceRequestException, BinanceAPIException
- get_order_book(**params) Dict[source]
Get the Order Book for the market
https://developers.binance.com/docs/binance-spot-api-docs/rest-api/market-data-endpoints#order-book
- Parameters:
symbol (str) – required
limit (int) – Default 100; max 1000
- Returns:
API response
{ "lastUpdateId": 1027024, "bids": [ [ "4.00000000", # PRICE "431.00000000", # QTY [] # Can be ignored ] ], "asks": [ [ "4.00000200", "12.00000000", [] ] ] }
- Raises:
BinanceRequestException, BinanceAPIException
- get_orderbook_ticker(**params)[source]
Latest price for a symbol or symbols.
- Parameters:
symbol (str)
- Returns:
API response
{ "symbol": "LTCBTC", "bidPrice": "4.00000000", "bidQty": "431.00000000", "askPrice": "4.00000200", "askQty": "9.00000000" }
OR
[ { "symbol": "LTCBTC", "bidPrice": "4.00000000", "bidQty": "431.00000000", "askPrice": "4.00000200", "askQty": "9.00000000" }, { "symbol": "ETHBTC", "bidPrice": "0.07946700", "bidQty": "9.00000000", "askPrice": "100000.00000000", "askQty": "1000.00000000" } ]
- Raises:
BinanceRequestException, BinanceAPIException
- get_orderbook_tickers(**params) Dict[source]
Best price/qty on the order book for all symbols.
- Parameters:
symbol (str) – optional
symbols (str) – optional accepted format [“BTCUSDT”,”BNBUSDT”] or %5B%22BTCUSDT%22,%22BNBUSDT%22%5D
- Returns:
List of order book market entries
[ { "symbol": "LTCBTC", "bidPrice": "4.00000000", "bidQty": "431.00000000", "askPrice": "4.00000200", "askQty": "9.00000000" }, { "symbol": "ETHBTC", "bidPrice": "0.07946700", "bidQty": "9.00000000", "askPrice": "100000.00000000", "askQty": "1000.00000000" } ]
- Raises:
BinanceRequestException, BinanceAPIException
- get_pay_trade_history(**params)[source]
Get C2C Trade History
https://binance-docs.github.io/apidocs/spot/en/#pay-endpoints
- Parameters:
startTime (int) – optional
endTime (int) – optional
limit (int) – optional - default 100, max 100
recvWindow (int) – optional
- Returns:
API response
- get_personal_left_quota(**params)[source]
Get Personal Left Quota of Staking Product
https://binance-docs.github.io/apidocs/spot/en/#get-personal-left-quota-of-staking-product-user_data
- get_prevented_matches(**params)[source]
Displays the list of orders that were expired because of STP.
- Parameters:
symbol (str) – required
preventedMatchId (int) – optional
orderId (int) – optional
fromPreventedMatchId (int) – optional
limit (int) – optional, Default: 500; Max: 1000
recvWindow (int) – the number of milliseconds the request is valid for
- Returns:
API response
- get_products() Dict[source]
Return list of products currently listed on Binance
Use get_exchange_info() call instead
- Returns:
list - List of product dictionaries
- Raises:
BinanceRequestException, BinanceAPIException
- get_recent_trades(**params) Dict[source]
Get recent trades (up to last 500).
- Parameters:
symbol (str) – required
limit (int) – Default 500; max 1000.
- Returns:
API response
[ { "id": 28457, "price": "4.00000100", "qty": "12.00000000", "time": 1499865549590, "isBuyerMaker": true, "isBestMatch": true } ]
- Raises:
BinanceRequestException, BinanceAPIException
- get_server_time() Dict[source]
Test connectivity to the Rest API and get the current server time.
- Returns:
Current server time
{ "serverTime": 1499827319559 }
- Raises:
BinanceRequestException, BinanceAPIException
- get_simple_earn_account(**params)[source]
https://binance-docs.github.io/apidocs/spot/en/#simple-account-user_data
- Parameters:
recvWindow (int) – the number of milliseconds the request is valid for
- Returns:
API response
{ "totalAmountInBTC": "0.01067982", "totalAmountInUSDT": "77.13289230", "totalFlexibleAmountInBTC": "0.00000000", "totalFlexibleAmountInUSDT": "0.00000000", "totalLockedInBTC": "0.01067982", "totalLockedInUSDT": "77.13289230" }
- Raises:
BinanceRequestException, BinanceAPIException
- get_simple_earn_flexible_product_list(**params)[source]
Get available Simple Earn flexible product list
https://binance-docs.github.io/apidocs/spot/en/#get-simple-earn-flexible-product-list-user_data
- Parameters:
asset (str) – optional
current (int) – optional - Currently querying page. Start from 1. Default:1
size (int) – optional - Default:10, Max:100
recvWindow (int) – the number of milliseconds the request is valid for
- Returns:
API response
{ "rows":[ { "asset": "BTC", "latestAnnualPercentageRate": "0.05000000", "tierAnnualPercentageRate": { "0-5BTC": 0.05, "5-10BTC": 0.03 }, "airDropPercentageRate": "0.05000000", "canPurchase": true, "canRedeem": true, "isSoldOut": true, "hot": true, "minPurchaseAmount": "0.01000000", "productId": "BTC001", "subscriptionStartTime": "1646182276000", "status": "PURCHASING" } ], "total": 1 }
- Raises:
BinanceRequestException, BinanceAPIException
- get_simple_earn_flexible_product_position(**params)[source]
https://binance-docs.github.io/apidocs/spot/en/#get-flexible-product-position-user_data
- Parameters:
asset (str) – optional
current (int) – optional - Currently querying page. Start from 1. Default:1
size (int) – optional - Default:10, Max:100
recvWindow (int) – the number of milliseconds the request is valid for
- Returns:
API response
{ "rows":[ { "totalAmount": "75.46000000", "tierAnnualPercentageRate": { "0-5BTC": 0.05, "5-10BTC": 0.03 }, "latestAnnualPercentageRate": "0.02599895", "yesterdayAirdropPercentageRate": "0.02599895", "asset": "USDT", "airDropAsset": "BETH", "canRedeem": true, "collateralAmount": "232.23123213", "productId": "USDT001", "yesterdayRealTimeRewards": "0.10293829", "cumulativeBonusRewards": "0.22759183", "cumulativeRealTimeRewards": "0.22759183", "cumulativeTotalRewards": "0.45459183", "autoSubscribe": true } ], "total": 1 }
- Raises:
BinanceRequestException, BinanceAPIException
- get_simple_earn_locked_product_list(**params)[source]
Get available Simple Earn flexible product list
https://binance-docs.github.io/apidocs/spot/en/#get-simple-earn-locked-product-list-user_data
- Parameters:
asset (str) – optional
current (int) – optional - Currently querying page. Start from 1. Default:1
size (int) – optional - Default:10, Max:100
recvWindow (int) – the number of milliseconds the request is valid for
- Returns:
API response
{ "rows": [ { "projectId": "Axs*90", "detail": { "asset": "AXS", "rewardAsset": "AXS", "duration": 90, "renewable": true, "isSoldOut": true, "apr": "1.2069", "status": "CREATED", "subscriptionStartTime": "1646182276000", "extraRewardAsset": "BNB", "extraRewardAPR": "0.23" }, "quota": { "totalPersonalQuota": "2", "minimum": "0.001" } } ], "total": 1 }
- Raises:
BinanceRequestException, BinanceAPIException
- get_simple_earn_locked_product_position(**params)[source]
https://binance-docs.github.io/apidocs/spot/en/#get-locked-product-position-user_data
- Parameters:
asset (str) – optional
current (int) – optional - Currently querying page. Start from 1. Default:1
size (int) – optional - Default:10, Max:100
recvWindow (int) – the number of milliseconds the request is valid for
- Returns:
API response
{ "rows":[ { "positionId": "123123", "projectId": "Axs*90", "asset": "AXS", "amount": "122.09202928", "purchaseTime": "1646182276000", "duration": "60", "accrualDays": "4", "rewardAsset": "AXS", "APY": "0.23", "isRenewable": true, "isAutoRenew": true, "redeemDate": "1732182276000" } ], "total": 1 }
- Raises:
BinanceRequestException, BinanceAPIException
- get_small_liability_exchange_assets(**params)[source]
Query the coins which can be small liability exchange
https://developers.binance.com/docs/margin_trading/trade/Get-Small-Liability-Exchange-Coin-List
- Returns:
API response
- get_small_liability_exchange_history(**params)[source]
Get Small liability Exchange History
https://developers.binance.com/docs/margin_trading/trade/Get-Small-Liability-Exchange-History
- Parameters:
current (int) – Currently querying page. Start from 1. Default:1
size (int) – Default:10, Max:100
startTime (long) – Default: 30 days from current timestamp
endTime – Default: present timestamp
- Returns:
API response
- get_spot_delist_schedule(**params)[source]
Get symbols delist schedule for spot
https://developers.binance.com/docs/wallet/others/delist-schedule
- Parameters:
recvWindow (int) – optional - the number of milliseconds the request is valid for
- Returns:
API response
- get_staking_asset_us(**params)[source]
Get staking information for a supported asset (or assets)
https://docs.binance.us/#get-staking-asset-information
- Raises:
BinanceRegionException – If client is not configured for binance.us
- get_staking_balance_us(**params)[source]
Get staking balance
https://docs.binance.us/#get-staking-balance
- Raises:
BinanceRegionException – If client is not configured for binance.us
- get_staking_history_us(**params)[source]
Get staking history
https://docs.binance.us/#get-staking-history
- Raises:
BinanceRegionException – If client is not configured for binance.us
- get_staking_position(**params)[source]
Get Staking Product Position
https://binance-docs.github.io/apidocs/spot/en/#get-staking-product-position-user_data
- get_staking_product_list(**params)[source]
Get Staking Product List
https://binance-docs.github.io/apidocs/spot/en/#get-staking-product-list-user_data
- get_staking_purchase_history(**params)[source]
Get Staking Purchase History
https://binance-docs.github.io/apidocs/spot/en/#get-staking-history-user_data
- get_staking_rewards_history_us(**params)[source]
Get staking rewards history for an asset(or assets) within a given time range.
https://docs.binance.us/#get-staking-rewards-history
- Raises:
BinanceRegionException – If client is not configured for binance.us
- get_sub_account_assets(**params)[source]
Fetch sub-account assets
https://developers.binance.com/docs/sub_account/asset-management/Query-Sub-account-Assets-V4
- Parameters:
email (str) – required
recvWindow (int) – optional
- Returns:
API response
{ "balances":[ { "asset":"ADA", "free":10000, "locked":0 }, { "asset":"BNB", "free":10003, "locked":0 }, { "asset":"BTC", "free":11467.6399, "locked":0 }, { "asset":"ETH", "free":10004.995, "locked":0 }, { "asset":"USDT", "free":11652.14213, "locked":0 } ] }
- Raises:
BinanceRequestException, BinanceAPIException
- get_sub_account_futures_transfer_history(**params)[source]
Query Sub-account Futures Transfer History.
- Parameters:
email (str) – required
futuresType (int) – required
startTime (int) – optional
endTime (int) – optional
page (int) – optional
limit (int) – optional
recvWindow (int) – optional
- Returns:
API response
{ "success":true, "futuresType": 2, "transfers":[ { "from":"aaa@test.com", "to":"bbb@test.com", "asset":"BTC", "qty":"1", "time":1544433328000 }, { "from":"bbb@test.com", "to":"ccc@test.com", "asset":"ETH", "qty":"2", "time":1544433328000 } ] }
- Raises:
BinanceRequestException, BinanceAPIException
- get_sub_account_list(**params)[source]
Query Sub-account List.
https://developers.binance.com/docs/sub_account/account-management/Query-Sub-account-List
- Parameters:
email (str) – optional - Sub-account email
isFreeze (str) – optional
page (int) – optional - Default value: 1
limit (int) – optional - Default value: 1, Max value: 200
recvWindow (int) – optional
- Returns:
API response
{ "subAccounts":[ { "email":"testsub@gmail.com", "isFreeze":false, "createTime":1544433328000 }, { "email":"virtual@oxebmvfonoemail.com", "isFreeze":false, "createTime":1544433328000 } ] }
- Raises:
BinanceRequestException, BinanceAPIException
- get_sub_account_transfer_history(**params)[source]
Query Sub-account Transfer History.
- Parameters:
fromEmail (str) – optional
toEmail (str) – optional
startTime (int) – optional
endTime (int) – optional
page (int) – optional - Default value: 1
limit (int) – optional - Default value: 500
recvWindow (int) – optional
- Returns:
API response
[ { "from":"aaa@test.com", "to":"bbb@test.com", "asset":"BTC", "qty":"10", "status": "SUCCESS", "tranId": 6489943656, "time":1544433328000 }, { "from":"bbb@test.com", "to":"ccc@test.com", "asset":"ETH", "qty":"2", "status": "SUCCESS", "tranId": 6489938713, "time":1544433328000 } ]
- Raises:
BinanceRequestException, BinanceAPIException
- get_subaccount_deposit_address(**params)[source]
Get Sub-account Deposit Address (For Master Account)
https://developers.binance.com/docs/sub_account/asset-management/Get-Sub-account-Deposit-Address
- Parameters:
email (str) – required - Sub account email
coin (str) – required
network (str) – optional
recvWindow (int) – optional
- Returns:
API response
{ "address":"TDunhSa7jkTNuKrusUTU1MUHtqXoBPKETV", "coin":"USDT", "tag":"", "url":"https://tronscan.org/#/address/TDunhSa7jkTNuKrusUTU1MUHtqXoBPKETV" }
- Raises:
BinanceRequestException, BinanceAPIException
- get_subaccount_deposit_history(**params)[source]
Get Sub-account Deposit History (For Master Account)
https://developers.binance.com/docs/sub_account/asset-management/Get-Sub-account-Deposit-History
- Parameters:
email (str) – required - Sub account email
coin (str) – optional
status (int) – optional - (0:pending,6: credited but cannot withdraw, 1:success)
startTime (int) – optional
endTime (int) – optional
limit (int) – optional
offset (int) – optional - default:0
recvWindow (int) – optional
- Returns:
API response
[ { "amount":"0.00999800", "coin":"PAXG", "network":"ETH", "status":1, "address":"0x788cabe9236ce061e5a892e1a59395a81fc8d62c", "addressTag":"", "txId":"0xaad4654a3234aa6118af9b4b335f5ae81c360b2394721c019b5d1e75328b09f3", "insertTime":1599621997000, "transferType":0, "confirmTimes":"12/12" }, { "amount":"0.50000000", "coin":"IOTA", "network":"IOTA", "status":1, "address":"SIZ9VLMHWATXKV99LH99CIGFJFUMLEHGWVZVNNZXRJJVWBPHYWPPBOSDORZ9EQSHCZAMPVAPGFYQAUUV9DROOXJLNW", "addressTag":"", "txId":"ESBFVQUTPIWQNJSPXFNHNYHSQNTGKRVKPRABQWTAXCDWOAKDKYWPTVG9BGXNVNKTLEJGESAVXIKIZ9999", "insertTime":1599620082000, "transferType":0, "confirmTimes":"1/1" } ]
- Raises:
BinanceRequestException, BinanceAPIException
- get_subaccount_futures_details(**params)[source]
Get Detail on Sub-account’s Futures Account (For Master Account)
- Parameters:
email (str) – required - Sub account email
recvWindow (int) – optional
- Returns:
API response
{ "email": "abc@test.com", "asset": "USDT", "assets":[ { "asset": "USDT", "initialMargin": "0.00000000", "maintenanceMargin": "0.00000000", "marginBalance": "0.88308000", "maxWithdrawAmount": "0.88308000", "openOrderInitialMargin": "0.00000000", "positionInitialMargin": "0.00000000", "unrealizedProfit": "0.00000000", "walletBalance": "0.88308000" } ], "canDeposit": true, "canTrade": true, "canWithdraw": true, "feeTier": 2, "maxWithdrawAmount": "0.88308000", "totalInitialMargin": "0.00000000", "totalMaintenanceMargin": "0.00000000", "totalMarginBalance": "0.88308000", "totalOpenOrderInitialMargin": "0.00000000", "totalPositionInitialMargin": "0.00000000", "totalUnrealizedProfit": "0.00000000", "totalWalletBalance": "0.88308000", "updateTime": 1576756674610 }
- Raises:
BinanceRequestException, BinanceAPIException
- get_subaccount_futures_margin_status(**params)[source]
Get Sub-account’s Status on Margin/Futures (For Master Account)
- Parameters:
email (str) – optional - Sub account email
recvWindow (int) – optional
- Returns:
API response
[ { "email":"123@test.com", // user email "isSubUserEnabled": true, // true or false "isUserActive": true, // true or false "insertTime": 1570791523523 // sub account create time "isMarginEnabled": true, // true or false for margin "isFutureEnabled": true // true or false for futures. "mobile": 1570791523523 // user mobile number } ]
- Raises:
BinanceRequestException, BinanceAPIException
- get_subaccount_futures_positionrisk(**params)[source]
Get Futures Position-Risk of Sub-account (For Master Account)
- Parameters:
email (str) – required - Sub account email
recvWindow (int) – optional
- Returns:
API response
[ { "entryPrice": "9975.12000", "leverage": "50", // current initial leverage "maxNotional": "1000000", // notional value limit of current initial leverage "liquidationPrice": "7963.54", "markPrice": "9973.50770517", "positionAmount": "0.010", "symbol": "BTCUSDT", "unrealizedProfit": "-0.01612295" } ]
- Raises:
BinanceRequestException, BinanceAPIException
- get_subaccount_futures_summary(**params)[source]
Get Summary of Sub-account’s Futures Account (For Master Account)
- Parameters:
recvWindow (int) – optional
- Returns:
API response
{ "totalInitialMargin": "9.83137400", "totalMaintenanceMargin": "0.41568700", "totalMarginBalance": "23.03235621", "totalOpenOrderInitialMargin": "9.00000000", "totalPositionInitialMargin": "0.83137400", "totalUnrealizedProfit": "0.03219710", "totalWalletBalance": "22.15879444", "asset": "USDT", "subAccountList":[ { "email": "123@test.com", "totalInitialMargin": "9.00000000", "totalMaintenanceMargin": "0.00000000", "totalMarginBalance": "22.12659734", "totalOpenOrderInitialMargin": "9.00000000", "totalPositionInitialMargin": "0.00000000", "totalUnrealizedProfit": "0.00000000", "totalWalletBalance": "22.12659734", "asset": "USDT" }, { "email": "345@test.com", "totalInitialMargin": "0.83137400", "totalMaintenanceMargin": "0.41568700", "totalMarginBalance": "0.90575887", "totalOpenOrderInitialMargin": "0.00000000", "totalPositionInitialMargin": "0.83137400", "totalUnrealizedProfit": "0.03219710", "totalWalletBalance": "0.87356177", "asset": "USDT" } ] }
- Raises:
BinanceRequestException, BinanceAPIException
- get_subaccount_margin_details(**params)[source]
Get Detail on Sub-account’s Margin Account (For Master Account)
- Parameters:
email (str) – required - Sub account email
recvWindow (int) – optional
- Returns:
API response
{ "email":"123@test.com", "marginLevel": "11.64405625", "totalAssetOfBtc": "6.82728457", "totalLiabilityOfBtc": "0.58633215", "totalNetAssetOfBtc": "6.24095242", "marginTradeCoeffVo": { "forceLiquidationBar": "1.10000000", // Liquidation margin ratio "marginCallBar": "1.50000000", // Margin call margin ratio "normalBar": "2.00000000" // Initial margin ratio }, "marginUserAssetVoList": [ { "asset": "BTC", "borrowed": "0.00000000", "free": "0.00499500", "interest": "0.00000000", "locked": "0.00000000", "netAsset": "0.00499500" }, { "asset": "BNB", "borrowed": "201.66666672", "free": "2346.50000000", "interest": "0.00000000", "locked": "0.00000000", "netAsset": "2144.83333328" }, { "asset": "ETH", "borrowed": "0.00000000", "free": "0.00000000", "interest": "0.00000000", "locked": "0.00000000", "netAsset": "0.00000000" }, { "asset": "USDT", "borrowed": "0.00000000", "free": "0.00000000", "interest": "0.00000000", "locked": "0.00000000", "netAsset": "0.00000000" } ] }
- Raises:
BinanceRequestException, BinanceAPIException
- get_subaccount_margin_summary(**params)[source]
Get Summary of Sub-account’s Margin Account (For Master Account)
- Parameters:
recvWindow (int) – optional
- Returns:
API response
{ "totalAssetOfBtc": "4.33333333", "totalLiabilityOfBtc": "2.11111112", "totalNetAssetOfBtc": "2.22222221", "subAccountList":[ { "email":"123@test.com", "totalAssetOfBtc": "2.11111111", "totalLiabilityOfBtc": "1.11111111", "totalNetAssetOfBtc": "1.00000000" }, { "email":"345@test.com", "totalAssetOfBtc": "2.22222222", "totalLiabilityOfBtc": "1.00000001", "totalNetAssetOfBtc": "1.22222221" } ] }
- Raises:
BinanceRequestException, BinanceAPIException
- get_subaccount_transfer_history(**params)[source]
Sub-account Transfer History (For Sub-account)
https://developers.binance.com/docs/sub_account/asset-management/Sub-account-Transfer-History
- Parameters:
asset (str) – required - The asset being transferred, e.g., USDT
type (int) – optional - 1: transfer in, 2: transfer out
startTime (int) – optional
endTime (int) – optional
limit (int) – optional - Default 500
recvWindow (int) – optional
- Returns:
API response
[ { "counterParty":"master", "email":"master@test.com", "type":1, // 1 for transfer in, 2 for transfer out "asset":"BTC", "qty":"1", "status":"SUCCESS", "tranId":11798835829, "time":1544433325000 }, { "counterParty":"subAccount", "email":"sub2@test.com", "type":2, "asset":"ETH", "qty":"2", "status":"SUCCESS", "tranId":11798829519, "time":1544433326000 } ]
- Raises:
BinanceRequestException, BinanceAPIException
- get_symbol_info(symbol) Dict | None[source]
Return information about a symbol
- Parameters:
symbol (str) – required e.g. BNBBTC
- Returns:
Dict if found, None if not
{ "symbol": "ETHBTC", "status": "TRADING", "baseAsset": "ETH", "baseAssetPrecision": 8, "quoteAsset": "BTC", "quotePrecision": 8, "orderTypes": ["LIMIT", "MARKET"], "icebergAllowed": false, "filters": [ { "filterType": "PRICE_FILTER", "minPrice": "0.00000100", "maxPrice": "100000.00000000", "tickSize": "0.00000100" }, { "filterType": "LOT_SIZE", "minQty": "0.00100000", "maxQty": "100000.00000000", "stepSize": "0.00100000" }, { "filterType": "MIN_NOTIONAL", "minNotional": "0.00100000" } ] }
- Raises:
BinanceRequestException, BinanceAPIException
- get_symbol_ticker(**params)[source]
Latest price for a symbol or symbols.
- Parameters:
symbol (str)
- Returns:
API response
{ "symbol": "LTCBTC", "price": "4.00000200" }
OR
[ { "symbol": "LTCBTC", "price": "4.00000200" }, { "symbol": "ETHBTC", "price": "0.07946600" } ]
- Raises:
BinanceRequestException, BinanceAPIException
- get_symbol_ticker_window(**params)[source]
Latest price for a symbol or symbols.
- Parameters:
symbol (str)
- Returns:
API response
{ "symbol": "LTCBTC", "price": "4.00000200" }
OR
[ { "symbol": "LTCBTC", "price": "4.00000200" }, { "symbol": "ETHBTC", "price": "0.07946600" } ]
- Raises:
BinanceRequestException, BinanceAPIException
- get_system_status()[source]
Get system status detail.
https://developers.binance.com/docs/wallet/others/system-status
- Returns:
API response
{ "status": 0, # 0: normal,1:system maintenance "msg": "normal" # normal or System maintenance. }
- Raises:
BinanceAPIException
- get_ticker(**params)[source]
24 hour price change statistics.
- Parameters:
symbol (str)
- Returns:
API response
{ "priceChange": "-94.99999800", "priceChangePercent": "-95.960", "weightedAvgPrice": "0.29628482", "prevClosePrice": "0.10002000", "lastPrice": "4.00000200", "bidPrice": "4.00000000", "askPrice": "4.00000200", "openPrice": "99.00000000", "highPrice": "100.00000000", "lowPrice": "0.10000000", "volume": "8913.30000000", "openTime": 1499783499040, "closeTime": 1499869899040, "fristId": 28385, # First tradeId "lastId": 28460, # Last tradeId "count": 76 # Trade count }
OR
[ { "priceChange": "-94.99999800", "priceChangePercent": "-95.960", "weightedAvgPrice": "0.29628482", "prevClosePrice": "0.10002000", "lastPrice": "4.00000200", "bidPrice": "4.00000000", "askPrice": "4.00000200", "openPrice": "99.00000000", "highPrice": "100.00000000", "lowPrice": "0.10000000", "volume": "8913.30000000", "openTime": 1499783499040, "closeTime": 1499869899040, "fristId": 28385, # First tradeId "lastId": 28460, # Last tradeId "count": 76 # Trade count } ]
- Raises:
BinanceRequestException, BinanceAPIException
- get_trade_fee(**params)[source]
Get trade fee.
https://developers.binance.com/docs/wallet/asset/trade-fee
- Parameters:
symbol (str) – optional
recvWindow (int) – the number of milliseconds the request is valid for
- Returns:
API response
[ { "symbol": "ADABNB", "makerCommission": "0.001", "takerCommission": "0.001" }, { "symbol": "BNBBTC", "makerCommission": "0.001", "takerCommission": "0.001" } ]
- get_ui_klines(**params) Dict[source]
Kline/candlestick bars for a symbol with UI enhancements. Klines are uniquely identified by their open time.
https://developers.binance.com/docs/binance-spot-api-docs/rest-api/market-data-endpoints#uiklines
- Parameters:
symbol (str) – required
interval (str) – required - The interval for the klines (e.g., 1m, 3m, 5m, etc.)
limit (int) – optional - Default 500; max 1000.
startTime (int) – optional - Start time in milliseconds
endTime (int) – optional - End time in milliseconds
- Returns:
API response
[ [ 1499040000000, # Open time "0.01634790", # Open "0.80000000", # High "0.01575800", # Low "0.01577100", # Close "148976.11427815", # Volume 1499644799999, # Close time "2434.19055334", # Quote asset volume 308, # Number of trades "1756.87402397", # Taker buy base asset volume "28.46694368", # Taker buy quote asset volume "17928899.62484339" # Can be ignored ] ]
- Raises:
BinanceRequestException, BinanceAPIException
- get_universal_transfer_history(**params)[source]
Universal Transfer (For Master Account)
https://developers.binance.com/docs/sub_account/asset-management/Query-Universal-Transfer-History
- Parameters:
fromEmail (str) – optional
toEmail (str) – optional
startTime (int) – optional
endTime (int) – optional
page (int) – optional
limit (int) – optional
recvWindow (int) – optional
- Returns:
API response
[ { "tranId":11945860693, "fromEmail":"master@test.com", "toEmail":"subaccount1@test.com", "asset":"BTC", "amount":"0.1", "fromAccountType":"SPOT", "toAccountType":"COIN_FUTURE", "status":"SUCCESS", "createTimeStamp":1544433325000 }, { "tranId":11945857955, "fromEmail":"master@test.com", "toEmail":"subaccount2@test.com", "asset":"ETH", "amount":"0.2", "fromAccountType":"SPOT", "toAccountType":"USDT_FUTURE", "status":"SUCCESS", "createTimeStamp":1544433326000 } ]
- Raises:
BinanceRequestException, BinanceAPIException
- get_user_asset(**params)[source]
Get user assets, just for positive data
https://developers.binance.com/docs/wallet/asset/user-assets
- get_withdraw_history(**params)[source]
Fetch withdraw history.
https://developers.binance.com/docs/wallet/capital/withdraw-history
- Parameters:
coin (str) – optional
offset (int) – optional - default:0
limit (int) – optional
startTime (int) – optional - Default: 90 days from current timestamp
endTime (int) – optional - Default: present timestamp
recvWindow (int) – the number of milliseconds the request is valid for
- Returns:
API response
[ { "address": "0x94df8b352de7f46f64b01d3666bf6e936e44ce60", "amount": "8.91000000", "applyTime": "2019-10-12 11:12:02", "coin": "USDT", "id": "b6ae22b3aa844210a7041aee7589627c", "withdrawOrderId": "WITHDRAWtest123", // will not be returned if there's no withdrawOrderId for this withdraw. "network": "ETH", "transferType": 0, // 1 for internal transfer, 0 for external transfer "status": 6, "txId": "0xb5ef8c13b968a406cc62a93a8bd80f9e9a906ef1b3fcf20a2e48573c17659268" }, { "address": "1FZdVHtiBqMrWdjPyRPULCUceZPJ2WLCsB", "amount": "0.00150000", "applyTime": "2019-09-24 12:43:45", "coin": "BTC", "id": "156ec387f49b41df8724fa744fa82719", "network": "BTC", "status": 6, "txId": "60fd9007ebfddc753455f95fafa808c4302c836e4d1eebc5a132c36c1d8ac354" } ]
- Raises:
BinanceRequestException, BinanceAPIException
- get_withdraw_history_id(withdraw_id, **params)[source]
Fetch withdraw history.
https://binance-docs.github.io/apidocs/spot/en/#withdraw-history-supporting-network-user_data
- Parameters:
withdraw_id (str) – required
asset (str) – optional
startTime (long) – optional
endTime (long) – optional
recvWindow (int) – the number of milliseconds the request is valid for
- Returns:
API response
{ "id":"7213fea8e94b4a5593d507237e5a555b", "withdrawOrderId": None, "amount": 0.99, "transactionFee": 0.01, "address": "0x6915f16f8791d0a1cc2bf47c13a6b2a92000504b", "asset": "ETH", "txId": "0xdf33b22bdb2b28b1f75ccd201a4a4m6e7g83jy5fc5d5a9d1340961598cfcb0a1", "applyTime": 1508198532000, "status": 4 }
- Raises:
BinanceRequestException, BinanceAPIException
- gift_card_create(**params)[source]
This API is for creating a Binance Gift Card.
To get started with, please make sure:
You have a Binance account
You have passed KYB
You have a sufficient balance(Gift Card amount and fee amount) in your Binance funding wallet
You need Enable Withdrawals for the API Key which requests this endpoint.
https://developers.binance.com/docs/gift_card/market-data
- Parameters:
token (str) – The token type contained in the Binance Gift Card
amount (float) – The amount of the token contained in the Binance Gift Card
- Returns:
api response
- gift_card_create_dual_token(**params)[source]
This API is for creating a dual-token ( stablecoin-denominated) Binance Gift Card. You may create a gift card using USDT as baseToken, that is redeemable to another designated token (faceToken). For example, you can create a fixed-value BTC gift card and pay with 100 USDT plus 1 USDT fee. This gift card can keep the value fixed at 100 USDT before redemption, and will be redeemable to BTC equivalent to 100 USDT upon redemption.
Once successfully created, the amount of baseToken (e.g. USDT) in the fixed-value gift card along with the fee would be deducted from your funding wallet.
To get started with, please make sure: - You have a Binance account - You have passed KYB - You have a sufficient balance(Gift Card amount and fee amount) in your Binance funding wallet - You need Enable Withdrawals for the API Key which requests this endpoint.
https://developers.binance.com/docs/gift_card/market-data/Create-a-dual-token-gift-card :param baseToken: The token you want to pay, example: BUSD :type baseToken: str :param faceToken: The token you want to buy, example: BNB. If faceToken = baseToken, it’s the same as createCode endpoint. :type faceToken: str :param discount: Stablecoin-denominated card discount percentage, Example: 1 for 1% discount. Scale should be less than 6. :type discount: float :return: api response .. code-block:: python
- {
“code”: “000000”, “message”: “success”, “data”: {
“referenceNo”: “0033002144060553”, “code”: “6H9EKF5ECCWFBHGE”, “expiredTime”: 1727417154000
}, “success”: true
}
- gift_card_fetch_rsa_public_key(**params)[source]
This API is for fetching the RSA Public Key. This RSA Public key will be used to encrypt the card code.
Important Note: The RSA Public key fetched is valid only for the current day.
https://developers.binance.com/docs/gift_card/market-data/Fetch-RSA-Public-Key :param recvWindow: The receive window for the request in milliseconds (optional) :type recvWindow: int :return: api response .. code-block:: python
- {
“code”: “000000”, “message”: “success”, “data”: “MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCXBBVKLAc1GQ5FsIFFqOHrPTox5noBONIKr+IAedTR9FkVxq6e65updEbfdhRNkMOeYIO2i0UylrjGC0X8YSoIszmrVHeV0l06Zh1oJuZos1+7N+WLuz9JvlPaawof3GUakTxYWWCa9+8KIbLKsoKMdfS96VT+8iOXO3quMGKUmQIDAQAB”, “success”: true
}
- gift_card_fetch_token_limit(**params)[source]
Verify which tokens are available for you to create Stablecoin-Denominated gift cards https://developers.binance.com/docs/gift_card/market-data/Fetch-Token-Limit
- Parameters:
baseToken (str) – The token you want to pay, example: BUSD
- Returns:
api response
- gift_card_redeem(**params)[source]
This API is for redeeming a Binance Gift Card. Once redeemed, the coins will be deposited in your funding wallet.
Important Note: If you enter the wrong redemption code 5 times within 24 hours, you will no longer be able to redeem any Binance Gift Cards that day.
Code Format Options: - Plaintext - Encrypted (Recommended for better security)
For encrypted format: 1. Fetch RSA public key from the RSA public key endpoint 2. Encrypt the code using algorithm: RSA/ECB/OAEPWithSHA-256AndMGF1Padding
https://developers.binance.com/docs/gift_card/market-data/Redeem-a-Binance-Gift-Card :param code: Redemption code of Binance Gift Card to be redeemed, supports both Plaintext & Encrypted code :type code: str :param externalUid: External unique ID representing a user on the partner platform.
Helps identify redemption behavior and control risks/limits. Max 400 characters. (optional)
- Parameters:
recvWindow (int) – The receive window for the request in milliseconds (optional)
- Returns:
api response
- gift_card_verify(**params)[source]
This API is for verifying whether the Binance Gift Card is valid or not by entering Gift Card Number.
Important Note: If you enter the wrong Gift Card Number 5 times within an hour, you will no longer be able to verify any Gift Card Number for that hour.
- Parameters:
referenceNo (str) – Enter the Gift Card Number
- Returns:
api response
- isolated_margin_stream_close(symbol, listenKey)[source]
Close out an isolated margin data stream.
- Parameters:
symbol (str) – required - symbol for the isolated margin account
listenKey (str) – required
- Returns:
API response
{}- Raises:
BinanceRequestException, BinanceAPIException
- isolated_margin_stream_get_listen_key(symbol)[source]
Start a new isolated margin data stream and return the listen key If a stream already exists it should return the same key. If the stream becomes invalid a new key is returned.
Can be used to keep the stream alive.
- Parameters:
symbol (str) – required - symbol for the isolated margin account
- Returns:
API response
{ "listenKey": "T3ee22BIYuWqmvne0HNq2A2WsFlEtLhvWCtItw6ffhhdmjifQ2tRbuKkTHhr" }
- Raises:
BinanceRequestException, BinanceAPIException
- isolated_margin_stream_keepalive(symbol, listenKey)[source]
PING an isolated margin data stream to prevent a time out.
- Parameters:
symbol (str) – required - symbol for the isolated margin account
listenKey (str) – required
- Returns:
API response
{}- Raises:
BinanceRequestException, BinanceAPIException
- make_subaccount_futures_transfer(**params)[source]
Futures Transfer for Sub-account (For Master Account)
https://developers.binance.com/docs/sub_account/asset-management
- Parameters:
email (str) – required - Sub account email
asset (str) – required - The asset being transferred, e.g., USDT
amount (float) – required - The amount to be transferred
type (int) – required - 1: transfer from subaccount’s spot account to its USDT-margined futures account 2: transfer from subaccount’s USDT-margined futures account to its spot account 3: transfer from subaccount’s spot account to its COIN-margined futures account 4: transfer from subaccount’s COIN-margined futures account to its spot account
- Returns:
API response
{ "txnId":"2966662589" }
- Raises:
BinanceRequestException, BinanceAPIException
- make_subaccount_margin_transfer(**params)[source]
Margin Transfer for Sub-account (For Master Account)
https://developers.binance.com/docs/sub_account/asset-management/Margin-Transfer-for-Sub-account
- Parameters:
email (str) – required - Sub account email
asset (str) – required - The asset being transferred, e.g., USDT
amount (float) – required - The amount to be transferred
type (int) – required - 1: transfer from subaccount’s spot account to margin account 2: transfer from subaccount’s margin account to its spot account
- Returns:
API response
{ "txnId":"2966662589" }
- Raises:
BinanceRequestException, BinanceAPIException
- make_subaccount_to_master_transfer(**params)[source]
Transfer to Master (For Sub-account)
https://developers.binance.com/docs/sub_account/asset-management/Transfer-to-Master
- Parameters:
asset (str) – required - The asset being transferred, e.g., USDT
amount (float) – required - The amount to be transferred
recvWindow (int) – optional
- Returns:
API response
{ "txnId":"2966662589" }
- Raises:
BinanceRequestException, BinanceAPIException
- make_subaccount_to_subaccount_transfer(**params)[source]
Transfer to Sub-account of Same Master (For Sub-account)
- Parameters:
toEmail (str) – required - Sub account email
asset (str) – required - The asset being transferred, e.g., USDT
amount (float) – required - The amount to be transferred
recvWindow (int) – optional
- Returns:
API response
{ "txnId":"2966662589" }
- Raises:
BinanceRequestException, BinanceAPIException
- make_subaccount_universal_transfer(**params)[source]
Universal Transfer (For Master Account)
https://developers.binance.com/docs/sub_account/asset-management/Universal-Transfer
- Parameters:
fromEmail (str) – optional
toEmail (str) – optional
fromAccountType (str) – required - “SPOT”,”USDT_FUTURE”,”COIN_FUTURE”
toAccountType (str) – required - “SPOT”,”USDT_FUTURE”,”COIN_FUTURE”
asset (str) – required - The asset being transferred, e.g., USDT
amount (float) – required
recvWindow (int) – optional
- Returns:
API response
{ "tranId":11945860693 }
- Raises:
BinanceRequestException, BinanceAPIException
- make_universal_transfer(**params)[source]
User Universal Transfer
https://developers.binance.com/docs/wallet/asset/user-universal-transfer
- Parameters:
type (str (ENUM)) – required
asset (str) – required
amount (str) – required
recvWindow (int) – the number of milliseconds the request is valid for
transfer_status = client.make_universal_transfer(params)
- Returns:
API response
{ "tranId":13526853623 }
- Raises:
BinanceRequestException, BinanceAPIException
- margin_borrow_repay(**params)[source]
Margin Account Borrow/Repay (MARGIN)
https://developers.binance.com/docs/margin_trading/borrow-and-repay/Margin-Account-Borrow-Repay
- Parameters:
asset (str) – required
amount (float) – required
isIsolated (str) – optional - for isolated margin or not, “TRUE”, “FALSE”, default “FALSE”
symbol (str) – optional - isolated symbol
type (str - BORROW or REPAY) – str
- Returns:
API response
- margin_create_listen_token(symbol: str | None = None, is_isolated: bool = False, validity: int | None = None)[source]
Create a listenToken for margin account user data stream
- Parameters:
symbol (str) – Trading pair symbol (required when is_isolated=True)
is_isolated (bool) – Whether it is isolated margin (default: False for cross-margin)
validity (int) – Validity in milliseconds (default: 24 hours, max: 24 hours)
- Returns:
API response with token and expirationTime
{ "token": "6xXxePXwZRjVSHKhzUCCGnmN3fkvMTXru+pYJS8RwijXk9Vcyr3rkwfVOTcP2OkONqciYA", "expirationTime": 1758792204196 }
- Raises:
BinanceRequestException, BinanceAPIException
- margin_get_borrow_repay_records(**params)[source]
Query Query borrow/repay records in Margin account (USER_DATA)
https://developers.binance.com/docs/margin_trading/borrow-and-repay/Query-Borrow-Repay
- Parameters:
asset (str) – required
isolatedSymbol (str) – optional - isolated symbol
txId (int) – optional - the tranId in POST /sapi/v1/margin/loan
startTime (int) – optional
endTime (int) – optional
current (int) – optional - Currently querying page. Start from 1. Default:1
size (int) – optional - Default:10 Max:100
- Returns:
API response
- {
- “rows”: [
- {
“type”: “AUTO”, // AUTO,MANUAL for Cross Margin Borrow; MANUAL,AUTO,BNB_AUTO_REPAY,POINT_AUTO_REPAY for Cross Margin Repay; AUTO,MANUAL for Isolated Margin Borrow/Repay; “isolatedSymbol”: “BNBUSDT”, // isolated symbol, will not be returned for crossed margin “amount”: “14.00000000”, // Total amount borrowed/repaid “asset”: “BNB”, “interest”: “0.01866667”, // Interest repaid “principal”: “13.98133333”, // Principal repaid “status”: “CONFIRMED”, //one of PENDING (pending execution), CONFIRMED (successfully execution), FAILED (execution failed, nothing happened to your account); “timestamp”: 1563438204000, “txId”: 2970933056
}
], “total”: 1
}
- margin_interest_history(**params)[source]
Get Interest History (USER_DATA)
https://developers.binance.com/docs/margin_trading/borrow-and-repay/Get-Interest-History
- Parameters:
asset (str) – optional
isolatedSymbol (str) – optional - isolated symbol
startTime (int) – optional
endTime (int) – optional
current (int) – optional - Currently querying page. Start from 1. Default:1
size (int) – optional - Default:10 Max:100
- Returns:
API response
- margin_interest_rate_history(**params)[source]
Query Margin Interest Rate History (USER_DATA)
- Parameters:
asset (str) – required
vipLevel (int) – optional
startTime (int) – optional
endTime (int) – optional
- Returns:
API response
- [
- {
“asset”: “BTC”, “dailyInterestRate”: “0.00025000”, “timestamp”: 1611544731000, “vipLevel”: 1
}, {
“asset”: “BTC”, “dailyInterestRate”: “0.00035000”, “timestamp”: 1610248118000, “vipLevel”: 1
}
]
- margin_manual_liquidation(**params)[source]
https://developers.binance.com/docs/margin_trading/trade/Margin-Manual-Liquidation
- Parameters:
type – required
- Returns:
API response
- [
- {
“asset”: “ETH”, “interest”: “0.00083334”, “principal”: “0.001”, “liabilityAsset”: “USDT”, “liabilityQty”: 0.3552
}
]
- margin_max_borrowable(**params)[source]
Query Max Borrow (USER_DATA)
https://developers.binance.com/docs/margin_trading/borrow-and-repay/Query-Max-Borrow
- Parameters:
asset (str) – required
isolatedSymbol (str) – optional - isolated symbol
- Returns:
API response
- {
“amount”: “1.69248805”, // account’s currently max borrowable amount with sufficient system availability “borrowLimit”: “60” // max borrowable amount limited by the account level
}
- margin_next_hourly_interest_rate(**params)[source]
Get future hourly interest rate (USER_DATA)
https://developers.binance.com/docs/margin_trading/borrow-and-repay
- Parameters:
assets (str) – required - List of assets, separated by commas, up to 20
isIsolated (bool) – required - for isolated margin or not, “TRUE”, “FALSE”
- Returns:
API response
- margin_stream_close(listenKey)[source]
Close out a cross-margin data stream.
https://developers.binance.com/docs/margin_trading/trade-data-stream/Close-Margin-User-Data-Stream
- Parameters:
listenKey (str) – required
- Returns:
API response
{}- Raises:
BinanceRequestException, BinanceAPIException
- margin_stream_get_listen_key()[source]
Start a new cross-margin data stream and return the listen key If a stream already exists it should return the same key. If the stream becomes invalid a new key is returned.
Can be used to keep the stream alive.
https://developers.binance.com/docs/margin_trading/trade-data-stream/Start-Margin-User-Data-Stream
- Returns:
API response
{ "listenKey": "pqia91ma19a5s61cv6a81va65sdf19v8a65a1a5s61cv6a81va65sdf19v8a65a1" }
- Raises:
BinanceRequestException, BinanceAPIException
- margin_stream_keepalive(listenKey)[source]
PING a cross-margin data stream to prevent a time out.
- Parameters:
listenKey (str) – required
- Returns:
API response
{}- Raises:
BinanceRequestException, BinanceAPIException
- margin_v1_delete_account_api_restrictions_ip_restriction_ip_list(**params)[source]
Placeholder function for DELETE /sapi/v1/account/apiRestrictions/ipRestriction/ipList. Note: This function was auto-generated. Any issue please open an issue on GitHub.
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- margin_v1_delete_algo_spot_order(**params)[source]
Placeholder function for DELETE /sapi/v1/algo/spot/order. Note: This function was auto-generated. Any issue please open an issue on GitHub.
https://developers.binance.com/docs/algo/spot-algo/Cancel-Algo-Order
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- margin_v1_delete_broker_sub_account_api(**params)[source]
Placeholder function for DELETE /sapi/v1/broker/subAccountApi. Note: This function was auto-generated. Any issue please open an issue on GitHub.
https://developers.binance.com/docs/binance_link/exchange-link/account/Delete-Sub-Account-Api-Key
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- margin_v1_delete_broker_sub_account_api_ip_restriction_ip_list(**params)[source]
Placeholder function for DELETE /sapi/v1/broker/subAccountApi/ipRestriction/ipList. Note: This function was auto-generated. Any issue please open an issue on GitHub.
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- margin_v1_delete_sub_account_sub_account_api_ip_restriction_ip_list(**params)[source]
Placeholder function for DELETE /sapi/v1/sub-account/subAccountApi/ipRestriction/ipList. Note: This function was auto-generated. Any issue please open an issue on GitHub.
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- margin_v1_get_account_api_restrictions_ip_restriction(**params)[source]
Placeholder function for GET /sapi/v1/account/apiRestrictions/ipRestriction. Note: This function was auto-generated. Any issue please open an issue on GitHub.
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- margin_v1_get_account_info(**params)[source]
Placeholder function for GET /sapi/v1/account/info. Note: This function was auto-generated. Any issue please open an issue on GitHub.
https://developers.binance.com/docs/wallet/account
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- margin_v1_get_algo_spot_historical_orders(**params)[source]
Placeholder function for GET /sapi/v1/algo/spot/historicalOrders. Note: This function was auto-generated. Any issue please open an issue on GitHub.
https://developers.binance.com/docs/algo/spot-algo/Query-Historical-Algo-Orders
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- margin_v1_get_algo_spot_open_orders(**params)[source]
Placeholder function for GET /sapi/v1/algo/spot/openOrders. Note: This function was auto-generated. Any issue please open an issue on GitHub.
https://developers.binance.com/docs/algo/spot-algo/Query-Current-Algo-Open-Orders
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- margin_v1_get_algo_spot_sub_orders(**params)[source]
Placeholder function for GET /sapi/v1/algo/spot/subOrders. Note: This function was auto-generated. Any issue please open an issue on GitHub.
https://developers.binance.com/docs/algo/spot-algo/Query-Sub-Orders
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- margin_v1_get_asset_custody_transfer_history(**params)[source]
Placeholder function for GET /sapi/v1/asset/custody/transfer-history. Note: This function was auto-generated. Any issue please open an issue on GitHub.
https://developers.binance.com/docs/wallet/asset/query-user-delegation
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- margin_v1_get_asset_ledger_transfer_cloud_mining_query_by_page(**params)[source]
Placeholder function for GET /sapi/v1/asset/ledger-transfer/cloud-mining/queryByPage. Note: This function was auto-generated. Any issue please open an issue on GitHub.
https://developers.binance.com/docs/wallet/asset/cloud-mining-payment-and-refund-history
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- margin_v1_get_asset_wallet_balance(**params)[source]
Placeholder function for GET /sapi/v1/asset/wallet/balance. Note: This function was auto-generated. Any issue please open an issue on GitHub.
https://developers.binance.com/docs/wallet/asset/query-user-wallet-balance
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- margin_v1_get_broker_rebate_futures_recent_record(**params)[source]
Placeholder function for GET /sapi/v1/broker/rebate/futures/recentRecord. Note: This function was auto-generated. Any issue please open an issue on GitHub.
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- margin_v1_get_broker_rebate_historical_record(**params)[source]
Placeholder function for GET /sapi/v1/broker/rebate/historicalRecord. Note: This function was auto-generated. Any issue please open an issue on GitHub.
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- margin_v1_get_broker_rebate_recent_record(**params)[source]
Placeholder function for GET /sapi/v1/broker/rebate/recentRecord. Note: This function was auto-generated. Any issue please open an issue on GitHub.
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- margin_v1_get_broker_sub_account(**params)[source]
Placeholder function for GET /sapi/v1/broker/subAccount. Note: This function was auto-generated. Any issue please open an issue on GitHub.
https://developers.binance.com/docs/binance_link/exchange-link/account/Query-Sub-Account
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- margin_v1_get_broker_sub_account_api(**params)[source]
Placeholder function for GET /sapi/v1/broker/subAccountApi. Note: This function was auto-generated. Any issue please open an issue on GitHub.
https://developers.binance.com/docs/binance_link/exchange-link/account/Query-Sub-Account-Api-Key
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- margin_v1_get_broker_sub_account_api_commission_coin_futures(**params)[source]
Placeholder function for GET /sapi/v1/broker/subAccountApi/commission/coinFutures. Note: This function was auto-generated. Any issue please open an issue on GitHub.
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- margin_v1_get_broker_sub_account_api_commission_futures(**params)[source]
Placeholder function for GET /sapi/v1/broker/subAccountApi/commission/futures. Note: This function was auto-generated. Any issue please open an issue on GitHub.
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- margin_v1_get_broker_sub_account_api_ip_restriction(**params)[source]
Placeholder function for GET /sapi/v1/broker/subAccountApi/ipRestriction. Note: This function was auto-generated. Any issue please open an issue on GitHub.
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- margin_v1_get_broker_sub_account_bnb_burn_status(**params)[source]
Placeholder function for GET /sapi/v1/broker/subAccount/bnbBurn/status. Note: This function was auto-generated. Any issue please open an issue on GitHub.
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- margin_v1_get_broker_sub_account_deposit_hist(**params)[source]
Placeholder function for GET /sapi/v1/broker/subAccount/depositHist. Note: This function was auto-generated. Any issue please open an issue on GitHub.
https://developers.binance.com/docs/binance_link/exchange-link/asset/Get-Sub-Account-Deposit-History
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- margin_v1_get_broker_sub_account_futures_summary(**params)[source]
Placeholder function for GET /sapi/v1/broker/subAccount/futuresSummary. Note: This function was auto-generated. Any issue please open an issue on GitHub.
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- margin_v1_get_broker_sub_account_margin_summary(**params)[source]
Placeholder function for GET /sapi/v1/broker/subAccount/marginSummary. Note: This function was auto-generated. Any issue please open an issue on GitHub.
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- margin_v1_get_broker_sub_account_spot_summary(**params)[source]
Placeholder function for GET /sapi/v1/broker/subAccount/spotSummary. Note: This function was auto-generated. Any issue please open an issue on GitHub.
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- margin_v1_get_broker_transfer(**params)[source]
Placeholder function for GET /sapi/v1/broker/transfer. Note: This function was auto-generated. Any issue please open an issue on GitHub.
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- margin_v1_get_broker_transfer_futures(**params)[source]
Placeholder function for GET /sapi/v1/broker/transfer/futures. Note: This function was auto-generated. Any issue please open an issue on GitHub.
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- margin_v1_get_broker_universal_transfer(**params)[source]
Placeholder function for GET /sapi/v1/broker/universalTransfer. Note: This function was auto-generated. Any issue please open an issue on GitHub.
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- margin_v1_get_capital_contract_convertible_coins(**params)[source]
Placeholder function for GET /sapi/v1/capital/contract/convertible-coins. Note: This function was auto-generated. Any issue please open an issue on GitHub.
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- margin_v1_get_capital_deposit_address_list(**params)[source]
Placeholder function for GET /sapi/v1/capital/deposit/address/list. Note: This function was auto-generated. Any issue please open an issue on GitHub.
https://developers.binance.com/docs/wallet/capital/deposite-address
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- margin_v1_get_convert_asset_info(**params)[source]
Placeholder function for GET /sapi/v1/convert/assetInfo. Note: This function was auto-generated. Any issue please open an issue on GitHub.
https://developers.binance.com/docs/convert/market-data/Query-order-quantity-precision-per-asset
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- margin_v1_get_convert_exchange_info(**params)[source]
Placeholder function for GET /sapi/v1/convert/exchangeInfo. Note: This function was auto-generated. Any issue please open an issue on GitHub.
https://developers.binance.com/docs/convert/market-data
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- margin_v1_get_convert_limit_query_open_orders(**params)[source]
Placeholder function for GET /sapi/v1/convert/limit/queryOpenOrders. Note: This function was auto-generated. Any issue please open an issue on GitHub.
https://developers.binance.com/docs/convert/trade/Query-Order
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- margin_v1_get_convert_order_status(**params)[source]
Placeholder function for GET /sapi/v1/convert/orderStatus. Note: This function was auto-generated. Any issue please open an issue on GitHub.
https://developers.binance.com/docs/convert/trade/Order-Status
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- margin_v1_get_copy_trading_futures_lead_symbol(**params)[source]
Placeholder function for GET /sapi/v1/copyTrading/futures/leadSymbol. Note: This function was auto-generated. Any issue please open an issue on GitHub.
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- margin_v1_get_copy_trading_futures_user_status(**params)[source]
Placeholder function for GET /sapi/v1/copyTrading/futures/userStatus. Note: This function was auto-generated. Any issue please open an issue on GitHub.
https://developers.binance.com/docs/copy_trading/future-copy-trading
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- margin_v1_get_dci_product_accounts(**params)[source]
Placeholder function for GET /sapi/v1/dci/product/accounts. Note: This function was auto-generated. Any issue please open an issue on GitHub.
https://developers.binance.com/docs/dual_investment/trade/Check-Dual-Investment-accounts
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- margin_v1_get_dci_product_list(**params)[source]
Placeholder function for GET /sapi/v1/dci/product/list. Note: This function was auto-generated. Any issue please open an issue on GitHub.
https://developers.binance.com/docs/dual_investment/market-data
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- margin_v1_get_dci_product_positions(**params)[source]
Placeholder function for GET /sapi/v1/dci/product/positions. Note: This function was auto-generated. Any issue please open an issue on GitHub.
https://developers.binance.com/docs/dual_investment/trade/Get-Dual-Investment-positions
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- margin_v1_get_eth_staking_eth_history_redemption_history(**params)[source]
Placeholder function for GET /sapi/v1/eth-staking/eth/history/redemptionHistory. Note: This function was auto-generated. Any issue please open an issue on GitHub.
https://developers.binance.com/docs/staking/eth-staking/history/Get-ETH-redemption-history
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- margin_v1_get_eth_staking_eth_history_staking_history(**params)[source]
Placeholder function for GET /sapi/v1/eth-staking/eth/history/stakingHistory. Note: This function was auto-generated. Any issue please open an issue on GitHub.
https://developers.binance.com/docs/staking/eth-staking/history
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- margin_v1_get_eth_staking_eth_history_wbeth_rewards_history(**params)[source]
Placeholder function for GET /sapi/v1/eth-staking/eth/history/wbethRewardsHistory. Note: This function was auto-generated. Any issue please open an issue on GitHub.
https://developers.binance.com/docs/staking/eth-staking/history/Get-WBETH-rewards-history
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- margin_v1_get_lending_auto_invest_all_asset(**params)[source]
Placeholder function for GET /sapi/v1/lending/auto-invest/all/asset. Note: This function was auto-generated. Any issue please open an issue on GitHub.
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- margin_v1_get_lending_auto_invest_history_list(**params)[source]
Placeholder function for GET /sapi/v1/lending/auto-invest/history/list. Note: This function was auto-generated. Any issue please open an issue on GitHub.
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- margin_v1_get_lending_auto_invest_index_info(**params)[source]
Placeholder function for GET /sapi/v1/lending/auto-invest/index/info. Note: This function was auto-generated. Any issue please open an issue on GitHub.
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- margin_v1_get_lending_auto_invest_index_user_summary(**params)[source]
Placeholder function for GET /sapi/v1/lending/auto-invest/index/user-summary. Note: This function was auto-generated. Any issue please open an issue on GitHub.
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- margin_v1_get_lending_auto_invest_one_off_status(**params)[source]
Placeholder function for GET /sapi/v1/lending/auto-invest/one-off/status. Note: This function was auto-generated. Any issue please open an issue on GitHub.
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- margin_v1_get_lending_auto_invest_plan_id(**params)[source]
Placeholder function for GET /sapi/v1/lending/auto-invest/plan/id. Note: This function was auto-generated. Any issue please open an issue on GitHub.
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- margin_v1_get_lending_auto_invest_plan_list(**params)[source]
Placeholder function for GET /sapi/v1/lending/auto-invest/plan/list. Note: This function was auto-generated. Any issue please open an issue on GitHub.
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- margin_v1_get_lending_auto_invest_rebalance_history(**params)[source]
Placeholder function for GET /sapi/v1/lending/auto-invest/rebalance/history. Note: This function was auto-generated. Any issue please open an issue on GitHub.
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- margin_v1_get_lending_auto_invest_redeem_history(**params)[source]
Placeholder function for GET /sapi/v1/lending/auto-invest/redeem/history. Note: This function was auto-generated. Any issue please open an issue on GitHub.
https://developers.binance.com/docs/wallet/travel-rule/withdraw-history
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- margin_v1_get_lending_auto_invest_source_asset_list(**params)[source]
Placeholder function for GET /sapi/v1/lending/auto-invest/source-asset/list. Note: This function was auto-generated. Any issue please open an issue on GitHub.
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- margin_v1_get_lending_auto_invest_target_asset_list(**params)[source]
Placeholder function for GET /sapi/v1/lending/auto-invest/target-asset/list. Note: This function was auto-generated. Any issue please open an issue on GitHub.
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- margin_v1_get_lending_auto_invest_target_asset_roi_list(**params)[source]
Placeholder function for GET /sapi/v1/lending/auto-invest/target-asset/roi/list. Note: This function was auto-generated. Any issue please open an issue on GitHub.
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- margin_v1_get_loan_borrow_history(**params)[source]
Placeholder function for GET /sapi/v1/loan/borrow/history. Note: This function was auto-generated. Any issue please open an issue on GitHub.
https://developers.binance.com/docs/crypto_loan/stable-rate/user-information
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- margin_v1_get_loan_collateral_data(**params)[source]
Placeholder function for GET /sapi/v1/loan/collateral/data. Note: This function was auto-generated. Any issue please open an issue on GitHub.
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- margin_v1_get_loan_income(**params)[source]
Placeholder function for GET /sapi/v1/loan/income. Note: This function was auto-generated. Any issue please open an issue on GitHub.
https://developers.binance.com/docs/crypto_loan/stable-rate/market-data
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- margin_v1_get_loan_loanable_data(**params)[source]
Placeholder function for GET /sapi/v1/loan/loanable/data. Note: This function was auto-generated. Any issue please open an issue on GitHub.
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- margin_v1_get_loan_ltv_adjustment_history(**params)[source]
Placeholder function for GET /sapi/v1/loan/ltv/adjustment/history. Note: This function was auto-generated. Any issue please open an issue on GitHub.
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- margin_v1_get_loan_ongoing_orders(**params)[source]
Placeholder function for GET /sapi/v1/loan/ongoing/orders. Note: This function was auto-generated. Any issue please open an issue on GitHub.
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- margin_v1_get_loan_repay_collateral_rate(**params)[source]
Placeholder function for GET /sapi/v1/loan/repay/collateral/rate. Note: This function was auto-generated. Any issue please open an issue on GitHub.
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- margin_v1_get_loan_repay_history(**params)[source]
Placeholder function for GET /sapi/v1/loan/repay/history. Note: This function was auto-generated. Any issue please open an issue on GitHub.
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- margin_v1_get_loan_vip_collateral_account(**params)[source]
Placeholder function for GET /sapi/v1/loan/vip/collateral/account. Note: This function was auto-generated. Any issue please open an issue on GitHub.
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- margin_v1_get_loan_vip_loanable_data(**params)[source]
Placeholder function for GET /sapi/v1/loan/vip/loanable/data. Note: This function was auto-generated. Any issue please open an issue on GitHub.
https://developers.binance.com/docs/vip_loan/market-data/Get-Loanable-Assets-Data
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- margin_v1_get_loan_vip_ongoing_orders(**params)[source]
Placeholder function for GET /sapi/v1/loan/vip/ongoing/orders. Note: This function was auto-generated. Any issue please open an issue on GitHub.
GET /sapi/v1/loan/vip/ongoing/orders
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- margin_v1_get_loan_vip_repay_history(**params)[source]
Placeholder function for GET /sapi/v1/loan/vip/repay/history. Note: This function was auto-generated. Any issue please open an issue on GitHub.
https://developers.binance.com/docs/vip_loan/user-information/Get-VIP-Loan-Repayment-History
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- margin_v1_get_loan_vip_request_interest_rate(**params)[source]
Placeholder function for GET /sapi/v1/loan/vip/request/interestRate. Note: This function was auto-generated. Any issue please open an issue on GitHub.
https://developers.binance.com/docs/vip_loan/market-data
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- margin_v1_get_localentity_deposit_history(**params)[source]
Placeholder function for GET /sapi/v1/localentity/deposit/history. Note: This function was auto-generated. Any issue please open an issue on GitHub.
https://developers.binance.com/docs/wallet/travel-rule/deposit-history
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- margin_v1_get_localentity_vasp(**params)[source]
Placeholder function for GET /sapi/v1/localentity/vasp. Note: This function was auto-generated. Any issue please open an issue on GitHub.
https://developers.binance.com/docs/wallet/travel-rule/onboarded-vasp-list
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- margin_v1_get_localentity_withdraw_history(**params)[source]
Placeholder function for GET /sapi/v1/localentity/withdraw/history. Note: This function was auto-generated. Any issue please open an issue on GitHub.
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- margin_v1_get_managed_subaccount_account_snapshot(**params)[source]
Placeholder function for GET /sapi/v1/managed-subaccount/accountSnapshot. Note: This function was auto-generated. Any issue please open an issue on GitHub.
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- margin_v1_get_managed_subaccount_asset(**params)[source]
Placeholder function for GET /sapi/v1/managed-subaccount/asset. Note: This function was auto-generated. Any issue please open an issue on GitHub.
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- margin_v1_get_managed_subaccount_deposit_address(**params)[source]
Placeholder function for GET /sapi/v1/managed-subaccount/deposit/address. Note: This function was auto-generated. Any issue please open an issue on GitHub.
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- margin_v1_get_managed_subaccount_fetch_future_asset(**params)[source]
Placeholder function for GET /sapi/v1/managed-subaccount/fetch-future-asset. Note: This function was auto-generated. Any issue please open an issue on GitHub.
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- margin_v1_get_managed_subaccount_info(**params)[source]
Placeholder function for GET /sapi/v1/managed-subaccount/info. Note: This function was auto-generated. Any issue please open an issue on GitHub.
https://developers.binance.com/docs/sub_account/managed-sub-account/Query-Managed-Sub-account-List
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- margin_v1_get_managed_subaccount_margin_asset(**params)[source]
Placeholder function for GET /sapi/v1/managed-subaccount/marginAsset. Note: This function was auto-generated. Any issue please open an issue on GitHub.
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- margin_v1_get_managed_subaccount_query_trans_log(**params)[source]
Placeholder function for GET /sapi/v1/managed-subaccount/query-trans-log. Note: This function was auto-generated. Any issue please open an issue on GitHub.
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- margin_v1_get_managed_subaccount_query_trans_log_for_investor(**params)[source]
Placeholder function for GET /sapi/v1/managed-subaccount/queryTransLogForInvestor. Note: This function was auto-generated. Any issue please open an issue on GitHub.
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- margin_v1_get_managed_subaccount_query_trans_log_for_trade_parent(**params)[source]
Placeholder function for GET /sapi/v1/managed-subaccount/queryTransLogForTradeParent. Note: This function was auto-generated. Any issue please open an issue on GitHub.
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- margin_v1_get_margin_all_order_list(**params)[source]
Placeholder function for GET /sapi/v1/margin/allOrderList. Note: This function was auto-generated. Any issue please open an issue on GitHub.
https://developers.binance.com/docs/margin_trading/trade/Query-Margin-Account-All-OCO
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- margin_v1_get_margin_available_inventory(**params)[source]
Placeholder function for GET /sapi/v1/margin/available-inventory. Note: This function was auto-generated. Any issue please open an issue on GitHub.
https://developers.binance.com/docs/margin_trading/market-data/Query-margin-avaliable-inventory
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- margin_v1_get_margin_delist_schedule(**params)[source]
Placeholder function for GET /sapi/v1/margin/delist-schedule. Note: This function was auto-generated. Any issue please open an issue on GitHub.
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- margin_v1_get_margin_leverage_bracket(**params)[source]
Placeholder function for GET /sapi/v1/margin/leverageBracket. Note: This function was auto-generated. Any issue please open an issue on GitHub.
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- margin_v1_get_margin_rate_limit_order(**params)[source]
Placeholder function for GET /sapi/v1/margin/rateLimit/order. Note: This function was auto-generated. Any issue please open an issue on GitHub.
https://developers.binance.com/docs/margin_trading/trade/Query-Current-Margin-Order-Count-Usage
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- margin_v1_get_margin_trade_coeff(**params)[source]
Placeholder function for GET /sapi/v1/margin/tradeCoeff. Note: This function was auto-generated. Any issue please open an issue on GitHub.
https://developers.binance.com/docs/margin_trading/account/Get-Summary-Of-Margin-Account
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- margin_v1_get_mining_hash_transfer_config_details_list(**params)[source]
Placeholder function for GET /sapi/v1/mining/hash-transfer/config/details/list. Note: This function was auto-generated. Any issue please open an issue on GitHub.
https://developers.binance.com/docs/mining/rest-api/Hashrate-Resale-List
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- margin_v1_get_mining_hash_transfer_profit_details(**params)[source]
Placeholder function for GET /sapi/v1/mining/hash-transfer/profit/details. Note: This function was auto-generated. Any issue please open an issue on GitHub.
https://developers.binance.com/docs/mining/rest-api/Hashrate-Resale-Detail
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- margin_v1_get_mining_payment_list(**params)[source]
Placeholder function for GET /sapi/v1/mining/payment/list. Note: This function was auto-generated. Any issue please open an issue on GitHub.
https://developers.binance.com/docs/mining/rest-api/Earnings-List
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- margin_v1_get_mining_payment_other(**params)[source]
Placeholder function for GET /sapi/v1/mining/payment/other. Note: This function was auto-generated. Any issue please open an issue on GitHub.
https://developers.binance.com/docs/mining/rest-api/Extra-Bonus-List
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- margin_v1_get_mining_payment_uid(**params)[source]
Placeholder function for GET /sapi/v1/mining/payment/uid. Note: This function was auto-generated. Any issue please open an issue on GitHub.
https://developers.binance.com/docs/mining/rest-api/Mining-Account-Earning
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- margin_v1_get_mining_pub_algo_list(**params)[source]
Placeholder function for GET /sapi/v1/mining/pub/algoList. Note: This function was auto-generated. Any issue please open an issue on GitHub.
https://developers.binance.com/docs/mining/rest-api
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- margin_v1_get_mining_pub_coin_list(**params)[source]
Placeholder function for GET /sapi/v1/mining/pub/coinList. Note: This function was auto-generated. Any issue please open an issue on GitHub.
https://developers.binance.com/docs/mining/rest-api/Acquiring-CoinName
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- margin_v1_get_mining_statistics_user_list(**params)[source]
Placeholder function for GET /sapi/v1/mining/statistics/user/list. Note: This function was auto-generated. Any issue please open an issue on GitHub.
https://developers.binance.com/docs/mining/rest-api/Account-List
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- margin_v1_get_mining_statistics_user_status(**params)[source]
Placeholder function for GET /sapi/v1/mining/statistics/user/status. Note: This function was auto-generated. Any issue please open an issue on GitHub.
https://developers.binance.com/docs/mining/rest-api/Statistic-List
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- margin_v1_get_mining_worker_detail(**params)[source]
Placeholder function for GET /sapi/v1/mining/worker/detail. Note: This function was auto-generated. Any issue please open an issue on GitHub.
https://developers.binance.com/docs/mining/rest-api/Request-for-Detail-Miner-List
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- margin_v1_get_mining_worker_list(**params)[source]
Placeholder function for GET /sapi/v1/mining/worker/list. Note: This function was auto-generated. Any issue please open an issue on GitHub.
https://developers.binance.com/docs/mining/rest-api/Request-for-Miner-List
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- margin_v1_get_portfolio_balance(**params)[source]
Placeholder function for GET /sapi/v1/portfolio/balance. Note: This function was auto-generated. Any issue please open an issue on GitHub.
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- margin_v1_get_simple_earn_flexible_history_redemption_record(**params)[source]
Placeholder function for GET /sapi/v1/simple-earn/flexible/history/redemptionRecord. Note: This function was auto-generated. Any issue please open an issue on GitHub.
https://developers.binance.com/docs/simple_earn/history/Get-Flexible-Redemption-Record
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- margin_v1_get_simple_earn_flexible_history_subscription_record(**params)[source]
Placeholder function for GET /sapi/v1/simple-earn/flexible/history/subscriptionRecord. Note: This function was auto-generated. Any issue please open an issue on GitHub.
https://developers.binance.com/docs/simple_earn/history
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- margin_v1_get_simple_earn_locked_history_redemption_record(**params)[source]
Placeholder function for GET /sapi/v1/simple-earn/locked/history/redemptionRecord. Note: This function was auto-generated. Any issue please open an issue on GitHub.
https://developers.binance.com/docs/simple_earn/history/Get-Locked-Redemption-Record
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- margin_v1_get_simple_earn_locked_history_subscription_record(**params)[source]
Placeholder function for GET /sapi/v1/simple-earn/locked/history/subscriptionRecord. Note: This function was auto-generated. Any issue please open an issue on GitHub.
https://developers.binance.com/docs/simple_earn/history/Get-Locked-Subscription-Record
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- margin_v1_get_sol_staking_account(**params)[source]
Placeholder function for GET /sapi/v1/sol-staking/account. Note: This function was auto-generated. Any issue please open an issue on GitHub.
https://developers.binance.com/docs/staking/sol-staking/account
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- margin_v1_get_sol_staking_sol_history_bnsol_rewards_history(**params)[source]
Placeholder function for GET /sapi/v1/sol-staking/sol/history/bnsolRewardsHistory. Note: This function was auto-generated. Any issue please open an issue on GitHub.
https://developers.binance.com/docs/staking/sol-staking/history/Get-BNSOL-rewards-history
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- margin_v1_get_sol_staking_sol_history_boost_rewards_history(**params)[source]
Placeholder function for GET /sapi/v1/sol-staking/sol/history/boostRewardsHistory. Note: This function was auto-generated. Any issue please open an issue on GitHub.
https://developers.binance.com/docs/staking/sol-staking/history/Get-Boost-rewards-History
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- margin_v1_get_sol_staking_sol_history_rate_history(**params)[source]
Placeholder function for GET /sapi/v1/sol-staking/sol/history/rateHistory. Note: This function was auto-generated. Any issue please open an issue on GitHub.
https://developers.binance.com/docs/staking/sol-staking/history/Get-BNSOL-Rate-History
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- margin_v1_get_sol_staking_sol_history_redemption_history(**params)[source]
Placeholder function for GET /sapi/v1/sol-staking/sol/history/redemptionHistory. Note: This function was auto-generated. Any issue please open an issue on GitHub.
https://developers.binance.com/docs/staking/sol-staking/history/Get-SOL-redemption-history
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- margin_v1_get_sol_staking_sol_history_staking_history(**params)[source]
Placeholder function for GET /sapi/v1/sol-staking/sol/history/stakingHistory. Note: This function was auto-generated. Any issue please open an issue on GitHub.
https://developers.binance.com/docs/staking/sol-staking/history
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- margin_v1_get_sol_staking_sol_history_unclaimed_rewards(**params)[source]
Placeholder function for GET /sapi/v1/sol-staking/sol/history/unclaimedRewards. Note: This function was auto-generated. Any issue please open an issue on GitHub.
https://developers.binance.com/docs/staking/sol-staking/history/Get-Unclaimed-rewards
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- margin_v1_get_sol_staking_sol_quota(**params)[source]
Placeholder function for GET /sapi/v1/sol-staking/sol/quota. Note: This function was auto-generated. Any issue please open an issue on GitHub.
https://developers.binance.com/docs/staking/sol-staking/account/Get-SOL-staking-quota-details
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- margin_v1_get_spot_delist_schedule(**params)[source]
Placeholder function for GET /sapi/v1/spot/delist-schedule. Note: This function was auto-generated. Any issue please open an issue on GitHub.
https://developers.binance.com/docs/wallet/asset/spot-delist-schedule
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- margin_v1_get_staking_staking_record(**params)[source]
Placeholder function for GET /sapi/v1/staking/stakingRecord. Note: This function was auto-generated. Any issue please open an issue on GitHub.
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- margin_v1_get_sub_account_sub_account_api_ip_restriction(**params)[source]
Placeholder function for GET /sapi/v1/sub-account/subAccountApi/ipRestriction. Note: This function was auto-generated. Any issue please open an issue on GitHub.
https://developers.binance.com/docs/sub_account/api-management
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- margin_v1_get_sub_account_transaction_statistics(**params)[source]
Placeholder function for GET /sapi/v1/sub-account/transaction-statistics. Note: This function was auto-generated. Any issue please open an issue on GitHub.
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- margin_v1_post_account_api_restrictions_ip_restriction(**params)[source]
Placeholder function for POST /sapi/v1/account/apiRestrictions/ipRestriction. Note: This function was auto-generated. Any issue please open an issue on GitHub.
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- margin_v1_post_account_api_restrictions_ip_restriction_ip_list(**params)[source]
Placeholder function for POST /sapi/v1/account/apiRestrictions/ipRestriction/ipList. Note: This function was auto-generated. Any issue please open an issue on GitHub.
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- margin_v1_post_account_disable_fast_withdraw_switch(**params)[source]
Placeholder function for POST /sapi/v1/account/disableFastWithdrawSwitch. Note: This function was auto-generated. Any issue please open an issue on GitHub.
https://developers.binance.com/docs/wallet/account/disable-fast-withdraw-switch
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- margin_v1_post_account_enable_fast_withdraw_switch(**params)[source]
Placeholder function for POST /sapi/v1/account/enableFastWithdrawSwitch. Note: This function was auto-generated. Any issue please open an issue on GitHub.
https://developers.binance.com/docs/wallet/account/enable-fast-withdraw-switch
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- margin_v1_post_algo_futures_new_order_twap(**params)[source]
Placeholder function for POST /sapi/v1/algo/futures/newOrderTwap. Note: This function was auto-generated. Any issue please open an issue on GitHub.
https://developers.binance.com/docs/algo/future-algo/Time-Weighted-Average-Price-New-Order
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- margin_v1_post_algo_futures_new_order_vp(**params)[source]
Placeholder function for POST /sapi/v1/algo/futures/newOrderVp. Note: This function was auto-generated. Any issue please open an issue on GitHub.
https://developers.binance.com/docs/algo/future-algo
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- margin_v1_post_algo_spot_new_order_twap(**params)[source]
Placeholder function for POST /sapi/v1/algo/spot/newOrderTwap. Note: This function was auto-generated. Any issue please open an issue on GitHub.
https://developers.binance.com/docs/algo/spot-algo/Time-Weighted-Average-Price-New-Order
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- margin_v1_post_asset_convert_transfer(**params)[source]
Placeholder function for POST /sapi/v1/asset/convert-transfer. Note: This function was auto-generated. Any issue please open an issue on GitHub.
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- margin_v1_post_asset_convert_transfer_query_by_page(**params)[source]
Placeholder function for POST /sapi/v1/asset/convert-transfer/queryByPage. Note: This function was auto-generated. Any issue please open an issue on GitHub.
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- margin_v1_post_broker_sub_account(**params)[source]
Placeholder function for POST /sapi/v1/broker/subAccount. Note: This function was auto-generated. Any issue please open an issue on GitHub.
https://developers.binance.com/docs/binance_link/exchange-link/account
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- margin_v1_post_broker_sub_account_api(**params)[source]
Placeholder function for POST /sapi/v1/broker/subAccountApi. Note: This function was auto-generated. Any issue please open an issue on GitHub.
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- margin_v1_post_broker_sub_account_api_commission(**params)[source]
Placeholder function for POST /sapi/v1/broker/subAccountApi/commission. Note: This function was auto-generated. Any issue please open an issue on GitHub.
https://developers.binance.com/docs/binance_link/exchange-link/fee
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- margin_v1_post_broker_sub_account_api_commission_coin_futures(**params)[source]
Placeholder function for POST /sapi/v1/broker/subAccountApi/commission/coinFutures. Note: This function was auto-generated. Any issue please open an issue on GitHub.
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- margin_v1_post_broker_sub_account_api_commission_futures(**params)[source]
Placeholder function for POST /sapi/v1/broker/subAccountApi/commission/futures. Note: This function was auto-generated. Any issue please open an issue on GitHub.
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- margin_v1_post_broker_sub_account_api_ip_restriction(**params)[source]
Placeholder function for POST /sapi/v1/broker/subAccountApi/ipRestriction. Note: This function was auto-generated. Any issue please open an issue on GitHub.
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- margin_v1_post_broker_sub_account_api_ip_restriction_ip_list(**params)[source]
Placeholder function for POST /sapi/v1/broker/subAccountApi/ipRestriction/ipList. Note: This function was auto-generated. Any issue please open an issue on GitHub.
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- margin_v1_post_broker_sub_account_api_permission(**params)[source]
Placeholder function for POST /sapi/v1/broker/subAccountApi/permission. Note: This function was auto-generated. Any issue please open an issue on GitHub.
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- margin_v1_post_broker_sub_account_api_permission_universal_transfer(**params)[source]
Placeholder function for POST /sapi/v1/broker/subAccountApi/permission/universalTransfer. Note: This function was auto-generated. Any issue please open an issue on GitHub.
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- margin_v1_post_broker_sub_account_api_permission_vanilla_options(**params)[source]
Placeholder function for POST /sapi/v1/broker/subAccountApi/permission/vanillaOptions. Note: This function was auto-generated. Any issue please open an issue on GitHub.
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- margin_v1_post_broker_sub_account_blvt(**params)[source]
Placeholder function for POST /sapi/v1/broker/subAccount/blvt. Note: This function was auto-generated. Any issue please open an issue on GitHub.
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- margin_v1_post_broker_sub_account_bnb_burn_margin_interest(**params)[source]
Placeholder function for POST /sapi/v1/broker/subAccount/bnbBurn/marginInterest. Note: This function was auto-generated. Any issue please open an issue on GitHub.
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- margin_v1_post_broker_sub_account_bnb_burn_spot(**params)[source]
Placeholder function for POST /sapi/v1/broker/subAccount/bnbBurn/spot. Note: This function was auto-generated. Any issue please open an issue on GitHub.
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- margin_v1_post_broker_transfer(**params)[source]
Placeholder function for POST /sapi/v1/broker/transfer. Note: This function was auto-generated. Any issue please open an issue on GitHub.
https://developers.binance.com/docs/binance_link/exchange-link/asset
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- margin_v1_post_broker_transfer_futures(**params)[source]
Placeholder function for POST /sapi/v1/broker/transfer/futures. Note: This function was auto-generated. Any issue please open an issue on GitHub.
https://developers.binance.com/docs/binance_link/exchange-link/asset/Sub-Account-Transfer-Futures
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- margin_v1_post_broker_universal_transfer(**params)[source]
Placeholder function for POST /sapi/v1/broker/universalTransfer. Note: This function was auto-generated. Any issue please open an issue on GitHub.
https://developers.binance.com/docs/binance_link/exchange-link/asset/Universal-Transfer
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- margin_v1_post_capital_contract_convertible_coins(**params)[source]
Placeholder function for POST /sapi/v1/capital/contract/convertible-coins. Note: This function was auto-generated. Any issue please open an issue on GitHub.
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- margin_v1_post_capital_deposit_credit_apply(**params)[source]
Placeholder function for POST /sapi/v1/capital/deposit/credit-apply. Note: This function was auto-generated. Any issue please open an issue on GitHub.
https://developers.binance.com/docs/wallet/capital/one-click-arrival-deposite-apply
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- margin_v1_post_convert_limit_cancel_order(**params)[source]
Placeholder function for POST /sapi/v1/convert/limit/cancelOrder. Note: This function was auto-generated. Any issue please open an issue on GitHub.
https://developers.binance.com/docs/convert/trade/Cancel-Order
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- margin_v1_post_convert_limit_place_order(**params)[source]
Placeholder function for POST /sapi/v1/convert/limit/placeOrder. Note: This function was auto-generated. Any issue please open an issue on GitHub.
https://developers.binance.com/docs/convert/trade/Place-Order
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- margin_v1_post_dci_product_auto_compound_edit_status(**params)[source]
Placeholder function for POST /sapi/v1/dci/product/auto_compound/edit-status. Note: This function was auto-generated. Any issue please open an issue on GitHub.
https://developers.binance.com/docs/dual_investment/trade/Change-Auto-Compound-status
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- margin_v1_post_dci_product_subscribe(**params)[source]
Placeholder function for POST /sapi/v1/dci/product/subscribe. Note: This function was auto-generated. Any issue please open an issue on GitHub.
https://developers.binance.com/docs/dual_investment/trade
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- margin_v1_post_eth_staking_eth_redeem(**params)[source]
Placeholder function for POST /sapi/v1/eth-staking/eth/redeem. Note: This function was auto-generated. Any issue please open an issue on GitHub.
https://developers.binance.com/docs/staking/eth-staking/staking/Redeem-ETH
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- margin_v1_post_eth_staking_wbeth_unwrap(**params)[source]
Placeholder function for POST /sapi/v1/eth-staking/wbeth/unwrap. Note: This function was auto-generated. Any issue please open an issue on GitHub.
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- margin_v1_post_eth_staking_wbeth_wrap(**params)[source]
Placeholder function for POST /sapi/v1/eth-staking/wbeth/wrap. Note: This function was auto-generated. Any issue please open an issue on GitHub.
https://developers.binance.com/docs/staking/eth-staking/staking/Wrap-BETH
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- margin_v1_post_lending_auto_invest_one_off(**params)[source]
Placeholder function for POST /sapi/v1/lending/auto-invest/one-off. Note: This function was auto-generated. Any issue please open an issue on GitHub.
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- margin_v1_post_lending_auto_invest_plan_add(**params)[source]
Placeholder function for POST /sapi/v1/lending/auto-invest/plan/add. Note: This function was auto-generated. Any issue please open an issue on GitHub.
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- margin_v1_post_lending_auto_invest_plan_edit_status(**params)[source]
Placeholder function for POST /sapi/v1/lending/auto-invest/plan/edit-status. Note: This function was auto-generated. Any issue please open an issue on GitHub.
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- margin_v1_post_lending_auto_invest_redeem(**params)[source]
Placeholder function for POST /sapi/v1/lending/auto-invest/redeem. Note: This function was auto-generated. Any issue please open an issue on GitHub.
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- margin_v1_post_lending_customized_fixed_purchase(**params)[source]
Placeholder function for POST /sapi/v1/lending/customizedFixed/purchase. Note: This function was auto-generated. Any issue please open an issue on GitHub.
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- margin_v1_post_lending_daily_purchase(**params)[source]
Placeholder function for POST /sapi/v1/lending/daily/purchase. Note: This function was auto-generated. Any issue please open an issue on GitHub.
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- margin_v1_post_lending_daily_redeem(**params)[source]
Placeholder function for POST /sapi/v1/lending/daily/redeem. Note: This function was auto-generated. Any issue please open an issue on GitHub.
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- margin_v1_post_loan_adjust_ltv(**params)[source]
Placeholder function for POST /sapi/v1/loan/adjust/ltv. Note: This function was auto-generated. Any issue please open an issue on GitHub.
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- margin_v1_post_loan_borrow(**params)[source]
Placeholder function for POST /sapi/v1/loan/borrow. Note: This function was auto-generated. Any issue please open an issue on GitHub.
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- margin_v1_post_loan_customize_margin_call(**params)[source]
Placeholder function for POST /sapi/v1/loan/customize/margin_call. Note: This function was auto-generated. Any issue please open an issue on GitHub.
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- margin_v1_post_loan_flexible_repay_history(**params)[source]
Placeholder function for POST /sapi/v1/loan/flexible/repay/history. Note: This function was auto-generated. Any issue please open an issue on GitHub.
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- margin_v1_post_loan_repay(**params)[source]
Placeholder function for POST /sapi/v1/loan/repay. Note: This function was auto-generated. Any issue please open an issue on GitHub.
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- margin_v1_post_loan_vip_borrow(**params)[source]
Placeholder function for POST /sapi/v1/loan/vip/borrow. Note: This function was auto-generated. Any issue please open an issue on GitHub.
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- margin_v1_post_loan_vip_renew(**params)[source]
Placeholder function for POST /sapi/v1/loan/vip/renew. Note: This function was auto-generated. Any issue please open an issue on GitHub.
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- margin_v1_post_loan_vip_repay(**params)[source]
Placeholder function for POST /sapi/v1/loan/vip/repay. Note: This function was auto-generated. Any issue please open an issue on GitHub.
https://developers.binance.com/docs/vip_loan/trade/VIP-Loan-Repay
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- margin_v1_post_localentity_withdraw_apply(**params)[source]
Placeholder function for POST /sapi/v1/localentity/withdraw/apply. Note: This function was auto-generated. Any issue please open an issue on GitHub.
https://developers.binance.com/docs/wallet/travel-rule/withdraw
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- margin_v1_post_managed_subaccount_deposit(**params)[source]
Placeholder function for POST /sapi/v1/managed-subaccount/deposit. Note: This function was auto-generated. Any issue please open an issue on GitHub.
https://developers.binance.com/docs/sub_account/managed-sub-account
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- margin_v1_post_managed_subaccount_withdraw(**params)[source]
Placeholder function for POST /sapi/v1/managed-subaccount/withdraw. Note: This function was auto-generated. Any issue please open an issue on GitHub.
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- margin_v1_post_mining_hash_transfer_config(**params)[source]
Placeholder function for POST /sapi/v1/mining/hash-transfer/config. Note: This function was auto-generated. Any issue please open an issue on GitHub.
https://developers.binance.com/docs/mining/rest-api/Hashrate-Resale-Request
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- margin_v1_post_mining_hash_transfer_config_cancel(**params)[source]
Placeholder function for POST /sapi/v1/mining/hash-transfer/config/cancel. Note: This function was auto-generated. Any issue please open an issue on GitHub.
https://developers.binance.com/docs/mining/rest-api/Cancel-hashrate-resale-configuration
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- margin_v1_post_portfolio_mint(**params)[source]
Placeholder function for POST /sapi/v1/portfolio/mint. Note: This function was auto-generated. Any issue please open an issue on GitHub.
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- margin_v1_post_portfolio_redeem(**params)[source]
Placeholder function for POST /sapi/v1/portfolio/redeem. Note: This function was auto-generated. Any issue please open an issue on GitHub.
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- margin_v1_post_portfolio_repay_futures_switch(**params)[source]
Placeholder function for POST /sapi/v1/portfolio/repay-futures-switch. Note: This function was auto-generated. Any issue please open an issue on GitHub.
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- margin_v1_post_simple_earn_locked_set_redeem_option(**params)[source]
Placeholder function for POST /sapi/v1/simple-earn/locked/setRedeemOption. Note: This function was auto-generated. Any issue please open an issue on GitHub.
https://developers.binance.com/docs/simple_earn/earn/Set-Locked-Redeem-Option
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- margin_v1_post_sol_staking_sol_claim(**params)[source]
Placeholder function for POST /sapi/v1/sol-staking/sol/claim. Note: This function was auto-generated. Any issue please open an issue on GitHub.
https://developers.binance.com/docs/staking/sol-staking/staking/Claim-Boost-rewards
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- margin_v1_post_sol_staking_sol_redeem(**params)[source]
Placeholder function for POST /sapi/v1/sol-staking/sol/redeem. Note: This function was auto-generated. Any issue please open an issue on GitHub.
https://developers.binance.com/docs/staking/sol-staking/staking/Redeem-SOL
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- margin_v1_post_sol_staking_sol_stake(**params)[source]
Placeholder function for POST /sapi/v1/sol-staking/sol/stake. Note: This function was auto-generated. Any issue please open an issue on GitHub.
https://developers.binance.com/docs/staking/sol-staking/staking
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- margin_v1_post_sub_account_blvt_enable(**params)[source]
Placeholder function for POST /sapi/v1/sub-account/blvt/enable. Note: This function was auto-generated. Any issue please open an issue on GitHub.
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- margin_v1_post_sub_account_eoptions_enable(**params)[source]
Placeholder function for POST /sapi/v1/sub-account/eoptions/enable. Note: This function was auto-generated. Any issue please open an issue on GitHub.
https://developers.binance.com/docs/sub_account/account-management/Enable-Options-for-Sub-account
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- margin_v1_post_sub_account_sub_account_api_ip_restriction(**params)[source]
Placeholder function for POST /sapi/v1/sub-account/subAccountApi/ipRestriction. Note: This function was auto-generated. Any issue please open an issue on GitHub.
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- margin_v1_post_sub_account_sub_account_api_ip_restriction_ip_list(**params)[source]
Placeholder function for POST /sapi/v1/sub-account/subAccountApi/ipRestriction/ipList. Note: This function was auto-generated. Any issue please open an issue on GitHub.
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- margin_v1_post_sub_account_virtual_sub_account(**params)[source]
Placeholder function for POST /sapi/v1/sub-account/virtualSubAccount. Note: This function was auto-generated. Any issue please open an issue on GitHub.
https://developers.binance.com/docs/sub_account/account-management
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- margin_v1_put_localentity_deposit_provide_info(**params)[source]
Placeholder function for PUT /sapi/v1/localentity/deposit/provide-info. Note: This function was auto-generated. Any issue please open an issue on GitHub.
https://developers.binance.com/docs/wallet/travel-rule/deposit-provide-info
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- margin_v2_get_broker_sub_account_futures_summary(**params)[source]
Placeholder function for GET /sapi/v2/broker/subAccount/futuresSummary. Note: This function was auto-generated. Any issue please open an issue on GitHub.
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- margin_v2_get_eth_staking_account(**params)[source]
Placeholder function for GET /sapi/v2/eth-staking/account. Note: This function was auto-generated. Any issue please open an issue on GitHub.
https://developers.binance.com/docs/staking/eth-staking/account
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- margin_v2_get_loan_flexible_borrow_history(**params)[source]
Placeholder function for GET /sapi/v2/loan/flexible/borrow/history. Note: This function was auto-generated. Any issue please open an issue on GitHub.
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- margin_v2_get_loan_flexible_collateral_data(**params)[source]
Placeholder function for GET /sapi/v2/loan/flexible/collateral/data. Note: This function was auto-generated. Any issue please open an issue on GitHub.
https://developers.binance.com/docs/crypto_loan/flexible-rate/market-data
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- margin_v2_get_loan_flexible_loanable_data(**params)[source]
Placeholder function for GET /sapi/v2/loan/flexible/loanable/data. Note: This function was auto-generated. Any issue please open an issue on GitHub.
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- margin_v2_get_loan_flexible_ltv_adjustment_history(**params)[source]
Placeholder function for GET /sapi/v2/loan/flexible/ltv/adjustment/history. Note: This function was auto-generated. Any issue please open an issue on GitHub.
https://developers.binance.com/docs/crypto_loan/flexible-rate/user-information
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- margin_v2_get_loan_flexible_ongoing_orders(**params)[source]
Placeholder function for GET /sapi/v2/loan/flexible/ongoing/orders. Note: This function was auto-generated. Any issue please open an issue on GitHub.
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- margin_v2_get_loan_flexible_repay_history(**params)[source]
Placeholder function for GET /sapi/v2/loan/flexible/repay/history. Note: This function was auto-generated. Any issue please open an issue on GitHub.
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- margin_v2_get_loan_flexible_repay_rate(**params)[source]
Placeholder function for GET /sapi/v2/loan/flexible/repay/rate. Note: This function was auto-generated. Any issue please open an issue on GitHub.
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- margin_v2_get_localentity_withdraw_history(**params)[source]
Placeholder function for GET /sapi/v2/localentity/withdraw/history. Note: This function was auto-generated. Any issue please open an issue on GitHub.
https://developers.binance.com/docs/wallet/travel-rule/withdraw-history-v2
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- margin_v2_get_portfolio_account(**params)[source]
Placeholder function for GET /sapi/v2/portfolio/account. Note: This function was auto-generated. Any issue please open an issue on GitHub.
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- margin_v2_get_portfolio_collateral_rate(**params)[source]
Placeholder function for GET /sapi/v2/portfolio/collateralRate. Note: This function was auto-generated. Any issue please open an issue on GitHub.
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- margin_v2_post_broker_sub_account_api_ip_restriction(**params)[source]
Placeholder function for POST /sapi/v2/broker/subAccountApi/ipRestriction. Note: This function was auto-generated. Any issue please open an issue on GitHub.
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- margin_v2_post_eth_staking_eth_stake(**params)[source]
Placeholder function for POST /sapi/v2/eth-staking/eth/stake. Note: This function was auto-generated. Any issue please open an issue on GitHub.
https://developers.binance.com/docs/staking/eth-staking/staking
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- margin_v2_post_loan_flexible_adjust_ltv(**params)[source]
Placeholder function for POST /sapi/v2/loan/flexible/adjust/ltv. Note: This function was auto-generated. Any issue please open an issue on GitHub.
https://developers.binance.com/docs/crypto_loan/flexible-rate/trade/Flexible-Loan-Adjust-LTV
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- margin_v2_post_loan_flexible_borrow(**params)[source]
Placeholder function for POST /sapi/v2/loan/flexible/borrow. Note: This function was auto-generated. Any issue please open an issue on GitHub.
https://developers.binance.com/docs/crypto_loan/flexible-rate/trade
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- margin_v2_post_loan_flexible_repay(**params)[source]
Placeholder function for POST /sapi/v2/loan/flexible/repay. Note: This function was auto-generated. Any issue please open an issue on GitHub.
https://developers.binance.com/docs/crypto_loan/flexible-rate/trade/Flexible-Loan-Repay
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- margin_v2_post_sub_account_sub_account_api_ip_restriction(**params)[source]
Placeholder function for POST /sapi/v2/sub-account/subAccountApi/ipRestriction. Note: This function was auto-generated. Any issue please open an issue on GitHub.
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- margin_v3_get_broker_sub_account_futures_summary(**params)[source]
Placeholder function for GET /sapi/v3/broker/subAccount/futuresSummary. Note: This function was auto-generated. Any issue please open an issue on GitHub.
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- new_transfer_history(**params)[source]
Get future account transaction history list
https://developers.binance.com/docs/wallet/asset/query-user-universal-transfer
- options_accept_block_trade_order(**params)[source]
Accept Block Trade Order (TRADE)
Accept a block trade order.
- Parameters:
blockOrderMatchingKey (str) – required - Block Order Matching Key
recvWindow (int) – optional - The value cannot be greater than 60000
- Returns:
API response
- Raises:
BinanceRequestException, BinanceAPIException
- options_account_get_block_trades(**params)[source]
Account Block Trade List (USER_DATA)
Gets block trades for a specific account.
- Parameters:
endTime (int) – optional
startTime (int) – optional
underlying (str) – optional
recvWindow (int) – optional - The value cannot be greater than 60000
- Returns:
API response
- Raises:
BinanceRequestException, BinanceAPIException
- options_account_info(**params)[source]
Account asset info (USER_DATA)
https://developers.binance.com/docs/derivatives/option/account
- Parameters:
recvWindow (int) – optional
- options_bill(**params)[source]
Account funding flow (USER_DATA)
https://binance-docs.github.io/apidocs/voptions/en/#account-funding-flow-user_data
- Parameters:
currency (str) – required - Asset type - USDT
recordId (int) – optional - Return the recordId and subsequent data, the latest data is returned by default - 100000
startTime (int) – optional - Start Time - 1593511200000
endTime (int) – optional - End Time - 1593511200000
limit (int) – optional - Number of result sets returned Default:100 Max:1000 - 100
recvWindow (int) – optional
- options_cancel_all_orders(**params)[source]
Cancel all Option orders (TRADE)
- Parameters:
symbol (str) – required - Option trading pair - BTC-200730-9000-C
recvWindow (int) – optional
- options_cancel_batch_order(**params)[source]
Cancel Multiple Option orders (TRADE)
https://developers.binance.com/docs/derivatives/option/trade/Cancel-Multiple-Option-Orders
- Parameters:
symbol (str) – required - Option trading pair - BTC-200730-9000-C
orderIds – optional - Order ID - [4611875134427365377,4611875134427365378]
clientOrderIds (list) – optional - User-defined order ID - [“my_id_1”,”my_id_2”]
recvWindow (int) – optional
- options_cancel_block_trade_order(**params)[source]
Cancel Block Trade Order (TRADE)
- Parameters:
blockOrderMatchingKey (str) – required - Block Order Matching Key
recvWindow (int) – optional - The value cannot be greater than 60000
- Returns:
API response
- Raises:
BinanceRequestException, BinanceAPIException
- options_cancel_order(**params)[source]
Cancel Option order (TRADE)
https://developers.binance.com/docs/derivatives/option/trade/Cancel-Option-Order
- Parameters:
symbol (str) – required - Option trading pair - BTC-200730-9000-C
orderId (str) – optional - Order ID - 4611875134427365377
clientOrderId (str) – optional - User-defined order ID - 10000
recvWindow (int) – optional
- options_create_block_trade_order(**params)[source]
New Block Trade Order (TRADE)
https://developers.binance.com/docs/derivatives/option/market-maker-block-trade
- Parameters:
liquidity (str) – required - Taker or Maker
symbol (str) – required - Option trading pair, e.g BTC-200730-9000-C
side (str) – required - BUY or SELL
price (float) – required - Order Price
quantity (float) – required - Order Quantity
recvWindow (int) – optional - The value cannot be greater than 60000
- Returns:
API response
- Raises:
BinanceRequestException, BinanceAPIException
- options_exchange_info()[source]
Get current limit info and trading pair info
https://developers.binance.com/docs/derivatives/option/market-data/Exchange-Information
- options_exercise_record(**params)[source]
Get account exercise records.
https://developers.binance.com/docs/derivatives/option/trade/User-Exercise-Record
- Parameters:
symbol (str) – optional
startTime (int) – optional
endTime (int) – optional
limit (int) – optional
recvWindow (int) – optional
- Returns:
API response
- options_extend_block_trade_order(**params)[source]
Extend Block Trade Order (TRADE)
Extends a block trade expire time by 30 mins from the current time.
- Parameters:
blockOrderMatchingKey (str) – required - Block Order Matching Key
recvWindow (int) – optional - The value cannot be greater than 60000
- Returns:
API response
- Raises:
BinanceRequestException, BinanceAPIException
- options_funds_transfer(**params)[source]
Funds transfer (USER_DATA)
https://binance-docs.github.io/apidocs/voptions/en/#funds-transfer-user_data
- Parameters:
currency (str) – required - Asset type - USDT
type (str (ENUM)) – required - IN: Transfer from spot account to option account OUT: Transfer from option account to spot account - IN
amount (float) – required - Amount - 10000
recvWindow (int) – optional
- options_get_bill(**params)[source]
Get account funding flows
https://developers.binance.com/docs/derivatives/option/account/Account-Funding-Flow
- Parameters:
currency (str) – required
recordId (int) – optional
startTime (int) – optional
endTime (int) – optional
limit (int) – optional
recvWindow (int) – optional
- Returns:
API response
- options_get_block_trade_order(**params)[source]
Query Block Trade Details (USER_DATA)
Query block trade details; returns block trade details from counterparty’s perspective.
- Parameters:
blockOrderMatchingKey (str) – required - Block Order Matching Key
recvWindow (int) – optional - The value cannot be greater than 60000
- Returns:
API response
- Raises:
BinanceRequestException, BinanceAPIException
- options_get_block_trade_orders(**params)[source]
Query Block Trade Order (TRADE)
Check block trade order status.
- Parameters:
blockOrderMatchingKey (str) – optional - Returns specific block trade for this key
endTime (int) – optional
startTime (int) – optional
underlying (str) – optional
recvWindow (int) – optional - The value cannot be greater than 60000
- Returns:
API response
- Raises:
BinanceRequestException, BinanceAPIException
- options_get_market_maker_protection_config(**params)[source]
Get config for MMP.
- Parameters:
underlying (str) – required
recvWindow (int) – optional
- options_historical_trades(**params)[source]
Query trade history
https://developers.binance.com/docs/derivatives/option/market-data/Old-Trades-Lookup
- Parameters:
symbol (str) – required - Option trading pair - BTC-200730-9000-C
fromId (int) – optional - The deal ID from which to return. The latest deal record is returned by default - 1592317127349
limit (int) – optional - Number of records Default:100 Max:500 - 100
- options_index_price(**params)[source]
Get the spot index price
https://developers.binance.com/docs/derivatives/option/market-data/Symbol-Price-Ticker
- Parameters:
underlying (str) – required - Spot pair(Option contract underlying asset)- BTCUSDT
- options_info()[source]
Get current trading pair info
https://binance-docs.github.io/apidocs/voptions/en/#get-current-trading-pair-info
- options_klines(**params)[source]
Candle data
https://developers.binance.com/docs/derivatives/option/market-data/Kline-Candlestick-Data
- Parameters:
symbol (str) – required - Option trading pair - BTC-200730-9000-C
interval (str) – required - Time interval - 5m
startTime (int) – optional - Start Time - 1592317127349
endTime (int) – optional - End Time - 1592317127349
limit (int) – optional - Number of records Default:500 Max:1500 - 500
- options_mark_price(**params)[source]
Get the latest mark price
https://developers.binance.com/docs/derivatives/option/market-data/Option-Mark-Price
- Parameters:
symbol (str) – optional - Option trading pair - BTC-200730-9000-C
- options_open_interest(**params)[source]
Get present open interest specific underlying asset on specific expiration date.
https://developers.binance.com/docs/derivatives/option/market-data/Open-Interest
- Parameters:
params (dict) – parameters required by the endpoint
underlyingAsset (str) – required
expiration (str) – required (e.g ‘221225’)
- options_order_book(**params)[source]
Depth information
https://developers.binance.com/docs/derivatives/option/market-data/Order-Book
- Parameters:
symbol (str) – required - Option trading pair - BTC-200730-9000-C
limit (int) – optional - Default:100 Max:1000.Optional value:[10, 20, 50, 100, 500, 1000] - 100
- options_ping()[source]
Test connectivity
https://developers.binance.com/docs/derivatives/option/market-data/Test-Connectivity
- options_place_batch_order(**params)[source]
Place Multiple Option orders (TRADE)
https://developers.binance.com/docs/derivatives/option/trade/Place-Multiple-Orders
- Parameters:
orders (list) – required - order list. Max 5 orders - [{“symbol”:”BTC-210115-35000-C”,”price”:”100”,”quantity”:”0.0001”,”side”:”BUY”,”type”:”LIMIT”}]
recvWindow (int) – optional
- options_place_order(**params)[source]
Option order (TRADE)
https://developers.binance.com/docs/derivatives/option/trade
- Parameters:
symbol (str) – required - Option trading pair - BTC-200730-9000-C
side (str (ENUM)) – required - Buy/sell direction: SELL, BUY - BUY
type (str (ENUM)) – required - Order Type: LIMIT, MARKET - LIMIT
quantity (float) – required - Order Quantity - 3
price (float) – optional - Order Price - 1000
timeInForce (str (ENUM)) – optional - Time in force method(Default GTC) - GTC
reduceOnly (bool) – optional - Reduce Only (Default false) - false
postOnly (bool) – optional - Post Only (Default false) - false
newOrderRespType (str (ENUM)) – optional - “ACK”, “RESULT”, Default “ACK” - ACK
clientOrderId (str) – optional - User-defined order ID cannot be repeated in pending orders - 10000
recvWindow (int) – optional
- options_positions(**params)[source]
Option holdings info (USER_DATA)
https://developers.binance.com/docs/derivatives/option/trade/Option-Position-Information
- Parameters:
symbol (str) – optional - Option trading pair - BTC-200730-9000-C
recvWindow (int) – optional
- options_post_market_maker_protection_config(**params)[source]
Set config for MMP.
- Parameters:
underlying (str) – required
windowTimeInMilliseconds (int) – required
frozenTimeInMilliseconds (int) – required
qtyLimit (decimal) – required
deltaLimit (decimal) – required
recvWindow (int) – optional
- options_price(**params)[source]
Get the latest price
- Parameters:
symbol (str) – optional - Option trading pair - BTC-200730-9000-C
- options_query_order(**params)[source]
Query Option order (TRADE)
https://developers.binance.com/docs/derivatives/option/trade/Query-Single-Order
- Parameters:
symbol (str) – required - Option trading pair - BTC-200730-9000-C
orderId (str) – optional - Order ID - 4611875134427365377
clientOrderId (str) – optional - User-defined order ID - 10000
recvWindow (int) – optional
- options_query_order_history(**params)[source]
Query Option order history (TRADE)
https://developers.binance.com/docs/derivatives/option/trade/Query-Option-Order-History
- Parameters:
symbol (str) – required - Option trading pair - BTC-200730-9000-C
orderId (str) – optional - Returns the orderId and subsequent orders, the most recent order is returned by default - 100000
startTime (int) – optional - Start Time - 1593511200000
endTime (int) – optional - End Time - 1593511200000
limit (int) – optional - Number of result sets returned Default:100 Max:1000 - 100
recvWindow (int) – optional
- options_query_pending_orders(**params)[source]
Query current pending Option orders (TRADE)
https://developers.binance.com/docs/derivatives/option/trade/Query-Current-Open-Option-Orders
- Parameters:
symbol (str) – required - Option trading pair - BTC-200730-9000-C
orderId (str) – optional - Returns the orderId and subsequent orders, the most recent order is returned by default - 100000
startTime (int) – optional - Start Time - 1593511200000
endTime (int) – optional - End Time - 1593511200000
limit (int) – optional - Number of result sets returned Default:100 Max:1000 - 100
recvWindow (int) – optional
- options_recent_trades(**params)[source]
Recently completed Option trades
https://developers.binance.com/docs/derivatives/option/market-data/Recent-Trades-List
- Parameters:
symbol (str) – required - Option trading pair - BTC-200730-9000-C
limit (int) – optional - Number of records Default:100 Max:500 - 100
- options_reset_market_maker_protection_config(**params)[source]
Reset MMP, start MMP order again.
- Parameters:
underlying (str) – required
recvWindow (int) – optional
- options_time()[source]
Get server time
https://developers.binance.com/docs/derivatives/option/market-data
- options_user_trades(**params)[source]
Option Trade List (USER_DATA)
https://developers.binance.com/docs/derivatives/option/trade/Account-Trade-List
- Parameters:
symbol (str) – required - Option trading pair - BTC-200730-9000-C
fromId (int) – optional - Trade id to fetch from. Default gets most recent trades. - 4611875134427365376
startTime (int) – optional - Start Time - 1593511200000
endTime (int) – optional - End Time - 1593511200000
limit (int) – optional - Number of result sets returned Default:100 Max:1000 - 100
recvWindow (int) – optional
- options_v1_delete_all_open_orders_by_underlying(**params)[source]
Placeholder function for DELETE /eapi/v1/allOpenOrdersByUnderlying. Note: This function was auto-generated. Any issue please open an issue on GitHub.
https://developers.binance.com/docs/derivatives/option/trade/Cancel-All-Option-Orders-By-Underlying
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- options_v1_get_block_trades(**params)[source]
Placeholder function for GET /eapi/v1/blockTrades. Note: This function was auto-generated. Any issue please open an issue on GitHub.
https://developers.binance.com/docs/derivatives/option/market-data/Recent-Block-Trade-List
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- options_v1_get_countdown_cancel_all(**params)[source]
Placeholder function for GET /eapi/v1/countdownCancelAll. Note: This function was auto-generated. Any issue please open an issue on GitHub.
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- options_v1_get_exercise_history(**params)[source]
Placeholder function for GET /eapi/v1/exerciseHistory. Note: This function was auto-generated. Any issue please open an issue on GitHub.
https://developers.binance.com/docs/derivatives/option/market-data/Historical-Exercise-Records
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- options_v1_get_income_asyn(**params)[source]
Placeholder function for GET /eapi/v1/income/asyn. Note: This function was auto-generated. Any issue please open an issue on GitHub.
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- options_v1_get_income_asyn_id(**params)[source]
Placeholder function for GET /eapi/v1/income/asyn/id. Note: This function was auto-generated. Any issue please open an issue on GitHub.
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- options_v1_get_margin_account(**params)[source]
Placeholder function for GET /eapi/v1/marginAccount. Note: This function was auto-generated. Any issue please open an issue on GitHub.
https://developers.binance.com/docs/derivatives/option/market-maker-endpoints
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- options_v1_post_countdown_cancel_all(**params)[source]
Placeholder function for POST /eapi/v1/countdownCancelAll. Note: This function was auto-generated. Any issue please open an issue on GitHub.
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- options_v1_post_countdown_cancel_all_heart_beat(**params)[source]
Placeholder function for POST /eapi/v1/countdownCancelAllHeartBeat. Note: This function was auto-generated. Any issue please open an issue on GitHub.
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- order_limit(timeInForce='GTC', **params)[source]
Send in a new limit order
https://developers.binance.com/docs/binance-spot-api-docs/rest-api/trading-endpoints#new-order-trade
Any order with an icebergQty MUST have timeInForce set to GTC.
- Parameters:
symbol (str) – required
side (str) – required
quantity (decimal) – required
price (str) – required
timeInForce (str) – default Good till cancelled
newClientOrderId (str) – A unique id for the order. Automatically generated if not sent.
icebergQty (decimal) – Used with LIMIT, STOP_LOSS_LIMIT, and TAKE_PROFIT_LIMIT to create an iceberg order.
newOrderRespType (str) – Set the response JSON. ACK, RESULT, or FULL; default: RESULT.
recvWindow (int) – the number of milliseconds the request is valid for
- Returns:
API response
See order endpoint for full response options
- Raises:
BinanceRequestException, BinanceAPIException, BinanceOrderException, BinanceOrderMinAmountException, BinanceOrderMinPriceException, BinanceOrderMinTotalException, BinanceOrderUnknownSymbolException, BinanceOrderInactiveSymbolException
- order_limit_buy(timeInForce='GTC', **params)[source]
Send in a new limit buy order
https://developers.binance.com/docs/binance-spot-api-docs/rest-api/trading-endpoints#new-order-trade
Any order with an icebergQty MUST have timeInForce set to GTC.
- Parameters:
symbol (str) – required
quantity (decimal) – required
price (str) – required
timeInForce (str) – default Good till cancelled
newClientOrderId (str) – A unique id for the order. Automatically generated if not sent.
stopPrice (decimal) – Used with stop orders
icebergQty (decimal) – Used with iceberg orders
newOrderRespType (str) – Set the response JSON. ACK, RESULT, or FULL; default: RESULT.
recvWindow (int) – the number of milliseconds the request is valid for
- Returns:
API response
See order endpoint for full response options
- Raises:
BinanceRequestException, BinanceAPIException, BinanceOrderException, BinanceOrderMinAmountException, BinanceOrderMinPriceException, BinanceOrderMinTotalException, BinanceOrderUnknownSymbolException, BinanceOrderInactiveSymbolException
- order_limit_sell(timeInForce='GTC', **params)[source]
Send in a new limit sell order
https://developers.binance.com/docs/binance-spot-api-docs/rest-api/trading-endpoints#new-order-trade
- Parameters:
symbol (str) – required
quantity (decimal) – required
price (str) – required
timeInForce (str) – default Good till cancelled
newClientOrderId (str) – A unique id for the order. Automatically generated if not sent.
stopPrice (decimal) – Used with stop orders
icebergQty (decimal) – Used with iceberg orders
newOrderRespType (str) – Set the response JSON. ACK, RESULT, or FULL; default: RESULT.
recvWindow (int) – the number of milliseconds the request is valid for
- Returns:
API response
See order endpoint for full response options
- Raises:
BinanceRequestException, BinanceAPIException, BinanceOrderException, BinanceOrderMinAmountException, BinanceOrderMinPriceException, BinanceOrderMinTotalException, BinanceOrderUnknownSymbolException, BinanceOrderInactiveSymbolException
- order_market(**params)[source]
Send in a new market order
https://developers.binance.com/docs/binance-spot-api-docs/rest-api/trading-endpoints#new-order-trade
- Parameters:
symbol (str) – required
side (str) – required
quantity (decimal) – required
quoteOrderQty (decimal) – amount the user wants to spend (when buying) or receive (when selling) of the quote asset
newClientOrderId (str) – A unique id for the order. Automatically generated if not sent.
newOrderRespType (str) – Set the response JSON. ACK, RESULT, or FULL; default: RESULT.
recvWindow (int) – the number of milliseconds the request is valid for
- Returns:
API response
See order endpoint for full response options
- Raises:
BinanceRequestException, BinanceAPIException, BinanceOrderException, BinanceOrderMinAmountException, BinanceOrderMinPriceException, BinanceOrderMinTotalException, BinanceOrderUnknownSymbolException, BinanceOrderInactiveSymbolException
- order_market_buy(**params)[source]
Send in a new market buy order
https://developers.binance.com/docs/binance-spot-api-docs/rest-api/trading-endpoints#new-order-trade
- Parameters:
symbol (str) – required
quantity (decimal) – required
quoteOrderQty (decimal) – the amount the user wants to spend of the quote asset
newClientOrderId (str) – A unique id for the order. Automatically generated if not sent.
newOrderRespType (str) – Set the response JSON. ACK, RESULT, or FULL; default: RESULT.
recvWindow (int) – the number of milliseconds the request is valid for
- Returns:
API response
See order endpoint for full response options
- Raises:
BinanceRequestException, BinanceAPIException, BinanceOrderException, BinanceOrderMinAmountException, BinanceOrderMinPriceException, BinanceOrderMinTotalException, BinanceOrderUnknownSymbolException, BinanceOrderInactiveSymbolException
- order_market_sell(**params)[source]
Send in a new market sell order
https://developers.binance.com/docs/binance-spot-api-docs/rest-api/trading-endpoints#new-order-trade
- Parameters:
symbol (str) – required
quantity (decimal) – required
quoteOrderQty (decimal) – the amount the user wants to receive of the quote asset
newClientOrderId (str) – A unique id for the order. Automatically generated if not sent.
newOrderRespType (str) – Set the response JSON. ACK, RESULT, or FULL; default: RESULT.
recvWindow (int) – the number of milliseconds the request is valid for
- Returns:
API response
See order endpoint for full response options
- Raises:
BinanceRequestException, BinanceAPIException, BinanceOrderException, BinanceOrderMinAmountException, BinanceOrderMinPriceException, BinanceOrderMinTotalException, BinanceOrderUnknownSymbolException, BinanceOrderInactiveSymbolException
- order_oco_buy(**params)[source]
Send in a new OCO buy order
- Parameters:
symbol (str) – required
listClientOrderId (str) – A unique id for the list order. Automatically generated if not sent.
quantity (decimal) – required
limitClientOrderId (str) – A unique id for the limit order. Automatically generated if not sent.
price (str) – required
limitIcebergQty (decimal) – Used to make the LIMIT_MAKER leg an iceberg order.
stopClientOrderId (str) – A unique id for the stop order. Automatically generated if not sent.
stopPrice (str) – required
stopLimitPrice (str) – If provided, stopLimitTimeInForce is required.
stopIcebergQty (decimal) – Used with STOP_LOSS_LIMIT leg to make an iceberg order.
stopLimitTimeInForce (str) – Valid values are GTC/FOK/IOC.
newOrderRespType (str) – Set the response JSON. ACK, RESULT, or FULL; default: RESULT.
recvWindow (int) – the number of milliseconds the request is valid for
- Returns:
API response
See OCO order endpoint for full response options
- Raises:
BinanceRequestException, BinanceAPIException, BinanceOrderException, BinanceOrderMinAmountException, BinanceOrderMinPriceException, BinanceOrderMinTotalException, BinanceOrderUnknownSymbolException, BinanceOrderInactiveSymbolException
- order_oco_sell(**params)[source]
Send in a new OCO sell order
- Parameters:
symbol (str) – required
listClientOrderId (str) – A unique id for the list order. Automatically generated if not sent.
quantity (decimal) – required
limitClientOrderId (str) – A unique id for the limit order. Automatically generated if not sent.
price (str) – required
limitIcebergQty (decimal) – Used to make the LIMIT_MAKER leg an iceberg order.
stopClientOrderId (str) – A unique id for the stop order. Automatically generated if not sent.
stopPrice (str) – required
stopLimitPrice (str) – If provided, stopLimitTimeInForce is required.
stopIcebergQty (decimal) – Used with STOP_LOSS_LIMIT leg to make an iceberg order.
stopLimitTimeInForce (str) – Valid values are GTC/FOK/IOC.
newOrderRespType (str) – Set the response JSON. ACK, RESULT, or FULL; default: RESULT.
recvWindow (int) – the number of milliseconds the request is valid for
- Returns:
API response
See OCO order endpoint for full response options
- Raises:
BinanceRequestException, BinanceAPIException, BinanceOrderException, BinanceOrderMinAmountException, BinanceOrderMinPriceException, BinanceOrderMinTotalException, BinanceOrderUnknownSymbolException, BinanceOrderInactiveSymbolException
- papi_bnb_transfer(**params)[source]
Transfer BNB in and out of UM.
https://developers.binance.com/docs/derivatives/portfolio-margin/account/BNB-transfer
- Parameters:
recvWindow (int) – optional
- Returns:
API response
- papi_cancel_cm_all_open_orders(**params)[source]
Cancel an active CM LIMIT order.
https://developers.binance.com/docs/derivatives/portfolio-margin/trade/Cancel-All-CM-Open-Orders
- Returns:
API response
- papi_cancel_cm_conditional_all_open_orders(**params)[source]
Cancel All CM Open Conditional Orders.
- Returns:
API response
- papi_cancel_cm_conditional_order(**params)[source]
Cancel CM Conditional Order.
https://developers.binance.com/docs/derivatives/portfolio-margin/trade/Cancel-CM-Conditional-Order
- Returns:
API response
- papi_cancel_cm_order(**params)[source]
Cancel an active CM LIMIT order.
https://developers.binance.com/docs/derivatives/portfolio-margin/trade/Cancel-CM-Order
- Returns:
API response
- papi_cancel_margin_all_open_orders(**params)[source]
Cancel Margin Account All Open Orders on a Symbol.
- Returns:
API response
- papi_cancel_margin_order(**params)[source]
Cancel Margin Account Order.
https://developers.binance.com/docs/derivatives/portfolio-margin/trade/Cancel-Margin-Account-Order
- Returns:
API response
- papi_cancel_margin_order_list(**params)[source]
Cancel Margin Account OCO Orders.
- Returns:
API response
- papi_cancel_um_all_open_orders(**params)[source]
Cancel an active UM LIMIT order.
https://developers.binance.com/docs/derivatives/portfolio-margin/trade/Cancel-All-UM-Open-Orders
- Returns:
API response
- papi_cancel_um_conditional_all_open_orders(**params)[source]
Cancel All UM Open Conditional Orders.
- Returns:
API response
- papi_cancel_um_conditional_order(**params)[source]
Cancel UM Conditional Order.
https://developers.binance.com/docs/derivatives/portfolio-margin/trade/Cancel-UM-Conditional-Order
- Returns:
API response
- papi_cancel_um_order(**params)[source]
Cancel an active UM LIMIT order.
https://developers.binance.com/docs/derivatives/portfolio-margin/trade/Cancel-UM-Order
- Returns:
API response
- papi_change_cm_position_side_dual(**params)[source]
Change user’s position mode (Hedge Mode or One-way Mode ) on EVERY symbol in CM.
https://developers.binance.com/docs/derivatives/portfolio-margin/account/Change-CM-Position-Mode
- Parameters:
dualSidePosition (str) – required
recvWindow (int) – optional
- Returns:
API response
- papi_change_um_position_side_dual(**params)[source]
Change user’s position mode (Hedge Mode or One-way Mode ) on EVERY symbol in UM.
https://developers.binance.com/docs/derivatives/portfolio-margin/account/Change-UM-Position-Mode
- Parameters:
dualSidePosition (str) – required
recvWindow (int) – optional
- Returns:
API response
- papi_create_cm_conditional_order(**params)[source]
Place new CM Conditional order.
https://developers.binance.com/docs/derivatives/portfolio-margin/trade/New-CM-Conditional-Order
- Returns:
API response
- papi_create_cm_order(**params)[source]
Place new CM order.
https://developers.binance.com/docs/derivatives/portfolio-margin/trade/New-CM-Order
- Returns:
API response
- papi_create_margin_order(**params)[source]
New Margin Order.
https://developers.binance.com/docs/derivatives/portfolio-margin/trade/New-Margin-Order
- Returns:
API response
- papi_create_um_conditional_order(**params)[source]
Place new UM Conditional order.
https://developers.binance.com/docs/derivatives/portfolio-margin/trade/New-UM-Conditional-Order
- Returns:
API response
- papi_create_um_order(**params)[source]
Place new UM order.
https://developers.binance.com/docs/derivatives/portfolio-margin/trade
- Returns:
API response
- papi_fund_asset_collection(**params)[source]
Transfers specific asset from Futures Account to Margin account.
https://developers.binance.com/docs/derivatives/portfolio-margin/account/Fund-Collection-by-Asset
- Parameters:
recvWindow (int) – optional
- Returns:
API response
- papi_fund_auto_collection(**params)[source]
Fund collection for Portfolio Margin.
https://developers.binance.com/docs/derivatives/portfolio-margin/account/Fund-Auto-collection
- Parameters:
recvWindow (int) – optional
- Returns:
API response
- papi_get_account(**params)[source]
Query account information.
https://developers.binance.com/docs/derivatives/portfolio-margin/account/Account-Information
- Parameters:
recvWindow (int) – optional
- Returns:
API response
- papi_get_balance(**params)[source]
Query account balance.
https://developers.binance.com/docs/derivatives/portfolio-margin/account
- Parameters:
asset (str) – required
recvWindow (int) – optional
- Returns:
API response
- papi_get_cm_account(**params)[source]
Get current CM account asset and position information.
https://developers.binance.com/docs/derivatives/portfolio-margin/account/Get-CM-Account-Detail
- Parameters:
recvWindow (int) – optional
- Returns:
API response
- papi_get_cm_adl_quantile(**params)[source]
Query CM Position ADL Quantile Estimation.
- Returns:
API response
- papi_get_cm_all_orders(**params)[source]
Get all account CM orders; active, canceled, or filled.
https://developers.binance.com/docs/derivatives/portfolio-margin/trade/Query-All-CM-Orders
- Returns:
API response
- papi_get_cm_comission_rate(**params)[source]
Get User Commission Rate for CM.
- Parameters:
symbol (str) – required
recvWindow (int) – optional
- Returns:
API response
- papi_get_cm_conditional_all_orders(**params)[source]
Query All CM Conditional Orders.
- Returns:
API response
- papi_get_cm_conditional_open_order(**params)[source]
Query Current UM Open Conditional Order.
- Returns:
API response
- papi_get_cm_conditional_open_orders(**params)[source]
Get all open conditional orders on a symbol.
- Returns:
API response
- papi_get_cm_conditional_order_history(**params)[source]
Get all open conditional orders on a symbol.
- Returns:
API response
- papi_get_cm_force_orders(**params)[source]
Query User’s CM Force Orders.
https://developers.binance.com/docs/derivatives/portfolio-margin/trade/Query-Users-CM-Force-Orders
- Returns:
API response
- papi_get_cm_income_history(**params)[source]
Get CM Income History.
https://developers.binance.com/docs/derivatives/portfolio-margin/account/Get-CM-Income-History
- Parameters:
recvWindow (int) – optional
- Returns:
API response
- papi_get_cm_leverage_bracket(**params)[source]
Query CM notional and leverage brackets.
- Parameters:
symbol (str) – optional
recvWindow (int) – optional
- Returns:
API response
- papi_get_cm_open_order(**params)[source]
Query current CM open order.
https://developers.binance.com/docs/derivatives/portfolio-margin/trade/Query-Current-CM-Open-Order
- Returns:
API response
- papi_get_cm_order(**params)[source]
Check an CM order’s status.
https://developers.binance.com/docs/derivatives/portfolio-margin/trade/Query-CM-Order
- Returns:
API response
- papi_get_cm_order_amendment(**params)[source]
Get order modification history.
https://developers.binance.com/docs/derivatives/portfolio-margin/trade/Query-CM-Modify-Order-History
- Returns:
API response
- papi_get_cm_position_risk(**params)[source]
Query margin max borrow.
- Parameters:
asset (str) – required
recvWindow (int) – optional
- Returns:
API response
- papi_get_cm_position_side_dual(**params)[source]
Get user’s position mode (Hedge Mode or One-way Mode ) on EVERY symbol in CM.
- Parameters:
recvWindow (int) – optional
- Returns:
API response
- papi_get_cm_user_trades(**params)[source]
Get trades for a specific account and CM symbol.
https://developers.binance.com/docs/derivatives/portfolio-margin/trade/CM-Account-Trade-List
- Returns:
API response
- papi_get_margin_all_order_list(**params)[source]
Query all OCO for a specific margin account based on provided optional parameters.
https://developers.binance.com/docs/derivatives/portfolio-margin/trade/Query-Margin-Account-all-OCO
- Returns:
API response
- papi_get_margin_all_orders(**params)[source]
Query All Margin Account Orders.
- Returns:
API response
- papi_get_margin_force_orders(**params)[source]
Query user’s margin force orders.
- Returns:
API response
- papi_get_margin_interest_history(**params)[source]
Get Margin Borrow/Loan Interest History.
- Parameters:
recvWindow (int) – optional
- Returns:
API response
- papi_get_margin_margin_loan(**params)[source]
Query margin loan record.
https://developers.binance.com/docs/derivatives/portfolio-margin/account/Query-Margin-Loan-Record
- Parameters:
asset (str) – required
recvWindow (int) – optional
- Returns:
API response
- papi_get_margin_max_borrowable(**params)[source]
Query margin max borrow.
https://developers.binance.com/docs/derivatives/portfolio-margin/account/Margin-Max-Borrow
- Parameters:
asset (str) – required
recvWindow (int) – optional
- Returns:
API response
- papi_get_margin_max_withdraw(**params)[source]
Query margin max borrow.
https://developers.binance.com/docs/derivatives/portfolio-margin/account/Query-Margin-Max-Withdraw
- Parameters:
asset (str) – required
recvWindow (int) – optional
- Returns:
API response
- papi_get_margin_my_trades(**params)[source]
Margin Account Trade List.
https://developers.binance.com/docs/derivatives/portfolio-margin/trade/Margin-Account-Trade-List
- Returns:
API response
- papi_get_margin_open_order_list(**params)[source]
Query Margin Account’s Open OCO.
https://developers.binance.com/docs/derivatives/portfolio-margin/trade/Query-Margin-Account-Open-OCO
- Returns:
API response
- papi_get_margin_open_orders(**params)[source]
Query Current Margin Open Order.
- Returns:
API response
- papi_get_margin_order(**params)[source]
Query Margin Account Order.
https://developers.binance.com/docs/derivatives/portfolio-margin/trade/Query-Margin-Account-Order
- Returns:
API response
- papi_get_margin_order_list(**params)[source]
Retrieves a specific OCO based on provided optional parameters.
https://developers.binance.com/docs/derivatives/portfolio-margin/trade/Query-Margin-Account-OCO
- Returns:
API response
- papi_get_margin_repay_debt(**params)[source]
Repay debt for a margin loan.
https://developers.binance.com/docs/derivatives/portfolio-margin/trade/Margin-Account-Repay-Debt
- Returns:
API response
- papi_get_margin_repay_loan(**params)[source]
Query margin repay record.
https://developers.binance.com/docs/derivatives/portfolio-margin/account/Query-Margin-repay-Record
- Parameters:
asset (str) – required
recvWindow (int) – optional
- Returns:
API response
- papi_get_portfolio_interest_history(**params)[source]
Query interest history of negative balance for portfolio margin.
- Parameters:
recvWindow (int) – optional
- Returns:
API response
- papi_get_portfolio_negative_balance_exchange_record(**params)[source]
Query user negative balance auto exchange record.
- Parameters:
recvWindow (int) – optional
- Returns:
API response
- papi_get_rate_limit(**params)[source]
Query User Rate Limit
https://developers.binance.com/docs/derivatives/portfolio-margin/account/Query-User-Rate-Limit
- Parameters:
recvWindow (int) – optional
- Returns:
API response
- papi_get_repay_futures_switch(**params)[source]
Query Auto-repay-futures Status.
- Parameters:
recvWindow (int) – optional
- Returns:
API response
- papi_get_um_account(**params)[source]
Get current UM account asset and position information.
https://developers.binance.com/docs/derivatives/portfolio-margin/account/Get-UM-Account-Detail
- Parameters:
recvWindow (int) – optional
- Returns:
API response
- papi_get_um_account_config(**params)[source]
Query UM Futures account configuration.
- Parameters:
recvWindow (int) – optional
- Returns:
API response
- papi_get_um_account_v2(**params)[source]
Get current UM account asset and position information.
https://developers.binance.com/docs/derivatives/portfolio-margin/account/Get-UM-Account-Detail-V2
- Parameters:
recvWindow (int) – optional
- Returns:
API response
- papi_get_um_adl_quantile(**params)[source]
Query UM Position ADL Quantile Estimation.
- Returns:
API response
- papi_get_um_all_orders(**params)[source]
Get all account UM orders; active, canceled, or filled.
https://developers.binance.com/docs/derivatives/portfolio-margin/trade/Query-All-UM-Orders
- Returns:
API response
- papi_get_um_api_trading_status(**params)[source]
Portfolio Margin UM Trading Quantitative Rules Indicators.
- Parameters:
symbol (str) – optional
recvWindow (int) – optional
- Returns:
API response
- papi_get_um_comission_rate(**params)[source]
Get User Commission Rate for UM.
- Parameters:
symbol (str) – required
recvWindow (int) – optional
- Returns:
API response
- papi_get_um_conditional_all_orders(**params)[source]
Query All UM Conditional Orders.
- Returns:
API response
- papi_get_um_conditional_open_order(**params)[source]
Query Current UM Open Conditional Order.
- Returns:
API response
- papi_get_um_conditional_open_orders(**params)[source]
Get all open conditional orders on a symbol.
- Returns:
API response
- papi_get_um_conditional_order_history(**params)[source]
Get all open conditional orders on a symbol.
- Returns:
API response
- papi_get_um_fee_burn(**params)[source]
Get user’s BNB Fee Discount for UM Futures (Fee Discount On or Fee Discount Off).
- Returns:
API response
- papi_get_um_force_orders(**params)[source]
Query User’s UM Force Orders.
https://developers.binance.com/docs/derivatives/portfolio-margin/trade/Query-Users-UM-Force-Orders
- Returns:
API response
- papi_get_um_income_asyn(**params)[source]
Get download id for UM futures transaction history.
- Parameters:
recvWindow (int) – optional
- Returns:
API response
- papi_get_um_income_asyn_id(**params)[source]
Get UM futures Transaction download link by Id.
- Parameters:
recvWindow (int) – optional
- Returns:
API response
- papi_get_um_income_history(**params)[source]
Get UM Income History.
https://developers.binance.com/docs/derivatives/portfolio-margin/account/Get-UM-Income-History
- Parameters:
recvWindow (int) – optional
- Returns:
API response
- papi_get_um_leverage_bracket(**params)[source]
Query UM notional and leverage brackets.
- Parameters:
symbol (str) – optional
recvWindow (int) – optional
- Returns:
API response
- papi_get_um_open_order(**params)[source]
Query current UM open order.
https://developers.binance.com/docs/derivatives/portfolio-margin/trade/Query-Current-UM-Open-Order
- Returns:
API response
- papi_get_um_order(**params)[source]
Check an UM order’s status.
https://developers.binance.com/docs/derivatives/portfolio-margin/trade/Query-UM-Order
- Returns:
API response
- papi_get_um_order_amendment(**params)[source]
Get order modification history.
https://developers.binance.com/docs/derivatives/portfolio-margin/trade/Query-UM-Modify-Order-History
- Returns:
API response
- papi_get_um_order_asyn(**params)[source]
Get download id for UM futures order history.
- Parameters:
recvWindow (int) – optional
- Returns:
API response
- papi_get_um_order_asyn_id(**params)[source]
Get UM futures order download link by Id.
- Parameters:
recvWindow (int) – optional
- Returns:
API response
- papi_get_um_position_risk(**params)[source]
Query margin max borrow.
- Parameters:
symbol (str) – required
recvWindow (int) – optional
- Returns:
API response
- papi_get_um_position_side_dual(**params)[source]
Get user’s position mode (Hedge Mode or One-way Mode ) on EVERY symbol in UM.
- Parameters:
recvWindow (int) – optional
- Returns:
API response
- papi_get_um_symbol_config(**params)[source]
Get current UM account symbol configuration.
- Parameters:
recvWindow (int) – optional
- Returns:
API response
- papi_get_um_trade_asyn(**params)[source]
Get download id for UM futures trade history.
- Parameters:
recvWindow (int) – optional
- Returns:
API response
- papi_get_um_trade_asyn_id(**params)[source]
Get UM futures trade download link by Id.
- Parameters:
recvWindow (int) – optional
- Returns:
API response
- papi_get_um_user_trades(**params)[source]
Get trades for a specific account and UM symbol.
https://developers.binance.com/docs/derivatives/portfolio-margin/trade/UM-Account-Trade-List
- Returns:
API response
- papi_margin_loan(**params)[source]
Apply for a margin loan.
https://developers.binance.com/docs/derivatives/portfolio-margin/trade/Margin-Account-Borrow
- Returns:
API response
- papi_margin_order_oco(**params)[source]
Send in a new OCO for a margin account.
https://developers.binance.com/docs/derivatives/portfolio-margin/trade/Margin-Account-New-OCO
- Returns:
API response
- papi_modify_cm_order(**params)[source]
Order modify function, currently only LIMIT order modification is supported, modified orders will be reordered in the match queue.
https://developers.binance.com/docs/derivatives/portfolio-margin/trade/Modify-CM-Order
- Returns:
API response
- papi_modify_um_order(**params)[source]
Order modify function, currently only LIMIT order modification is supported, modified orders will be reordered in the match queue.
https://developers.binance.com/docs/derivatives/portfolio-margin/trade/Modify-UM-Order
- Returns:
API response
- papi_ping(**params)[source]
Test connectivity to the Rest API.
https://developers.binance.com/docs/derivatives/portfolio-margin/market-data
- Returns:
API response
- papi_repay_futures_negative_balance(**params)[source]
Repay futures Negative Balance.
- Parameters:
recvWindow (int) – optional
- Returns:
API response
- papi_repay_futures_switch(**params)[source]
Change Auto-repay-futures Status.
- Parameters:
autoRepay (str) – required
recvWindow (int) – optional
- Returns:
API response
- papi_repay_loan(**params)[source]
Repay for a margin loan.
https://developers.binance.com/docs/derivatives/portfolio-margin/trade/Margin-Account-Repay
- Returns:
API response
- papi_set_cm_leverage(**params)[source]
Query margin max borrow.
https://developers.binance.com/docs/derivatives/portfolio-margin/account/Change-CM-Initial-Leverage
- Parameters:
asset (str) – required
leverage (int) – required
recvWindow (int) – optional
- Returns:
API response
- papi_set_um_fee_burn(**params)[source]
Change user’s BNB Fee Discount for UM Futures (Fee Discount On or Fee Discount Off ) on EVERY symbol.
- Returns:
API response
- papi_set_um_leverage(**params)[source]
Query margin max borrow.
https://developers.binance.com/docs/derivatives/portfolio-margin/account/Change-UM-Initial-Leverage
- Parameters:
asset (str) – required
leverage (int) – required
recvWindow (int) – optional
- Returns:
API response
- papi_stream_close(listenKey)[source]
Close out a user data stream.
- Returns:
API response
{}
Weight: 1
- papi_stream_get_listen_key()[source]
Start a new user data stream for Portfolio Margin account.
- Returns:
API response
- {
“listenKey”: “pM_XXXXXXX”
}
The stream will close after 60 minutes unless a keepalive is sent. If the account has an active listenKey, that listenKey will be returned and its validity will be extended for 60 minutes.
Weight: 1
- papi_stream_keepalive(listenKey)[source]
Keepalive a user data stream to prevent a time out.
- Returns:
API response
{}
User data streams will close after 60 minutes. It’s recommended to send a ping about every 60 minutes.
Weight: 1
- papi_v1_post_ping(**params)[source]
Placeholder function for POST /papi/v1/ping. Note: This function was auto-generated. Any issue please open an issue on GitHub.
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- ping() Dict[source]
Test connectivity to the Rest API.
- Returns:
Empty array
{}- Raises:
BinanceRequestException, BinanceAPIException
- purchase_staking_product(**params)[source]
Purchase Staking Product
https://binance-docs.github.io/apidocs/spot/en/#purchase-staking-product-user_data
- query_subaccount_spot_summary(**params)[source]
Query Sub-account Spot Assets Summary (For Master Account)
- Parameters:
email (str) – optional - Sub account email
page (int) – optional - default 1
size (int) – optional - default 10, max 20
recvWindow (int) – optional
- Returns:
API response
{ "totalCount":2, "masterAccountTotalAsset": "0.23231201", "spotSubUserAssetBtcVoList":[ { "email":"sub123@test.com", "totalAsset":"9999.00000000" }, { "email":"test456@test.com", "totalAsset":"0.00000000" } ] }
- Raises:
BinanceRequestException, BinanceAPIException
- query_universal_transfer_history(**params)[source]
Query User Universal Transfer History
https://developers.binance.com/docs/wallet/asset/query-user-universal-transfer
- Parameters:
type (str (ENUM)) – required
startTime (int) – optional
endTime (int) – optional
current (int) – optional - Default 1
size (int) – required - Default 10, Max 100
recvWindow (int) – the number of milliseconds the request is valid for
transfer_status = client.query_universal_transfer_history(params)
- Returns:
API response
{ "total":2, "rows":[ { "asset":"USDT", "amount":"1", "type":"MAIN_UMFUTURE" "status": "CONFIRMED", "tranId": 11415955596, "timestamp":1544433328000 }, { "asset":"USDT", "amount":"2", "type":"MAIN_UMFUTURE", "status": "CONFIRMED", "tranId": 11366865406, "timestamp":1544433328000 } ] }
- Raises:
BinanceRequestException, BinanceAPIException
- redeem_simple_earn_flexible_product(**params)[source]
Redeem a simple earn flexible product
https://binance-docs.github.io/apidocs/spot/en/#redeem-flexible-product-trade
- Parameters:
productId (str) – required
amount (str) – optional
redeemAll (bool) – optional - Default False
recvWindow (int) – the number of milliseconds the request is valid for
- Returns:
API response
{ "redeemId": 40607, "success": true }
- Raises:
BinanceRequestException, BinanceAPIException
- redeem_simple_earn_locked_product(**params)[source]
Redeem a simple earn locked product
https://binance-docs.github.io/apidocs/spot/en/#redeem-locked-product-trade
- Parameters:
productId (str) – required
recvWindow (int) – the number of milliseconds the request is valid for
- Returns:
API response
{ "redeemId": 40607, "success": true }
- Raises:
BinanceRequestException, BinanceAPIException
- redeem_staking_product(**params)[source]
Redeem Staking Product
https://binance-docs.github.io/apidocs/spot/en/#redeem-staking-product-user_data
- repay_margin_loan(**params)[source]
Repay loan in cross-margin or isolated-margin account.
If amount is more than the amount borrowed, the full loan will be repaid.
https://binance-docs.github.io/apidocs/spot/en/#margin-account-repay-margin
- Parameters:
asset (str) – name of the asset
amount (str) – amount to transfer
isIsolated (str) – set to ‘TRUE’ for isolated margin (default ‘FALSE’)
symbol (str) – Isolated margin symbol (default blank for cross-margin)
recvWindow (int) – the number of milliseconds the request is valid for
transaction = client.margin_repay_loan(asset='BTC', amount='1.1') transaction = client.margin_repay_loan(asset='BTC', amount='1.1', isIsolated='TRUE', symbol='ETHBTC')
- Returns:
API response
{ "tranId": 100000001 }
- Raises:
BinanceRequestException, BinanceAPIException
- set_auto_staking(**params)[source]
Set Auto Staking on Locked Staking or Locked DeFi Staking
https://binance-docs.github.io/apidocs/spot/en/#set-auto-staking-user_data
- set_margin_max_leverage(**params)[source]
Adjust cross margin max leverage
https://developers.binance.com/docs/margin_trading/account
- Parameters:
maxLeverage (int) – required Can only adjust 3 or 5,Example: maxLeverage=3
- Returns:
API response
- {
“success”: true
}
- Raises:
BinanceRequestException, BinanceAPIException
- stake_asset_us(**params)[source]
Stake a supported asset.
https://docs.binance.us/#stake-asset
- Raises:
BinanceRegionException – If client is not configured for binance.us
- stream_close(listenKey)[source]
Close out a user data stream.
https://binance-docs.github.io/apidocs/spot/en/#listen-key-spot
- Parameters:
listenKey (str) – required
- Returns:
API response
{}- Raises:
BinanceRequestException, BinanceAPIException
- stream_get_listen_key()[source]
Start a new user data stream and return the listen key If a stream already exists it should return the same key. If the stream becomes invalid a new key is returned.
Can be used to keep the user stream alive.
https://binance-docs.github.io/apidocs/spot/en/#listen-key-spot
- Returns:
API response
{ "listenKey": "pqia91ma19a5s61cv6a81va65sdf19v8a65a1a5s61cv6a81va65sdf19v8a65a1" }
- Raises:
BinanceRequestException, BinanceAPIException
- stream_keepalive(listenKey)[source]
PING a user data stream to prevent a time out.
https://binance-docs.github.io/apidocs/spot/en/#listen-key-spot
- Parameters:
listenKey (str) – required
- Returns:
API response
{}- Raises:
BinanceRequestException, BinanceAPIException
- subscribe_simple_earn_flexible_product(**params)[source]
Subscribe to a simple earn flexible product
https://binance-docs.github.io/apidocs/spot/en/#subscribe-locked-product-trade
- Parameters:
productId (str) – required
amount (str) – required
autoSubscribe (bool) – optional - Default True
recvWindow (int) – the number of milliseconds the request is valid for
- Returns:
API response
{ "purchaseId": 40607, "success": true }
- Raises:
BinanceRequestException, BinanceAPIException
- subscribe_simple_earn_locked_product(**params)[source]
Subscribe to a simple earn locked product
https://binance-docs.github.io/apidocs/spot/en/#subscribe-locked-product-trade
- Parameters:
productId (str) – required
amount (str) – required
autoSubscribe (bool) – optional - Default True
recvWindow (int) – the number of milliseconds the request is valid for
- Returns:
API response
{ "purchaseId": 40607, "positionId": "12345", "success": true }
- Raises:
BinanceRequestException, BinanceAPIException
- toggle_bnb_burn_spot_margin(**params)[source]
Toggle BNB Burn On Spot Trade And Margin Interest
https://developers.binance.com/docs/wallet/asset/Toggle-BNB-Burn-On-Spot-Trade-And-Margin-Interest
- Parameters:
spotBNBBurn (bool) – Determines whether to use BNB to pay for trading fees on SPOT
interestBNBBurn (bool) – Determines whether to use BNB to pay for margin loan’s interest
response = client.toggle_bnb_burn_spot_margin()
- Returns:
API response
{ "spotBNBBurn":true, "interestBNBBurn": false }
- Raises:
BinanceRequestException, BinanceAPIException
- transfer_dust(**params)[source]
Convert dust assets to BNB.
https://developers.binance.com/docs/wallet/asset/dust-transfer
- Parameters:
asset (str) – The asset being converted. e.g: ‘ONE’
recvWindow (int) – the number of milliseconds the request is valid for
result = client.transfer_dust(asset='ONE')
- Returns:
API response
{ "totalServiceCharge":"0.02102542", "totalTransfered":"1.05127099", "transferResult":[ { "amount":"0.03000000", "fromAsset":"ETH", "operateTime":1563368549307, "serviceChargeAmount":"0.00500000", "tranId":2970932918, "transferedAmount":"0.25000000" } ] }
- Raises:
BinanceRequestException, BinanceAPIException
- transfer_isolated_margin_to_spot(**params)[source]
Execute transfer between isolated margin account and spot account.
https://binance-docs.github.io/apidocs/spot/en/#isolated-margin-account-transfer-margin
- Parameters:
asset (str) – name of the asset
symbol (str) – pair symbol
amount (str) – amount to transfer
recvWindow (int) – the number of milliseconds the request is valid for
transfer = client.transfer_isolated_margin_to_spot(asset='BTC', symbol='ETHBTC', amount='1.1')
- Returns:
API response
{ "tranId": 100000001 }
- Raises:
BinanceRequestException, BinanceAPIException
- transfer_margin_dust(**params)[source]
Convert dust assets to BNB.
https://binance-docs.github.io/apidocs/spot/en/#dust-transfer-trade
- Returns:
API response
- transfer_margin_to_spot(**params)[source]
Execute transfer between cross-margin account and spot account.
https://binance-docs.github.io/apidocs/spot/en/#cross-margin-account-transfer-margin
- Parameters:
asset (str) – name of the asset
amount (str) – amount to transfer
recvWindow (int) – the number of milliseconds the request is valid for
transfer = client.transfer_margin_to_spot(asset='BTC', amount='1.1')
- Returns:
API response
{ "tranId": 100000001 }
- Raises:
BinanceRequestException, BinanceAPIException
- transfer_spot_to_isolated_margin(**params)[source]
Execute transfer between spot account and isolated margin account.
https://binance-docs.github.io/apidocs/spot/en/#isolated-margin-account-transfer-margin
- Parameters:
asset (str) – name of the asset
symbol (str) – pair symbol
amount (str) – amount to transfer
recvWindow (int) – the number of milliseconds the request is valid for
transfer = client.transfer_spot_to_isolated_margin(asset='BTC', symbol='ETHBTC', amount='1.1')
- Returns:
API response
{ "tranId": 100000001 }
- Raises:
BinanceRequestException, BinanceAPIException
- transfer_spot_to_margin(**params)[source]
Execute transfer between spot account and cross-margin account.
https://binance-docs.github.io/apidocs/spot/en/#cross-margin-account-transfer-margin
- Parameters:
asset (str) – name of the asset
amount (str) – amount to transfer
recvWindow (int) – the number of milliseconds the request is valid for
transfer = client.transfer_spot_to_margin(asset='BTC', amount='1.1')
- Returns:
API response
{ "tranId": 100000001 }
- Raises:
BinanceRequestException, BinanceAPIException
- universal_transfer(**params)[source]
Unviversal transfer api accross different binance account types
https://developers.binance.com/docs/wallet/asset/user-universal-transfer
- unstake_asset_us(**params)[source]
Unstake a staked asset
https://docs.binance.us/#unstake-asset
- Raises:
BinanceRegionException – If client is not configured for binance.us
- v3_delete_order_list(**params)[source]
Placeholder function for DELETE /api/v3/orderList. Note: This function was auto-generated. Any issue please open an issue on GitHub.
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- v3_get_account_commission(**params)[source]
Placeholder function for GET /api/v3/account/commission. Note: This function was auto-generated. Any issue please open an issue on GitHub.
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- v3_get_all_order_list(**params)[source]
Placeholder function for GET /api/v3/allOrderList. Note: This function was auto-generated. Any issue please open an issue on GitHub.
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- v3_get_order_list(**params)[source]
Placeholder function for GET /api/v3/orderList. Note: This function was auto-generated. Any issue please open an issue on GitHub.
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- v3_get_ticker_trading_day(**params)[source]
Placeholder function for GET /api/v3/ticker/tradingDay. Note: This function was auto-generated. Any issue please open an issue on GitHub.
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- v3_post_cancel_replace(**params)[source]
Placeholder function for POST /api/v3/cancelReplace. Note: This function was auto-generated. Any issue please open an issue on GitHub.
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- v3_post_order_list_oto(**params)[source]
Placeholder function for POST /api/v3/orderList/oto. Note: This function was auto-generated. Any issue please open an issue on GitHub.
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- v3_post_order_list_otoco(**params)[source]
Placeholder function for POST /api/v3/orderList/otoco. Note: This function was auto-generated. Any issue please open an issue on GitHub.
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- v3_post_sor_order(**params)[source]
Placeholder function for POST /api/v3/sor/order. Note: This function was auto-generated. Any issue please open an issue on GitHub.
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- v3_post_sor_order_test(**params)[source]
Placeholder function for POST /api/v3/sor/order/test. Note: This function was auto-generated. Any issue please open an issue on GitHub.
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- withdraw(**params)[source]
Submit a withdraw request.
https://developers.binance.com/docs/wallet/capital/withdraw
Assumptions:
You must have Withdraw permissions enabled on your API key
You must have withdrawn to the address specified through the website and approved the transaction via email
- Parameters:
coin (str) – required
withdrawOrderId (str) – optional - client id for withdraw
network (str) – optional
address (str) – optional
amount (decimal) – required
transactionFeeFlag (bool) – required - When making internal transfer, true for returning the fee to the destination account; false for returning the fee back to the departure account. Default false.
name (str) – optional - Description of the address, default asset value passed will be used
recvWindow (int) – the number of milliseconds the request is valid for
- Returns:
API response
{ "id":"7213fea8e94b4a5593d507237e5a555b" }
- Raises:
BinanceRequestException, BinanceAPIException
- ws_cancel_all_open_orders(**params)[source]
Cancel all open orders on a symbol or all symbols. https://developers.binance.com/docs/binance-spot-api-docs/testnet/web-socket-api/public-api-requests#cancel-open-orders-trade
- Parameters:
symbol (str) – optional - Symbol to cancel orders for
recvWindow (int) – optional - The value cannot be greater than 60000
- Returns:
Websocket message
Response format: [
- {
“symbol”: “BTCUSDT”, “origClientOrderId”: “4d96324ff9d44481926157”, “orderId”: 12569099453, “orderListId”: -1, “clientOrderId”: “91fe37ce9e69c90d6358c0”, “price”: “23416.10000000”, “origQty”: “0.00847000”, “executedQty”: “0.00847000”, “cummulativeQuoteQty”: “198.33521500”, “status”: “CANCELED”, “timeInForce”: “GTC”, “type”: “LIMIT”, “side”: “SELL”, “stopPrice”: “0.00000000”, “trailingDelta”: 0, “trailingTime”: -1, “icebergQty”: “0.00000000”, “strategyId”: 37463720, “strategyType”: 1000000, “selfTradePreventionMode”: “NONE”
}
]
Weight: 1
- ws_cancel_and_replace_order(**params)[source]
Cancels an existing order and places a new order on the same symbol. https://developers.binance.com/docs/binance-spot-api-docs/testnet/web-socket-api/public-api-requests#cancel-and-replace-order-trade
- Parameters:
symbol (str) – required - Trading symbol, e.g. ‘BTCUSDT’
cancelReplaceMode (str) – required - The mode of cancel-replace: STOP_ON_FAILURE - If the cancel request fails, new order placement will not be attempted. ALLOW_FAILURE - New order placement will be attempted even if cancel request fails
cancelOrderId (int) – optional - The order ID to cancel
cancelOrigClientOrderId (str) – optional - The original client order ID to cancel
cancelNewClientOrderId (str) – optional - Used to uniquely identify this cancel. Automatically generated if not sent
side (str) – required - BUY or SELL
type (str) – required - Order type, e.g. LIMIT, MARKET
timeInForce (str) – optional - GTC, IOC, FOK
price (str) – optional - Order price
quantity (str) – optional - Order quantity
quoteOrderQty (str) – optional - Quote quantity
newClientOrderId (str) – optional - Used to uniquely identify this new order
newOrderRespType (str) – optional - ACK, RESULT, or FULL
stopPrice (str) – optional - Used with STOP_LOSS, STOP_LOSS_LIMIT, TAKE_PROFIT, and TAKE_PROFIT_LIMIT orders
trailingDelta (int) – optional - Used with TAKE_PROFIT, TAKE_PROFIT_LIMIT, STOP_LOSS, STOP_LOSS_LIMIT orders
icebergQty (str) – optional - Used with iceberg orders
strategyId (int) – optional - Arbitrary numeric value identifying the order within an order strategy
strategyType (int) – optional - Arbitrary numeric value identifying the order strategy
selfTradePreventionMode (str) – optional - The allowed enums is dependent on what is configured on the symbol
cancelRestrictions (str) – optional - ONLY_NEW - Cancel will succeed if order status is NEW. ONLY_PARTIALLY_FILLED - Cancel will succeed if order status is PARTIALLY_FILLED
recvWindow (int) – optional - The number of milliseconds the request is valid for
Either cancelOrderId or cancelOrigClientOrderId must be provided. Price is required for LIMIT orders. Either quantity or quoteOrderQty must be provided.
Weight: 1
Returns: .. code-block:: python
- {
“id”: “99de6b92-0eda-4154-9c8d-a51d93c6f92e”, “status”: 200, “result”: {
“cancelResult”: “SUCCESS”, “newOrderResult”: “SUCCESS”, “cancelResponse”: {
“symbol”: “BTCUSDT”, “origClientOrderId”: “4d96324ff9d44481926157”, “orderId”: 12569099453, “orderListId”: -1, “clientOrderId”: “91fe37ce9e69c90d6358c0”, “price”: “23416.10000000”, “origQty”: “0.00847000”, “executedQty”: “0.00001000”, “cummulativeQuoteQty”: “0.23416100”, “status”: “CANCELED”, “timeInForce”: “GTC”, “type”: “LIMIT”, “side”: “SELL”, “selfTradePreventionMode”: “NONE”
}, “newOrderResponse”: {
“symbol”: “BTCUSDT”, “orderId”: 12569099454, “orderListId”: -1, “clientOrderId”: “bX5wROblo6YeDwa9iTLeyY”, “transactTime”: 1660801715639
}
}
}
- ws_cancel_oco_order(**params)[source]
Cancel an OCO (One-Cancels-the-Other) order list.
- Parameters:
symbol (str) – required - Trading symbol
orderListId (int) – optional - The ID of the OCO order list to cancel
listClientOrderId (str) – optional - The client-specified ID of the OCO order list
newClientOrderId (str) – optional - Client ID to identify the cancel request
apiKey (str) – required - Your API key
recvWindow (int) – optional - Number of milliseconds the request is valid for
signature (str) – required - HMAC SHA256 signature
timestamp (int) – required - Current timestamp in milliseconds
- Notes:
Either orderListId or listClientOrderId must be provided
newClientOrderId will be auto-generated if not provided
Response example: .. code-block:: python
- {
“id”: “c5899911-d3f4-47ae-8835-97da553d27d0”, “status”: 200, “result”: {
“orderListId”: 1274512, “contingencyType”: “OCO”, “listStatusType”: “ALL_DONE”, “listOrderStatus”: “ALL_DONE”, “listClientOrderId”: “6023531d7edaad348f5aff”, “transactionTime”: 1660801720215, “symbol”: “BTCUSDT”, “orders”: [
- {
“symbol”: “BTCUSDT”, “orderId”: 12569138901, “clientOrderId”: “BqtFCj5odMoWtSqGk2X9tU”
}, {
“symbol”: “BTCUSDT”, “orderId”: 12569138902, “clientOrderId”: “jLnZpj5enfMXTuhKB1d0us”
}
], “orderReports”: [
- {
“symbol”: “BTCUSDT”, “orderId”: 12569138901, “orderListId”: 1274512, “clientOrderId”: “BqtFCj5odMoWtSqGk2X9tU”, “transactTime”: 1660801720215, “price”: “23416.10000000”, “origQty”: “0.00847000”, “executedQty”: “0.00000000”, “cummulativeQuoteQty”: “0.00000000”, “status”: “CANCELED”, “timeInForce”: “GTC”, “type”: “STOP_LOSS_LIMIT”, “side”: “SELL”, “stopPrice”: “23416.10000000”, “selfTradePreventionMode”: “NONE”
}, {
“symbol”: “BTCUSDT”, “orderId”: 12569138902, “orderListId”: 1274512, “clientOrderId”: “jLnZpj5enfMXTuhKB1d0us”, “transactTime”: 1660801720215, “price”: “23416.10000000”, “origQty”: “0.00847000”, “executedQty”: “0.00000000”, “cummulativeQuoteQty”: “0.00000000”, “status”: “CANCELED”, “timeInForce”: “GTC”, “type”: “LIMIT_MAKER”, “side”: “SELL”, “selfTradePreventionMode”: “NONE”
}
]
}, “rateLimits”: [
- {
“rateLimitType”: “REQUEST_WEIGHT”, “interval”: “MINUTE”, “intervalNum”: 1, “limit”: 6000, “count”: 1
}
]
}
- ws_cancel_order(**params)[source]
Cancel an active order. https://developers.binance.com/docs/binance-spot-api-docs/testnet/web-socket-api/public-api-requests#cancel-order-trade
- Parameters:
symbol (str) – required - Trading symbol, e.g. ‘BTCUSDT’
orderId (int) – optional - The unique order id
origClientOrderId (str) – optional - The original client order id
newClientOrderId (str) – optional - Used to uniquely identify this cancel. Automatically generated if not sent
cancelRestrictions (str) – optional - ONLY_NEW - Cancel will succeed if the order status is NEW. ONLY_PARTIALLY_FILLED - Cancel will succeed if order status is PARTIALLY_FILLED.
recvWindow (int) – optional - The number of milliseconds the request is valid for
Either orderId or origClientOrderId must be sent.
Weight: 1
Returns: .. code-block:: python
- {
“id”: “5633b6a2-90a9-4192-83e7-925c90b6a2fd”, “method”: “order.cancel”, “params”: {
“symbol”: “BTCUSDT”, “origClientOrderId”: “4d96324ff9d44481926157”, “apiKey”: “vmPUZE6mv9SD5VNHk4HlWFsOr6aKE2zvsw0MuIgwCIPy6utIco14y7Ju91duEh8A”, “signature”: “33d5b721f278ae17a52f004a82a6f68a70c68e7dd6776ed0be77a455ab855282”, “timestamp”: 1660801715830
}
}
- ws_create_oco_order(**params)[source]
Create a new OCO (One-Cancels-the-Other) order. https://developers.binance.com/docs/binance-spot-api-docs/testnet/web-socket-api/public-api-requests#place-new-order-list—oco-trade
- Parameters:
symbol (str) – required - Trading symbol
side (str) – required - BUY or SELL
quantity (decimal) – required - Order quantity
price (decimal) – required - Order price for limit leg
stopPrice (decimal) – required - Stop trigger price for stop leg
stopLimitPrice (decimal) – optional - Stop limit price for stop leg
stopLimitTimeInForce (str) – optional - Time in force for stop leg
listClientOrderId (str) – optional - Unique ID for the entire orderList
limitClientOrderId (str) – optional - Unique ID for the limit order
stopClientOrderId (str) – optional - Unique ID for the stop order
limitStrategyId (int) – optional - Arbitrary numeric value identifying the limit order within an order strategy
limitStrategyType (int) – optional - Arbitrary numeric value identifying the limit order strategy
stopStrategyId (int) – optional - Arbitrary numeric value identifying the stop order within an order strategy
stopStrategyType (int) – optional - Arbitrary numeric value identifying the stop order strategy
limitIcebergQty (decimal) – optional - Iceberg quantity for the limit leg
stopIcebergQty (decimal) – optional - Iceberg quantity for the stop leg
recvWindow (int) – optional - The value cannot be greater than 60000
- Returns:
Websocket message
Response format: .. code-block:: python
- {
“id”: “56374a46-3261-486b-a211-99ed972eb648”, “status”: 200, “result”: {
“orderListId”: 2, “contingencyType”: “OCO”, “listStatusType”: “EXEC_STARTED”, “listOrderStatus”: “EXECUTING”, “listClientOrderId”: “cKPMnDCbcLQILtDYM4f4fX”, “transactionTime”: 1711062760648, “symbol”: “LTCBNB”, “orders”: [ {
“symbol”: “LTCBNB”, “orderId”: 2, “clientOrderId”: “0m6I4wfxvTUrOBSMUl0OPU”
}, {
“symbol”: “LTCBNB”, “orderId”: 3, “clientOrderId”: “Z2IMlR79XNY5LU0tOxrWyW”
} ], “orderReports”: [ {
“symbol”: “LTCBNB”, “orderId”: 2, “orderListId”: 2, “clientOrderId”: “0m6I4wfxvTUrOBSMUl0OPU”, “transactTime”: 1711062760648, “price”: “1.50000000”, “origQty”: “1.000000”, “executedQty”: “0.000000”, “origQuoteOrderQty”: “0.000000”, “cummulativeQuoteQty”: “0.00000000”, “status”: “NEW”, “timeInForce”: “GTC”, “type”: “STOP_LOSS_LIMIT”, “side”: “BUY”, “stopPrice”: “1.50000001”, “workingTime”: -1, “selfTradePreventionMode”: “NONE”
}, {
“symbol”: “LTCBNB”, “orderId”: 3, “orderListId”: 2, “clientOrderId”: “Z2IMlR79XNY5LU0tOxrWyW”, “transactTime”: 1711062760648, “price”: “1.49999999”, “origQty”: “1.000000”, “executedQty”: “0.000000”, “origQuoteOrderQty”: “0.000000”, “cummulativeQuoteQty”: “0.00000000”, “status”: “NEW”, “timeInForce”: “GTC”, “type”: “LIMIT_MAKER”, “side”: “BUY”, “workingTime”: 1711062760648, “selfTradePreventionMode”: “NONE”
}, “rateLimits”: [
{ “rateLimitType”: “ORDERS”, “interval”: “SECOND”, “intervalNum”: 10, “limit”: 50, “count”: 2 }, { “rateLimitType”: “ORDERS”, “interval”: “DAY”, “intervalNum”: 1, “limit”: 160000, “count”: 2 }, { “rateLimitType”: “REQUEST_WEIGHT”, “interval”: “MINUTE”, “intervalNum”: 1, “limit”: 6000, “count”: 1 }
]
}
Weight: 2
- ws_create_order(**params)[source]
Create an order via WebSocket. https://binance-docs.github.io/apidocs/websocket_api/en/#place-new-order-trade :param id: The request ID to be used. By default uuid22() is used. :param symbol: The symbol to create an order for :param side: BUY or SELL :param type: Order type (e.g., LIMIT, MARKET) :param quantity: The amount to buy or sell :param kwargs: Additional order parameters
- ws_create_oto_order(**params)[source]
Create a new OTO (One-Triggers-Other) order list. https://developers.binance.com/docs/binance-spot-api-docs/testnet/web-socket-api/public-api-requests#place-new-order-list—oto-trade
An OTO order list consists of two orders: 1. Primary order that must be filled first 2. Secondary order that is placed only after the primary order is filled
- Parameters:
symbol (str) – required - Trading symbol
orders (list) –
required - Array of order objects containing: [
- { # Primary order
”type”: required - Order type (e.g. LIMIT, MARKET), “side”: required - BUY or SELL, “price”: required for LIMIT orders, “quantity”: required - Order quantity, “timeInForce”: required for LIMIT orders, “icebergQty”: optional, “strategyId”: optional, “strategyType”: optional, “selfTradePreventionMode”: optional
}, { # Secondary order - same parameters as primary
…
}
]
listClientOrderId (str) – optional - Unique ID for the entire order list
limitClientOrderId (str) – optional - Client order ID for the LIMIT leg
limitStrategyId (int) – optional - Strategy ID for the LIMIT leg
limitStrategyType (int) – optional - Strategy type for the LIMIT leg
stopClientOrderId (str) – optional - Client order ID for the STOP_LOSS/STOP_LOSS_LIMIT leg
stopStrategyId (int) – optional - Strategy ID for the STOP_LOSS/STOP_LOSS_LIMIT leg
stopStrategyType (int) – optional - Strategy type for the STOP_LOSS/STOP_LOSS_LIMIT leg
newOrderRespType (str) – optional - Set the response JSON
Response example: .. code-block:: python
- {
“id”: “c5899911-d3f4-47ae-8835-97da553d27d0”, “status”: 200, “result”: {
“orderListId”: 1, “contingencyType”: “OTO”, “listStatusType”: “EXEC_STARTED”, “listOrderStatus”: “EXECUTING”, “listClientOrderId”: “C3wyRVh3aqKyI2RpBZYmFz”, “transactionTime”: 1669632210676, “symbol”: “BTCUSDT”, “orders”: [
- {
“symbol”: “BTCUSDT”, “orderId”: 12569099453, “clientOrderId”: “bX5wROblo6YeDwa9iTLeyY”
}, {
“symbol”: “BTCUSDT”, “orderId”: 12569099454, “clientOrderId”: “Tnu2IP0J5Y4mxw3IxZYeFi”
}
], “orderReports”: [
- {
“symbol”: “BTCUSDT”, “orderId”: 12569099453, “orderListId”: 1, “clientOrderId”: “bX5wROblo6YeDwa9iTLeyY”, “transactTime”: 1669632210676, “price”: “23416.10000000”, “origQty”: “0.00847000”, “executedQty”: “0.00847000”, “cummulativeQuoteQty”: “198.33521500”, “status”: “FILLED”, “timeInForce”: “GTC”, “type”: “LIMIT”, “side”: “SELL”, “stopPrice”: “0.00000000”, “workingTime”: 1669632210676, “selfTradePreventionMode”: “NONE”
}, {
“symbol”: “BTCUSDT”, “orderId”: 12569099454, “orderListId”: 1, “clientOrderId”: “Tnu2IP0J5Y4mxw3IxZYeFi”, “transactTime”: 1669632210676, “price”: “0.00000000”, “origQty”: “0.00847000”, “executedQty”: “0.00000000”, “cummulativeQuoteQty”: “0.00000000”, “status”: “NEW”, “timeInForce”: “GTC”, “type”: “MARKET”, “side”: “BUY”, “stopPrice”: “0.00000000”, “workingTime”: -1, “selfTradePreventionMode”: “NONE”
}
]
}, “rateLimits”: [
- {
“rateLimitType”: “ORDERS”, “interval”: “SECOND”, “intervalNum”: 10, “limit”: 50, “count”: 1
}, {
“rateLimitType”: “ORDERS”, “interval”: “DAY”, “intervalNum”: 1, “limit”: 160000, “count”: 1
}, {
“rateLimitType”: “REQUEST_WEIGHT”, “interval”: “MINUTE”, “intervalNum”: 1, “limit”: 6000, “count”: 1
}
]
}
Weight: 1
- ws_create_otoco_order(**params)[source]
Returns: Websocket message .. code-block:: python
- {
“id”: “1712544408508”, “status”: 200, “result”: {
“orderListId”: 629, “contingencyType”: “OTO”, “listStatusType”: “EXEC_STARTED”, “listOrderStatus”: “EXECUTING”, “listClientOrderId”: “GaeJHjZPasPItFj4x7Mqm6”, “transactionTime”: 1712544408537, “symbol”: “1712544378871”, “orders”: [ {
“symbol”: “1712544378871”, “orderId”: 23, “clientOrderId”: “OVQOpKwfmPCfaBTD0n7e7H”
}, {
“symbol”: “1712544378871”, “orderId”: 24, “clientOrderId”: “YcCPKCDMQIjNvLtNswt82X”
}, {
“symbol”: “1712544378871”, “orderId”: 25, “clientOrderId”: “ilpIoShcFZ1ZGgSASKxMPt”
} ], “orderReports”: [ {
“symbol”: “LTCBNB”, “orderId”: 23, “orderListId”: 629, “clientOrderId”: “OVQOpKwfmPCfaBTD0n7e7H”, “transactTime”: 1712544408537, “price”: “1.500000”, “origQty”: “1.000000”, “executedQty”: “0.000000”, “origQuoteOrderQty”: “0.000000”, “cummulativeQuoteQty”: “0.000000”, “status”: “NEW”, “timeInForce”: “GTC”, “type”: “LIMIT”, “side”: “BUY”, “workingTime”: 1712544408537, “selfTradePreventionMode”: “NONE”
}, {
“symbol”: “LTCBNB”, “orderId”: 24, “orderListId”: 629, “clientOrderId”: “YcCPKCDMQIjNvLtNswt82X”, “transactTime”: 1712544408537, “price”: “0.000000”, “origQty”: “5.000000”, “executedQty”: “0.000000”, “origQuoteOrderQty”: “0.000000”, “cummulativeQuoteQty”: “0.000000”, “status”: “PENDING_NEW”, “timeInForce”: “GTC”, “type”: “STOP_LOSS”, “side”: “SELL”, “stopPrice”: “0.500000”, “workingTime”: -1, “selfTradePreventionMode”: “NONE”
}, {
“symbol”: “LTCBNB”, “orderId”: 25, “orderListId”: 629, “clientOrderId”: “ilpIoShcFZ1ZGgSASKxMPt”, “transactTime”: 1712544408537, “price”: “5.000000”, “origQty”: “5.000000”, “executedQty”: “0.000000”, “origQuoteOrderQty”: “0.000000”, “cummulativeQuoteQty”: “0.000000”, “status”: “PENDING_NEW”, “timeInForce”: “GTC”, “type”: “LIMIT_MAKER”, “side”: “SELL”, “workingTime”: -1, “selfTradePreventionMode”: “NONE”
}, “rateLimits”: [
{ “rateLimitType”: “ORDERS”, “interval”: “MINUTE”, “intervalNum”: 1, “limit”: 10000000, “count”: 18 }, { “rateLimitType”: “REQUEST_WEIGHT”, “interval”: “MINUTE”, “intervalNum”: 1, “limit”: 1000, “count”: 65 }
]
}
Weight: 1
- ws_create_sor_order(**params)[source]
Place a new order using Smart Order Routing (SOR).
- Parameters:
symbol (str) – required - Trading symbol, e.g. BTCUSDT
side (str) – required - Order side: BUY or SELL
type (str) – required - Order type: LIMIT or MARKET
quantity (float) – required - Order quantity
timeInForce (str) – required for LIMIT orders - Time in force: GTC, IOC, FOK
price (float) – required for LIMIT orders - Order price
newClientOrderId (str) – optional - Unique order ID. Automatically generated if not sent
newOrderRespType (str) – optional - Response format: ACK, RESULT, FULL. MARKET and LIMIT orders use FULL by default
strategyId (int) – optional - Arbitrary numeric value identifying the order within an order strategy
strategyType (int) – optional - Arbitrary numeric value identifying the order strategy. Values < 1000000 are reserved
selfTradePreventionMode (str) – optional - Supported values depend on exchange configuration: EXPIRE_TAKER, EXPIRE_MAKER, EXPIRE_BOTH, NONE
recvWindow (int) – optional - Number of milliseconds after timestamp the request is valid for. Default 5000, max 60000
- Returns:
Websocket message
- Notes:
SOR only supports LIMIT and MARKET orders
quoteOrderQty is not supported
Weight: 1
Data Source: Matching Engine
- ws_create_test_order(**params)[source]
Test new order creation and signature/recvWindow long. Creates and validates a new order but does not send it into the matching engine. https://binance-docs.github.io/apidocs/websocket_api/en/#test-new-order-trade :param symbol: required :type symbol: str :param side: required :type side: str :param type: required :type type: str :param timeInForce: required if limit order :type timeInForce: str :param quantity: required :type quantity: decimal :param price: required :type price: str :param newClientOrderId: A unique id for the order. Automatically generated if not sent. :type newClientOrderId: str :param icebergQty: Used with iceberg orders :type icebergQty: decimal :param newOrderRespType: Set the response JSON. ACK, RESULT, or FULL; default: RESULT. :type newOrderRespType: str :param recvWindow: The number of milliseconds the request is valid for :type recvWindow: int :returns: WS response .. code-block:: python
{}
- ws_create_test_sor_order(**params)[source]
Test new order creation using Smart Order Routing (SOR). Creates and validates a new order but does not send it into the matching engine.
- Parameters:
symbol (str) – required - Trading symbol, e.g. BTCUSDT
side (str) – required - Order side: BUY or SELL
type (str) – required - Order type: LIMIT or MARKET
quantity (float) – required - Order quantity
timeInForce (str) – required for LIMIT orders - Time in force: GTC, IOC, FOK
price (float) – required for LIMIT orders - Order price
newClientOrderId (str) – optional - Unique order ID. Generated automatically if not sent
strategyId (int) – optional - Arbitrary numeric value identifying the order within an order strategy
strategyType (int) – optional - Arbitrary numeric value identifying the order strategy. Values < 1000000 are reserved
selfTradePreventionMode (str) – optional - EXPIRE_TAKER, EXPIRE_MAKER, EXPIRE_BOTH, NONE
computeCommissionRates (bool) – optional - Calculate commission rates. Default: False
- Returns:
Websocket message
Without computeCommissionRates:
{ "id": "3a4437e2-41a3-4c19-897c-9cadc5dce8b6", "status": 200, "result": {}, "rateLimits": [ { "rateLimitType": "REQUEST_WEIGHT", "interval": "MINUTE", "intervalNum": 1, "limit": 6000, "count": 1 } ] }
With computeCommissionRates:
{ "id": "3a4437e2-41a3-4c19-897c-9cadc5dce8b6", "status": 200, "result": { "standardCommissionForOrder": { "maker": "0.00000112", "taker": "0.00000114" }, "taxCommissionForOrder": { "maker": "0.00000112", "taker": "0.00000114" }, "discount": { "enabledForAccount": true, "enabledForSymbol": true, "discountAsset": "BNB", "discount": "0.25" } }, "rateLimits": [...] }
- Notes:
SOR only supports LIMIT and MARKET orders
quoteOrderQty is not supported
Weight: 1 (without computeCommissionRates), 20 (with computeCommissionRates)
Data Source: Memory
- ws_futures_account_balance(**params)[source]
Get current account information. https://developers.binance.com/docs/derivatives/usds-margined-futures/account/websocket-api/Futures-Account-Balance
- ws_futures_account_position(**params)[source]
Get current position information. https://developers.binance.com/docs/derivatives/usds-margined-futures/trade/websocket-api/Position-Information
- ws_futures_account_status(**params)[source]
Get current account information. User in single-asset/ multi-assets mode will see different value, see comments in response section for detail. https://developers.binance.com/docs/derivatives/usds-margined-futures/account/websocket-api/Account-Information
- ws_futures_cancel_algo_order(**params)[source]
Cancel an active algo order.
https://developers.binance.com/docs/derivatives/usds-margined-futures/trade/websocket-api
- Parameters:
symbol (str) – required
algoId (int) – optional - Either algoId or clientAlgoId must be sent
clientAlgoId (str) – optional - Either algoId or clientAlgoId must be sent
recvWindow (int) – optional - the number of milliseconds the request is valid for
- Returns:
WS response
- ws_futures_cancel_order(**params)[source]
cancel an order https://developers.binance.com/docs/derivatives/usds-margined-futures/trade/websocket-api/Cancel-Order
- ws_futures_create_algo_order(**params)[source]
Send in a new algo order (conditional order).
https://developers.binance.com/docs/derivatives/usds-margined-futures/trade/websocket-api
- Parameters:
symbol (str) – required
side (str) – required - BUY or SELL
type (str) – required - STOP, TAKE_PROFIT, STOP_MARKET, TAKE_PROFIT_MARKET, TRAILING_STOP_MARKET
algoType (str) – required - Only support CONDITIONAL
positionSide (str) – optional - Default BOTH for One-way Mode; LONG or SHORT for Hedge Mode
timeInForce (str) – optional - IOC or GTC or FOK, default GTC
quantity (decimal) – optional - Cannot be sent with closePosition=true
price (decimal) – optional
triggerPrice (decimal) – optional - Used with STOP, STOP_MARKET, TAKE_PROFIT, TAKE_PROFIT_MARKET
workingType (str) – optional - triggerPrice triggered by: MARK_PRICE, CONTRACT_PRICE. Default CONTRACT_PRICE
priceMatch (str) – optional - only available for LIMIT/STOP/TAKE_PROFIT order
closePosition (bool) – optional - true or false; Close-All, used with STOP_MARKET or TAKE_PROFIT_MARKET
priceProtect (str) – optional - “TRUE” or “FALSE”, default “FALSE”
reduceOnly (str) – optional - “true” or “false”, default “false”
activationPrice (decimal) – optional - Used with TRAILING_STOP_MARKET orders
callbackRate (decimal) – optional - Used with TRAILING_STOP_MARKET orders, min 0.1, max 10
clientAlgoId (str) – optional - A unique id among open orders
selfTradePreventionMode (str) – optional - EXPIRE_TAKER, EXPIRE_MAKER, EXPIRE_BOTH; default NONE
goodTillDate (int) – optional - order cancel time for timeInForce GTD
newOrderRespType (str) – optional - “ACK”, “RESULT”, default “ACK”
recvWindow (int) – optional - the number of milliseconds the request is valid for
- Returns:
WS response
- ws_futures_create_order(**params)[source]
Send in a new order https://developers.binance.com/docs/derivatives/usds-margined-futures/trade/websocket-api
- ws_futures_edit_order(**params)[source]
Edit an order https://developers.binance.com/docs/derivatives/usds-margined-futures/trade/websocket-api/Modify-Order
- ws_futures_get_all_tickers(**params)[source]
Latest price for a symbol or symbols https://developers.binance.com/docs/derivatives/usds-margined-futures/market-data/websocket-api/Symbol-Price-Ticker
- ws_futures_get_order(**params)[source]
Get an order https://developers.binance.com/docs/derivatives/usds-margined-futures/trade/websocket-api/Query-Order
Note: Algo/conditional orders cannot be queried via websocket API
- ws_futures_get_order_book(**params)[source]
Get the order book for a symbol https://developers.binance.com/docs/derivatives/usds-margined-futures/market-data/websocket-api
- ws_futures_get_order_book_ticker(**params)[source]
Best price/qty on the order book for a symbol or symbols. https://developers.binance.com/docs/derivatives/usds-margined-futures/market-data/websocket-api/Symbol-Order-Book-Ticker
- ws_futures_v2_account_balance(**params)[source]
Get current account information. https://developers.binance.com/docs/derivatives/usds-margined-futures/account/websocket-api#api-description
- ws_futures_v2_account_position(**params)[source]
Get current position information(only symbol that has position or open orders will be returned). https://developers.binance.com/docs/derivatives/usds-margined-futures/trade/websocket-api/Position-Info-V2
- ws_futures_v2_account_status(**params)[source]
Get current account information. User in single-asset/ multi-assets mode will see different value, see comments in response section for detail. https://developers.binance.com/docs/derivatives/usds-margined-futures/account/websocket-api/Account-Information-V2
- ws_get_account(**params)[source]
Get current account information.
- Parameters:
omitZeroBalances (bool) – optional - When set to true, emits only the non-zero balances of an account. Default: false
recvWindow (int) – optional - The value cannot be greater than 60000
- Returns:
Websocket message
{ "makerCommission": 15, "takerCommission": 15, "buyerCommission": 0, "sellerCommission": 0, "canTrade": true, "canWithdraw": true, "canDeposit": true, "commissionRates": { "maker": "0.00150000", "taker": "0.00150000", "buyer": "0.00000000", "seller": "0.00000000" }, "brokered": false, "requireSelfTradePrevention": false, "preventSor": false, "updateTime": 1660801833000, "accountType": "SPOT", "balances": [ { "asset": "BNB", "free": "0.00000000", "locked": "0.00000000" }, { "asset": "BTC", "free": "1.34471120", "locked": "0.08600000" } ], "permissions": [ "SPOT" ], "uid": 354937868 }
- Notes:
Weight: 20
Data Source: Memory => Database
- ws_get_account_rate_limits_orders(**params)[source]
Query your current unfilled order count for all intervals.
- Parameters:
recvWindow (int) – optional - The value cannot be greater than 60000
- Returns:
Websocket response
{ "result": [ { "rateLimitType": "ORDERS", "interval": "SECOND", "intervalNum": 10, "limit": 50, "count": 0 }, { "rateLimitType": "ORDERS", "interval": "DAY", "intervalNum": 1, "limit": 160000, "count": 0 } ], "id": "d3783d8d-f8d1-4d2c-b8a0-b7596af5a664" }
- Raises:
BinanceRequestException, BinanceAPIException
- Notes:
Weight: 40
Data Source: Memory
- ws_get_aggregate_trades(**params)[source]
Get aggregate trades.
An aggregate trade represents one or more individual trades that fill at the same time, from the same taker order, with the same price.
- Parameters:
symbol (str) – STRING - Required - Trading symbol
fromId (int) – INT - Optional - Aggregate trade ID to begin at
startTime (int) – INT - Optional - Start time in milliseconds
endTime (int) – INT - Optional - End time in milliseconds
limit (int) – INT - Optional - Default 500; max 1000
- Returns:
API response
{ "id": "...", "status": 200, "result": [ { "a": 50000000, # Aggregate trade ID "p": "0.00274100", # Price "q": "57.19000000", # Quantity "f": 59120167, # First trade ID "l": 59120170, # Last trade ID "T": 1565877971222, # Timestamp "m": true, # Was the buyer the maker? "M": true # Was the trade the best price match? } ] }
- Raises:
BinanceRequestException, BinanceAPIException
- Notes:
If fromId is specified, return aggtrades with aggregate trade ID >= fromId.
Use fromId and limit to page through all aggtrades. - If startTime and/or endTime are specified, aggtrades are filtered by execution time (T). fromId cannot be used together with startTime and endTime. - If no condition is specified, the most recent aggregate trades are returned. - For real-time updates, consider using WebSocket Streams: <symbol>@aggTrade - For historical data, consider using data.binance.vision
Weight: 2 Data Source: Database
- ws_get_all_orders(**params)[source]
Query information about all your orders – active, canceled, filled – filtered by time range.
- Parameters:
symbol (str) – STRING - Required
orderId (int) – optional - Order ID to begin at
startTime (int) – optional
endTime (int) – optional
limit (int) – optional - Default 500; max 1000
recvWindow (int) – optional - The value cannot be greater than 60000
- Returns:
Websocket response
{ "id": "734235c2-13d2-4574-be68-723e818c08f3", "status": 200, "result": [ { "symbol": "BTCUSDT", "orderId": 12569099453, "orderListId": -1, "clientOrderId": "4d96324ff9d44481926157", "price": "23416.10000000", "origQty": "0.00847000", "executedQty": "0.00847000", "cummulativeQuoteQty": "198.33521500", "status": "FILLED", "timeInForce": "GTC", "type": "LIMIT", "side": "SELL", "stopPrice": "0.00000000", "icebergQty": "0.00000000", "time": 1660801715639, "updateTime": 1660801717945, "isWorking": true, "workingTime": 1660801715639, "origQuoteOrderQty": "0.00000000", "selfTradePreventionMode": "NONE", "preventedMatchId": 0, // Only appears if order expired due to STP "preventedQuantity": "1.200000" // Only appears if order expired due to STP } ] }
- Notes:
Weight: 20
Data Source: Database
If startTime and/or endTime are specified, orderId is ignored
Orders are filtered by time of the last execution status update
If orderId is specified, return orders with order ID >= orderId
If no condition is specified, the most recent orders are returned
For some historical orders the cummulativeQuoteQty response field may be negative
The time between startTime and endTime can’t be longer than 24 hours
- ws_get_allocations(**params)[source]
Get information about orders that were expired due to STP (Self-Trade Prevention).
- Parameters:
symbol (str) – STRING - Required - Trading symbol
preventedMatchId (int) – LONG - Optional - Get specific prevented match by ID
orderId (int) – LONG - Optional - Get prevented matches for specific order
fromPreventedMatchId (int) – LONG - Optional - Get prevented matches from this ID
limit (int) – INT - Optional - Default 500; max 1000
recvWindow (int) – LONG - Optional - The value cannot be greater than 60000
timestamp (int) – LONG - Required
- Returns:
API response
- Supported parameter combinations:
symbol + preventedMatchId
symbol + orderId
symbol + orderId + fromPreventedMatchId (limit defaults to 500)
symbol + orderId + fromPreventedMatchId + limit
- Weight:
2 if symbol is invalid
2 when querying by preventedMatchId
20 when querying by orderId
Data Source: Database
- ws_get_avg_price(**params)[source]
Get current average price for a symbol.
- Parameters:
symbol (str) – STRING - Required - Trading symbol
- Returns:
Websocket message
Weight: 2
- ws_get_commission_rates(**params)[source]
Get current account commission rates for a symbol.
- Parameters:
symbol (str) – STRING - Required - Trading symbol
recvWindow (int) – LONG - Optional - The value cannot be greater than 60000
- Returns:
API response dict with commission rates:
- {
“symbol”: “BTCUSDT”, “standardCommission”: { # Standard commission rates on trades
”maker”: “0.00000010”, “taker”: “0.00000020”, “buyer”: “0.00000030”, “seller”: “0.00000040”
}, “taxCommission”: { # Tax commission rates on trades
”maker”: “0.00000112”, “taker”: “0.00000114”, “buyer”: “0.00000118”, “seller”: “0.00000116”
}, “discount”: { # Discount on standard commissions when paying in BNB
”enabledForAccount”: true, “enabledForSymbol”: true, “discountAsset”: “BNB”, “discount”: “0.75000000” # Standard commission reduction rate when paying in BNB
}
}
- Raises:
BinanceRequestException, BinanceAPIException
Weight: 20
Data Source: Database
- ws_get_exchange_info(**params)[source]
Query current exchange trading rules, rate limits, and symbol information.
- Parameters:
symbol – str - Filter by single symbol (optional)
symbols – list - Filter by multiple symbols (optional)
permissions – list or str - Filter symbols by permissions (optional)
- Returns:
API response containing exchange information including: - Rate limits - Exchange filters - Symbol information including:
Status
Base/quote assets
Order types allowed
Filters (price, lot size, etc)
Trading permissions
Self-trade prevention modes
Example response: {
”timezone”: “UTC”, “serverTime”: 1655969291181, “rateLimits”: [
- {
“rateLimitType”: “REQUEST_WEIGHT”, “interval”: “MINUTE”, “intervalNum”: 1, “limit”: 6000
], “exchangeFilters”: [], “symbols”: [
- {
“symbol”: “BTCUSDT”, “status”: “TRADING”, “baseAsset”: “BTC”, “baseAssetPrecision”: 8, …
}
]
}
- Raises:
BinanceRequestException, BinanceAPIException
- Notes:
Only one of symbol, symbols, permissions parameters can be specified
Without parameters, displays all symbols with [“SPOT”, “MARGIN”, “LEVERAGED”] permissions
To list all active symbols, explicitly request all permissions
Permissions accepts either a list or single permission name (e.g. “SPOT”)
Weight: 20 Data Source: Memory
- ws_get_historical_trades(**params)[source]
Get historical trades.
- Parameters:
symbol (str) – STRING - Required - Trading symbol
fromId (int) – INT - Optional - Trade ID to begin at
limit (int) – INT - Optional - Default 500; max 1000
- Returns:
Websocket message
{ "id": "cffc9c7d-4efc-4ce0-b587-6b87448f052a", "result": [ { "id": 0, # Trade ID "price": "0.00005000", # Price "qty": "40.00000000", # Quantity "quoteQty": "0.00200000", # Quote quantity "time": 1500004800376, # Trade time "isBuyerMaker": true, # Was the buyer the maker? "isBestMatch": true # Was this the best price match? } ] }
- Raises:
BinanceRequestException, BinanceAPIException
- Notes:
If fromId is not specified, the most recent trades are returned
Weight: 25 Data Source: Database
- ws_get_klines(**params)[source]
Get klines (candlestick bars).
Klines are uniquely identified by their open & close time.
- Parameters:
symbol (str) – STRING - Required - Trading symbol
interval (str) – ENUM - Required - Kline interval
startTime (int) – INT - Optional - Start time in milliseconds
endTime (int) – INT - Optional - End time in milliseconds
timeZone (str) – STRING - Optional - Default: 0 (UTC)
limit (int) – INT - Optional - Default 500; max 1000
- Supported kline intervals:
seconds: 1s
minutes: 1m, 3m, 5m, 15m, 30m
hours: 1h, 2h, 4h, 6h, 8h, 12h
days: 1d, 3d
weeks: 1w
months: 1M
- Notes:
If startTime/endTime not specified, returns most recent klines
- Supported timeZone values:
Hours and minutes (e.g. “-1:00”, “05:45”)
Only hours (e.g. “0”, “8”, “4”)
Accepted range is strictly [-12:00 to +14:00] inclusive
If timeZone provided, kline intervals interpreted in that timezone instead of UTC
startTime and endTime always interpreted in UTC, regardless of timeZone
For real-time updates, consider using WebSocket Streams: <symbol>@kline_<interval>
For historical data, consider using data.binance.vision
Weight: 2 Data Source: Database
- Returns:
API response
{ "id": "1dbbeb56-8eea-466a-8f6e-86bdcfa2fc0b", "status": 200, "result": [ [ 1655971200000, # Kline open time "0.01086000", # Open price "0.01086600", # High price "0.01083600", # Low price "0.01083800", # Close price "2290.53800000", # Volume 1655974799999, # Kline close time "24.85074442", # Quote asset volume 2283, # Number of trades "1171.64000000", # Taker buy base asset volume "12.71225884", # Taker buy quote asset volume "0" # Unused field, ignore ] ] }
- Raises:
BinanceRequestException, BinanceAPIException
- ws_get_my_trades(**params)[source]
Query information about your trades, filtered by time range.
- Parameters:
symbol (str) – STRING - Required
orderId (int) – optional - Get trades for a specific order
startTime (int) – optional
endTime (int) – optional
fromId (int) – optional - Trade ID to fetch from
limit (int) – optional - Default 500; max 1000
recvWindow (int) – optional - The value cannot be greater than 60000
- Returns:
Websocket response
[ { "symbol": "BTCUSDT", "id": 1650422481, "orderId": 12569099453, "orderListId": -1, "price": "23416.10000000", "qty": "0.00635000", "quoteQty": "148.69223500", "commission": "0.00000000", "commissionAsset": "BNB", "time": 1660801715793, "isBuyer": false, "isMaker": true, "isBestMatch": true } ]
- Notes:
Weight: 20
Data Source: Memory => Database
If fromId is specified, return trades with trade ID >= fromId
If startTime and/or endTime are specified, trades are filtered by execution time (time)
fromId cannot be used together with startTime and endTime
If orderId is specified, only trades related to that order are returned
startTime and endTime cannot be used together with orderId
If no condition is specified, the most recent trades are returned
The time between startTime and endTime can’t be longer than 24 hours
- ws_get_oco_open_orders(**params)[source]
Query current open OCO (One-Cancels-the-Other) order lists.
- Parameters:
recvWindow (int) – optional - Number of milliseconds after timestamp the request is valid for. Default 5000, max 60000
apiKey (str) – required - Your API key
signature (str) – required - HMAC SHA256 signature
timestamp (int) – required - Current timestamp in milliseconds
- Returns:
API response in JSON format with open OCO orders
- {
“id”: “c5899911-d3f5-47b3-9b67-4c1342f2a7e1”, “status”: 200, “result”: [
- {
“orderListId”: 1274512, “contingencyType”: “OCO”, “listStatusType”: “EXEC_STARTED”, “listOrderStatus”: “EXECUTING”, “listClientOrderId”: “08985fedd9ea2cf6b28996”, “transactionTime”: 1660801713793, “symbol”: “BTCUSDT”, “orders”: [
- {
“symbol”: “BTCUSDT”, “orderId”: 12569138901, “clientOrderId”: “BqtFCj5odMoWtSqGk2X9tU”
}, {
”symbol”: “BTCUSDT”, “orderId”: 12569138902, “clientOrderId”: “jLnZpj5enfMXTuhKB1d0us”
}
]
}
], “rateLimits”: [
- {
“rateLimitType”: “REQUEST_WEIGHT”, “interval”: “MINUTE”, “intervalNum”: 1, “limit”: 6000, “count”: 10
}
]
}
- Raises:
BinanceRequestException, BinanceAPIException
Weight: 10 Data Source: Memory
- ws_get_oco_order(**params)[source]
Query information about a specific OCO order list.
- Parameters:
orderListId – int - The identifier for the OCO order list (optional)
origClientOrderId – str - The client-specified OCO order list ID (optional)
- Returns:
API response containing OCO order list information including:
- Notes:
Either orderListId or origClientOrderId must be provided
Weight: 4
Data Source: Database
- ws_get_open_orders(**params)[source]
Get all open orders on a symbol or all symbols. https://developers.binance.com/docs/binance-spot-api-docs/testnet/web-socket-api/public-api-requests#current-open-orders-user_data
- Parameters:
symbol (str) – optional - Symbol to get open orders for
recvWindow (int) – optional - The value cannot be greater than 60000
- Returns:
API response
Response format: [
- {
“symbol”: “BTCUSDT”, “orderId”: 12569099453, “orderListId”: -1, “clientOrderId”: “4d96324ff9d44481926157”, “price”: “23416.10000000”, “origQty”: “0.00847000”, “executedQty”: “0.00720000”, “cummulativeQuoteQty”: “168.59532000”, “status”: “PARTIALLY_FILLED”, “timeInForce”: “GTC”, “type”: “LIMIT”, “side”: “SELL”, “stopPrice”: “0.00000000”, “icebergQty”: “0.00000000”, “time”: 1660801715639, “updateTime”: 1660801717945, “isWorking”: true, “workingTime”: 1660801715639, “origQuoteOrderQty”: “0.00000000”, “selfTradePreventionMode”: “NONE”
}
]
Weight: Adjusted based on parameters: - With symbol: 6 - Without symbol: 12
- ws_get_order(**params)[source]
Check an order’s status. Either orderId or origClientOrderId must be sent. https://binance-docs.github.io/apidocs/websocket_api/en/#query-order-user_data :param symbol: required :type symbol: str :param orderId: The unique order id :type orderId: int :param origClientOrderId: optional :type origClientOrderId: str :param recvWindow: the number of milliseconds the request is valid for :type recvWindow: int
- ws_get_order_book(**params)[source]
Get current order book for a symbol.
Note that this request returns limited market depth. If you need to continuously monitor order book updates, consider using WebSocket Streams: - <symbol>@depth<levels> - <symbol>@depth
You can use depth request together with <symbol>@depth streams to maintain a local order book.
- Parameters:
symbol (str) – STRING - Required - Trading symbol
limit (int) – INT - Optional - Default 100; max 5000
- Returns:
Websocket message
- {
“lastUpdateId”: 2731179239, “bids”: [ // Bid levels sorted from highest to lowest price
- [
“0.01379900”, // Price level “3.43200000” // Quantity
], “asks”: [ // Ask levels sorted from lowest to highest price
- [
“0.01380000”, // Price level “5.91700000” // Quantity
]
}
- Weight: Adjusted based on limit:
1-100: 5
101-500: 25
501-1000: 50
1001-5000: 250
Data Source: Memory
- ws_get_orderbook_ticker(**params)[source]
Get the best price/quantity on the order book for a symbol or symbols.
- Parameters:
symbol (str) – STRING - Optional - Query ticker of a single symbol
symbols (list) – ARRAY of STRING - Optional - Query ticker for multiple symbols
- Returns:
Websocket response
With symbol parameter: {
”symbol”: “BNBBTC”, “bidPrice”: “0.01358000”, “bidQty”: “0.95200000”, “askPrice”: “0.01358100”, “askQty”: “11.91700000”
}
With symbols parameter: [
- {
“symbol”: “BNBBTC”, “bidPrice”: “0.01358000”, “bidQty”: “0.95200000”, “askPrice”: “0.01358100”, “askQty”: “11.91700000”
}, {
”symbol”: “BTCUSDT”, “bidPrice”: “23440.90000000”, “bidQty”: “0.00200000”, “askPrice”: “23440.91000000”, “askQty”: “0.00200000”
}
]
- Weight:
2 for a single symbol
4 for up to 100 symbols
40 for 101 or more symbols
- ws_get_prevented_matches(**params)[source]
Displays the list of orders that were expired due to STP (Self-Trade Prevention).
- Parameters:
symbol (str) – STRING - Required
preventedMatchId (int) – optional - Get specific prevented match by ID
orderId (int) – optional - Get prevented matches for specific order
fromPreventedMatchId (int) – optional - Get prevented matches from this ID
limit (int) – optional - Default 500; max 1000
recvWindow (int) – optional - The value cannot be greater than 60000
- Returns:
Websocket response
- Supported parameter combinations:
symbol + preventedMatchId
symbol + orderId
symbol + orderId + fromPreventedMatchId (limit defaults to 500)
symbol + orderId + fromPreventedMatchId + limit
- Weight:
2 if symbol is invalid
2 when querying by preventedMatchId
20 when querying by orderId
Data Source: Database
- ws_get_recent_trades(**params)[source]
Get recent trades for a symbol.
If you need access to real-time trading activity, please consider using WebSocket Streams: - <symbol>@trade
- Parameters:
symbol (str) – STRING - Required - Trading symbol
limit (int) – INT - Optional - Default 500; max 1000
- Returns:
API response
- Raises:
BinanceRequestException, BinanceAPIException
Weight: 25 Data Source: Memory
- ws_get_symbol_ticker(**params)[source]
Get latest price for a symbol or symbols.
- Parameters:
symbol (str) – STRING - Optional - Query ticker of a single symbol
symbols (list) – ARRAY of STRING - Optional - Query ticker for multiple symbols
- Returns:
Websocket message
- With symbol parameter:
- {
“symbol”: “BNBBTC”, “price”: “0.01361000”
}
With symbols parameter: [
- {
“symbol”: “BNBBTC”, “price”: “0.01361000”
}, {
“symbol”: “BTCUSDT”, “price”: “23440.91000000”
}
]
- Weight:
1 for a single symbol
2 for up to 20 symbols
40 for 21 to 100 symbols
40 for all symbols
- ws_get_symbol_ticker_window(**params)[source]
Get rolling window price change statistics.
- Parameters:
symbol (str) – STRING - Optional - Query ticker of a single symbol
symbols (list) – ARRAY of STRING - Optional - Query ticker for multiple symbols
windowSize (str) – STRING - Required - Supported windowSize values: - 1h, 2h, 4h, 6h, 12h - 1d, 2d, 3d, 4d, 5d, 6d, 7d, 14d, 30d
type (str) – ENUM - Optional - FULL (default) or MINI
- Returns:
Websocket message
With symbol parameter: .. code-block:: python
- {
“symbol”: “BTCUSDT”, “priceChange”: “-83.13000000”, # Absolute price change “priceChangePercent”: “-0.317”, # Relative price change in percent “weightedAvgPrice”: “26234.58803036”, # quoteVolume / volume “openPrice”: “26304.80000000”, “highPrice”: “26397.46000000”, “lowPrice”: “26088.34000000”, “lastPrice”: “26221.67000000”, “volume”: “18495.35066000”, # Volume in base asset “quoteVolume”: “485217905.04210480”, # Volume in quote asset “openTime”: 1695686400000, “closeTime”: 1695772799999, “firstId”: 3220151555, # Trade ID of first trade in the interval “lastId”: 3220849281, # Trade ID of last trade in the interval “count”: 697727 # Number of trades in the interval
}
With symbols parameter: .. code-block:: python
- [
- {
# Same fields as above
}, {
# Same fields as above for next symbol
}
]
For MINI type response: .. code-block:: python
- {
“symbol”: “BTCUSDT”, “openPrice”: “26304.80000000”, “highPrice”: “26397.46000000”, “lowPrice”: “26088.34000000”, “lastPrice”: “26221.67000000”, “volume”: “18495.35066000”, “quoteVolume”: “485217905.04210480”, “openTime”: 1695686400000, “closeTime”: 1695772799999, “firstId”: 3220151555, “lastId”: 3220849281, “count”: 697727
}
- Weight:
4 for each requested symbol
Weight caps at 200 once number of symbols > 50
- ws_get_ticker(**params)[source]
Get 24-hour rolling window price change statistics.
- Parameters:
symbol (str) – STRING - Optional - Query ticker for a single symbol
symbols (list) – ARRAY of STRING - Optional - Query ticker for multiple symbols
type (str) – ENUM - Optional - Ticker type: FULL (default) or MINI
- Note:
symbol and symbols cannot be used together
If no symbol is specified, returns information about all symbols currently trading on the exchange
- Weight:
Adjusted based on the number of requested symbols: - 1-20 symbols: 2 - 21-100 symbols: 40 - 101 or more symbols: 80 - all symbols: 80
- Returns:
Websocket message
For a single symbol with type=FULL: .. code-block:: python
- {
“symbol”: “BNBBTC”, “priceChange”: “0.00013900”, # Absolute price change “priceChangePercent”: “1.020”, # Relative price change in percent “weightedAvgPrice”: “0.01382453”, # Quote volume divided by volume “prevClosePrice”: “0.01362800”, # Previous day’s close price “lastPrice”: “0.01376700”, # Latest price “lastQty”: “1.78800000”, # Latest quantity “bidPrice”: “0.01376700”, # Best bid price “bidQty”: “4.64600000”, # Best bid quantity “askPrice”: “0.01376800”, # Best ask price “askQty”: “14.31400000”, # Best ask quantity “openPrice”: “0.01362800”, # Open price 24 hours ago “highPrice”: “0.01414900”, # Highest price in the last 24 hours “lowPrice”: “0.01346600”, # Lowest price in the last 24 hours “volume”: “69412.40500000”, # Trading volume in base asset “quoteVolume”: “959.59411487”, # Trading volume in quote asset “openTime”: 1660014164909, # Open time for 24hr rolling window “closeTime”: 1660100564909, # Close time for 24hr rolling window “firstId”: 194696115, # First trade ID “lastId”: 194968287, # Last trade ID “count”: 272173 # Number of trades
}
For a single symbol with type=MINI: .. code-block:: python
- {
“symbol”: “BNBBTC”, “openPrice”: “0.01362800”, “highPrice”: “0.01414900”, “lowPrice”: “0.01346600”, “lastPrice”: “0.01376700”, “volume”: “69412.40500000”, “quoteVolume”: “959.59411487”, “openTime”: 1660014164909, “closeTime”: 1660100564909, “firstId”: 194696115, “lastId”: 194968287, “count”: 272173
}
- ws_get_time(**params)[source]
Test connectivity to the WebSocket API and get the current server time.
- Returns:
API response with server time
- {
“id”: “187d3cb2-942d-484c-8271-4e2141bbadb1”, “status”: 200, “result”: {
”serverTime”: 1656400526260
}, “rateLimits”: [
- {
“rateLimitType”: “REQUEST_WEIGHT”, “interval”: “MINUTE”, “intervalNum”: 1, “limit”: 6000, “count”: 1
}
]
}
Weight: 1 Data Source: Memory
- ws_get_trading_day_ticker(**params)[source]
Price change statistics for a trading day.
- Parameters:
symbol (str) – STRING - Optional - Query ticker of a single symbol
symbols (list) – ARRAY of STRING - Optional - Query ticker for multiple symbols
timeZone (str) – STRING - Optional - Default: 0 (UTC) Supported values: - Hours and minutes (e.g. “-1:00”, “05:45”) - Only hours (e.g. “0”, “8”, “4”) - Accepted range is strictly [-12:00 to +14:00] inclusive
type (str) – ENUM - Optional - FULL (default) or MINI
- Returns:
Websocket message
Response FULL type example: {
“symbol”: “BTCUSDT”, “priceChange”: “-83.13000000”, # Absolute price change “priceChangePercent”: “-0.317”, # Relative price change in percent “weightedAvgPrice”: “26234.58803036”, # quoteVolume / volume “openPrice”: “26304.80000000”, “highPrice”: “26397.46000000”, “lowPrice”: “26088.34000000”, “lastPrice”: “26221.67000000”, “volume”: “18495.35066000”, # Volume in base asset “quoteVolume”: “485217905.04210480”, “openTime”: 1695686400000, “closeTime”: 1695772799999, “firstId”: 3220151555, “lastId”: 3220849281, “count”: 697727
}
Response MINI type example: {
“symbol”: “BTCUSDT”, “openPrice”: “26304.80000000”, “highPrice”: “26397.46000000”, “lowPrice”: “26088.34000000”, “lastPrice”: “26221.67000000”, “volume”: “18495.35066000”, # Volume in base asset “quoteVolume”: “485217905.04210480”, # Volume in quote asset “openTime”: 1695686400000, “closeTime”: 1695772799999, “firstId”: 3220151555, # Trade ID of the first trade in the interval “lastId”: 3220849281, # Trade ID of the last trade in the interval “count”: 697727 # Number of trades in the interval
}
- Weight:
4 for each requested symbol
Weight caps at 200 once number of symbols > 50
- ws_get_uiKlines(**params)[source]
Get klines (candlestick bars) optimized for presentation.
This request is similar to klines, having the same parameters and response. uiKlines return modified kline data, optimized for presentation of candlestick charts.
- Parameters:
symbol (str) – STRING - Required - Trading symbol
interval (str) – ENUM - Required - Kline interval
startTime (int) – INT - Optional - Start time in milliseconds
endTime (int) – INT - Optional - End time in milliseconds
timeZone (str) – STRING - Optional - Default: 0 (UTC)
limit (int) – INT - Optional - Default 500; max 1000
- Supported kline intervals:
seconds: 1s
minutes: 1m, 3m, 5m, 15m, 30m
hours: 1h, 2h, 4h, 6h, 8h, 12h
days: 1d, 3d
weeks: 1w
months: 1M
- Notes:
If startTime/endTime not specified, returns most recent klines
- Supported timeZone values:
Hours and minutes (e.g. “-1:00”, “05:45”)
Only hours (e.g. “0”, “8”, “4”)
Accepted range is strictly [-12:00 to +14:00] inclusive
If timeZone provided, kline intervals are interpreted in that timezone instead of UTC
startTime and endTime are always interpreted in UTC, regardless of timeZone
- Returns:
API response
{ "id": "b137468a-fb20-4c06-bd6b-625148eec958", "result": [ [ 1655971200000, # Kline open time "0.01086000", # Open price "0.01086600", # High price "0.01083600", # Low price "0.01083800", # Close price "2290.53800000", # Volume 1655974799999, # Kline close time "24.85074442", # Quote asset volume 2283, # Number of trades "1171.64000000", # Taker buy base asset volume "12.71225884", # Taker buy quote asset volume "0" # Unused field, ignore ] ] }
- Raises:
BinanceRequestException, BinanceAPIException
- ws_order_limit(timeInForce='GTC', **params)[source]
Send in a new limit order Any order with an icebergQty MUST have timeInForce set to GTC. :param symbol: required :type symbol: str :param side: required :type side: str :param quantity: required :type quantity: decimal :param price: required :type price: str :param timeInForce: default Good till cancelled :type timeInForce: str :param newClientOrderId: A unique id for the order. Automatically generated if not sent. :type newClientOrderId: str :param icebergQty: Used with LIMIT, STOP_LOSS_LIMIT, and TAKE_PROFIT_LIMIT to create an iceberg order. :type icebergQty: decimal :param newOrderRespType: Set the response JSON. ACK, RESULT, or FULL; default: RESULT. :type newOrderRespType: str :param recvWindow: the number of milliseconds the request is valid for :type recvWindow: int :returns: WS response See order endpoint for full response options
- ws_order_limit_buy(timeInForce='GTC', **params)[source]
Send in a new limit buy order Any order with an icebergQty MUST have timeInForce set to GTC. :param symbol: required :type symbol: str :param quantity: required :type quantity: decimal :param price: required :type price: str :param timeInForce: default Good till cancelled :type timeInForce: str :param newClientOrderId: A unique id for the order. Automatically generated if not sent. :type newClientOrderId: str :param stopPrice: Used with stop orders :type stopPrice: decimal :param icebergQty: Used with iceberg orders :type icebergQty: decimal :param newOrderRespType: Set the response JSON. ACK, RESULT, or FULL; default: RESULT. :type newOrderRespType: str :param recvWindow: the number of milliseconds the request is valid for :type recvWindow: int :returns: WS response See order endpoint for full response options
- ws_order_limit_sell(timeInForce='GTC', **params)[source]
Send in a new limit sell order :param symbol: required :type symbol: str :param quantity: required :type quantity: decimal :param price: required :type price: str :param timeInForce: default Good till cancelled :type timeInForce: str :param newClientOrderId: A unique id for the order. Automatically generated if not sent. :type newClientOrderId: str :param stopPrice: Used with stop orders :type stopPrice: decimal :param icebergQty: Used with iceberg orders :type icebergQty: decimal :param newOrderRespType: Set the response JSON. ACK, RESULT, or FULL; default: RESULT. :type newOrderRespType: str :param recvWindow: the number of milliseconds the request is valid for :type recvWindow: int :returns: WS response See order endpoint for full response options
- ws_order_market(**params)[source]
Send in a new market order :param symbol: required :type symbol: str :param side: required :type side: str :param quantity: required :type quantity: decimal :param quoteOrderQty: amount the user wants to spend (when buying) or receive (when selling)
of the quote asset
- Parameters:
newClientOrderId (str) – A unique id for the order. Automatically generated if not sent.
newOrderRespType (str) – Set the response JSON. ACK, RESULT, or FULL; default: RESULT.
recvWindow (int) – the number of milliseconds the request is valid for
- Returns:
WS response
See order endpoint for full response options
- ws_order_market_buy(**params)[source]
Send in a new market buy order :param symbol: required :type symbol: str :param quantity: required :type quantity: decimal :param quoteOrderQty: the amount the user wants to spend of the quote asset :type quoteOrderQty: decimal :param newClientOrderId: A unique id for the order. Automatically generated if not sent. :type newClientOrderId: str :param newOrderRespType: Set the response JSON. ACK, RESULT, or FULL; default: RESULT. :type newOrderRespType: str :param recvWindow: the number of milliseconds the request is valid for :type recvWindow: int :returns: WS response See order endpoint for full response options
- ws_order_market_sell(**params)[source]
Send in a new market sell order :param symbol: required :type symbol: str :param quantity: required :type quantity: decimal :param quoteOrderQty: the amount the user wants to receive of the quote asset :type quoteOrderQty: decimal :param newClientOrderId: A unique id for the order. Automatically generated if not sent. :type newClientOrderId: str :param newOrderRespType: Set the response JSON. ACK, RESULT, or FULL; default: RESULT. :type newOrderRespType: str :param recvWindow: the number of milliseconds the request is valid for :type recvWindow: int :returns: WS response See order endpoint for full response options
Async client module
- class binance.async_client.AsyncClient(api_key: str | None = None, api_secret: str | None = None, requests_params: Dict[str, Any] | None = None, tld: str = 'com', base_endpoint: str = '', testnet: bool = False, demo: bool = False, loop=None, session_params: Dict[str, Any] | None = None, private_key: str | Path | None = None, private_key_pass: str | None = None, https_proxy: str | None = None, time_unit: str | None = None, verbose: bool = False)[source]
Bases:
BaseClient- __init__(api_key: str | None = None, api_secret: str | None = None, requests_params: Dict[str, Any] | None = None, tld: str = 'com', base_endpoint: str = '', testnet: bool = False, demo: bool = False, loop=None, session_params: Dict[str, Any] | None = None, private_key: str | Path | None = None, private_key_pass: str | None = None, https_proxy: str | None = None, time_unit: str | None = None, verbose: bool = False)[source]
Binance API Client constructor
- Parameters:
api_key (str.) – Api Key
api_secret (str.) – Api Secret
requests_params (dict.) – optional - Dictionary of requests params to use for all calls
testnet (bool) – Use testnet environment - only available for vanilla options at the moment
private_key (optional - str or Path) – Path to private key, or string of file contents
private_key_pass (optional - str) – Password of private key
time_unit (optional - str) – Time unit to use for requests. Supported values: “MILLISECOND”, “MICROSECOND”
verbose (bool) – Enable verbose logging for debugging
- async aggregate_trade_iter(symbol, start_str=None, last_id=None)[source]
Iterate over aggregate trade data from (start_time or last_id) to the end of the history so far.
If start_time is specified, start with the first trade after start_time. Meant to initialise a local cache of trade data.
If last_id is specified, start with the trade after it. This is meant for updating a pre-existing local trade data cache.
Only allows start_str or last_id—not both. Not guaranteed to work right if you’re running more than one of these simultaneously. You will probably hit your rate limit.
See dateparser docs for valid start and end string formats http://dateparser.readthedocs.io/en/latest/
If using offset strings for dates add “UTC” to date string e.g. “now UTC”, “11 hours ago UTC”
- Parameters:
symbol (str) – Symbol string e.g. ETHBTC
start_str – Start date string in UTC format or timestamp in milliseconds. The iterator will
return the first trade occurring later than this time. :type start_str: str|int :param last_id: aggregate trade ID of the last known aggregate trade. Not a regular trade ID. See https://binance-docs.github.io/apidocs/spot/en/#compressed-aggregate-trades-list
- Returns:
an iterator of JSON objects, one per trade. The format of
each object is identical to Client.aggregate_trades().
- async cancel_all_open_margin_orders(**params)[source]
Cancels all active orders on a symbol for margin account.
https://developers.binance.com/docs/margin_trading/trade/Margin-Account-Cancel-All-Open-Orders
- Parameters:
symbol (str) – required
isIsolated (str) – set to ‘TRUE’ for isolated margin (default ‘FALSE’)
recvWindow (int) – the number of milliseconds the request is valid for
- Returns:
API response
- Raises:
BinanceRequestException, BinanceAPIException
- async cancel_all_open_orders(**params)[source]
Cancel all open orders on a symbol.
- Parameters:
symbol (str) – required
- Returns:
API response
- async cancel_margin_oco_order(**params)[source]
Cancel an entire Order List for a margin account.
https://developers.binance.com/docs/margin_trading/trade/Margin-Account-Cancel-OCO
- Parameters:
symbol (str) – required
isIsolated – for isolated margin or not, “TRUE”, “FALSE”,default “FALSE”
orderListId (int) – Either orderListId or listClientOrderId must be provided
listClientOrderId (str) – Either orderListId or listClientOrderId must be provided
newClientOrderId (str) – Used to uniquely identify this cancel. Automatically generated by default.
recvWindow (int) – the number of milliseconds the request is valid for
- Returns:
API response
{ "orderListId": 0, "contingencyType": "OCO", "listStatusType": "ALL_DONE", "listOrderStatus": "ALL_DONE", "listClientOrderId": "C3wyj4WVEktd7u9aVBRXcN", "transactionTime": 1574040868128, "symbol": "LTCBTC", "isIsolated": false, // if isolated margin "orders": [ { "symbol": "LTCBTC", "orderId": 2, "clientOrderId": "pO9ufTiFGg3nw2fOdgeOXa" }, { "symbol": "LTCBTC", "orderId": 3, "clientOrderId": "TXOvglzXuaubXAaENpaRCB" } ], "orderReports": [ { "symbol": "LTCBTC", "origClientOrderId": "pO9ufTiFGg3nw2fOdgeOXa", "orderId": 2, "orderListId": 0, "clientOrderId": "unfWT8ig8i0uj6lPuYLez6", "price": "1.00000000", "origQty": "10.00000000", "executedQty": "0.00000000", "cummulativeQuoteQty": "0.00000000", "status": "CANCELED", "timeInForce": "GTC", "type": "STOP_LOSS_LIMIT", "side": "SELL", "stopPrice": "1.00000000" }, { "symbol": "LTCBTC", "origClientOrderId": "TXOvglzXuaubXAaENpaRCB", "orderId": 3, "orderListId": 0, "clientOrderId": "unfWT8ig8i0uj6lPuYLez6", "price": "3.00000000", "origQty": "10.00000000", "executedQty": "0.00000000", "cummulativeQuoteQty": "0.00000000", "status": "CANCELED", "timeInForce": "GTC", "type": "LIMIT_MAKER", "side": "SELL" } ] }
- async cancel_margin_order(**params)[source]
Cancel an active order for margin account.
Either orderId or origClientOrderId must be sent.
https://developers.binance.com/docs/margin_trading/trade/Margin-Account-Cancel-Order
- Parameters:
symbol (str) – required
isIsolated (str) – set to ‘TRUE’ for isolated margin (default ‘FALSE’)
orderId (str)
origClientOrderId (str)
newClientOrderId (str) – Used to uniquely identify this cancel. Automatically generated by default.
recvWindow (int) – the number of milliseconds the request is valid for
- Returns:
API response
- {
“symbol”: “LTCBTC”, “orderId”: 28, “origClientOrderId”: “myOrder1”, “clientOrderId”: “cancelMyOrder1”, “transactTime”: 1507725176595, “price”: “1.00000000”, “origQty”: “10.00000000”, “executedQty”: “8.00000000”, “cummulativeQuoteQty”: “8.00000000”, “status”: “CANCELED”, “timeInForce”: “GTC”, “type”: “LIMIT”, “side”: “SELL”
}
- Raises:
BinanceRequestException, BinanceAPIException
- async cancel_order(**params)[source]
Cancel an active order. Either orderId or origClientOrderId must be sent.
- Parameters:
symbol (str) – required
orderId (int) – The unique order id
origClientOrderId (str) – optional
newClientOrderId (str) – Used to uniquely identify this cancel. Automatically generated by default.
recvWindow (int) – the number of milliseconds the request is valid for
- Returns:
API response
{ "symbol": "LTCBTC", "origClientOrderId": "myOrder1", "orderId": 1, "clientOrderId": "cancelMyOrder1" }
- Raises:
BinanceRequestException, BinanceAPIException
- async cancel_replace_order(**params)[source]
Cancels an existing order and places a new order on the same symbol.
Filters and Order Count are evaluated before the processing of the cancellation and order placement occurs.
A new order that was not attempted (i.e. when newOrderResult: NOT_ATTEMPTED), will still increase the order count by 1.
- Parameters:
symbol (str) – required
side (enum) – required
type (enum) – required
cancelReplaceMode (enum) – required - STOP_ON_FAILURE or ALLOW_FAILURE
timeInForce (enum) – optional
quantity (decimal) – optional
quoteOrderQty (decimal) – optional
price (decimal) – optional
cancelNewClientOrderId (str) – optional - Used to uniquely identify this cancel. Automatically generated by default.
cancelOrigClientOrderId (str) – optional - Either the cancelOrigClientOrderId or cancelOrderId must be provided. If both are provided, cancelOrderId takes precedence.
cancelOrderId (long) – optional - Either the cancelOrigClientOrderId or cancelOrderId must be provided. If both are provided, cancelOrderId takes precedence.
newClientOrderId (str) – optional - Used to identify the new order.
strategyId (int) – optional
strategyType (int) – optional - The value cannot be less than 1000000.
stopPrice (decimal) – optional
trailingDelta (long) – optional
icebergQty (decimal) – optional
newOrderRespType (enum) – optional - ACK, RESULT or FULL. MARKET and LIMIT orders types default to FULL; all other orders default to ACK
selfTradePreventionMode (enum) – optional - EXPIRE_TAKER, EXPIRE_MAKER, EXPIRE_BOTH or NONE.
cancelRestrictions (enum) – optional - ONLY_NEW or ONLY_PARTIALLY_FILLED
recvWindow (int) – optional - The value cannot be greater than 60000
- Returns:
API response
//Both the cancel order placement and new order placement succeeded. { "cancelResult": "SUCCESS", "newOrderResult": "SUCCESS", "cancelResponse": { "symbol": "BTCUSDT", "origClientOrderId": "DnLo3vTAQcjha43lAZhZ0y", "orderId": 9, "orderListId": -1, "clientOrderId": "osxN3JXAtJvKvCqGeMWMVR", "transactTime": 1684804350068, "price": "0.01000000", "origQty": "0.000100", "executedQty": "0.00000000", "cummulativeQuoteQty": "0.00000000", "status": "CANCELED", "timeInForce": "GTC", "type": "LIMIT", "side": "SELL", "selfTradePreventionMode": "NONE" }, "newOrderResponse": { "symbol": "BTCUSDT", "orderId": 10, "orderListId": -1, "clientOrderId": "wOceeeOzNORyLiQfw7jd8S", "transactTime": 1652928801803, "price": "0.02000000", "origQty": "0.040000", "executedQty": "0.00000000", "cummulativeQuoteQty": "0.00000000", "status": "NEW", "timeInForce": "GTC", "type": "LIMIT", "side": "BUY", "workingTime": 1669277163808, "fills": [], "selfTradePreventionMode": "NONE" } }
Similar to POST /api/v3/order, additional mandatory parameters are determined by type.
Response format varies depending on whether the processing of the message succeeded, partially succeeded, or failed.
- Raises:
BinanceRequestException, BinanceAPIException
- async change_fixed_activity_to_daily_position(**params)[source]
Change Fixed/Activity Position to Daily Position
- async convert_accept_quote(**params)[source]
Accept the offered quote by quote ID.
https://developers.binance.com/docs/convert/trade/Accept-Quote
- Parameters:
quoteId (str) – required - 457235734584567
recvWindow (int) – optional
- Returns:
API response
- async convert_request_quote(**params)[source]
Request a quote for the requested token pairs
https://developers.binance.com/docs/convert/trade
- Parameters:
fromAsset (str) – required - Asset to convert from - BUSD
toAsset (str) – required - Asset to convert to - BTC
fromAmount (decimal) – EITHER - When specified, it is the amount you will be debited after the conversion
toAmount (decimal) – EITHER - When specified, it is the amount you will be credited after the conversion
recvWindow (int) – optional
- Returns:
API response
- async classmethod create(api_key: str | None = None, api_secret: str | None = None, requests_params: Dict[str, Any] | None = None, tld: str = 'com', base_endpoint: str = '', testnet: bool = False, demo: bool = False, loop=None, session_params: Dict[str, Any] | None = None, private_key: str | Path | None = None, private_key_pass: str | None = None, https_proxy: str | None = None, time_unit: str | None = None, verbose: bool = False)[source]
- async create_isolated_margin_account(**params)[source]
Create isolated margin account for symbol
https://binance-docs.github.io/apidocs/spot/en/#create-isolated-margin-account-margin
- Parameters:
base (str) – Base asset of symbol
quote (str) – Quote asset of symbol
pair_details = client.create_isolated_margin_account(base='USDT', quote='BTC')
- Returns:
API response
{ "success": true, "symbol": "BTCUSDT" }
- Raises:
BinanceRequestException, BinanceAPIException
- async create_margin_loan(**params)[source]
Apply for a loan in cross-margin or isolated-margin account.
https://binance-docs.github.io/apidocs/spot/en/#margin-account-borrow-margin
- Parameters:
asset (str) – name of the asset
amount (str) – amount to transfer
isIsolated (str) – set to ‘TRUE’ for isolated margin (default ‘FALSE’)
symbol (str) – Isolated margin symbol (default blank for cross-margin)
recvWindow (int) – the number of milliseconds the request is valid for
transaction = client.margin_create_loan(asset='BTC', amount='1.1') transaction = client.margin_create_loan(asset='BTC', amount='1.1', isIsolated='TRUE', symbol='ETHBTC')
- Returns:
API response
{ "tranId": 100000001 }
- Raises:
BinanceRequestException, BinanceAPIException
- async create_margin_oco_order(**params)[source]
Post a new OCO trade for margin account.
https://developers.binance.com/docs/margin_trading/trade/Margin-Account-New-OCO
- Parameters:
symbol (str) – required
isIsolated – for isolated margin or not, “TRUE”, “FALSE”,default “FALSE”
listClientOrderId (str) – A unique id for the list order. Automatically generated if not sent.
side (str) – required
quantity (decimal) – required
limitClientOrderId (str) – A unique id for the limit order. Automatically generated if not sent.
price (str) – required
limitIcebergQty (decimal) – Used to make the LIMIT_MAKER leg an iceberg order.
stopClientOrderId (str) – A unique Id for the stop loss/stop loss limit leg. Automatically generated if not sent.
stopPrice (str) – required
stopLimitPrice (str) – If provided, stopLimitTimeInForce is required.
stopIcebergQty (decimal) – Used with STOP_LOSS_LIMIT leg to make an iceberg order.
stopLimitTimeInForce (str) – Valid values are GTC/FOK/IOC.
newOrderRespType (str) – Set the response JSON. ACK, RESULT, or FULL; default: RESULT.
sideEffectType (str) – NO_SIDE_EFFECT, MARGIN_BUY, AUTO_REPAY; default NO_SIDE_EFFECT.
recvWindow (int) – the number of milliseconds the request is valid for
- Returns:
API response
{ "orderListId": 0, "contingencyType": "OCO", "listStatusType": "EXEC_STARTED", "listOrderStatus": "EXECUTING", "listClientOrderId": "JYVpp3F0f5CAG15DhtrqLp", "transactionTime": 1563417480525, "symbol": "LTCBTC", "marginBuyBorrowAmount": "5", // will not return if no margin trade happens "marginBuyBorrowAsset": "BTC", // will not return if no margin trade happens "isIsolated": false, // if isolated margin "orders": [ { "symbol": "LTCBTC", "orderId": 2, "clientOrderId": "Kk7sqHb9J6mJWTMDVW7Vos" }, { "symbol": "LTCBTC", "orderId": 3, "clientOrderId": "xTXKaGYd4bluPVp78IVRvl" } ], "orderReports": [ { "symbol": "LTCBTC", "orderId": 2, "orderListId": 0, "clientOrderId": "Kk7sqHb9J6mJWTMDVW7Vos", "transactTime": 1563417480525, "price": "0.000000", "origQty": "0.624363", "executedQty": "0.000000", "cummulativeQuoteQty": "0.000000", "status": "NEW", "timeInForce": "GTC", "type": "STOP_LOSS", "side": "BUY", "stopPrice": "0.960664" }, { "symbol": "LTCBTC", "orderId": 3, "orderListId": 0, "clientOrderId": "xTXKaGYd4bluPVp78IVRvl", "transactTime": 1563417480525, "price": "0.036435", "origQty": "0.624363", "executedQty": "0.000000", "cummulativeQuoteQty": "0.000000", "status": "NEW", "timeInForce": "GTC", "type": "LIMIT_MAKER", "side": "BUY" } ] }
- Raises:
BinanceRequestException, BinanceAPIException, BinanceOrderException, BinanceOrderMinAmountException, BinanceOrderMinPriceException, BinanceOrderMinTotalException, BinanceOrderUnknownSymbolException, BinanceOrderInactiveSymbolException
- async create_margin_order(**params)[source]
Post a new order for margin account.
https://developers.binance.com/docs/margin_trading/trade/Margin-Account-New-Order
- Parameters:
symbol (str) – required
isIsolated (str) – set to ‘TRUE’ for isolated margin (default ‘FALSE’)
side (str) – required
type (str) – required
quantity (decimal) – required
price (str) – required
stopPrice (str) – Used with STOP_LOSS, STOP_LOSS_LIMIT, TAKE_PROFIT, and TAKE_PROFIT_LIMIT orders.
timeInForce (str) – required if limit order GTC,IOC,FOK
newClientOrderId (str) – A unique id for the order. Automatically generated if not sent.
icebergQty (str) – Used with LIMIT, STOP_LOSS_LIMIT, and TAKE_PROFIT_LIMIT to create an iceberg order.
newOrderRespType (str) – Set the response JSON. ACK, RESULT, or FULL; MARKET and LIMIT order types default to FULL, all other orders default to ACK.
recvWindow (int) – the number of milliseconds the request is valid for
- Returns:
API response
Response ACK:
{ "symbol": "BTCUSDT", "orderId": 28, "clientOrderId": "6gCrw2kRUAF9CvJDGP16IP", "transactTime": 1507725176595 }
Response RESULT:
{ "symbol": "BTCUSDT", "orderId": 28, "clientOrderId": "6gCrw2kRUAF9CvJDGP16IP", "transactTime": 1507725176595, "price": "1.00000000", "origQty": "10.00000000", "executedQty": "10.00000000", "cummulativeQuoteQty": "10.00000000", "status": "FILLED", "timeInForce": "GTC", "type": "MARKET", "side": "SELL" }
Response FULL:
{ "symbol": "BTCUSDT", "orderId": 28, "clientOrderId": "6gCrw2kRUAF9CvJDGP16IP", "transactTime": 1507725176595, "price": "1.00000000", "origQty": "10.00000000", "executedQty": "10.00000000", "cummulativeQuoteQty": "10.00000000", "status": "FILLED", "timeInForce": "GTC", "type": "MARKET", "side": "SELL", "fills": [ { "price": "4000.00000000", "qty": "1.00000000", "commission": "4.00000000", "commissionAsset": "USDT" }, { "price": "3999.00000000", "qty": "5.00000000", "commission": "19.99500000", "commissionAsset": "USDT" }, { "price": "3998.00000000", "qty": "2.00000000", "commission": "7.99600000", "commissionAsset": "USDT" }, { "price": "3997.00000000", "qty": "1.00000000", "commission": "3.99700000", "commissionAsset": "USDT" }, { "price": "3995.00000000", "qty": "1.00000000", "commission": "3.99500000", "commissionAsset": "USDT" } ] }
- Raises:
BinanceRequestException, BinanceAPIException, BinanceOrderException, BinanceOrderMinAmountException, BinanceOrderMinPriceException, BinanceOrderMinTotalException, BinanceOrderUnknownSymbolException, BinanceOrderInactiveSymbolException
- async create_oco_order(**params)[source]
Send in an one-cancels-the-other (OCO) pair, where activation of one order immediately cancels the other.
An OCO has 2 orders called the above order and below order. One of the orders must be a LIMIT_MAKER/TAKE_PROFIT/TAKE_PROFIT_LIMIT order and the other must be STOP_LOSS or STOP_LOSS_LIMIT order.
Price restrictions: If the OCO is on the SELL side:
LIMIT_MAKER/TAKE_PROFIT_LIMIT price > Last Traded Price > STOP_LOSS/STOP_LOSS_LIMIT stopPrice TAKE_PROFIT stopPrice > Last Traded Price > STOP_LOSS/STOP_LOSS_LIMIT stopPrice
- If the OCO is on the BUY side:
LIMIT_MAKER/TAKE_PROFIT_LIMIT price < Last Traded Price < stopPrice TAKE_PROFIT stopPrice < Last Traded Price < STOP_LOSS/STOP_LOSS_LIMIT stopPrice
Weight: 1
- Parameters:
symbol (str) – required
listClientOrderId (str) – Arbitrary unique ID among open order lists. Automatically generated if not sent.
side (str) – required - BUY or SELL
quantity (decimal) – required - Quantity for both orders of the order list
aboveType (str) – required - STOP_LOSS_LIMIT, STOP_LOSS, LIMIT_MAKER, TAKE_PROFIT, TAKE_PROFIT_LIMIT
aboveClientOrderId (str) – Arbitrary unique ID among open orders for the above order
aboveIcebergQty (decimal) – Note that this can only be used if aboveTimeInForce is GTC
abovePrice (decimal) – Can be used if aboveType is STOP_LOSS_LIMIT, LIMIT_MAKER, or TAKE_PROFIT_LIMIT
aboveStopPrice (decimal) – Can be used if aboveType is STOP_LOSS, STOP_LOSS_LIMIT, TAKE_PROFIT, TAKE_PROFIT_LIMIT
aboveTrailingDelta (int) – See Trailing Stop order FAQ
aboveTimeInForce (str) – Required if aboveType is STOP_LOSS_LIMIT or TAKE_PROFIT_LIMIT
aboveStrategyId (int) – Arbitrary numeric value identifying the above order within an order strategy
aboveStrategyType (int) – Arbitrary numeric value identifying the above order strategy (>= 1000000)
belowType (str) – required - STOP_LOSS, STOP_LOSS_LIMIT, TAKE_PROFIT, TAKE_PROFIT_LIMIT
belowClientOrderId (str) – Arbitrary unique ID among open orders for the below order
belowIcebergQty (decimal) – Note that this can only be used if belowTimeInForce is GTC
belowPrice (decimal) – Can be used if belowType is STOP_LOSS_LIMIT, LIMIT_MAKER, or TAKE_PROFIT_LIMIT
belowStopPrice (decimal) – Can be used if belowType is STOP_LOSS, STOP_LOSS_LIMIT, TAKE_PROFIT or TAKE_PROFIT_LIMIT
belowTrailingDelta (int) – See Trailing Stop order FAQ
belowTimeInForce (str) – Required if belowType is STOP_LOSS_LIMIT or TAKE_PROFIT_LIMIT
belowStrategyId (int) – Arbitrary numeric value identifying the below order within an order strategy
belowStrategyType (int) – Arbitrary numeric value identifying the below order strategy (>= 1000000)
newOrderRespType (str) – Select response format: ACK, RESULT, FULL
selfTradePreventionMode (str) – The allowed enums is dependent on what is configured on the symbol
recvWindow (int) – The value cannot be greater than 60000
timestamp (int) – required
- Returns:
API response
- {
“orderListId”: 1, “contingencyType”: “OCO”, “listStatusType”: “EXEC_STARTED”, “listOrderStatus”: “EXECUTING”, “listClientOrderId”: “lH1YDkuQKWiXVXHPSKYEIp”, “transactionTime”: 1710485608839, “symbol”: “LTCBTC”, “orders”: [
- {
“symbol”: “LTCBTC”, “orderId”: 10, “clientOrderId”: “44nZvqpemY7sVYgPYbvPih”
}, {
”symbol”: “LTCBTC”, “orderId”: 11, “clientOrderId”: “NuMp0nVYnciDiFmVqfpBqK”
}
], “orderReports”: [
- {
“symbol”: “LTCBTC”, “orderId”: 10, “orderListId”: 1, “clientOrderId”: “44nZvqpemY7sVYgPYbvPih”, “transactTime”: 1710485608839, “price”: “1.00000000”, “origQty”: “5.00000000”, “executedQty”: “0.00000000”, “origQuoteOrderQty”: “0.000000”, “cummulativeQuoteQty”: “0.00000000”, “status”: “NEW”, “timeInForce”: “GTC”, “type”: “STOP_LOSS_LIMIT”, “side”: “SELL”, “stopPrice”: “1.00000000”, “workingTime”: -1, “icebergQty”: “1.00000000”, “selfTradePreventionMode”: “NONE”
}, {
”symbol”: “LTCBTC”, “orderId”: 11, “orderListId”: 1, “clientOrderId”: “NuMp0nVYnciDiFmVqfpBqK”, “transactTime”: 1710485608839, “price”: “3.00000000”, “origQty”: “5.00000000”, “executedQty”: “0.00000000”, “origQuoteOrderQty”: “0.000000”, “cummulativeQuoteQty”: “0.00000000”, “status”: “NEW”, “timeInForce”: “GTC”, “type”: “LIMIT_MAKER”, “side”: “SELL”, “workingTime”: 1710485608839, “selfTradePreventionMode”: “NONE”
}
]
}
- Raises:
BinanceRequestException, BinanceAPIException, BinanceOrderException, BinanceOrderMinAmountException, BinanceOrderMinPriceException, BinanceOrderMinTotalException, BinanceOrderUnknownSymbolException, BinanceOrderInactiveSymbolException
- async create_order(**params)[source]
Send in a new order
Any order with an icebergQty MUST have timeInForce set to GTC.
https://developers.binance.com/docs/binance-spot-api-docs/rest-api/trading-endpoints#new-order-trade
- Parameters:
symbol (str) – required
side (str) – required
type (str) – required
timeInForce (str) – required if limit order
quantity (decimal) – required
quoteOrderQty (decimal) – amount the user wants to spend (when buying) or receive (when selling) of the quote asset, applicable to MARKET orders
price (str) – required
newClientOrderId (str) – A unique id for the order. Automatically generated if not sent.
icebergQty (decimal) – Used with LIMIT, STOP_LOSS_LIMIT, and TAKE_PROFIT_LIMIT to create an iceberg order.
newOrderRespType (str) – Set the response JSON. ACK, RESULT, or FULL; default: RESULT.
recvWindow (int) – the number of milliseconds the request is valid for
- Returns:
API response
Response ACK:
{ "symbol":"LTCBTC", "orderId": 1, "clientOrderId": "myOrder1" # Will be newClientOrderId "transactTime": 1499827319559 }
Response RESULT:
{ "symbol": "BTCUSDT", "orderId": 28, "clientOrderId": "6gCrw2kRUAF9CvJDGP16IP", "transactTime": 1507725176595, "price": "0.00000000", "origQty": "10.00000000", "executedQty": "10.00000000", "cummulativeQuoteQty": "10.00000000", "status": "FILLED", "timeInForce": "GTC", "type": "MARKET", "side": "SELL" }
Response FULL:
{ "symbol": "BTCUSDT", "orderId": 28, "clientOrderId": "6gCrw2kRUAF9CvJDGP16IP", "transactTime": 1507725176595, "price": "0.00000000", "origQty": "10.00000000", "executedQty": "10.00000000", "cummulativeQuoteQty": "10.00000000", "status": "FILLED", "timeInForce": "GTC", "type": "MARKET", "side": "SELL", "fills": [ { "price": "4000.00000000", "qty": "1.00000000", "commission": "4.00000000", "commissionAsset": "USDT" }, { "price": "3999.00000000", "qty": "5.00000000", "commission": "19.99500000", "commissionAsset": "USDT" }, { "price": "3998.00000000", "qty": "2.00000000", "commission": "7.99600000", "commissionAsset": "USDT" }, { "price": "3997.00000000", "qty": "1.00000000", "commission": "3.99700000", "commissionAsset": "USDT" }, { "price": "3995.00000000", "qty": "1.00000000", "commission": "3.99500000", "commissionAsset": "USDT" } ] }
- Raises:
BinanceRequestException, BinanceAPIException, BinanceOrderException, BinanceOrderMinAmountException, BinanceOrderMinPriceException, BinanceOrderMinTotalException, BinanceOrderUnknownSymbolException, BinanceOrderInactiveSymbolException
- async create_sub_account_futures_transfer(**params)[source]
Execute sub-account Futures transfer
https://developers.binance.com/docs/sub_account/asset-management/Sub-account-Futures-Asset-Transfer
- Parameters:
fromEmail (str) – required - Sender email
toEmail (str) – required - Recipient email
futuresType (int) – required
asset (str) – required
amount (decimal) – required
recvWindow (int) – optional
- Returns:
API response
{ "success":true, "txnId":"2934662589" }
- Raises:
BinanceRequestException, BinanceAPIException
- async create_test_order(**params)[source]
Test new order creation and signature/recvWindow long. Creates and validates a new order but does not send it into the matching engine.
- Parameters:
symbol (str) – required
side (str) – required
type (str) – required
timeInForce (str) – required if limit order
quantity (decimal) – required
price (str) – required
newClientOrderId (str) – A unique id for the order. Automatically generated if not sent.
icebergQty (decimal) – Used with iceberg orders
newOrderRespType (str) – Set the response JSON. ACK, RESULT, or FULL; default: RESULT.
recvWindow (int) – The number of milliseconds the request is valid for
- Returns:
API response
{}- Raises:
BinanceRequestException, BinanceAPIException, BinanceOrderException, BinanceOrderMinAmountException, BinanceOrderMinPriceException, BinanceOrderMinTotalException, BinanceOrderUnknownSymbolException, BinanceOrderInactiveSymbolException
- async disable_fast_withdraw_switch(**params)[source]
Disable Fast Withdraw Switch
https://binance-docs.github.io/apidocs/spot/en/#disable-fast-withdraw-switch-user_data
- Parameters:
recvWindow (int) – optional
- Returns:
API response
- Raises:
BinanceRequestException, BinanceAPIException
- async disable_isolated_margin_account(**params)[source]
Disable isolated margin account for a specific symbol. Each trading pair can only be deactivated once every 24 hours.
https://developers.binance.com/docs/margin_trading/account/Disable-Isolated-Margin-Account
- Parameters:
symbol
- Returns:
API response
{ "success": true, "symbol": "BTCUSDT" }
- async enable_fast_withdraw_switch(**params)[source]
Enable Fast Withdraw Switch
https://binance-docs.github.io/apidocs/spot/en/#enable-fast-withdraw-switch-user_data
- Parameters:
recvWindow (int) – optional
- Returns:
API response
- Raises:
BinanceRequestException, BinanceAPIException
- async enable_isolated_margin_account(**params)[source]
Enable isolated margin account for a specific symbol.
https://developers.binance.com/docs/margin_trading/account/Enable-Isolated-Margin-Account
- Parameters:
symbol
- Returns:
API response
{ "success": true, "symbol": "BTCUSDT" }
- async enable_subaccount_futures(**params)[source]
Enable Futures for Sub-account (For Master Account)
https://developers.binance.com/docs/sub_account/account-management/Enable-Futures-for-Sub-account
- Parameters:
email (str) – required - Sub account email
recvWindow (int) – optional
- Returns:
API response
{ "email":"123@test.com", "isFuturesEnabled": true // true or false }
- Raises:
BinanceRequestException, BinanceAPIException
- async enable_subaccount_margin(**params)[source]
Enable Margin for Sub-account (For Master Account)
https://binance-docs.github.io/apidocs/spot/en/#enable-margin-for-sub-account-for-master-account
- Parameters:
email (str) – required - Sub account email
recvWindow (int) – optional
- Returns:
API response
{ "email":"123@test.com", "isMarginEnabled": true }
- Raises:
BinanceRequestException, BinanceAPIException
- async exchange_small_liability_assets(**params)[source]
Cross Margin Small Liability Exchange
https://developers.binance.com/docs/margin_trading/trade/Small-Liability-Exchange
- Parameters:
assetNames (array) – The assets list of small liability exchange
- Returns:
API response
none
- async funding_wallet(**params)[source]
Query Funding Wallet
https://developers.binance.com/docs/wallet/asset/funding-wallet
- async futures_account_config(**params)[source]
Get futures account configuration https://developers.binance.com/docs/derivatives/usds-margined-futures/account/rest-api/Account-Config
- async futures_account_trades(**params)[source]
Get trades for the authenticated account and symbol.
- async futures_account_transfer(**params)[source]
Execute transfer between spot account and futures account.
https://binance-docs.github.io/apidocs/futures/en/#new-future-account-transfer
- async futures_aggregate_trades(**params)[source]
Get compressed, aggregate trades. Trades that fill at the time, from the same order, with the same price will have the quantity aggregated.
- async futures_api_trading_status(**params)[source]
Get quantitative trading rules for order placement, such as Unfilled Ratio (UFR), Good-Til-Canceled Ratio (GCR), Immediate-or-Cancel (IOC) & Fill-or-Kill (FOK) Expire Ratio (IFER), among others. https://www.binance.com/en/support/faq/binance-futures-trading-quantitative-rules-4f462ebe6ff445d4a170be7d9e897272
- Parameters:
symbol (str) – optional
- Returns:
API response
{ "indicators": { // indicator: quantitative rules indicators, value: user's indicators value, triggerValue: trigger indicator value threshold of quantitative rules. "BTCUSDT": [ { "isLocked": true, "plannedRecoverTime": 1545741270000, "indicator": "UFR", // Unfilled Ratio (UFR) "value": 0.05, // Current value "triggerValue": 0.995 // Trigger value }, { "isLocked": true, "plannedRecoverTime": 1545741270000, "indicator": "IFER", // IOC/FOK Expiration Ratio (IFER) "value": 0.99, // Current value "triggerValue": 0.99 // Trigger value }, { "isLocked": true, "plannedRecoverTime": 1545741270000, "indicator": "GCR", // GTC Cancellation Ratio (GCR) "value": 0.99, // Current value "triggerValue": 0.99 // Trigger value }, { "isLocked": true, "plannedRecoverTime": 1545741270000, "indicator": "DR", // Dust Ratio (DR) "value": 0.99, // Current value "triggerValue": 0.99 // Trigger value } ], "ETHUSDT": [ { "isLocked": true, "plannedRecoverTime": 1545741270000, "indicator": "UFR", "value": 0.05, "triggerValue": 0.995 }, { "isLocked": true, "plannedRecoverTime": 1545741270000, "indicator": "IFER", "value": 0.99, "triggerValue": 0.99 }, { "isLocked": true, "plannedRecoverTime": 1545741270000, "indicator": "GCR", "value": 0.99, "triggerValue": 0.99 } { "isLocked": true, "plannedRecoverTime": 1545741270000, "indicator": "DR", "value": 0.99, "triggerValue": 0.99 } ] }, "updateTime": 1545741270000 }
- Raises:
BinanceRequestException, BinanceAPIException
- async futures_cancel_algo_order(**params)[source]
Cancel an active algo order.
- Parameters:
symbol (str) – required
algoId (int) – optional - Either algoId or clientAlgoId must be sent
clientAlgoId (str) – optional - Either algoId or clientAlgoId must be sent
recvWindow (int) – optional - the number of milliseconds the request is valid for
- Returns:
API response
- async futures_cancel_all_algo_open_orders(**params)[source]
Cancel all open algo orders
- Parameters:
symbol (str) – required
recvWindow (int) – optional - the number of milliseconds the request is valid for
- Returns:
API response
- async futures_cancel_all_open_orders(**params)[source]
Cancel all open futures orders
- Parameters:
conditional (bool) – optional - Set to True to cancel algo/conditional orders
- async futures_cancel_order(**params)[source]
Cancel an active futures order.
https://developers.binance.com/docs/derivatives/usds-margined-futures/trade/rest-api/Cancel-Order
- Parameters:
conditional (bool) – optional - Set to True to cancel algo/conditional order
algoId (int) – optional - Algo order ID (for conditional orders)
clientAlgoId (str) – optional - Client algo order ID (for conditional orders)
- async futures_change_leverage(**params)[source]
Change user’s initial leverage of specific symbol market
- async futures_change_multi_assets_mode(multiAssetsMargin: bool)[source]
Change user’s Multi-Assets mode (Multi-Assets Mode or Single-Asset Mode) on Every symbol
- async futures_change_position_mode(**params)[source]
Change position mode for authenticated account
- async futures_coin_account_order_history_download(**params)[source]
Get Download Id For Futures Order History
- Parameters:
startTime (int) – required - Start timestamp in ms
endTime (int) – required - End timestamp in ms
recvWindow (int) – optional
- Returns:
API response
{ "avgCostTimestampOfLast30d": 7241837, # Average time taken for data download in the past 30 days "downloadId": "546975389218332672" }
- Note:
Request Limitation is 10 times per month, shared by front end download page and rest api
The time between startTime and endTime can not be longer than 1 year
- Raises:
BinanceRequestException, BinanceAPIException
- async futures_coin_account_order_history_download_link(**params)[source]
Get futures order history download link by Id
- Parameters:
downloadId (str) – required - Download ID obtained from futures_coin_download_id
recvWindow (int) – optional
- Returns:
API response
{ "downloadId": "545923594199212032", "status": "completed", # Enum:completed,processing "url": "www.binance.com", # The link is mapped to download id "notified": true, # ignore "expirationTimestamp": 1645009771000, # The link would expire after this timestamp "isExpired": null } # OR (Response when server is processing) { "downloadId": "545923594199212032", "status": "processing", "url": "", "notified": false, "expirationTimestamp": -1, "isExpired": null }
- Note:
Download link expiration: 24h
- Raises:
BinanceRequestException, BinanceAPIException
- async futures_coin_account_trade_history_download(**params)[source]
Get Download Id For Futures Trade History (USER_DATA)
- Parameters:
startTime (int) – required - Start timestamp in ms
endTime (int) – required - End timestamp in ms
- Returns:
API response
{ "avgCostTimestampOfLast30d": 7241837, # Average time taken for data download in the past 30 days "downloadId": "546975389218332672" }
- Note:
Request Limitation is 5 times per month, shared by front end download page and rest api
The time between startTime and endTime can not be longer than 1 year
- Raises:
BinanceRequestException, BinanceAPIException
- async futures_coin_account_trade_history_download_link(**params)[source]
Get futures trade download link by Id
- Parameters:
downloadId (str) – required - Download ID obtained from futures_coin_trade_download_id
- Returns:
API response
{ "downloadId": "545923594199212032", "status": "completed", # Enum:completed,processing "url": "www.binance.com", # The link is mapped to download id "notified": true, # ignore "expirationTimestamp": 1645009771000, # The link would expire after this timestamp "isExpired": null } # OR (Response when server is processing) { "downloadId": "545923594199212032", "status": "processing", "url": "", "notified": false, "expirationTimestamp": -1, "isExpired": null }
- Note:
Download link expiration: 24h
- Raises:
BinanceRequestException, BinanceAPIException
- async futures_coin_account_trades(**params)[source]
Get trades for the authenticated account and symbol.
- async futures_coin_aggregate_trades(**params)[source]
Get compressed, aggregate trades. Trades that fill at the time, from the same order, with the same price will have the quantity aggregated.
- async futures_coin_cancel_order(**params)[source]
Cancel an active futures order.
https://developers.binance.com/docs/derivatives/coin-margined-futures/trade/rest-api/Cancel-Order
- async futures_coin_change_leverage(**params)[source]
Change user’s initial leverage of specific symbol market
- async futures_coin_change_position_margin(**params)[source]
Change the position margin for a symbol
- async futures_coin_change_position_mode(**params)[source]
Change user’s position mode (Hedge Mode or One-way Mode ) on EVERY symbol
- async futures_coin_continous_klines(**params)[source]
Kline/candlestick bars for a specific contract type. Klines are uniquely identified by their open time.
- async futures_coin_create_order(**params)[source]
Send in a new order.
https://developers.binance.com/docs/derivatives/coin-margined-futures/trade/rest-api
- async futures_coin_get_all_orders(**params)[source]
Get all futures account orders; active, canceled, or filled.
https://developers.binance.com/docs/derivatives/coin-margined-futures/trade/rest-api/All-Orders
- async futures_coin_get_order(**params)[source]
Check an order’s status.
https://developers.binance.com/docs/derivatives/coin-margined-futures/trade/rest-api/Query-Order
- async futures_coin_get_position_mode(**params)[source]
Get user’s position mode (Hedge Mode or One-way Mode ) on EVERY symbol
- async futures_coin_index_price_klines(**params)[source]
Kline/candlestick bars for the index price of a pair..
- async futures_coin_klines(**params)[source]
Kline/candlestick bars for a symbol. Klines are uniquely identified by their open time.
- async futures_coin_mark_price_klines(**params)[source]
Kline/candlestick bars for the mark price of a symbol. Klines are uniquely identified by their open time.
- async futures_coin_open_interest_hist(**params)[source]
Get open interest statistics of a specific symbol.
- async futures_coin_orderbook_ticker(**params)[source]
Best price/qty on the order book for a symbol or symbols.
- async futures_coin_ping()[source]
Test connectivity to the Rest API
https://developers.binance.com/docs/derivatives/coin-margined-futures/market-data/rest-api
- async futures_coin_place_batch_order(**params)[source]
Send in new orders.
To avoid modifying the existing signature generation and parameter order logic, the url encoding is done on the special query param, batchOrders, in the early stage.
Premium index kline bars of a symbol.l. Klines are uniquely identified by their open time.
- async futures_coin_time()[source]
Test connectivity to the Rest API and get the current server time.
- async futures_coin_v1_get_adl_quantile(**params)[source]
Placeholder function for GET /dapi/v1/adlQuantile. Note: This function was auto-generated. Any issue please open an issue on GitHub.
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- async futures_coin_v1_get_commission_rate(**params)[source]
Placeholder function for GET /dapi/v1/commissionRate. Note: This function was auto-generated. Any issue please open an issue on GitHub.
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- async futures_coin_v1_get_funding_info(**params)[source]
Placeholder function for GET /dapi/v1/fundingInfo. Note: This function was auto-generated. Any issue please open an issue on GitHub.
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- async futures_coin_v1_get_income_asyn(**params)[source]
Placeholder function for GET /dapi/v1/income/asyn. Note: This function was auto-generated. Any issue please open an issue on GitHub.
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- async futures_coin_v1_get_income_asyn_id(**params)[source]
Placeholder function for GET /dapi/v1/income/asyn/id. Note: This function was auto-generated. Any issue please open an issue on GitHub.
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- async futures_coin_v1_get_order_amendment(**params)[source]
Placeholder function for GET /dapi/v1/orderAmendment. Note: This function was auto-generated. Any issue please open an issue on GitHub.
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- async futures_coin_v1_get_pm_account_info(**params)[source]
Placeholder function for GET /dapi/v1/pmAccountInfo. Note: This function was auto-generated. Any issue please open an issue on GitHub.
https://developers.binance.com/docs/derivatives/coin-margined-futures/portfolio-margin-endpoints
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- async futures_coin_v1_put_batch_orders(**params)[source]
Placeholder function for PUT /dapi/v1/batchOrders. Note: This function was auto-generated. Any issue please open an issue on GitHub.
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- async futures_coin_v1_put_order(**params)[source]
Placeholder function for PUT /dapi/v1/order. Note: This function was auto-generated. Any issue please open an issue on GitHub.
https://developers.binance.com/docs/derivatives/coin-margined-futures/trade/rest-api/Modify-Order
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- async futures_commission_rate(**params)[source]
Get Futures commission rate
- Parameters:
symbol (str) – required
- Returns:
API response
{ "symbol": "BTCUSDT", "makerCommissionRate": "0.0002", // 0.02% "takerCommissionRate": "0.0004" // 0.04% }
- Raises:
BinanceRequestException, BinanceAPIException
- async futures_continuous_klines(**params)[source]
Kline/candlestick bars for a specific contract type. Klines are uniquely identified by their open time.
- async futures_countdown_cancel_all(**params)[source]
Cancel all open orders of the specified symbol at the end of the specified countdown.
- Parameters:
symbol (str) – required
countdownTime (int) – required
recvWindow (int) – optional - the number of milliseconds the request is valid for
- Returns:
API response
- {
“symbol”: “BTCUSDT”, “countdownTime”: “100000”
}
- async futures_create_algo_order(**params)[source]
Send in a new algo order (conditional order).
https://developers.binance.com/docs/derivatives/usds-margined-futures/trade/rest-api/New-Algo-Order
- Parameters:
algoType (str) – required - Only support CONDITIONAL
symbol (str) – required
side (str) – required - BUY or SELL
positionSide (str) – optional - Default BOTH for One-way Mode; LONG or SHORT for Hedge Mode
type (str) – required - STOP_MARKET/TAKE_PROFIT_MARKET/STOP/TAKE_PROFIT/TRAILING_STOP_MARKET
timeInForce (str) – optional - IOC or GTC or FOK or GTX, default GTC
quantity (decimal) – optional - Cannot be sent with closePosition=true
price (decimal) – optional
triggerPrice (decimal) – optional - Used with STOP, STOP_MARKET, TAKE_PROFIT, TAKE_PROFIT_MARKET
workingType (str) – optional - triggerPrice triggered by: MARK_PRICE, CONTRACT_PRICE. Default CONTRACT_PRICE
priceMatch (str) – optional - only available for LIMIT/STOP/TAKE_PROFIT order
closePosition (str) – optional - true, false; Close-All, used with STOP_MARKET or TAKE_PROFIT_MARKET
priceProtect (str) – optional - “TRUE” or “FALSE”, default “FALSE”
reduceOnly (str) – optional - “true” or “false”, default “false”
activatePrice (decimal) – optional - Used with TRAILING_STOP_MARKET orders
callbackRate (decimal) – optional - Used with TRAILING_STOP_MARKET orders, min 0.1, max 10
clientAlgoId (str) – optional - A unique id among open orders
newOrderRespType (str) – optional - “ACK”, “RESULT”, default “ACK”
selfTradePreventionMode (str) – optional - EXPIRE_TAKER, EXPIRE_MAKER, EXPIRE_BOTH, default NONE
goodTillDate (long) – optional - order cancel time for timeInForce GTD
recvWindow (int) – optional - the number of milliseconds the request is valid for
- Returns:
API response
result = client.futures_create_algo_order( algoType='CONDITIONAL', symbol='BNBUSDT', side='SELL', type='TAKE_PROFIT', quantity='0.01', price='750.000', triggerPrice='750.000', timeInForce='GTC' )
- async futures_create_order(**params)[source]
Send in a new order.
https://developers.binance.com/docs/derivatives/usds-margined-futures/trade/rest-api
Note: After 2025-12-09, conditional order types (STOP, STOP_MARKET, TAKE_PROFIT, TAKE_PROFIT_MARKET, TRAILING_STOP_MARKET) are automatically routed to the algo order endpoint.
- async futures_create_test_order(**params)[source]
Testing order request, this order will not be submitted to matching engine
https://developers.binance.com/docs/derivatives/usds-margined-futures/trade/rest-api/New-Order-Test
- async futures_get_algo_order(**params)[source]
Check an algo order’s status.
- Parameters:
symbol (str) – required
algoId (int) – optional - Either algoId or clientAlgoId must be sent
clientAlgoId (str) – optional - Either algoId or clientAlgoId must be sent
recvWindow (int) – optional - the number of milliseconds the request is valid for
- Returns:
API response
- async futures_get_all_algo_orders(**params)[source]
Get all algo account orders; active, canceled, or filled.
- Parameters:
symbol (str) – required
startTime (int) – optional
endTime (int) – optional
limit (int) – optional - Default 100; max 100
recvWindow (int) – optional - the number of milliseconds the request is valid for
- Returns:
API response
- async futures_get_all_orders(**params)[source]
Get all futures account orders; active, canceled, or filled.
https://developers.binance.com/docs/derivatives/usds-margined-futures/trade/rest-api/All-Orders
- Parameters:
conditional (bool) – optional - Set to True to query algo/conditional orders
- async futures_get_multi_assets_mode()[source]
Get user’s Multi-Assets mode (Multi-Assets Mode or Single-Asset Mode) on Every symbol
https://binance-docs.github.io/apidocs/futures/en/#get-current-multi-assets-mode-user_data
- async futures_get_open_algo_orders(**params)[source]
Get all open algo orders on a symbol.
- Parameters:
symbol (str) – optional
recvWindow (int) – optional - the number of milliseconds the request is valid for
- Returns:
API response
- async futures_get_open_orders(**params)[source]
Get all open orders on a symbol.
- Parameters:
conditional (bool) – optional - Set to True to query algo/conditional orders
- async futures_get_order(**params)[source]
Check an order’s status.
https://developers.binance.com/docs/derivatives/usds-margined-futures/trade/rest-api/Query-Order
- Parameters:
conditional (bool) – optional - Set to True to query algo/conditional order
algoId (int) – optional - Algo order ID (for conditional orders)
clientAlgoId (str) – optional - Client algo order ID (for conditional orders)
- async futures_get_position_mode(**params)[source]
Get position mode for authenticated account
https://binance-docs.github.io/apidocs/futures/en/#get-current-position-mode-user_data
- async futures_global_longshort_ratio(**params)[source]
Get present global long to short ratio of a specific symbol.
- async futures_historical_data_link(**params)[source]
Get Future TickLevel Orderbook Historical Data Download Link.
https://developers.binance.com/docs/derivatives/futures-data/market-data
- Parameters:
symbol (str) – STRING - Required - Symbol name, e.g. BTCUSDT or BTCUSD_PERP
dataType (str) – ENUM - Required - Data type: - T_DEPTH for ticklevel orderbook data - S_DEPTH for orderbook snapshot data
startTime (int) – LONG - Required - Start time in milliseconds
endTime (int) – LONG - Required - End time in milliseconds
recvWindow (int) – LONG - Optional - Number of milliseconds after timestamp the request is valid for
timestamp (int) – LONG - Required - Current timestamp in milliseconds
- Returns:
API response
{ "data": [ { "day": "2023-06-30", "url": "" } ] }
- Raises:
BinanceRequestException, BinanceAPIException
- Notes:
The span between startTime and endTime can’t be more than 7 days
The download link will be valid for 1 day
Only VIP users can query this endpoint
Weight: 200
- async futures_historical_klines(symbol: str, interval: str, start_str, end_str=None, limit=None)[source]
Get historical futures klines from Binance
- Parameters:
symbol (str) – Name of symbol pair e.g. BNBBTC
interval (str) – Binance Kline interval
start_str (str|int) – Start date string in UTC format or timestamp in milliseconds
end_str (str|int) – optional - end date string in UTC format or timestamp in milliseconds (default will fetch everything up to now)
limit (int) – Default None (fetches full range in batches of max 1000 per request). To limit the number of rows, pass an integer.
- Returns:
list of OHLCV values (Open time, Open, High, Low, Close, Volume, Close time, Quote asset volume, Number of trades, Taker buy base asset volume, Taker buy quote asset volume, Ignore)
- async futures_historical_klines_generator(symbol, interval, start_str, end_str=None)[source]
Get historical futures klines generator from Binance
- Parameters:
symbol (str) – Name of symbol pair e.g. BNBBTC
interval (str) – Binance Kline interval
start_str (str|int) – Start date string in UTC format or timestamp in milliseconds
end_str (str|int) – optional - end date string in UTC format or timestamp in milliseconds (default will fetch everything up to now)
- Returns:
generator of OHLCV values
- async futures_index_price_klines(**params)[source]
Kline/candlestick bars for the index price of a symbol. Klines are uniquely identified by their open time.
- async futures_klines(**params)[source]
Kline/candlestick bars for a symbol. Klines are uniquely identified by their open time.
- async futures_limit_buy_order(**params)[source]
Send in a new futures limit buy order.
https://developers.binance.com/docs/derivatives/usds-margined-futures/trade/rest-api
- async futures_limit_order(**params)[source]
Send in a new futures limit order.
https://developers.binance.com/docs/derivatives/usds-margined-futures/trade/rest-api
- async futures_limit_sell_order(**params)[source]
Send in a new futures limit sell order.
https://developers.binance.com/docs/derivatives/usds-margined-futures/trade/rest-api
- async futures_mark_price_klines(**params)[source]
Kline/candlestick bars for the mark price of a symbol. Klines are uniquely identified by their open time.
- async futures_market_buy_order(**params)[source]
Send in a new futures market buy order.
https://developers.binance.com/docs/derivatives/usds-margined-futures/trade/rest-api
- async futures_market_order(**params)[source]
Send in a new futures market order.
https://developers.binance.com/docs/derivatives/usds-margined-futures/trade/rest-api
- async futures_market_sell_order(**params)[source]
Send in a new futures market sell order.
https://developers.binance.com/docs/derivatives/usds-margined-futures/trade/rest-api
- async futures_modify_order(**params)[source]
Modify an existing order. Currently only LIMIT order modification is supported.
https://developers.binance.com/docs/derivatives/usds-margined-futures/trade/rest-api/Modify-Order
- async futures_open_interest_hist(**params)[source]
Get open interest statistics of a specific symbol.
- async futures_orderbook_ticker(**params)[source]
Best price/qty on the order book for a symbol or symbols.
- async futures_ping()[source]
Test connectivity to the Rest API
https://developers.binance.com/docs/derivatives/usds-margined-futures/market-data/rest-api
- async futures_place_batch_order(**params)[source]
Send in new orders.
To avoid modifying the existing signature generation and parameter order logic, the url encoding is done on the special query param, batchOrders, in the early stage.
Kline/candlestick bars for the index price of a symbol. Klines are uniquely identified by their open time.
- async futures_rpi_depth(**params)[source]
Get RPI Order Book with Retail Price Improvement orders
- Parameters:
symbol (str) – required
limit (int) – Default 1000; Valid limits:[1000]
- Returns:
API response
{ "lastUpdateId": 1027024, "E": 1589436922972, // Message output time "T": 1589436922959, // Transaction time "bids": [ [ "4.00000000", // PRICE "431.00000000" // QTY ] ], "asks": [ [ "4.00000200", "12.00000000" ] ] }
- Raises:
BinanceRequestException, BinanceAPIException
- async futures_symbol_adl_risk(**params)[source]
Query the symbol-level ADL (Auto-Deleveraging) risk rating
The ADL risk rating measures the likelihood of ADL during liquidation. Rating can be: high, medium, low. Updated every 30 minutes.
- Parameters:
symbol (str) – optional - if not provided, returns ADL risk for all symbols
- Returns:
API response
# Single symbol { "symbol": "BTCUSDT", "adlRisk": "low", "updateTime": 1597370495002 } # All symbols (when symbol not provided) [ { "symbol": "BTCUSDT", "adlRisk": "low", "updateTime": 1597370495002 }, { "symbol": "ETHUSDT", "adlRisk": "high", "updateTime": 1597370495004 } ]
- Raises:
BinanceRequestException, BinanceAPIException
- async futures_symbol_config(**params)[source]
Get current account symbol configuration https://developers.binance.com/docs/derivatives/usds-margined-futures/account/rest-api/Symbol-Config
- async futures_taker_longshort_ratio(**params)[source]
Get taker buy to sell volume ratio of a specific symbol
- async futures_top_longshort_account_ratio(**params)[source]
Get present long to short ratio for top accounts of a specific symbol.
- async futures_top_longshort_position_ratio(**params)[source]
Get present long to short ratio for top positions of a specific symbol.
- async futures_v1_delete_batch_order(**params)[source]
Placeholder function for DELETE /fapi/v1/batchOrder. Note: This function was auto-generated. Any issue please open an issue on GitHub.
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- async futures_v1_get_asset_index(**params)[source]
Placeholder function for GET /fapi/v1/assetIndex. Note: This function was auto-generated. Any issue please open an issue on GitHub.
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- async futures_v1_get_convert_exchange_info(**params)[source]
Placeholder function for GET /fapi/v1/convert/exchangeInfo. Note: This function was auto-generated. Any issue please open an issue on GitHub.
https://developers.binance.com/docs/derivatives/usds-margined-futures/convert
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- async futures_v1_get_convert_order_status(**params)[source]
Placeholder function for GET /fapi/v1/convert/orderStatus. Note: This function was auto-generated. Any issue please open an issue on GitHub.
https://developers.binance.com/docs/derivatives/usds-margined-futures/convert/Order-Status
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- async futures_v1_get_fee_burn(**params)[source]
Placeholder function for GET /fapi/v1/feeBurn. Note: This function was auto-generated. Any issue please open an issue on GitHub.
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- async futures_v1_get_funding_info(**params)[source]
Placeholder function for GET /fapi/v1/fundingInfo. Note: This function was auto-generated. Any issue please open an issue on GitHub.
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- async futures_v1_get_income_asyn(**params)[source]
Placeholder function for GET /fapi/v1/income/asyn. Note: This function was auto-generated. Any issue please open an issue on GitHub.
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- async futures_v1_get_income_asyn_id(**params)[source]
Placeholder function for GET /fapi/v1/income/asyn/id. Note: This function was auto-generated. Any issue please open an issue on GitHub.
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- async futures_v1_get_open_order(**params)[source]
Placeholder function for GET /fapi/v1/openOrder. Note: This function was auto-generated. Any issue please open an issue on GitHub.
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- async futures_v1_get_order_amendment(**params)[source]
Placeholder function for GET /fapi/v1/orderAmendment. Note: This function was auto-generated. Any issue please open an issue on GitHub.
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- async futures_v1_get_order_asyn(**params)[source]
Placeholder function for GET /fapi/v1/order/asyn. Note: This function was auto-generated. Any issue please open an issue on GitHub.
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- async futures_v1_get_order_asyn_id(**params)[source]
Placeholder function for GET /fapi/v1/order/asyn/id. Note: This function was auto-generated. Any issue please open an issue on GitHub.
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- async futures_v1_get_pm_account_info(**params)[source]
Placeholder function for GET /fapi/v1/pmAccountInfo. Note: This function was auto-generated. Any issue please open an issue on GitHub.
https://developers.binance.com/docs/derivatives/usds-margined-futures/portfolio-margin-endpoints
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- async futures_v1_get_rate_limit_order(**params)[source]
Placeholder function for GET /fapi/v1/rateLimit/order. Note: This function was auto-generated. Any issue please open an issue on GitHub.
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- async futures_v1_get_trade_asyn(**params)[source]
Placeholder function for GET /fapi/v1/trade/asyn. Note: This function was auto-generated. Any issue please open an issue on GitHub.
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- async futures_v1_get_trade_asyn_id(**params)[source]
Placeholder function for GET /fapi/v1/trade/asyn/id. Note: This function was auto-generated. Any issue please open an issue on GitHub.
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- async futures_v1_post_batch_order(**params)[source]
Placeholder function for POST /fapi/v1/batchOrder. Note: This function was auto-generated. Any issue please open an issue on GitHub.
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- async futures_v1_post_convert_accept_quote(**params)[source]
Placeholder function for POST /fapi/v1/convert/acceptQuote. Note: This function was auto-generated. Any issue please open an issue on GitHub.
https://developers.binance.com/docs/derivatives/usds-margined-futures/convert/Accept-Quote
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- async futures_v1_post_convert_get_quote(**params)[source]
Placeholder function for POST /fapi/v1/convert/getQuote. Note: This function was auto-generated. Any issue please open an issue on GitHub.
https://developers.binance.com/docs/derivatives/usds-margined-futures/convert/Send-quote-request
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- async futures_v1_post_fee_burn(**params)[source]
Placeholder function for POST /fapi/v1/feeBurn. Note: This function was auto-generated. Any issue please open an issue on GitHub.
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- async futures_v1_put_batch_order(**params)[source]
Placeholder function for PUT /fapi/v1/batchOrder. Note: This function was auto-generated. Any issue please open an issue on GitHub.
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- async futures_v1_put_batch_orders(**params)[source]
Placeholder function for PUT /fapi/v1/batchOrders. Note: This function was auto-generated. Any issue please open an issue on GitHub.
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- async get_account(**params)[source]
Get current account information.
- Parameters:
recvWindow (int) – the number of milliseconds the request is valid for
- Returns:
API response
{ "makerCommission": 15, "takerCommission": 15, "buyerCommission": 0, "sellerCommission": 0, "canTrade": true, "canWithdraw": true, "canDeposit": true, "balances": [ { "asset": "BTC", "free": "4723846.89208129", "locked": "0.00000000" }, { "asset": "LTC", "free": "4763368.68006011", "locked": "0.00000000" } ] }
- Raises:
BinanceRequestException, BinanceAPIException
- async get_account_api_permissions(**params)[source]
Fetch api key permissions.
https://developers.binance.com/docs/wallet/account/api-key-permission
- Parameters:
recvWindow (int) – the number of milliseconds the request is valid for
- Returns:
API response
{ "ipRestrict": false, "createTime": 1623840271000, "enableWithdrawals": false, // This option allows you to withdraw via API. You must apply the IP Access Restriction filter in order to enable withdrawals "enableInternalTransfer": true, // This option authorizes this key to transfer funds between your master account and your sub account instantly "permitsUniversalTransfer": true, // Authorizes this key to be used for a dedicated universal transfer API to transfer multiple supported currencies. Each business's own transfer API rights are not affected by this authorization "enableVanillaOptions": false, // Authorizes this key to Vanilla options trading "enableReading": true, "enableFutures": false, // API Key created before your futures account opened does not support futures API service "enableMargin": false, // This option can be adjusted after the Cross Margin account transfer is completed "enableSpotAndMarginTrading": false, // Spot and margin trading "tradingAuthorityExpirationTime": 1628985600000 // Expiration time for spot and margin trading permission }
- async get_account_api_trading_status(**params)[source]
Fetch account api trading status detail.
https://developers.binance.com/docs/wallet/account/account-api-trading-status
- Parameters:
recvWindow (int) – the number of milliseconds the request is valid for
- Returns:
API response
{ "data": { // API trading status detail "isLocked": false, // API trading function is locked or not "plannedRecoverTime": 0, // If API trading function is locked, this is the planned recover time "triggerCondition": { "GCR": 150, // Number of GTC orders "IFER": 150, // Number of FOK/IOC orders "UFR": 300 // Number of orders }, "indicators": { // The indicators updated every 30 seconds "BTCUSDT": [ // The symbol { "i": "UFR", // Unfilled Ratio (UFR) "c": 20, // Count of all orders "v": 0.05, // Current UFR value "t": 0.995 // Trigger UFR value }, { "i": "IFER", // IOC/FOK Expiration Ratio (IFER) "c": 20, // Count of FOK/IOC orders "v": 0.99, // Current IFER value "t": 0.99 // Trigger IFER value }, { "i": "GCR", // GTC Cancellation Ratio (GCR) "c": 20, // Count of GTC orders "v": 0.99, // Current GCR value "t": 0.99 // Trigger GCR value } ], "ETHUSDT": [ { "i": "UFR", "c": 20, "v": 0.05, "t": 0.995 }, { "i": "IFER", "c": 20, "v": 0.99, "t": 0.99 }, { "i": "GCR", "c": 20, "v": 0.99, "t": 0.99 } ] }, "updateTime": 1547630471725 } }
- async get_account_snapshot(**params)[source]
Get daily account snapshot of specific type.
https://developers.binance.com/docs/wallet/account/daily-account-snapshoot
- Parameters:
type (string) – required. Valid values are SPOT/MARGIN/FUTURES.
startTime (int) – optional
endTime (int) – optional
limit (int) – optional
recvWindow (int) – optional
- Returns:
API response
{ "code":200, // 200 for success; others are error codes "msg":"", // error message "snapshotVos":[ { "data":{ "balances":[ { "asset":"BTC", "free":"0.09905021", "locked":"0.00000000" }, { "asset":"USDT", "free":"1.89109409", "locked":"0.00000000" } ], "totalAssetOfBtc":"0.09942700" }, "type":"spot", "updateTime":1576281599000 } ] }
OR
{ "code":200, // 200 for success; others are error codes "msg":"", // error message "snapshotVos":[ { "data":{ "marginLevel":"2748.02909813", "totalAssetOfBtc":"0.00274803", "totalLiabilityOfBtc":"0.00000100", "totalNetAssetOfBtc":"0.00274750", "userAssets":[ { "asset":"XRP", "borrowed":"0.00000000", "free":"1.00000000", "interest":"0.00000000", "locked":"0.00000000", "netAsset":"1.00000000" } ] }, "type":"margin", "updateTime":1576281599000 } ] }
OR
{ "code":200, // 200 for success; others are error codes "msg":"", // error message "snapshotVos":[ { "data":{ "assets":[ { "asset":"USDT", "marginBalance":"118.99782335", "walletBalance":"120.23811389" } ], "position":[ { "entryPrice":"7130.41000000", "markPrice":"7257.66239673", "positionAmt":"0.01000000", "symbol":"BTCUSDT", "unRealizedProfit":"1.24029054" } ] }, "type":"futures", "updateTime":1576281599000 } ] }
- Raises:
BinanceRequestException, BinanceAPIException
- async get_account_status(**params)[source]
Get account status detail.
https://binance-docs.github.io/apidocs/spot/en/#account-status-sapi-user_data https://developers.binance.com/docs/wallet/account/account-status :param version: the api version :param version: int :param recvWindow: the number of milliseconds the request is valid for :type recvWindow: int
- Returns:
API response
{ "data": "Normal" }
- async get_aggregate_trades(**params) Dict[source]
Get compressed, aggregate trades. Trades that fill at the time, from the same order, with the same price will have the quantity aggregated.
- Parameters:
symbol (str) – required
fromId (str) – ID to get aggregate trades from INCLUSIVE.
startTime (int) – Timestamp in ms to get aggregate trades from INCLUSIVE.
endTime (int) – Timestamp in ms to get aggregate trades until INCLUSIVE.
limit (int) – Default 500; max 1000.
- Returns:
API response
[ { "a": 26129, # Aggregate tradeId "p": "0.01633102", # Price "q": "4.70443515", # Quantity "f": 27781, # First tradeId "l": 27781, # Last tradeId "T": 1498793709153, # Timestamp "m": true, # Was the buyer the maker? "M": true # Was the trade the best price match? } ]
- Raises:
BinanceRequestException, BinanceAPIException
- async get_all_coins_info(**params)[source]
Get information of coins (available for deposit and withdraw) for user.
https://developers.binance.com/docs/wallet/capital
- Parameters:
recvWindow (int) – optional
- Returns:
API response
{ "coin": "BTC", "depositAllEnable": true, "withdrawAllEnable": true, "name": "Bitcoin", "free": "0", "locked": "0", "freeze": "0", "withdrawing": "0", "ipoing": "0", "ipoable": "0", "storage": "0", "isLegalMoney": false, "trading": true, "networkList": [ { "network": "BNB", "coin": "BTC", "withdrawIntegerMultiple": "0.00000001", "isDefault": false, "depositEnable": true, "withdrawEnable": true, "depositDesc": "", "withdrawDesc": "", "specialTips": "Both a MEMO and an Address are required to successfully deposit your BEP2-BTCB tokens to Binance.", "name": "BEP2", "resetAddressStatus": false, "addressRegex": "^(bnb1)[0-9a-z]{38}$", "memoRegex": "^[0-9A-Za-z-_]{1,120}$", "withdrawFee": "0.0000026", "withdrawMin": "0.0000052", "withdrawMax": "0", "minConfirm": 1, "unLockConfirm": 0 }, { "network": "BTC", "coin": "BTC", "withdrawIntegerMultiple": "0.00000001", "isDefault": true, "depositEnable": true, "withdrawEnable": true, "depositDesc": "", "withdrawDesc": "", "specialTips": "", "name": "BTC", "resetAddressStatus": false, "addressRegex": "^[13][a-km-zA-HJ-NP-Z1-9]{25,34}$|^(bc1)[0-9A-Za-z]{39,59}$", "memoRegex": "", "withdrawFee": "0.0005", "withdrawMin": "0.001", "withdrawMax": "0", "minConfirm": 1, "unLockConfirm": 2 } ] }
- Raises:
BinanceRequestException, BinanceAPIException
- async get_all_isolated_margin_symbols(**params)[source]
Query isolated margin symbol info for all pairs
https://developers.binance.com/docs/margin_trading/market-data/Get-All-Isolated-Margin-Symbol
pair_details = client.get_all_isolated_margin_symbols()
- Returns:
API response
[ { "base": "BNB", "isBuyAllowed": true, "isMarginTrade": true, "isSellAllowed": true, "quote": "BTC", "symbol": "BNBBTC" }, { "base": "TRX", "isBuyAllowed": true, "isMarginTrade": true, "isSellAllowed": true, "quote": "BTC", "symbol": "TRXBTC" } ]
- Raises:
BinanceRequestException, BinanceAPIException
- async get_all_margin_orders(**params)[source]
Query all margin accounts orders
If orderId is set, it will get orders >= that orderId. Otherwise most recent orders are returned.
For some historical orders cummulativeQuoteQty will be < 0, meaning the data is not available at this time.
https://developers.binance.com/docs/margin_trading/trade/Query-Margin-Account-All-Orders
- Parameters:
symbol (str) – required
isIsolated (str) – set to ‘TRUE’ for isolated margin (default ‘FALSE’)
orderId (str) – optional
startTime (str) – optional
endTime (str) – optional
limit (int) – Default 500; max 1000
recvWindow (int) – the number of milliseconds the request is valid for
- Returns:
API response
- [
- {
“id”: 43123876, “price”: “0.00395740”, “qty”: “4.06000000”, “quoteQty”: “0.01606704”, “symbol”: “BNBBTC”, “time”: 1556089977693
}, {
”id”: 43123877, “price”: “0.00395740”, “qty”: “0.77000000”, “quoteQty”: “0.00304719”, “symbol”: “BNBBTC”, “time”: 1556089977693
}, {
”id”: 43253549, “price”: “0.00428930”, “qty”: “23.30000000”, “quoteQty”: “0.09994069”, “symbol”: “BNBBTC”, “time”: 1556163963504
}
]
- Raises:
BinanceRequestException, BinanceAPIException
- async get_all_orders(**params)[source]
Get all account orders; active, canceled, or filled.
- Parameters:
symbol (str) – required
orderId (int) – The unique order id
startTime (int) – optional
endTime (int) – optional
limit (int) – Default 500; max 1000.
recvWindow (int) – the number of milliseconds the request is valid for
- Returns:
API response
[ { "symbol": "LTCBTC", "orderId": 1, "clientOrderId": "myOrder1", "price": "0.1", "origQty": "1.0", "executedQty": "0.0", "status": "NEW", "timeInForce": "GTC", "type": "LIMIT", "side": "BUY", "stopPrice": "0.0", "icebergQty": "0.0", "time": 1499827319559 } ]
- Raises:
BinanceRequestException, BinanceAPIException
- async get_all_tickers(symbol: str | None = None) List[Dict[str, str]][source]
Latest price for all symbols.
- Returns:
List of market tickers
[ { "symbol": "LTCBTC", "price": "4.00000200" }, { "symbol": "ETHBTC", "price": "0.07946600" } ]
- Raises:
BinanceRequestException, BinanceAPIException
- async get_allocations(**params)[source]
Retrieves allocations resulting from SOR order placement.
- Parameters:
symbol (str) – required
startTime (int) – optional
endTime (int) – optional
fromAllocationId (int) – optional
orderId (int) – optional
limit (int) – optional, Default: 500; Max: 1000
recvWindow (int) – the number of milliseconds the request is valid for
- Returns:
API response
- async get_asset_balance(asset=None, **params)[source]
Get current asset balance.
- Parameters:
asset (str) – optional - the asset to get the balance of
recvWindow (int) – the number of milliseconds the request is valid for
- Returns:
dictionary or None if not found
{ "asset": "BTC", "free": "4723846.89208129", "locked": "0.00000000" }
- Raises:
BinanceRequestException, BinanceAPIException
- async get_asset_details(**params)[source]
Fetch details on assets.
https://developers.binance.com/docs/wallet/asset
- Parameters:
asset (str) – optional
recvWindow (int) – the number of milliseconds the request is valid for
- Returns:
API response
{ "CTR": { "minWithdrawAmount": "70.00000000", //min withdraw amount "depositStatus": false,//deposit status (false if ALL of networks' are false) "withdrawFee": 35, // withdraw fee "withdrawStatus": true, //withdraw status (false if ALL of networks' are false) "depositTip": "Delisted, Deposit Suspended" //reason }, "SKY": { "minWithdrawAmount": "0.02000000", "depositStatus": true, "withdrawFee": 0.01, "withdrawStatus": true } }
- async get_asset_dividend_history(**params)[source]
Query asset dividend record.
https://developers.binance.com/docs/wallet/asset/assets-divided-record
- Parameters:
asset (str) – optional
startTime (long) – optional
endTime (long) – optional
recvWindow (int) – the number of milliseconds the request is valid for
result = client.get_asset_dividend_history()
- Returns:
API response
{ "rows":[ { "amount":"10.00000000", "asset":"BHFT", "divTime":1563189166000, "enInfo":"BHFT distribution", "tranId":2968885920 }, { "amount":"10.00000000", "asset":"BHFT", "divTime":1563189165000, "enInfo":"BHFT distribution", "tranId":2968885920 } ], "total":2 }
- Raises:
BinanceRequestException, BinanceAPIException
- async get_avg_price(**params)[source]
Current average price for a symbol.
- Parameters:
symbol (str)
- Returns:
API response
{ "mins": 5, "price": "9.35751834" }
- async get_bnb_burn_spot_margin(**params)[source]
Get BNB Burn Status
https://developers.binance.com/docs/margin_trading/account/Get-BNB-Burn-Status
status = client.get_bnb_burn_spot_margin()
- Returns:
API response
{ "spotBNBBurn":true, "interestBNBBurn": false }
- Raises:
BinanceRequestException, BinanceAPIException
- async get_c2c_trade_history(**params)[source]
Get C2C Trade History
https://binance-docs.github.io/apidocs/spot/en/#get-c2c-trade-history-user_data
- Parameters:
tradeType (str) – required - BUY, SELL
startTimestamp – optional
endTimestamp (int) – optional
page (int) – optional - default 1
rows (int) – optional - default 100, max 100
recvWindow (int) – optional
- Returns:
API response
- {
“code”: “000000”, “message”: “success”, “data”: [
- {
“orderNumber”:”20219644646554779648”, “advNo”: “11218246497340923904”, “tradeType”: “SELL”, “asset”: “BUSD”, “fiat”: “CNY”, “fiatSymbol”: “¥”, “amount”: “5000.00000000”, // Quantity (in Crypto) “totalPrice”: “33400.00000000”, “unitPrice”: “6.68”, // Unit Price (in Fiat) “orderStatus”: “COMPLETED”, // PENDING, TRADING, BUYER_PAYED, DISTRIBUTING, COMPLETED, IN_APPEAL, CANCELLED, CANCELLED_BY_SYSTEM “createTime”: 1619361369000, “commission”: “0”, // Transaction Fee (in Crypto) “counterPartNickName”: “ab***”, “advertisementRole”: “TAKER”
}
], “total”: 1, “success”: true
}
- async get_convert_trade_history(**params)[source]
Get C2C Trade History
https://developers.binance.com/docs/convert/trade/Get-Convert-Trade-History
- Parameters:
startTime (int) – required - Start Time - 1593511200000
endTime (int) – required - End Time - 1593511200000
limit (int) – optional - default 100, max 100
recvWindow (int) – optional
- Returns:
API response
- async get_cross_margin_collateral_ratio(**params)[source]
https://developers.binance.com/docs/margin_trading/market-data
:param none
- Returns:
API response
- async get_cross_margin_data(**params)[source]
Query Cross Margin Fee Data (USER_DATA)
https://developers.binance.com/docs/margin_trading/account/Query-Cross-Margin-Fee-Data
- Parameters:
vipLevel (int) – User’s current specific margin data will be returned if vipLevel is omitted
:param coin :type coin: str :param recvWindow: the number of milliseconds the request is valid for :type recvWindow: int :returns: API response (example):
- [
- {
“vipLevel”: 0, “coin”: “BTC”, “transferIn”: true, “borrowable”: true, “dailyInterest”: “0.00026125”, “yearlyInterest”: “0.0953”, “borrowLimit”: “180”, “marginablePairs”: [
“BNBBTC”, “TRXBTC”, “ETHBTC”, “BTCUSDT”
]
}
]
- async get_current_order_count(**params)[source]
Displays the user’s current order count usage for all intervals.
- Returns:
API response
- async get_deposit_address(coin: str, network: str | None = None, **params)[source]
Fetch a deposit address for a symbol
https://developers.binance.com/docs/wallet/capital/deposite-address
- Parameters:
coin (str) – required
network (str) – optional
recvWindow (int) – the number of milliseconds the request is valid for
- Returns:
API response
{ "address": "1HPn8Rx2y6nNSfagQBKy27GB99Vbzg89wv", "coin": "BTC", "tag": "", "url": "https://btc.com/1HPn8Rx2y6nNSfagQBKy27GB99Vbzg89wv" }
- Raises:
BinanceRequestException, BinanceAPIException
- async get_deposit_history(**params)[source]
Fetch deposit history.
https://developers.binance.com/docs/wallet/capital/deposite-history
- Parameters:
coin (str) – optional
startTime (long) – optional
endTime (long) – optional
offset (long) – optional - default:0
limit (long) – optional
recvWindow (int) – the number of milliseconds the request is valid for
- Returns:
API response
[ { "amount":"0.00999800", "coin":"PAXG", "network":"ETH", "status":1, "address":"0x788cabe9236ce061e5a892e1a59395a81fc8d62c", "addressTag":"", "txId":"0xaad4654a3234aa6118af9b4b335f5ae81c360b2394721c019b5d1e75328b09f3", "insertTime":1599621997000, "transferType":0, "confirmTimes":"12/12" }, { "amount":"0.50000000", "coin":"IOTA", "network":"IOTA", "status":1, "address":"SIZ9VLMHWATXKV99LH99CIGFJFUMLEHGWVZVNNZXRJJVWBPHYWPPBOSDORZ9EQSHCZAMPVAPGFYQAUUV9DROOXJLNW", "addressTag":"", "txId":"ESBFVQUTPIWQNJSPXFNHNYHSQNTGKRVKPRABQWTAXCDWOAKDKYWPTVG9BGXNVNKTLEJGESAVXIKIZ9999", "insertTime":1599620082000, "transferType":0, "confirmTimes":"1/1" } ]
- Raises:
BinanceRequestException, BinanceAPIException
- async get_dust_assets(**params)[source]
Get assets that can be converted into BNB
https://developers.binance.com/docs/wallet/asset/assets-can-convert-bnb
- Returns:
API response
{ "details": [ { "asset": "ADA", "assetFullName": "ADA", "amountFree": "6.21", //Convertible amount "toBTC": "0.00016848", //BTC amount "toBNB": "0.01777302", //BNB amount(Not deducted commission fee) "toBNBOffExchange": "0.01741756", //BNB amount(Deducted commission fee) "exchange": "0.00035546" //Commission fee } ], "totalTransferBtc": "0.00016848", "totalTransferBNB": "0.01777302", "dribbletPercentage": "0.02" //Commission fee }
- async get_dust_log(**params)[source]
Get log of small amounts exchanged for BNB.
https://developers.binance.com/docs/wallet/asset/dust-log
- Parameters:
startTime (int) – optional
endTime (int) – optional
recvWindow (int) – the number of milliseconds the request is valid for
- Returns:
API response
{ "total": 8, //Total counts of exchange "userAssetDribblets": [ { "totalTransferedAmount": "0.00132256", // Total transfered BNB amount for this exchange. "totalServiceChargeAmount": "0.00002699", //Total service charge amount for this exchange. "transId": 45178372831, "userAssetDribbletDetails": [ //Details of this exchange. { "transId": 4359321, "serviceChargeAmount": "0.000009", "amount": "0.0009", "operateTime": 1615985535000, "transferedAmount": "0.000441", "fromAsset": "USDT" }, { "transId": 4359321, "serviceChargeAmount": "0.00001799", "amount": "0.0009", "operateTime": "2018-05-03 17:07:04", "transferedAmount": "0.00088156", "fromAsset": "ETH" } ] }, { "operateTime":1616203180000, "totalTransferedAmount": "0.00058795", "totalServiceChargeAmount": "0.000012", "transId": 4357015, "userAssetDribbletDetails": [ { "transId": 4357015, "serviceChargeAmount": "0.00001" "amount": "0.001", "operateTime": 1616203180000, "transferedAmount": "0.00049", "fromAsset": "USDT" }, { "transId": 4357015, "serviceChargeAmount": "0.000002" "amount": "0.0001", "operateTime": 1616203180000, "transferedAmount": "0.00009795", "fromAsset": "ETH" } ] } ] }
- async get_enabled_isolated_margin_account_limit(**params)[source]
Query enabled isolated margin account limit.
- Returns:
API response
- async get_exchange_info() Dict[source]
Return rate limits and list of symbols
- Returns:
list - List of product dictionaries
{ "timezone": "UTC", "serverTime": 1508631584636, "rateLimits": [ { "rateLimitType": "REQUESTS", "interval": "MINUTE", "limit": 1200 }, { "rateLimitType": "ORDERS", "interval": "SECOND", "limit": 10 }, { "rateLimitType": "ORDERS", "interval": "DAY", "limit": 100000 } ], "exchangeFilters": [], "symbols": [ { "symbol": "ETHBTC", "status": "TRADING", "baseAsset": "ETH", "baseAssetPrecision": 8, "quoteAsset": "BTC", "quotePrecision": 8, "orderTypes": ["LIMIT", "MARKET"], "icebergAllowed": false, "filters": [ { "filterType": "PRICE_FILTER", "minPrice": "0.00000100", "maxPrice": "100000.00000000", "tickSize": "0.00000100" }, { "filterType": "LOT_SIZE", "minQty": "0.00100000", "maxQty": "100000.00000000", "stepSize": "0.00100000" }, { "filterType": "MIN_NOTIONAL", "minNotional": "0.00100000" } ] } ] }
- Raises:
BinanceRequestException, BinanceAPIException
- async get_fiat_deposit_withdraw_history(**params)[source]
Get Fiat Deposit/Withdraw History
https://binance-docs.github.io/apidocs/spot/en/#get-fiat-deposit-withdraw-history-user_data
- Parameters:
transactionType (str) – required - 0-deposit,1-withdraw
beginTime (int) – optional
endTime (int) – optional
page (int) – optional - default 1
rows (int) – optional - default 100, max 500
recvWindow (int) – optional
- async get_fiat_payments_history(**params)[source]
Get Fiat Payments History
https://binance-docs.github.io/apidocs/spot/en/#get-fiat-payments-history-user_data
- Parameters:
transactionType (str) – required - 0-buy,1-sell
beginTime (int) – optional
endTime (int) – optional
page (int) – optional - default 1
rows (int) – optional - default 100, max 500
recvWindow (int) – optional
- async get_fixed_activity_project_list(**params)[source]
Get Fixed and Activity Project List
https://binance-docs.github.io/apidocs/spot/en/#get-fixed-and-activity-project-list-user_data
- Parameters:
asset (str) – optional
type (str) – required - “ACTIVITY”, “CUSTOMIZED_FIXED”
status (str) – optional - “ALL”, “SUBSCRIBABLE”, “UNSUBSCRIBABLE”; default “ALL”
sortBy (str) – optional - “START_TIME”, “LOT_SIZE”, “INTEREST_RATE”, “DURATION”; default “START_TIME”
current (int) – optional - Currently querying page. Start from 1. Default:1
size (int) – optional - Default:10, Max:100
recvWindow (int) – the number of milliseconds the request is valid for
- Returns:
API response
[ { "asset": "USDT", "displayPriority": 1, "duration": 90, "interestPerLot": "1.35810000", "interestRate": "0.05510000", "lotSize": "100.00000000", "lotsLowLimit": 1, "lotsPurchased": 74155, "lotsUpLimit": 80000, "maxLotsPerUser": 2000, "needKyc": False, "projectId": "CUSDT90DAYSS001", "projectName": "USDT", "status": "PURCHASING", "type": "CUSTOMIZED_FIXED", "withAreaLimitation": False } ]
- Raises:
BinanceRequestException, BinanceAPIException
- async get_future_hourly_interest_rate(**params)[source]
Get user the next hourly estimate interest
https://developers.binance.com/docs/margin_trading/borrow-and-repay
- Parameters:
assets (str) – List of assets, separated by commas, up to 20
isIsolated (bool) – for isolated margin or not, “TRUE”, “FALSE”
- Returns:
API response
- async get_historical_klines(symbol, interval, start_str=None, end_str=None, limit=None, klines_type: HistoricalKlinesType = HistoricalKlinesType.SPOT)[source]
Get Historical Klines from Binance
https://developers.binance.com/docs/binance-spot-api-docs/rest-api/market-data-endpoints#klinecandlestick-data https://developers.binance.com/docs/derivatives/option/market-data/Kline-Candlestick-Data https://developers.binance.com/docs/derivatives/usds-margined-futures/market-data/rest-api/Kline-Candlestick-Data https://developers.binance.com/docs/derivatives/usds-margined-futures/market-data/rest-api/Index-Price-Kline-Candlestick-Data https://developers.binance.com/docs/derivatives/usds-margined-futures/market-data/rest-api/Mark-Price-Kline-Candlestick-Data https://developers.binance.com/docs/derivatives/usds-margined-futures/market-data/rest-api/Premium-Index-Kline-Data https://developers.binance.com/docs/derivatives/coin-margined-futures/market-data/rest-api/Kline-Candlestick-Data https://developers.binance.com/docs/derivatives/coin-margined-futures/market-data/rest-api/Index-Price-Kline-Candlestick-Data https://developers.binance.com/docs/derivatives/coin-margined-futures/market-data/rest-api/Mark-Price-Kline-Candlestick-Data https://developers.binance.com/docs/derivatives/coin-margined-futures/market-data/rest-api/Premium-Index-Kline-Data
- Parameters:
symbol (str) – Name of symbol pair e.g. BNBBTC
interval (str) – Binance Kline interval
start_str (str|int) – optional - start date string in UTC format or timestamp in milliseconds
end_str (str|int) – optional - end date string in UTC format or timestamp in milliseconds (default will fetch everything up to now)
limit (int) – Default 1000; max 1000.
klines_type (HistoricalKlinesType) – Historical klines type: SPOT or FUTURES
- Returns:
list of OHLCV values (Open time, Open, High, Low, Close, Volume, Close time, Quote asset volume, Number of trades, Taker buy base asset volume, Taker buy quote asset volume, Ignore)
- async get_historical_klines_generator(symbol, interval, start_str=None, end_str=None, limit=1000, klines_type: HistoricalKlinesType = HistoricalKlinesType.SPOT)[source]
Get Historical Klines generator from Binance
https://developers.binance.com/docs/binance-spot-api-docs/rest-api/market-data-endpoints#klinecandlestick-data https://developers.binance.com/docs/derivatives/option/market-data/Kline-Candlestick-Data https://developers.binance.com/docs/derivatives/usds-margined-futures/market-data/rest-api/Kline-Candlestick-Data https://developers.binance.com/docs/derivatives/usds-margined-futures/market-data/rest-api/Index-Price-Kline-Candlestick-Data https://developers.binance.com/docs/derivatives/usds-margined-futures/market-data/rest-api/Mark-Price-Kline-Candlestick-Data https://developers.binance.com/docs/derivatives/usds-margined-futures/market-data/rest-api/Premium-Index-Kline-Data https://developers.binance.com/docs/derivatives/coin-margined-futures/market-data/rest-api/Kline-Candlestick-Data https://developers.binance.com/docs/derivatives/coin-margined-futures/market-data/rest-api/Index-Price-Kline-Candlestick-Data https://developers.binance.com/docs/derivatives/coin-margined-futures/market-data/rest-api/Mark-Price-Kline-Candlestick-Data https://developers.binance.com/docs/derivatives/coin-margined-futures/market-data/rest-api/Premium-Index-Kline-Data
- Parameters:
symbol (str) – Name of symbol pair e.g. BNBBTC
interval (str) – Binance Kline interval
start_str (str|int) – optional - Start date string in UTC format or timestamp in milliseconds
end_str (str|int) – optional - end date string in UTC format or timestamp in milliseconds (default will fetch everything up to now)
limit (int) – amount of candles to return per request (default 1000)
klines_type (HistoricalKlinesType) – Historical klines type: SPOT or FUTURES
- Returns:
generator of OHLCV values
- async get_historical_trades(**params) Dict[source]
Get older trades.
- Parameters:
symbol (str) – required
limit (int) – Default 500; max 1000.
fromId (str) – TradeId to fetch from. Default gets most recent trades.
- Returns:
API response
[ { "id": 28457, "price": "4.00000100", "qty": "12.00000000", "time": 1499865549590, "isBuyerMaker": true, "isBestMatch": true } ]
- Raises:
BinanceRequestException, BinanceAPIException
- async get_isolated_margin_account(**params)[source]
Query isolated margin account details
https://developers.binance.com/docs/margin_trading/account/Query-Isolated-Margin-Account-Info
- Parameters:
symbols – optional up to 5 margin pairs as a comma separated string
account_info = client.get_isolated_margin_account() account_info = client.get_isolated_margin_account(symbols="BTCUSDT,ETHUSDT")
- Returns:
API response
If "symbols" is not sent: { "assets":[ { "baseAsset": { "asset": "BTC", "borrowEnabled": true, "borrowed": "0.00000000", "free": "0.00000000", "interest": "0.00000000", "locked": "0.00000000", "netAsset": "0.00000000", "netAssetOfBtc": "0.00000000", "repayEnabled": true, "totalAsset": "0.00000000" }, "quoteAsset": { "asset": "USDT", "borrowEnabled": true, "borrowed": "0.00000000", "free": "0.00000000", "interest": "0.00000000", "locked": "0.00000000", "netAsset": "0.00000000", "netAssetOfBtc": "0.00000000", "repayEnabled": true, "totalAsset": "0.00000000" }, "symbol": "BTCUSDT" "isolatedCreated": true, "marginLevel": "0.00000000", "marginLevelStatus": "EXCESSIVE", // "EXCESSIVE", "NORMAL", "MARGIN_CALL", "PRE_LIQUIDATION", "FORCE_LIQUIDATION" "marginRatio": "0.00000000", "indexPrice": "10000.00000000" "liquidatePrice": "1000.00000000", "liquidateRate": "1.00000000" "tradeEnabled": true } ], "totalAssetOfBtc": "0.00000000", "totalLiabilityOfBtc": "0.00000000", "totalNetAssetOfBtc": "0.00000000" } If "symbols" is sent: { "assets":[ { "baseAsset": { "asset": "BTC", "borrowEnabled": true, "borrowed": "0.00000000", "free": "0.00000000", "interest": "0.00000000", "locked": "0.00000000", "netAsset": "0.00000000", "netAssetOfBtc": "0.00000000", "repayEnabled": true, "totalAsset": "0.00000000" }, "quoteAsset": { "asset": "USDT", "borrowEnabled": true, "borrowed": "0.00000000", "free": "0.00000000", "interest": "0.00000000", "locked": "0.00000000", "netAsset": "0.00000000", "netAssetOfBtc": "0.00000000", "repayEnabled": true, "totalAsset": "0.00000000" }, "symbol": "BTCUSDT" "isolatedCreated": true, "marginLevel": "0.00000000", "marginLevelStatus": "EXCESSIVE", // "EXCESSIVE", "NORMAL", "MARGIN_CALL", "PRE_LIQUIDATION", "FORCE_LIQUIDATION" "marginRatio": "0.00000000", "indexPrice": "10000.00000000" "liquidatePrice": "1000.00000000", "liquidateRate": "1.00000000" "tradeEnabled": true } ] }
- async get_isolated_margin_fee_data(**params)[source]
Get isolated margin fee data collection with any vip level or user’s current specific data as https://www.binance.com/en/margin-fee
https://developers.binance.com/docs/margin_trading/account/Query-Isolated-Margin-Fee-Data
- Parameters:
vipLevel (int) – User’s current specific margin data will be returned if vipLevel is omitted
symbol (str) – optional
- Returns:
API response
- async get_isolated_margin_symbol(**params)[source]
Query isolated margin symbol info
https://binance-docs.github.io/apidocs/spot/en/#query-isolated-margin-symbol-user_data
- Parameters:
symbol (str) – name of the symbol pair
pair_details = client.get_isolated_margin_symbol(symbol='BTCUSDT')
- Returns:
API response
{ "symbol":"BTCUSDT", "base":"BTC", "quote":"USDT", "isMarginTrade":true, "isBuyAllowed":true, "isSellAllowed":true }
- Raises:
BinanceRequestException, BinanceAPIException
- async get_isolated_margin_tier_data(**params)[source]
Get isolated margin tier data collection with any tier as https://www.binance.com/en/margin-data
https://developers.binance.com/docs/margin_trading/market-data/Query-Isolated-Margin-Tier-Data
- Parameters:
symbol (str) – required
tier (int) – All margin tier data will be returned if tier is omitted
recvWindow – optional: No more than 60000
- Returns:
API response
- async get_klines(**params) Dict[source]
Kline/candlestick bars for a symbol. Klines are uniquely identified by their open time.
- Parameters:
symbol (str) – required
interval (str)
limit (int) –
Default 500; max 1000.
startTime (int)
endTime (int)
- Returns:
API response
[ [ 1499040000000, # Open time "0.01634790", # Open "0.80000000", # High "0.01575800", # Low "0.01577100", # Close "148976.11427815", # Volume 1499644799999, # Close time "2434.19055334", # Quote asset volume 308, # Number of trades "1756.87402397", # Taker buy base asset volume "28.46694368", # Taker buy quote asset volume "17928899.62484339" # Can be ignored ] ]
- Raises:
BinanceRequestException, BinanceAPIException
- async get_margin_account(**params)[source]
Query cross-margin account details
https://developers.binance.com/docs/margin_trading/account/Query-Cross-Margin-Account-Details
- Returns:
API response
{ "borrowEnabled": true, "marginLevel": "11.64405625", "totalAssetOfBtc": "6.82728457", "totalLiabilityOfBtc": "0.58633215", "totalNetAssetOfBtc": "6.24095242", "tradeEnabled": true, "transferEnabled": true, "userAssets": [ { "asset": "BTC", "borrowed": "0.00000000", "free": "0.00499500", "interest": "0.00000000", "locked": "0.00000000", "netAsset": "0.00499500" }, { "asset": "BNB", "borrowed": "201.66666672", "free": "2346.50000000", "interest": "0.00000000", "locked": "0.00000000", "netAsset": "2144.83333328" }, { "asset": "ETH", "borrowed": "0.00000000", "free": "0.00000000", "interest": "0.00000000", "locked": "0.00000000", "netAsset": "0.00000000" }, { "asset": "USDT", "borrowed": "0.00000000", "free": "0.00000000", "interest": "0.00000000", "locked": "0.00000000", "netAsset": "0.00000000" } ] }
- Raises:
BinanceRequestException, BinanceAPIException
- async get_margin_all_assets(**params)[source]
Get All Margin Assets (MARKET_DATA)
https://developers.binance.com/docs/margin_trading/market-data/Get-All-Margin-Assets
margin_assets = client.get_margin_all_assets()
- Returns:
API response
[ { "assetFullName": "USD coin", "assetName": "USDC", "isBorrowable": true, "isMortgageable": true, "userMinBorrow": "0.00000000", "userMinRepay": "0.00000000" }, { "assetFullName": "BNB-coin", "assetName": "BNB", "isBorrowable": true, "isMortgageable": true, "userMinBorrow": "1.00000000", "userMinRepay": "0.00000000" } ]
- Raises:
BinanceRequestException, BinanceAPIException
- async get_margin_all_pairs(**params)[source]
Get All Cross Margin Pairs (MARKET_DATA)
https://developers.binance.com/docs/margin_trading/market-data/Get-All-Cross-Margin-Pairs
margin_pairs = client.get_margin_all_pairs()
- Returns:
API response
[ { "base": "BNB", "id": 351637150141315861, "isBuyAllowed": true, "isMarginTrade": true, "isSellAllowed": true, "quote": "BTC", "symbol": "BNBBTC" }, { "base": "TRX", "id": 351637923235429141, "isBuyAllowed": true, "isMarginTrade": true, "isSellAllowed": true, "quote": "BTC", "symbol": "TRXBTC" } ]
- Raises:
BinanceRequestException, BinanceAPIException
- async get_margin_asset(**params)[source]
Query cross-margin asset
https://binance-docs.github.io/apidocs/spot/en/#query-margin-asset-market_data
- Parameters:
asset (str) – name of the asset
asset_details = client.get_margin_asset(asset='BNB')
- Returns:
API response
{ "assetFullName": "Binance Coin", "assetName": "BNB", "isBorrowable": false, "isMortgageable": true, "userMinBorrow": "0.00000000", "userMinRepay": "0.00000000" }
- Raises:
BinanceRequestException, BinanceAPIException
- async get_margin_capital_flow(**params)[source]
Get cross or isolated margin capital flow
https://developers.binance.com/docs/margin_trading/account/Query-Cross-Isolated-Margin-Capital-Flow
- Parameters:
asset (str) – optional
symbol (str) – Required when querying isolated data
type (string) – optional
startTime (long) – Only supports querying the data of the last 90 days
endTime (long) – optional
formId (long) – If fromId is set, the data with id > fromId will be returned. Otherwise the latest data will be returned
limit (long) – The number of data items returned each time is limited. Default 500; Max 1000.
- Returns:
API response
- async get_margin_delist_schedule(**params)[source]
Get tokens or symbols delist schedule for cross margin and isolated margin
https://developers.binance.com/docs/margin_trading/market-data/Get-Delist-Schedule
- Parameters:
recvWindow (int) – optional - the number of milliseconds the request is valid for
- Returns:
API response
- async get_margin_dust_assets(**params)[source]
Get margin assets that can be converted into BNB.
https://binance-docs.github.io/apidocs/spot/en/#margin-dustlog-user_data
- Returns:
API response
- async get_margin_dustlog(**params)[source]
Query the historical information of user’s margin account small-value asset conversion BNB.
https://binance-docs.github.io/apidocs/spot/en/#margin-dustlog-user_data
- Parameters:
startTime (long) – optional
endTime (long) – optional
- Returns:
API response
- async get_margin_force_liquidation_rec(**params)[source]
Get Force Liquidation Record (USER_DATA)
https://developers.binance.com/docs/margin_trading/trade
- Parameters:
startTime (str)
endTime (str)
isolatedSymbol (str) – isolated symbol (if querying isolated margin)
current (str) – Currently querying page. Start from 1. Default:1
size (int) – Default:10 Max:100
recvWindow (int) – the number of milliseconds the request is valid for
- Returns:
API response
- {
- “rows”: [
- {
“avgPrice”: “0.00388359”, “executedQty”: “31.39000000”, “orderId”: 180015097, “price”: “0.00388110”, “qty”: “31.39000000”, “side”: “SELL”, “symbol”: “BNBBTC”, “timeInForce”: “GTC”, “isIsolated”: true, “updatedTime”: 1558941374745
}
], “total”: 1
}
- async get_margin_interest_history(**params)[source]
Get Interest History (USER_DATA)
https://developers.binance.com/docs/margin_trading/borrow-and-repay/Get-Interest-History
- Parameters:
asset (str)
isolatedSymbol (str) – isolated symbol (if querying isolated margin)
startTime (str)
endTime (str)
current (str) – Currently querying page. Start from 1. Default:1
size (int) – Default:10 Max:100
archived (bool) – Default: false. Set to true for archived data from 6 months ago
recvWindow (int) – the number of milliseconds the request is valid for
- Returns:
API response
- {
- “rows”:[
- {
“isolatedSymbol”: “BNBUSDT”, // isolated symbol, will not be returned for crossed margin “asset”: “BNB”, “interest”: “0.02414667”, “interestAccuredTime”: 1566813600000, “interestRate”: “0.01600000”, “principal”: “36.22000000”, “type”: “ON_BORROW”
}
], “total”: 1
}
- async get_margin_loan_details(**params)[source]
Query loan record
txId or startTime must be sent. txId takes precedence.
https://binance-docs.github.io/apidocs/spot/en/#query-loan-record-user_data
- Parameters:
asset (str) – required
isolatedSymbol (str) – isolated symbol (if querying isolated margin)
txId (str) – the tranId in of the created loan
startTime (str) – earliest timestamp to filter transactions
endTime (str) – Used to uniquely identify this cancel. Automatically generated by default.
current (str) – Currently querying page. Start from 1. Default:1
size (int) – Default:10 Max:100
recvWindow (int) – the number of milliseconds the request is valid for
- Returns:
API response
- {
- “rows”: [
- {
“asset”: “BNB”, “principal”: “0.84624403”, “timestamp”: 1555056425000, //one of PENDING (pending to execution), CONFIRMED (successfully loaned), FAILED (execution failed, nothing happened to your account); “status”: “CONFIRMED”
}
], “total”: 1
}
- Raises:
BinanceRequestException, BinanceAPIException
- async get_margin_oco_order(**params)[source]
Retrieves a specific OCO based on provided optional parameters
https://developers.binance.com/docs/margin_trading/trade/Query-Margin-Account-OCO
- Parameters:
isIsolated – for isolated margin or not, “TRUE”, “FALSE”,default “FALSE”
symbol (str) – mandatory for isolated margin, not supported for cross margin
orderListId (int) – Either orderListId or listClientOrderId must be provided
listClientOrderId (str) – Either orderListId or listClientOrderId must be provided
recvWindow (int) – the number of milliseconds the request is valid for
- Returns:
API response
- {
“orderListId”: 27, “contingencyType”: “OCO”, “listStatusType”: “EXEC_STARTED”, “listOrderStatus”: “EXECUTING”, “listClientOrderId”: “h2USkA5YQpaXHPIrkd96xE”, “transactionTime”: 1565245656253, “symbol”: “LTCBTC”, “isIsolated”: false, // if isolated margin “orders”: [
- {
“symbol”: “LTCBTC”, “orderId”: 4, “clientOrderId”: “qD1gy3kc3Gx0rihm9Y3xwS”
}, {
”symbol”: “LTCBTC”, “orderId”: 5, “clientOrderId”: “ARzZ9I00CPM8i3NhmU9Ega”
}
]
}
- async get_margin_order(**params)[source]
Query margin accounts order
Either orderId or origClientOrderId must be sent.
For some historical orders cummulativeQuoteQty will be < 0, meaning the data is not available at this time.
https://developers.binance.com/docs/margin_trading/trade/Query-Margin-Account-Order
- Parameters:
symbol (str) – required
isIsolated (str) – set to ‘TRUE’ for isolated margin (default ‘FALSE’)
orderId (str)
origClientOrderId (str)
recvWindow (int) – the number of milliseconds the request is valid for
- Returns:
API response
- {
“clientOrderId”: “ZwfQzuDIGpceVhKW5DvCmO”, “cummulativeQuoteQty”: “0.00000000”, “executedQty”: “0.00000000”, “icebergQty”: “0.00000000”, “isWorking”: true, “orderId”: 213205622, “origQty”: “0.30000000”, “price”: “0.00493630”, “side”: “SELL”, “status”: “NEW”, “stopPrice”: “0.00000000”, “symbol”: “BNBBTC”, “time”: 1562133008725, “timeInForce”: “GTC”, “type”: “LIMIT”, “updateTime”: 1562133008725
}
- Raises:
BinanceRequestException, BinanceAPIException
- async get_margin_price_index(**params)[source]
Query margin priceIndex
https://developers.binance.com/docs/margin_trading/market-data/Query-Margin-PriceIndex
- Parameters:
symbol (str) – name of the symbol pair
price_index_details = client.get_margin_price_index(symbol='BTCUSDT')
- Returns:
API response
{ "calcTime": 1562046418000, "price": "0.00333930", "symbol": "BNBBTC" }
- Raises:
BinanceRequestException, BinanceAPIException
- async get_margin_repay_details(**params)[source]
Query repay record
txId or startTime must be sent. txId takes precedence.
https://binance-docs.github.io/apidocs/spot/en/#query-repay-record-user_data
- Parameters:
asset (str) – required
isolatedSymbol (str) – isolated symbol (if querying isolated margin)
txId (str) – the tranId in of the created loan
startTime (str)
endTime (str) – Used to uniquely identify this cancel. Automatically generated by default.
current (str) – Currently querying page. Start from 1. Default:1
size (int) – Default:10 Max:100
recvWindow (int) – the number of milliseconds the request is valid for
- Returns:
API response
- {
- “rows”: [
- {
//Total amount repaid “amount”: “14.00000000”, “asset”: “BNB”, //Interest repaid “interest”: “0.01866667”, //Principal repaid “principal”: “13.98133333”, //one of PENDING (pending to execution), CONFIRMED (successfully loaned), FAILED (execution failed, nothing happened to your account); “status”: “CONFIRMED”, “timestamp”: 1563438204000, “txId”: 2970933056
}
], “total”: 1
}
- Raises:
BinanceRequestException, BinanceAPIException
- async get_margin_symbol(**params)[source]
Query cross-margin symbol info
https://binance-docs.github.io/apidocs/spot/en/#query-cross-margin-pair-market_data
- Parameters:
symbol (str) – name of the symbol pair
pair_details = client.get_margin_symbol(symbol='BTCUSDT')
- Returns:
API response
{ "id":323355778339572400, "symbol":"BTCUSDT", "base":"BTC", "quote":"USDT", "isMarginTrade":true, "isBuyAllowed":true, "isSellAllowed":true }
- Raises:
BinanceRequestException, BinanceAPIException
- async get_margin_trades(**params)[source]
Query margin accounts trades
If fromId is set, it will get orders >= that fromId. Otherwise most recent orders are returned.
https://developers.binance.com/docs/margin_trading/trade/Query-Margin-Account-Trade-List
- Parameters:
symbol (str) – required
isIsolated (str) – set to ‘TRUE’ for isolated margin (default ‘FALSE’)
fromId (str) – optional
startTime (str) – optional
endTime (str) – optional
limit (int) – Default 500; max 1000
recvWindow (int) – the number of milliseconds the request is valid for
- Returns:
API response
- [
- {
“commission”: “0.00006000”, “commissionAsset”: “BTC”, “id”: 34, “isBestMatch”: true, “isBuyer”: false, “isMaker”: false, “orderId”: 39324, “price”: “0.02000000”, “qty”: “3.00000000”, “symbol”: “BNBBTC”, “time”: 1561973357171
- }, {
“commission”: “0.00002950”, “commissionAsset”: “BTC”, “id”: 32, “isBestMatch”: true, “isBuyer”: false, “isMaker”: true, “orderId”: 39319, “price”: “0.00590000”, “qty”: “5.00000000”, “symbol”: “BNBBTC”, “time”: 1561964645345
}
]
- Raises:
BinanceRequestException, BinanceAPIException
- async get_margin_transfer_history(**params)[source]
Query margin transfer history
https://developers.binance.com/docs/margin_trading/transfer
- Parameters:
asset (str) – optional
type (str) – optional Transfer Type: ROLL_IN, ROLL_OUT
archived (str) – optional Default: false. Set to true for archived data from 6 months ago
startTime (str) – earliest timestamp to filter transactions
endTime (str) – Used to uniquely identify this cancel. Automatically generated by default.
current (str) – Currently querying page. Start from 1. Default:1
size (int) – Default:10 Max:100
recvWindow (int) – the number of milliseconds the request is valid for
- Returns:
API response
- {
- “rows”: [
- {
“amount”: “0.10000000”, “asset”: “BNB”, “status”: “CONFIRMED”, “timestamp”: 1566898617, “txId”: 5240372201, “type”: “ROLL_IN”
}, {
”amount”: “5.00000000”, “asset”: “USDT”, “status”: “CONFIRMED”, “timestamp”: 1566888436, “txId”: 5239810406, “type”: “ROLL_OUT”
}, {
”amount”: “1.00000000”, “asset”: “EOS”, “status”: “CONFIRMED”, “timestamp”: 1566888403, “txId”: 5239808703, “type”: “ROLL_IN”
}
], “total”: 3
}
- Raises:
BinanceRequestException, BinanceAPIException
- async get_max_margin_loan(**params)[source]
Query max borrow amount for an asset
https://binance-docs.github.io/apidocs/spot/en/#query-max-borrow-user_data
- Parameters:
asset (str) – required
isolatedSymbol (str) – isolated symbol (if querying isolated margin)
recvWindow (int) – the number of milliseconds the request is valid for
- Returns:
API response
- {
“amount”: “1.69248805”
}
- Raises:
BinanceRequestException, BinanceAPIException
- async get_max_margin_transfer(**params)[source]
Query max transfer-out amount
https://developers.binance.com/docs/margin_trading/transfer/Query-Max-Transfer-Out-Amount
- Parameters:
asset (str) – required
isolatedSymbol (str) – isolated symbol (if querying isolated margin)
recvWindow (int) – the number of milliseconds the request is valid for
- Returns:
API response
- {
“amount”: “3.59498107”
}
- Raises:
BinanceRequestException, BinanceAPIException
- async get_my_trades(**params)[source]
Get trades for a specific symbol.
- Parameters:
symbol (str) – required
startTime (int) – optional
endTime (int) – optional
limit (int) – Default 500; max 1000.
fromId (int) – TradeId to fetch from. Default gets most recent trades.
recvWindow (int) – the number of milliseconds the request is valid for
- Returns:
API response
[ { "id": 28457, "price": "4.00000100", "qty": "12.00000000", "commission": "10.10000000", "commissionAsset": "BNB", "time": 1499865549590, "isBuyer": true, "isMaker": false, "isBestMatch": true } ]
- Raises:
BinanceRequestException, BinanceAPIException
- async get_open_margin_oco_orders(**params)[source]
Retrieves open OCO trades
https://developers.binance.com/docs/margin_trading/trade/Query-Margin-Account-Open-OCO
- Parameters:
isIsolated – for isolated margin or not, “TRUE”, “FALSE”,default “FALSE”
symbol (str) – mandatory for isolated margin, not supported for cross margin
fromId (int) – If supplied, neither startTime or endTime can be provided
startTime (int) – optional
endTime (int) – optional
limit (int) – optional Default Value: 500; Max Value: 1000
recvWindow (int) – the number of milliseconds the request is valid for
- Returns:
API response
- [
- {
“orderListId”: 29, “contingencyType”: “OCO”, “listStatusType”: “EXEC_STARTED”, “listOrderStatus”: “EXECUTING”, “listClientOrderId”: “amEEAXryFzFwYF1FeRpUoZ”, “transactionTime”: 1565245913483, “symbol”: “LTCBTC”, “isIsolated”: true, // if isolated margin “orders”: [
- {
“symbol”: “LTCBTC”, “orderId”: 4, “clientOrderId”: “oD7aesZqjEGlZrbtRpy5zB”
}, {
”symbol”: “LTCBTC”, “orderId”: 5, “clientOrderId”: “Jr1h6xirOxgeJOUuYQS7V3”
}
]
}, {
”orderListId”: 28, “contingencyType”: “OCO”, “listStatusType”: “EXEC_STARTED”, “listOrderStatus”: “EXECUTING”, “listClientOrderId”: “hG7hFNxJV6cZy3Ze4AUT4d”, “transactionTime”: 1565245913407, “symbol”: “LTCBTC”, “orders”: [
- {
“symbol”: “LTCBTC”, “orderId”: 2, “clientOrderId”: “j6lFOfbmFMRjTYA7rRJ0LP”
}, {
”symbol”: “LTCBTC”, “orderId”: 3, “clientOrderId”: “z0KCjOdditiLS5ekAFtK81”
}
]
}
]
- async get_open_margin_orders(**params)[source]
Query margin accounts open orders
If the symbol is not sent, orders for all symbols will be returned in an array (cross-margin only).
If querying isolated margin orders, both the isIsolated=’TRUE’ and symbol=symbol_name must be set.
When all symbols are returned, the number of requests counted against the rate limiter is equal to the number of symbols currently trading on the exchange.
https://developers.binance.com/docs/margin_trading/trade/Query-Margin-Account-Open-Orders
- Parameters:
symbol (str) – optional
isIsolated (str) – set to ‘TRUE’ for isolated margin (default ‘FALSE’)
recvWindow (int) – the number of milliseconds the request is valid for
- Returns:
API response
- [
- {
“clientOrderId”: “qhcZw71gAkCCTv0t0k8LUK”, “cummulativeQuoteQty”: “0.00000000”, “executedQty”: “0.00000000”, “icebergQty”: “0.00000000”, “isWorking”: true, “orderId”: 211842552, “origQty”: “0.30000000”, “price”: “0.00475010”, “side”: “SELL”, “status”: “NEW”, “stopPrice”: “0.00000000”, “symbol”: “BNBBTC”, “time”: 1562040170089, “timeInForce”: “GTC”, “type”: “LIMIT”, “updateTime”: 1562040170089
}
]
- Raises:
BinanceRequestException, BinanceAPIException
- async get_open_oco_orders(**params)[source]
Get all open orders on a symbol. https://developers.binance.com/docs/binance-spot-api-docs/rest-api/account-endpoints#query-open-order-lists-user_data :param recvWindow: the number of milliseconds the request is valid for :type recvWindow: int :returns: API response .. code-block:: python
- [
- {
“orderListId”: 31, “contingencyType”: “OCO”, “listStatusType”: “EXEC_STARTED”, “listOrderStatus”: “EXECUTING”, “listClientOrderId”: “wuB13fmulKj3YjdqWEcsnp”, “transactionTime”: 1565246080644, “symbol”: “LTCBTC”, “orders”: [
- {
“symbol”: “LTCBTC”, “orderId”: 4, “clientOrderId”: “r3EH2N76dHfLoSZWIUw1bT”
}, {
“symbol”: “LTCBTC”, “orderId”: 5, “clientOrderId”: “Cv1SnyPD3qhqpbjpYEHbd2”
}
]
}
]
- Raises:
BinanceRequestException, BinanceAPIException
- async get_open_orders(**params)[source]
Get all open orders on a symbol.
- Parameters:
symbol (str) – optional
recvWindow (int) – the number of milliseconds the request is valid for
- Returns:
API response
[ { "symbol": "LTCBTC", "orderId": 1, "clientOrderId": "myOrder1", "price": "0.1", "origQty": "1.0", "executedQty": "0.0", "status": "NEW", "timeInForce": "GTC", "type": "LIMIT", "side": "BUY", "stopPrice": "0.0", "icebergQty": "0.0", "time": 1499827319559 } ]
- Raises:
BinanceRequestException, BinanceAPIException
- async get_order(**params)[source]
Check an order’s status. Either orderId or origClientOrderId must be sent.
- Parameters:
symbol (str) – required
orderId (int) – The unique order id
origClientOrderId (str) – optional
recvWindow (int) – the number of milliseconds the request is valid for
- Returns:
API response
{ "symbol": "LTCBTC", "orderId": 1, "clientOrderId": "myOrder1", "price": "0.1", "origQty": "1.0", "executedQty": "0.0", "status": "NEW", "timeInForce": "GTC", "type": "LIMIT", "side": "BUY", "stopPrice": "0.0", "icebergQty": "0.0", "time": 1499827319559 }
- Raises:
BinanceRequestException, BinanceAPIException
- async get_order_book(**params) Dict[source]
Get the Order Book for the market
https://developers.binance.com/docs/binance-spot-api-docs/rest-api/market-data-endpoints#order-book
- Parameters:
symbol (str) – required
limit (int) – Default 100; max 1000
- Returns:
API response
{ "lastUpdateId": 1027024, "bids": [ [ "4.00000000", # PRICE "431.00000000", # QTY [] # Can be ignored ] ], "asks": [ [ "4.00000200", "12.00000000", [] ] ] }
- Raises:
BinanceRequestException, BinanceAPIException
- async get_orderbook_ticker(**params)[source]
Latest price for a symbol or symbols.
- Parameters:
symbol (str)
- Returns:
API response
{ "symbol": "LTCBTC", "bidPrice": "4.00000000", "bidQty": "431.00000000", "askPrice": "4.00000200", "askQty": "9.00000000" }
OR
[ { "symbol": "LTCBTC", "bidPrice": "4.00000000", "bidQty": "431.00000000", "askPrice": "4.00000200", "askQty": "9.00000000" }, { "symbol": "ETHBTC", "bidPrice": "0.07946700", "bidQty": "9.00000000", "askPrice": "100000.00000000", "askQty": "1000.00000000" } ]
- Raises:
BinanceRequestException, BinanceAPIException
- async get_orderbook_tickers(**params) Dict[source]
Best price/qty on the order book for all symbols.
- Parameters:
symbol (str) – optional
symbols (str) – optional accepted format [“BTCUSDT”,”BNBUSDT”] or %5B%22BTCUSDT%22,%22BNBUSDT%22%5D
- Returns:
List of order book market entries
[ { "symbol": "LTCBTC", "bidPrice": "4.00000000", "bidQty": "431.00000000", "askPrice": "4.00000200", "askQty": "9.00000000" }, { "symbol": "ETHBTC", "bidPrice": "0.07946700", "bidQty": "9.00000000", "askPrice": "100000.00000000", "askQty": "1000.00000000" } ]
- Raises:
BinanceRequestException, BinanceAPIException
- async get_pay_trade_history(**params)[source]
Get C2C Trade History
https://binance-docs.github.io/apidocs/spot/en/#pay-endpoints
- Parameters:
startTime (int) – optional
endTime (int) – optional
limit (int) – optional - default 100, max 100
recvWindow (int) – optional
- Returns:
API response
- async get_personal_left_quota(**params)[source]
Get Personal Left Quota of Staking Product
https://binance-docs.github.io/apidocs/spot/en/#get-personal-left-quota-of-staking-product-user_data
- async get_prevented_matches(**params)[source]
Displays the list of orders that were expired because of STP.
- Parameters:
symbol (str) – required
preventedMatchId (int) – optional
orderId (int) – optional
fromPreventedMatchId (int) – optional
limit (int) – optional, Default: 500; Max: 1000
recvWindow (int) – the number of milliseconds the request is valid for
- Returns:
API response
- async get_products() Dict[source]
Return list of products currently listed on Binance
Use get_exchange_info() call instead
- Returns:
list - List of product dictionaries
- Raises:
BinanceRequestException, BinanceAPIException
- async get_recent_trades(**params) Dict[source]
Get recent trades (up to last 500).
- Parameters:
symbol (str) – required
limit (int) – Default 500; max 1000.
- Returns:
API response
[ { "id": 28457, "price": "4.00000100", "qty": "12.00000000", "time": 1499865549590, "isBuyerMaker": true, "isBestMatch": true } ]
- Raises:
BinanceRequestException, BinanceAPIException
- async get_server_time() Dict[source]
Test connectivity to the Rest API and get the current server time.
- Returns:
Current server time
{ "serverTime": 1499827319559 }
- Raises:
BinanceRequestException, BinanceAPIException
- async get_simple_earn_account(**params)[source]
https://binance-docs.github.io/apidocs/spot/en/#simple-account-user_data
- Parameters:
recvWindow (int) – the number of milliseconds the request is valid for
- Returns:
API response
{ "totalAmountInBTC": "0.01067982", "totalAmountInUSDT": "77.13289230", "totalFlexibleAmountInBTC": "0.00000000", "totalFlexibleAmountInUSDT": "0.00000000", "totalLockedInBTC": "0.01067982", "totalLockedInUSDT": "77.13289230" }
- Raises:
BinanceRequestException, BinanceAPIException
- async get_simple_earn_flexible_product_list(**params)[source]
Get available Simple Earn flexible product list
https://binance-docs.github.io/apidocs/spot/en/#get-simple-earn-flexible-product-list-user_data
- Parameters:
asset (str) – optional
current (int) – optional - Currently querying page. Start from 1. Default:1
size (int) – optional - Default:10, Max:100
recvWindow (int) – the number of milliseconds the request is valid for
- Returns:
API response
{ "rows":[ { "asset": "BTC", "latestAnnualPercentageRate": "0.05000000", "tierAnnualPercentageRate": { "0-5BTC": 0.05, "5-10BTC": 0.03 }, "airDropPercentageRate": "0.05000000", "canPurchase": true, "canRedeem": true, "isSoldOut": true, "hot": true, "minPurchaseAmount": "0.01000000", "productId": "BTC001", "subscriptionStartTime": "1646182276000", "status": "PURCHASING" } ], "total": 1 }
- Raises:
BinanceRequestException, BinanceAPIException
- async get_simple_earn_flexible_product_position(**params)[source]
https://binance-docs.github.io/apidocs/spot/en/#get-flexible-product-position-user_data
- Parameters:
asset (str) – optional
current (int) – optional - Currently querying page. Start from 1. Default:1
size (int) – optional - Default:10, Max:100
recvWindow (int) – the number of milliseconds the request is valid for
- Returns:
API response
{ "rows":[ { "totalAmount": "75.46000000", "tierAnnualPercentageRate": { "0-5BTC": 0.05, "5-10BTC": 0.03 }, "latestAnnualPercentageRate": "0.02599895", "yesterdayAirdropPercentageRate": "0.02599895", "asset": "USDT", "airDropAsset": "BETH", "canRedeem": true, "collateralAmount": "232.23123213", "productId": "USDT001", "yesterdayRealTimeRewards": "0.10293829", "cumulativeBonusRewards": "0.22759183", "cumulativeRealTimeRewards": "0.22759183", "cumulativeTotalRewards": "0.45459183", "autoSubscribe": true } ], "total": 1 }
- Raises:
BinanceRequestException, BinanceAPIException
- async get_simple_earn_locked_product_list(**params)[source]
Get available Simple Earn flexible product list
https://binance-docs.github.io/apidocs/spot/en/#get-simple-earn-locked-product-list-user_data
- Parameters:
asset (str) – optional
current (int) – optional - Currently querying page. Start from 1. Default:1
size (int) – optional - Default:10, Max:100
recvWindow (int) – the number of milliseconds the request is valid for
- Returns:
API response
{ "rows": [ { "projectId": "Axs*90", "detail": { "asset": "AXS", "rewardAsset": "AXS", "duration": 90, "renewable": true, "isSoldOut": true, "apr": "1.2069", "status": "CREATED", "subscriptionStartTime": "1646182276000", "extraRewardAsset": "BNB", "extraRewardAPR": "0.23" }, "quota": { "totalPersonalQuota": "2", "minimum": "0.001" } } ], "total": 1 }
- Raises:
BinanceRequestException, BinanceAPIException
- async get_simple_earn_locked_product_position(**params)[source]
https://binance-docs.github.io/apidocs/spot/en/#get-locked-product-position-user_data
- Parameters:
asset (str) – optional
current (int) – optional - Currently querying page. Start from 1. Default:1
size (int) – optional - Default:10, Max:100
recvWindow (int) – the number of milliseconds the request is valid for
- Returns:
API response
{ "rows":[ { "positionId": "123123", "projectId": "Axs*90", "asset": "AXS", "amount": "122.09202928", "purchaseTime": "1646182276000", "duration": "60", "accrualDays": "4", "rewardAsset": "AXS", "APY": "0.23", "isRenewable": true, "isAutoRenew": true, "redeemDate": "1732182276000" } ], "total": 1 }
- Raises:
BinanceRequestException, BinanceAPIException
- async get_small_liability_exchange_assets(**params)[source]
Query the coins which can be small liability exchange
https://developers.binance.com/docs/margin_trading/trade/Get-Small-Liability-Exchange-Coin-List
- Returns:
API response
- async get_small_liability_exchange_history(**params)[source]
Get Small liability Exchange History
https://developers.binance.com/docs/margin_trading/trade/Get-Small-Liability-Exchange-History
- Parameters:
current (int) – Currently querying page. Start from 1. Default:1
size (int) – Default:10, Max:100
startTime (long) – Default: 30 days from current timestamp
endTime – Default: present timestamp
- Returns:
API response
- async get_spot_delist_schedule(**params)[source]
Get symbols delist schedule for spot
https://developers.binance.com/docs/wallet/others/delist-schedule
- Parameters:
recvWindow (int) – optional - the number of milliseconds the request is valid for
- Returns:
API response
- async get_staking_asset_us(**params)[source]
Get staking information for a supported asset (or assets)
https://docs.binance.us/#get-staking-asset-information
- Raises:
BinanceRegionException – If client is not configured for binance.us
- async get_staking_balance_us(**params)[source]
Get staking balance
https://docs.binance.us/#get-staking-balance
- Raises:
BinanceRegionException – If client is not configured for binance.us
- async get_staking_history_us(**params)[source]
Get staking history
https://docs.binance.us/#get-staking-history
- Raises:
BinanceRegionException – If client is not configured for binance.us
- async get_staking_position(**params)[source]
Get Staking Product Position
https://binance-docs.github.io/apidocs/spot/en/#get-staking-product-position-user_data
- async get_staking_product_list(**params)[source]
Get Staking Product List
https://binance-docs.github.io/apidocs/spot/en/#get-staking-product-list-user_data
- async get_staking_purchase_history(**params)[source]
Get Staking Purchase History
https://binance-docs.github.io/apidocs/spot/en/#get-staking-history-user_data
- async get_staking_rewards_history_us(**params)[source]
Get staking rewards history for an asset(or assets) within a given time range.
https://docs.binance.us/#get-staking-rewards-history
- Raises:
BinanceRegionException – If client is not configured for binance.us
- async get_sub_account_assets(**params)[source]
Fetch sub-account assets
https://developers.binance.com/docs/sub_account/asset-management/Query-Sub-account-Assets-V4
- Parameters:
email (str) – required
recvWindow (int) – optional
- Returns:
API response
{ "balances":[ { "asset":"ADA", "free":10000, "locked":0 }, { "asset":"BNB", "free":10003, "locked":0 }, { "asset":"BTC", "free":11467.6399, "locked":0 }, { "asset":"ETH", "free":10004.995, "locked":0 }, { "asset":"USDT", "free":11652.14213, "locked":0 } ] }
- Raises:
BinanceRequestException, BinanceAPIException
- async get_sub_account_futures_transfer_history(**params)[source]
Query Sub-account Futures Transfer History.
- Parameters:
email (str) – required
futuresType (int) – required
startTime (int) – optional
endTime (int) – optional
page (int) – optional
limit (int) – optional
recvWindow (int) – optional
- Returns:
API response
{ "success":true, "futuresType": 2, "transfers":[ { "from":"aaa@test.com", "to":"bbb@test.com", "asset":"BTC", "qty":"1", "time":1544433328000 }, { "from":"bbb@test.com", "to":"ccc@test.com", "asset":"ETH", "qty":"2", "time":1544433328000 } ] }
- Raises:
BinanceRequestException, BinanceAPIException
- async get_sub_account_list(**params)[source]
Query Sub-account List.
https://developers.binance.com/docs/sub_account/account-management/Query-Sub-account-List
- Parameters:
email (str) – optional - Sub-account email
isFreeze (str) – optional
page (int) – optional - Default value: 1
limit (int) – optional - Default value: 1, Max value: 200
recvWindow (int) – optional
- Returns:
API response
{ "subAccounts":[ { "email":"testsub@gmail.com", "isFreeze":false, "createTime":1544433328000 }, { "email":"virtual@oxebmvfonoemail.com", "isFreeze":false, "createTime":1544433328000 } ] }
- Raises:
BinanceRequestException, BinanceAPIException
- async get_sub_account_transfer_history(**params)[source]
Query Sub-account Transfer History.
- Parameters:
fromEmail (str) – optional
toEmail (str) – optional
startTime (int) – optional
endTime (int) – optional
page (int) – optional - Default value: 1
limit (int) – optional - Default value: 500
recvWindow (int) – optional
- Returns:
API response
[ { "from":"aaa@test.com", "to":"bbb@test.com", "asset":"BTC", "qty":"10", "status": "SUCCESS", "tranId": 6489943656, "time":1544433328000 }, { "from":"bbb@test.com", "to":"ccc@test.com", "asset":"ETH", "qty":"2", "status": "SUCCESS", "tranId": 6489938713, "time":1544433328000 } ]
- Raises:
BinanceRequestException, BinanceAPIException
- async get_subaccount_deposit_address(**params)[source]
Get Sub-account Deposit Address (For Master Account)
https://developers.binance.com/docs/sub_account/asset-management/Get-Sub-account-Deposit-Address
- Parameters:
email (str) – required - Sub account email
coin (str) – required
network (str) – optional
recvWindow (int) – optional
- Returns:
API response
{ "address":"TDunhSa7jkTNuKrusUTU1MUHtqXoBPKETV", "coin":"USDT", "tag":"", "url":"https://tronscan.org/#/address/TDunhSa7jkTNuKrusUTU1MUHtqXoBPKETV" }
- Raises:
BinanceRequestException, BinanceAPIException
- async get_subaccount_deposit_history(**params)[source]
Get Sub-account Deposit History (For Master Account)
https://developers.binance.com/docs/sub_account/asset-management/Get-Sub-account-Deposit-History
- Parameters:
email (str) – required - Sub account email
coin (str) – optional
status (int) – optional - (0:pending,6: credited but cannot withdraw, 1:success)
startTime (int) – optional
endTime (int) – optional
limit (int) – optional
offset (int) – optional - default:0
recvWindow (int) – optional
- Returns:
API response
[ { "amount":"0.00999800", "coin":"PAXG", "network":"ETH", "status":1, "address":"0x788cabe9236ce061e5a892e1a59395a81fc8d62c", "addressTag":"", "txId":"0xaad4654a3234aa6118af9b4b335f5ae81c360b2394721c019b5d1e75328b09f3", "insertTime":1599621997000, "transferType":0, "confirmTimes":"12/12" }, { "amount":"0.50000000", "coin":"IOTA", "network":"IOTA", "status":1, "address":"SIZ9VLMHWATXKV99LH99CIGFJFUMLEHGWVZVNNZXRJJVWBPHYWPPBOSDORZ9EQSHCZAMPVAPGFYQAUUV9DROOXJLNW", "addressTag":"", "txId":"ESBFVQUTPIWQNJSPXFNHNYHSQNTGKRVKPRABQWTAXCDWOAKDKYWPTVG9BGXNVNKTLEJGESAVXIKIZ9999", "insertTime":1599620082000, "transferType":0, "confirmTimes":"1/1" } ]
- Raises:
BinanceRequestException, BinanceAPIException
- async get_subaccount_futures_details(**params)[source]
Get Detail on Sub-account’s Futures Account (For Master Account)
- Parameters:
email (str) – required - Sub account email
recvWindow (int) – optional
- Returns:
API response
{ "email": "abc@test.com", "asset": "USDT", "assets":[ { "asset": "USDT", "initialMargin": "0.00000000", "maintenanceMargin": "0.00000000", "marginBalance": "0.88308000", "maxWithdrawAmount": "0.88308000", "openOrderInitialMargin": "0.00000000", "positionInitialMargin": "0.00000000", "unrealizedProfit": "0.00000000", "walletBalance": "0.88308000" } ], "canDeposit": true, "canTrade": true, "canWithdraw": true, "feeTier": 2, "maxWithdrawAmount": "0.88308000", "totalInitialMargin": "0.00000000", "totalMaintenanceMargin": "0.00000000", "totalMarginBalance": "0.88308000", "totalOpenOrderInitialMargin": "0.00000000", "totalPositionInitialMargin": "0.00000000", "totalUnrealizedProfit": "0.00000000", "totalWalletBalance": "0.88308000", "updateTime": 1576756674610 }
- Raises:
BinanceRequestException, BinanceAPIException
- async get_subaccount_futures_margin_status(**params)[source]
Get Sub-account’s Status on Margin/Futures (For Master Account)
- Parameters:
email (str) – optional - Sub account email
recvWindow (int) – optional
- Returns:
API response
[ { "email":"123@test.com", // user email "isSubUserEnabled": true, // true or false "isUserActive": true, // true or false "insertTime": 1570791523523 // sub account create time "isMarginEnabled": true, // true or false for margin "isFutureEnabled": true // true or false for futures. "mobile": 1570791523523 // user mobile number } ]
- Raises:
BinanceRequestException, BinanceAPIException
- async get_subaccount_futures_positionrisk(**params)[source]
Get Futures Position-Risk of Sub-account (For Master Account)
- Parameters:
email (str) – required - Sub account email
recvWindow (int) – optional
- Returns:
API response
[ { "entryPrice": "9975.12000", "leverage": "50", // current initial leverage "maxNotional": "1000000", // notional value limit of current initial leverage "liquidationPrice": "7963.54", "markPrice": "9973.50770517", "positionAmount": "0.010", "symbol": "BTCUSDT", "unrealizedProfit": "-0.01612295" } ]
- Raises:
BinanceRequestException, BinanceAPIException
- async get_subaccount_futures_summary(**params)[source]
Get Summary of Sub-account’s Futures Account (For Master Account)
- Parameters:
recvWindow (int) – optional
- Returns:
API response
{ "totalInitialMargin": "9.83137400", "totalMaintenanceMargin": "0.41568700", "totalMarginBalance": "23.03235621", "totalOpenOrderInitialMargin": "9.00000000", "totalPositionInitialMargin": "0.83137400", "totalUnrealizedProfit": "0.03219710", "totalWalletBalance": "22.15879444", "asset": "USDT", "subAccountList":[ { "email": "123@test.com", "totalInitialMargin": "9.00000000", "totalMaintenanceMargin": "0.00000000", "totalMarginBalance": "22.12659734", "totalOpenOrderInitialMargin": "9.00000000", "totalPositionInitialMargin": "0.00000000", "totalUnrealizedProfit": "0.00000000", "totalWalletBalance": "22.12659734", "asset": "USDT" }, { "email": "345@test.com", "totalInitialMargin": "0.83137400", "totalMaintenanceMargin": "0.41568700", "totalMarginBalance": "0.90575887", "totalOpenOrderInitialMargin": "0.00000000", "totalPositionInitialMargin": "0.83137400", "totalUnrealizedProfit": "0.03219710", "totalWalletBalance": "0.87356177", "asset": "USDT" } ] }
- Raises:
BinanceRequestException, BinanceAPIException
- async get_subaccount_margin_details(**params)[source]
Get Detail on Sub-account’s Margin Account (For Master Account)
- Parameters:
email (str) – required - Sub account email
recvWindow (int) – optional
- Returns:
API response
{ "email":"123@test.com", "marginLevel": "11.64405625", "totalAssetOfBtc": "6.82728457", "totalLiabilityOfBtc": "0.58633215", "totalNetAssetOfBtc": "6.24095242", "marginTradeCoeffVo": { "forceLiquidationBar": "1.10000000", // Liquidation margin ratio "marginCallBar": "1.50000000", // Margin call margin ratio "normalBar": "2.00000000" // Initial margin ratio }, "marginUserAssetVoList": [ { "asset": "BTC", "borrowed": "0.00000000", "free": "0.00499500", "interest": "0.00000000", "locked": "0.00000000", "netAsset": "0.00499500" }, { "asset": "BNB", "borrowed": "201.66666672", "free": "2346.50000000", "interest": "0.00000000", "locked": "0.00000000", "netAsset": "2144.83333328" }, { "asset": "ETH", "borrowed": "0.00000000", "free": "0.00000000", "interest": "0.00000000", "locked": "0.00000000", "netAsset": "0.00000000" }, { "asset": "USDT", "borrowed": "0.00000000", "free": "0.00000000", "interest": "0.00000000", "locked": "0.00000000", "netAsset": "0.00000000" } ] }
- Raises:
BinanceRequestException, BinanceAPIException
- async get_subaccount_margin_summary(**params)[source]
Get Summary of Sub-account’s Margin Account (For Master Account)
- Parameters:
recvWindow (int) – optional
- Returns:
API response
{ "totalAssetOfBtc": "4.33333333", "totalLiabilityOfBtc": "2.11111112", "totalNetAssetOfBtc": "2.22222221", "subAccountList":[ { "email":"123@test.com", "totalAssetOfBtc": "2.11111111", "totalLiabilityOfBtc": "1.11111111", "totalNetAssetOfBtc": "1.00000000" }, { "email":"345@test.com", "totalAssetOfBtc": "2.22222222", "totalLiabilityOfBtc": "1.00000001", "totalNetAssetOfBtc": "1.22222221" } ] }
- Raises:
BinanceRequestException, BinanceAPIException
- async get_subaccount_transfer_history(**params)[source]
Sub-account Transfer History (For Sub-account)
https://developers.binance.com/docs/sub_account/asset-management/Sub-account-Transfer-History
- Parameters:
asset (str) – required - The asset being transferred, e.g., USDT
type (int) – optional - 1: transfer in, 2: transfer out
startTime (int) – optional
endTime (int) – optional
limit (int) – optional - Default 500
recvWindow (int) – optional
- Returns:
API response
[ { "counterParty":"master", "email":"master@test.com", "type":1, // 1 for transfer in, 2 for transfer out "asset":"BTC", "qty":"1", "status":"SUCCESS", "tranId":11798835829, "time":1544433325000 }, { "counterParty":"subAccount", "email":"sub2@test.com", "type":2, "asset":"ETH", "qty":"2", "status":"SUCCESS", "tranId":11798829519, "time":1544433326000 } ]
- Raises:
BinanceRequestException, BinanceAPIException
- async get_symbol_info(symbol) Dict | None[source]
Return information about a symbol
- Parameters:
symbol (str) – required e.g. BNBBTC
- Returns:
Dict if found, None if not
{ "symbol": "ETHBTC", "status": "TRADING", "baseAsset": "ETH", "baseAssetPrecision": 8, "quoteAsset": "BTC", "quotePrecision": 8, "orderTypes": ["LIMIT", "MARKET"], "icebergAllowed": false, "filters": [ { "filterType": "PRICE_FILTER", "minPrice": "0.00000100", "maxPrice": "100000.00000000", "tickSize": "0.00000100" }, { "filterType": "LOT_SIZE", "minQty": "0.00100000", "maxQty": "100000.00000000", "stepSize": "0.00100000" }, { "filterType": "MIN_NOTIONAL", "minNotional": "0.00100000" } ] }
- Raises:
BinanceRequestException, BinanceAPIException
- async get_symbol_ticker(**params)[source]
Latest price for a symbol or symbols.
- Parameters:
symbol (str)
- Returns:
API response
{ "symbol": "LTCBTC", "price": "4.00000200" }
OR
[ { "symbol": "LTCBTC", "price": "4.00000200" }, { "symbol": "ETHBTC", "price": "0.07946600" } ]
- Raises:
BinanceRequestException, BinanceAPIException
- async get_symbol_ticker_window(**params)[source]
Latest price for a symbol or symbols.
- Parameters:
symbol (str)
- Returns:
API response
{ "symbol": "LTCBTC", "price": "4.00000200" }
OR
[ { "symbol": "LTCBTC", "price": "4.00000200" }, { "symbol": "ETHBTC", "price": "0.07946600" } ]
- Raises:
BinanceRequestException, BinanceAPIException
- async get_system_status()[source]
Get system status detail.
https://developers.binance.com/docs/wallet/others/system-status
- Returns:
API response
{ "status": 0, # 0: normal,1:system maintenance "msg": "normal" # normal or System maintenance. }
- Raises:
BinanceAPIException
- async get_ticker(**params)[source]
24 hour price change statistics.
- Parameters:
symbol (str)
- Returns:
API response
{ "priceChange": "-94.99999800", "priceChangePercent": "-95.960", "weightedAvgPrice": "0.29628482", "prevClosePrice": "0.10002000", "lastPrice": "4.00000200", "bidPrice": "4.00000000", "askPrice": "4.00000200", "openPrice": "99.00000000", "highPrice": "100.00000000", "lowPrice": "0.10000000", "volume": "8913.30000000", "openTime": 1499783499040, "closeTime": 1499869899040, "fristId": 28385, # First tradeId "lastId": 28460, # Last tradeId "count": 76 # Trade count }
OR
[ { "priceChange": "-94.99999800", "priceChangePercent": "-95.960", "weightedAvgPrice": "0.29628482", "prevClosePrice": "0.10002000", "lastPrice": "4.00000200", "bidPrice": "4.00000000", "askPrice": "4.00000200", "openPrice": "99.00000000", "highPrice": "100.00000000", "lowPrice": "0.10000000", "volume": "8913.30000000", "openTime": 1499783499040, "closeTime": 1499869899040, "fristId": 28385, # First tradeId "lastId": 28460, # Last tradeId "count": 76 # Trade count } ]
- Raises:
BinanceRequestException, BinanceAPIException
- async get_trade_fee(**params)[source]
Get trade fee.
https://developers.binance.com/docs/wallet/asset/trade-fee
- Parameters:
symbol (str) – optional
recvWindow (int) – the number of milliseconds the request is valid for
- Returns:
API response
[ { "symbol": "ADABNB", "makerCommission": "0.001", "takerCommission": "0.001" }, { "symbol": "BNBBTC", "makerCommission": "0.001", "takerCommission": "0.001" } ]
- async get_ui_klines(**params) Dict[source]
Kline/candlestick bars for a symbol with UI enhancements. Klines are uniquely identified by their open time.
https://developers.binance.com/docs/binance-spot-api-docs/rest-api/market-data-endpoints#uiklines
- Parameters:
symbol (str) – required
interval (str) – required - The interval for the klines (e.g., 1m, 3m, 5m, etc.)
limit (int) – optional - Default 500; max 1000.
startTime (int) – optional - Start time in milliseconds
endTime (int) – optional - End time in milliseconds
- Returns:
API response
[ [ 1499040000000, # Open time "0.01634790", # Open "0.80000000", # High "0.01575800", # Low "0.01577100", # Close "148976.11427815", # Volume 1499644799999, # Close time "2434.19055334", # Quote asset volume 308, # Number of trades "1756.87402397", # Taker buy base asset volume "28.46694368", # Taker buy quote asset volume "17928899.62484339" # Can be ignored ] ]
- Raises:
BinanceRequestException, BinanceAPIException
- async get_universal_transfer_history(**params)[source]
Universal Transfer (For Master Account)
https://developers.binance.com/docs/sub_account/asset-management/Query-Universal-Transfer-History
- Parameters:
fromEmail (str) – optional
toEmail (str) – optional
startTime (int) – optional
endTime (int) – optional
page (int) – optional
limit (int) – optional
recvWindow (int) – optional
- Returns:
API response
[ { "tranId":11945860693, "fromEmail":"master@test.com", "toEmail":"subaccount1@test.com", "asset":"BTC", "amount":"0.1", "fromAccountType":"SPOT", "toAccountType":"COIN_FUTURE", "status":"SUCCESS", "createTimeStamp":1544433325000 }, { "tranId":11945857955, "fromEmail":"master@test.com", "toEmail":"subaccount2@test.com", "asset":"ETH", "amount":"0.2", "fromAccountType":"SPOT", "toAccountType":"USDT_FUTURE", "status":"SUCCESS", "createTimeStamp":1544433326000 } ]
- Raises:
BinanceRequestException, BinanceAPIException
- async get_user_asset(**params)[source]
Get user assets, just for positive data
https://developers.binance.com/docs/wallet/asset/user-assets
- async get_withdraw_history(**params)[source]
Fetch withdraw history.
https://developers.binance.com/docs/wallet/capital/withdraw-history
- Parameters:
coin (str) – optional
offset (int) – optional - default:0
limit (int) – optional
startTime (int) – optional - Default: 90 days from current timestamp
endTime (int) – optional - Default: present timestamp
recvWindow (int) – the number of milliseconds the request is valid for
- Returns:
API response
[ { "address": "0x94df8b352de7f46f64b01d3666bf6e936e44ce60", "amount": "8.91000000", "applyTime": "2019-10-12 11:12:02", "coin": "USDT", "id": "b6ae22b3aa844210a7041aee7589627c", "withdrawOrderId": "WITHDRAWtest123", // will not be returned if there's no withdrawOrderId for this withdraw. "network": "ETH", "transferType": 0, // 1 for internal transfer, 0 for external transfer "status": 6, "txId": "0xb5ef8c13b968a406cc62a93a8bd80f9e9a906ef1b3fcf20a2e48573c17659268" }, { "address": "1FZdVHtiBqMrWdjPyRPULCUceZPJ2WLCsB", "amount": "0.00150000", "applyTime": "2019-09-24 12:43:45", "coin": "BTC", "id": "156ec387f49b41df8724fa744fa82719", "network": "BTC", "status": 6, "txId": "60fd9007ebfddc753455f95fafa808c4302c836e4d1eebc5a132c36c1d8ac354" } ]
- Raises:
BinanceRequestException, BinanceAPIException
- async get_withdraw_history_id(withdraw_id, **params)[source]
Fetch withdraw history.
https://binance-docs.github.io/apidocs/spot/en/#withdraw-history-supporting-network-user_data
- Parameters:
withdraw_id (str) – required
asset (str) – optional
startTime (long) – optional
endTime (long) – optional
recvWindow (int) – the number of milliseconds the request is valid for
- Returns:
API response
{ "id":"7213fea8e94b4a5593d507237e5a555b", "withdrawOrderId": None, "amount": 0.99, "transactionFee": 0.01, "address": "0x6915f16f8791d0a1cc2bf47c13a6b2a92000504b", "asset": "ETH", "txId": "0xdf33b22bdb2b28b1f75ccd201a4a4m6e7g83jy5fc5d5a9d1340961598cfcb0a1", "applyTime": 1508198532000, "status": 4 }
- Raises:
BinanceRequestException, BinanceAPIException
- async gift_card_create(**params)[source]
This API is for creating a Binance Gift Card.
To get started with, please make sure:
You have a Binance account
You have passed KYB
You have a sufficient balance(Gift Card amount and fee amount) in your Binance funding wallet
You need Enable Withdrawals for the API Key which requests this endpoint.
https://developers.binance.com/docs/gift_card/market-data
- Parameters:
token (str) – The token type contained in the Binance Gift Card
amount (float) – The amount of the token contained in the Binance Gift Card
- Returns:
api response
- async gift_card_create_dual_token(**params)[source]
This API is for creating a dual-token ( stablecoin-denominated) Binance Gift Card. You may create a gift card using USDT as baseToken, that is redeemable to another designated token (faceToken). For example, you can create a fixed-value BTC gift card and pay with 100 USDT plus 1 USDT fee. This gift card can keep the value fixed at 100 USDT before redemption, and will be redeemable to BTC equivalent to 100 USDT upon redemption.
Once successfully created, the amount of baseToken (e.g. USDT) in the fixed-value gift card along with the fee would be deducted from your funding wallet.
To get started with, please make sure: - You have a Binance account - You have passed KYB - You have a sufficient balance(Gift Card amount and fee amount) in your Binance funding wallet - You need Enable Withdrawals for the API Key which requests this endpoint.
https://developers.binance.com/docs/gift_card/market-data/Create-a-dual-token-gift-card :param baseToken: The token you want to pay, example: BUSD :type baseToken: str :param faceToken: The token you want to buy, example: BNB. If faceToken = baseToken, it’s the same as createCode endpoint. :type faceToken: str :param discount: Stablecoin-denominated card discount percentage, Example: 1 for 1% discount. Scale should be less than 6. :type discount: float :return: api response .. code-block:: python
- {
“code”: “000000”, “message”: “success”, “data”: {
“referenceNo”: “0033002144060553”, “code”: “6H9EKF5ECCWFBHGE”, “expiredTime”: 1727417154000
}, “success”: true
}
- async gift_card_fetch_rsa_public_key(**params)[source]
This API is for fetching the RSA Public Key. This RSA Public key will be used to encrypt the card code.
Important Note: The RSA Public key fetched is valid only for the current day.
https://developers.binance.com/docs/gift_card/market-data/Fetch-RSA-Public-Key :param recvWindow: The receive window for the request in milliseconds (optional) :type recvWindow: int :return: api response .. code-block:: python
- {
“code”: “000000”, “message”: “success”, “data”: “MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCXBBVKLAc1GQ5FsIFFqOHrPTox5noBONIKr+IAedTR9FkVxq6e65updEbfdhRNkMOeYIO2i0UylrjGC0X8YSoIszmrVHeV0l06Zh1oJuZos1+7N+WLuz9JvlPaawof3GUakTxYWWCa9+8KIbLKsoKMdfS96VT+8iOXO3quMGKUmQIDAQAB”, “success”: true
}
- async gift_card_fetch_token_limit(**params)[source]
Verify which tokens are available for you to create Stablecoin-Denominated gift cards https://developers.binance.com/docs/gift_card/market-data/Fetch-Token-Limit
- Parameters:
baseToken (str) – The token you want to pay, example: BUSD
- Returns:
api response
- async gift_card_redeem(**params)[source]
This API is for redeeming a Binance Gift Card. Once redeemed, the coins will be deposited in your funding wallet.
Important Note: If you enter the wrong redemption code 5 times within 24 hours, you will no longer be able to redeem any Binance Gift Cards that day.
Code Format Options: - Plaintext - Encrypted (Recommended for better security)
For encrypted format: 1. Fetch RSA public key from the RSA public key endpoint 2. Encrypt the code using algorithm: RSA/ECB/OAEPWithSHA-256AndMGF1Padding
https://developers.binance.com/docs/gift_card/market-data/Redeem-a-Binance-Gift-Card :param code: Redemption code of Binance Gift Card to be redeemed, supports both Plaintext & Encrypted code :type code: str :param externalUid: External unique ID representing a user on the partner platform.
Helps identify redemption behavior and control risks/limits. Max 400 characters. (optional)
- Parameters:
recvWindow (int) – The receive window for the request in milliseconds (optional)
- Returns:
api response
- async gift_card_verify(**params)[source]
This API is for verifying whether the Binance Gift Card is valid or not by entering Gift Card Number.
Important Note: If you enter the wrong Gift Card Number 5 times within an hour, you will no longer be able to verify any Gift Card Number for that hour.
- Parameters:
referenceNo (str) – Enter the Gift Card Number
- Returns:
api response
- async isolated_margin_stream_close(symbol, listenKey)[source]
Close out an isolated margin data stream.
- Parameters:
symbol (str) – required - symbol for the isolated margin account
listenKey (str) – required
- Returns:
API response
{}- Raises:
BinanceRequestException, BinanceAPIException
- async isolated_margin_stream_get_listen_key(symbol)[source]
Start a new isolated margin data stream and return the listen key If a stream already exists it should return the same key. If the stream becomes invalid a new key is returned.
Can be used to keep the stream alive.
- Parameters:
symbol (str) – required - symbol for the isolated margin account
- Returns:
API response
{ "listenKey": "T3ee22BIYuWqmvne0HNq2A2WsFlEtLhvWCtItw6ffhhdmjifQ2tRbuKkTHhr" }
- Raises:
BinanceRequestException, BinanceAPIException
- async isolated_margin_stream_keepalive(symbol, listenKey)[source]
PING an isolated margin data stream to prevent a time out.
- Parameters:
symbol (str) – required - symbol for the isolated margin account
listenKey (str) – required
- Returns:
API response
{}- Raises:
BinanceRequestException, BinanceAPIException
- async make_subaccount_futures_transfer(**params)[source]
Futures Transfer for Sub-account (For Master Account)
https://developers.binance.com/docs/sub_account/asset-management
- Parameters:
email (str) – required - Sub account email
asset (str) – required - The asset being transferred, e.g., USDT
amount (float) – required - The amount to be transferred
type (int) – required - 1: transfer from subaccount’s spot account to its USDT-margined futures account 2: transfer from subaccount’s USDT-margined futures account to its spot account 3: transfer from subaccount’s spot account to its COIN-margined futures account 4: transfer from subaccount’s COIN-margined futures account to its spot account
- Returns:
API response
{ "txnId":"2966662589" }
- Raises:
BinanceRequestException, BinanceAPIException
- async make_subaccount_margin_transfer(**params)[source]
Margin Transfer for Sub-account (For Master Account)
https://developers.binance.com/docs/sub_account/asset-management/Margin-Transfer-for-Sub-account
- Parameters:
email (str) – required - Sub account email
asset (str) – required - The asset being transferred, e.g., USDT
amount (float) – required - The amount to be transferred
type (int) – required - 1: transfer from subaccount’s spot account to margin account 2: transfer from subaccount’s margin account to its spot account
- Returns:
API response
{ "txnId":"2966662589" }
- Raises:
BinanceRequestException, BinanceAPIException
- async make_subaccount_to_master_transfer(**params)[source]
Transfer to Master (For Sub-account)
https://developers.binance.com/docs/sub_account/asset-management/Transfer-to-Master
- Parameters:
asset (str) – required - The asset being transferred, e.g., USDT
amount (float) – required - The amount to be transferred
recvWindow (int) – optional
- Returns:
API response
{ "txnId":"2966662589" }
- Raises:
BinanceRequestException, BinanceAPIException
- async make_subaccount_to_subaccount_transfer(**params)[source]
Transfer to Sub-account of Same Master (For Sub-account)
- Parameters:
toEmail (str) – required - Sub account email
asset (str) – required - The asset being transferred, e.g., USDT
amount (float) – required - The amount to be transferred
recvWindow (int) – optional
- Returns:
API response
{ "txnId":"2966662589" }
- Raises:
BinanceRequestException, BinanceAPIException
- async make_subaccount_universal_transfer(**params)[source]
Universal Transfer (For Master Account)
https://developers.binance.com/docs/sub_account/asset-management/Universal-Transfer
- Parameters:
fromEmail (str) – optional
toEmail (str) – optional
fromAccountType (str) – required - “SPOT”,”USDT_FUTURE”,”COIN_FUTURE”
toAccountType (str) – required - “SPOT”,”USDT_FUTURE”,”COIN_FUTURE”
asset (str) – required - The asset being transferred, e.g., USDT
amount (float) – required
recvWindow (int) – optional
- Returns:
API response
{ "tranId":11945860693 }
- Raises:
BinanceRequestException, BinanceAPIException
- async make_universal_transfer(**params)[source]
User Universal Transfer
https://developers.binance.com/docs/wallet/asset/user-universal-transfer
- Parameters:
type (str (ENUM)) – required
asset (str) – required
amount (str) – required
recvWindow (int) – the number of milliseconds the request is valid for
transfer_status = client.make_universal_transfer(params)
- Returns:
API response
{ "tranId":13526853623 }
- Raises:
BinanceRequestException, BinanceAPIException
- async margin_borrow_repay(**params)[source]
Margin Account Borrow/Repay (MARGIN)
https://developers.binance.com/docs/margin_trading/borrow-and-repay/Margin-Account-Borrow-Repay
- Parameters:
asset (str) – required
amount (float) – required
isIsolated (str) – optional - for isolated margin or not, “TRUE”, “FALSE”, default “FALSE”
symbol (str) – optional - isolated symbol
type (str - BORROW or REPAY) – str
- Returns:
API response
- async margin_create_listen_token(symbol: str | None = None, is_isolated: bool = False, validity: int | None = None)[source]
Create a listenToken for margin account user data stream
- Parameters:
symbol (str) – Trading pair symbol (required when is_isolated=True)
is_isolated (bool) – Whether it is isolated margin (default: False for cross-margin)
validity (int) – Validity in milliseconds (default: 24 hours, max: 24 hours)
- Returns:
API response with token and expirationTime
{ "token": "6xXxePXwZRjVSHKhzUCCGnmN3fkvMTXru+pYJS8RwijXk9Vcyr3rkwfVOTcP2OkONqciYA", "expirationTime": 1758792204196 }
- async margin_get_borrow_repay_records(**params)[source]
Query Query borrow/repay records in Margin account (USER_DATA)
https://developers.binance.com/docs/margin_trading/borrow-and-repay/Query-Borrow-Repay
- Parameters:
asset (str) – required
isolatedSymbol (str) – optional - isolated symbol
txId (int) – optional - the tranId in POST /sapi/v1/margin/loan
startTime (int) – optional
endTime (int) – optional
current (int) – optional - Currently querying page. Start from 1. Default:1
size (int) – optional - Default:10 Max:100
- Returns:
API response
- {
- “rows”: [
- {
“type”: “AUTO”, // AUTO,MANUAL for Cross Margin Borrow; MANUAL,AUTO,BNB_AUTO_REPAY,POINT_AUTO_REPAY for Cross Margin Repay; AUTO,MANUAL for Isolated Margin Borrow/Repay; “isolatedSymbol”: “BNBUSDT”, // isolated symbol, will not be returned for crossed margin “amount”: “14.00000000”, // Total amount borrowed/repaid “asset”: “BNB”, “interest”: “0.01866667”, // Interest repaid “principal”: “13.98133333”, // Principal repaid “status”: “CONFIRMED”, //one of PENDING (pending execution), CONFIRMED (successfully execution), FAILED (execution failed, nothing happened to your account); “timestamp”: 1563438204000, “txId”: 2970933056
}
], “total”: 1
}
- async margin_interest_history(**params)[source]
Get Interest History (USER_DATA)
https://developers.binance.com/docs/margin_trading/borrow-and-repay/Get-Interest-History
- Parameters:
asset (str) – optional
isolatedSymbol (str) – optional - isolated symbol
startTime (int) – optional
endTime (int) – optional
current (int) – optional - Currently querying page. Start from 1. Default:1
size (int) – optional - Default:10 Max:100
- Returns:
API response
- async margin_interest_rate_history(**params)[source]
Query Margin Interest Rate History (USER_DATA)
- Parameters:
asset (str) – required
vipLevel (int) – optional
startTime (int) – optional
endTime (int) – optional
- Returns:
API response
- [
- {
“asset”: “BTC”, “dailyInterestRate”: “0.00025000”, “timestamp”: 1611544731000, “vipLevel”: 1
}, {
“asset”: “BTC”, “dailyInterestRate”: “0.00035000”, “timestamp”: 1610248118000, “vipLevel”: 1
}
]
- async margin_manual_liquidation(**params)[source]
https://developers.binance.com/docs/margin_trading/trade/Margin-Manual-Liquidation
- Parameters:
type – required
- Returns:
API response
- [
- {
“asset”: “ETH”, “interest”: “0.00083334”, “principal”: “0.001”, “liabilityAsset”: “USDT”, “liabilityQty”: 0.3552
}
]
- async margin_max_borrowable(**params)[source]
Query Max Borrow (USER_DATA)
https://developers.binance.com/docs/margin_trading/borrow-and-repay/Query-Max-Borrow
- Parameters:
asset (str) – required
isolatedSymbol (str) – optional - isolated symbol
- Returns:
API response
- {
“amount”: “1.69248805”, // account’s currently max borrowable amount with sufficient system availability “borrowLimit”: “60” // max borrowable amount limited by the account level
}
- async margin_next_hourly_interest_rate(**params)[source]
Get future hourly interest rate (USER_DATA)
https://developers.binance.com/docs/margin_trading/borrow-and-repay
- Parameters:
assets (str) – required - List of assets, separated by commas, up to 20
isIsolated (bool) – required - for isolated margin or not, “TRUE”, “FALSE”
- Returns:
API response
- async margin_stream_close(listenKey)[source]
Close out a cross-margin data stream.
https://developers.binance.com/docs/margin_trading/trade-data-stream/Close-Margin-User-Data-Stream
- Parameters:
listenKey (str) – required
- Returns:
API response
{}- Raises:
BinanceRequestException, BinanceAPIException
- async margin_stream_get_listen_key()[source]
Start a new cross-margin data stream and return the listen key If a stream already exists it should return the same key. If the stream becomes invalid a new key is returned.
Can be used to keep the stream alive.
https://developers.binance.com/docs/margin_trading/trade-data-stream/Start-Margin-User-Data-Stream
- Returns:
API response
{ "listenKey": "pqia91ma19a5s61cv6a81va65sdf19v8a65a1a5s61cv6a81va65sdf19v8a65a1" }
- Raises:
BinanceRequestException, BinanceAPIException
- async margin_stream_keepalive(listenKey)[source]
PING a cross-margin data stream to prevent a time out.
- Parameters:
listenKey (str) – required
- Returns:
API response
{}- Raises:
BinanceRequestException, BinanceAPIException
- async margin_v1_delete_account_api_restrictions_ip_restriction_ip_list(**params)[source]
Placeholder function for DELETE /sapi/v1/account/apiRestrictions/ipRestriction/ipList. Note: This function was auto-generated. Any issue please open an issue on GitHub.
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- async margin_v1_delete_algo_spot_order(**params)[source]
Placeholder function for DELETE /sapi/v1/algo/spot/order. Note: This function was auto-generated. Any issue please open an issue on GitHub.
https://developers.binance.com/docs/algo/spot-algo/Cancel-Algo-Order
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- async margin_v1_delete_broker_sub_account_api(**params)[source]
Placeholder function for DELETE /sapi/v1/broker/subAccountApi. Note: This function was auto-generated. Any issue please open an issue on GitHub.
https://developers.binance.com/docs/binance_link/exchange-link/account/Delete-Sub-Account-Api-Key
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- async margin_v1_delete_broker_sub_account_api_ip_restriction_ip_list(**params)[source]
Placeholder function for DELETE /sapi/v1/broker/subAccountApi/ipRestriction/ipList. Note: This function was auto-generated. Any issue please open an issue on GitHub.
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- async margin_v1_delete_sub_account_sub_account_api_ip_restriction_ip_list(**params)[source]
Placeholder function for DELETE /sapi/v1/sub-account/subAccountApi/ipRestriction/ipList. Note: This function was auto-generated. Any issue please open an issue on GitHub.
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- async margin_v1_get_account_api_restrictions_ip_restriction(**params)[source]
Placeholder function for GET /sapi/v1/account/apiRestrictions/ipRestriction. Note: This function was auto-generated. Any issue please open an issue on GitHub.
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- async margin_v1_get_account_info(**params)[source]
Placeholder function for GET /sapi/v1/account/info. Note: This function was auto-generated. Any issue please open an issue on GitHub.
https://developers.binance.com/docs/wallet/account
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- async margin_v1_get_algo_spot_historical_orders(**params)[source]
Placeholder function for GET /sapi/v1/algo/spot/historicalOrders. Note: This function was auto-generated. Any issue please open an issue on GitHub.
https://developers.binance.com/docs/algo/spot-algo/Query-Historical-Algo-Orders
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- async margin_v1_get_algo_spot_open_orders(**params)[source]
Placeholder function for GET /sapi/v1/algo/spot/openOrders. Note: This function was auto-generated. Any issue please open an issue on GitHub.
https://developers.binance.com/docs/algo/spot-algo/Query-Current-Algo-Open-Orders
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- async margin_v1_get_algo_spot_sub_orders(**params)[source]
Placeholder function for GET /sapi/v1/algo/spot/subOrders. Note: This function was auto-generated. Any issue please open an issue on GitHub.
https://developers.binance.com/docs/algo/spot-algo/Query-Sub-Orders
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- async margin_v1_get_asset_custody_transfer_history(**params)[source]
Placeholder function for GET /sapi/v1/asset/custody/transfer-history. Note: This function was auto-generated. Any issue please open an issue on GitHub.
https://developers.binance.com/docs/wallet/asset/query-user-delegation
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- async margin_v1_get_asset_ledger_transfer_cloud_mining_query_by_page(**params)[source]
Placeholder function for GET /sapi/v1/asset/ledger-transfer/cloud-mining/queryByPage. Note: This function was auto-generated. Any issue please open an issue on GitHub.
https://developers.binance.com/docs/wallet/asset/cloud-mining-payment-and-refund-history
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- async margin_v1_get_asset_wallet_balance(**params)[source]
Placeholder function for GET /sapi/v1/asset/wallet/balance. Note: This function was auto-generated. Any issue please open an issue on GitHub.
https://developers.binance.com/docs/wallet/asset/query-user-wallet-balance
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- async margin_v1_get_broker_rebate_futures_recent_record(**params)[source]
Placeholder function for GET /sapi/v1/broker/rebate/futures/recentRecord. Note: This function was auto-generated. Any issue please open an issue on GitHub.
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- async margin_v1_get_broker_rebate_historical_record(**params)[source]
Placeholder function for GET /sapi/v1/broker/rebate/historicalRecord. Note: This function was auto-generated. Any issue please open an issue on GitHub.
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- async margin_v1_get_broker_rebate_recent_record(**params)[source]
Placeholder function for GET /sapi/v1/broker/rebate/recentRecord. Note: This function was auto-generated. Any issue please open an issue on GitHub.
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- async margin_v1_get_broker_sub_account(**params)[source]
Placeholder function for GET /sapi/v1/broker/subAccount. Note: This function was auto-generated. Any issue please open an issue on GitHub.
https://developers.binance.com/docs/binance_link/exchange-link/account/Query-Sub-Account
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- async margin_v1_get_broker_sub_account_api(**params)[source]
Placeholder function for GET /sapi/v1/broker/subAccountApi. Note: This function was auto-generated. Any issue please open an issue on GitHub.
https://developers.binance.com/docs/binance_link/exchange-link/account/Query-Sub-Account-Api-Key
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- async margin_v1_get_broker_sub_account_api_commission_coin_futures(**params)[source]
Placeholder function for GET /sapi/v1/broker/subAccountApi/commission/coinFutures. Note: This function was auto-generated. Any issue please open an issue on GitHub.
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- async margin_v1_get_broker_sub_account_api_commission_futures(**params)[source]
Placeholder function for GET /sapi/v1/broker/subAccountApi/commission/futures. Note: This function was auto-generated. Any issue please open an issue on GitHub.
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- async margin_v1_get_broker_sub_account_api_ip_restriction(**params)[source]
Placeholder function for GET /sapi/v1/broker/subAccountApi/ipRestriction. Note: This function was auto-generated. Any issue please open an issue on GitHub.
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- async margin_v1_get_broker_sub_account_bnb_burn_status(**params)[source]
Placeholder function for GET /sapi/v1/broker/subAccount/bnbBurn/status. Note: This function was auto-generated. Any issue please open an issue on GitHub.
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- async margin_v1_get_broker_sub_account_deposit_hist(**params)[source]
Placeholder function for GET /sapi/v1/broker/subAccount/depositHist. Note: This function was auto-generated. Any issue please open an issue on GitHub.
https://developers.binance.com/docs/binance_link/exchange-link/asset/Get-Sub-Account-Deposit-History
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- async margin_v1_get_broker_sub_account_futures_summary(**params)[source]
Placeholder function for GET /sapi/v1/broker/subAccount/futuresSummary. Note: This function was auto-generated. Any issue please open an issue on GitHub.
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- async margin_v1_get_broker_sub_account_margin_summary(**params)[source]
Placeholder function for GET /sapi/v1/broker/subAccount/marginSummary. Note: This function was auto-generated. Any issue please open an issue on GitHub.
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- async margin_v1_get_broker_sub_account_spot_summary(**params)[source]
Placeholder function for GET /sapi/v1/broker/subAccount/spotSummary. Note: This function was auto-generated. Any issue please open an issue on GitHub.
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- async margin_v1_get_broker_transfer(**params)[source]
Placeholder function for GET /sapi/v1/broker/transfer. Note: This function was auto-generated. Any issue please open an issue on GitHub.
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- async margin_v1_get_broker_transfer_futures(**params)[source]
Placeholder function for GET /sapi/v1/broker/transfer/futures. Note: This function was auto-generated. Any issue please open an issue on GitHub.
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- async margin_v1_get_broker_universal_transfer(**params)[source]
Placeholder function for GET /sapi/v1/broker/universalTransfer. Note: This function was auto-generated. Any issue please open an issue on GitHub.
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- async margin_v1_get_capital_contract_convertible_coins(**params)[source]
Placeholder function for GET /sapi/v1/capital/contract/convertible-coins. Note: This function was auto-generated. Any issue please open an issue on GitHub.
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- async margin_v1_get_capital_deposit_address_list(**params)[source]
Placeholder function for GET /sapi/v1/capital/deposit/address/list. Note: This function was auto-generated. Any issue please open an issue on GitHub.
https://developers.binance.com/docs/wallet/capital/deposite-address
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- async margin_v1_get_convert_asset_info(**params)[source]
Placeholder function for GET /sapi/v1/convert/assetInfo. Note: This function was auto-generated. Any issue please open an issue on GitHub.
https://developers.binance.com/docs/convert/market-data/Query-order-quantity-precision-per-asset
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- async margin_v1_get_convert_exchange_info(**params)[source]
Placeholder function for GET /sapi/v1/convert/exchangeInfo. Note: This function was auto-generated. Any issue please open an issue on GitHub.
https://developers.binance.com/docs/convert/market-data
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- async margin_v1_get_convert_limit_query_open_orders(**params)[source]
Placeholder function for GET /sapi/v1/convert/limit/queryOpenOrders. Note: This function was auto-generated. Any issue please open an issue on GitHub.
https://developers.binance.com/docs/convert/trade/Query-Order
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- async margin_v1_get_convert_order_status(**params)[source]
Placeholder function for GET /sapi/v1/convert/orderStatus. Note: This function was auto-generated. Any issue please open an issue on GitHub.
https://developers.binance.com/docs/convert/trade/Order-Status
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- async margin_v1_get_copy_trading_futures_lead_symbol(**params)[source]
Placeholder function for GET /sapi/v1/copyTrading/futures/leadSymbol. Note: This function was auto-generated. Any issue please open an issue on GitHub.
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- async margin_v1_get_copy_trading_futures_user_status(**params)[source]
Placeholder function for GET /sapi/v1/copyTrading/futures/userStatus. Note: This function was auto-generated. Any issue please open an issue on GitHub.
https://developers.binance.com/docs/copy_trading/future-copy-trading
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- async margin_v1_get_dci_product_accounts(**params)[source]
Placeholder function for GET /sapi/v1/dci/product/accounts. Note: This function was auto-generated. Any issue please open an issue on GitHub.
https://developers.binance.com/docs/dual_investment/trade/Check-Dual-Investment-accounts
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- async margin_v1_get_dci_product_list(**params)[source]
Placeholder function for GET /sapi/v1/dci/product/list. Note: This function was auto-generated. Any issue please open an issue on GitHub.
https://developers.binance.com/docs/dual_investment/market-data
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- async margin_v1_get_dci_product_positions(**params)[source]
Placeholder function for GET /sapi/v1/dci/product/positions. Note: This function was auto-generated. Any issue please open an issue on GitHub.
https://developers.binance.com/docs/dual_investment/trade/Get-Dual-Investment-positions
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- async margin_v1_get_eth_staking_eth_history_redemption_history(**params)[source]
Placeholder function for GET /sapi/v1/eth-staking/eth/history/redemptionHistory. Note: This function was auto-generated. Any issue please open an issue on GitHub.
https://developers.binance.com/docs/staking/eth-staking/history/Get-ETH-redemption-history
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- async margin_v1_get_eth_staking_eth_history_staking_history(**params)[source]
Placeholder function for GET /sapi/v1/eth-staking/eth/history/stakingHistory. Note: This function was auto-generated. Any issue please open an issue on GitHub.
https://developers.binance.com/docs/staking/eth-staking/history
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- async margin_v1_get_eth_staking_eth_history_wbeth_rewards_history(**params)[source]
Placeholder function for GET /sapi/v1/eth-staking/eth/history/wbethRewardsHistory. Note: This function was auto-generated. Any issue please open an issue on GitHub.
https://developers.binance.com/docs/staking/eth-staking/history/Get-WBETH-rewards-history
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- async margin_v1_get_lending_auto_invest_all_asset(**params)[source]
Placeholder function for GET /sapi/v1/lending/auto-invest/all/asset. Note: This function was auto-generated. Any issue please open an issue on GitHub.
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- async margin_v1_get_lending_auto_invest_history_list(**params)[source]
Placeholder function for GET /sapi/v1/lending/auto-invest/history/list. Note: This function was auto-generated. Any issue please open an issue on GitHub.
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- async margin_v1_get_lending_auto_invest_index_info(**params)[source]
Placeholder function for GET /sapi/v1/lending/auto-invest/index/info. Note: This function was auto-generated. Any issue please open an issue on GitHub.
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- async margin_v1_get_lending_auto_invest_index_user_summary(**params)[source]
Placeholder function for GET /sapi/v1/lending/auto-invest/index/user-summary. Note: This function was auto-generated. Any issue please open an issue on GitHub.
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- async margin_v1_get_lending_auto_invest_one_off_status(**params)[source]
Placeholder function for GET /sapi/v1/lending/auto-invest/one-off/status. Note: This function was auto-generated. Any issue please open an issue on GitHub.
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- async margin_v1_get_lending_auto_invest_plan_id(**params)[source]
Placeholder function for GET /sapi/v1/lending/auto-invest/plan/id. Note: This function was auto-generated. Any issue please open an issue on GitHub.
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- async margin_v1_get_lending_auto_invest_plan_list(**params)[source]
Placeholder function for GET /sapi/v1/lending/auto-invest/plan/list. Note: This function was auto-generated. Any issue please open an issue on GitHub.
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- async margin_v1_get_lending_auto_invest_rebalance_history(**params)[source]
Placeholder function for GET /sapi/v1/lending/auto-invest/rebalance/history. Note: This function was auto-generated. Any issue please open an issue on GitHub.
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- async margin_v1_get_lending_auto_invest_redeem_history(**params)[source]
Placeholder function for GET /sapi/v1/lending/auto-invest/redeem/history. Note: This function was auto-generated. Any issue please open an issue on GitHub.
https://developers.binance.com/docs/wallet/travel-rule/withdraw-history
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- async margin_v1_get_lending_auto_invest_source_asset_list(**params)[source]
Placeholder function for GET /sapi/v1/lending/auto-invest/source-asset/list. Note: This function was auto-generated. Any issue please open an issue on GitHub.
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- async margin_v1_get_lending_auto_invest_target_asset_list(**params)[source]
Placeholder function for GET /sapi/v1/lending/auto-invest/target-asset/list. Note: This function was auto-generated. Any issue please open an issue on GitHub.
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- async margin_v1_get_lending_auto_invest_target_asset_roi_list(**params)[source]
Placeholder function for GET /sapi/v1/lending/auto-invest/target-asset/roi/list. Note: This function was auto-generated. Any issue please open an issue on GitHub.
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- async margin_v1_get_loan_borrow_history(**params)[source]
Placeholder function for GET /sapi/v1/loan/borrow/history. Note: This function was auto-generated. Any issue please open an issue on GitHub.
https://developers.binance.com/docs/crypto_loan/stable-rate/user-information
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- async margin_v1_get_loan_collateral_data(**params)[source]
Placeholder function for GET /sapi/v1/loan/collateral/data. Note: This function was auto-generated. Any issue please open an issue on GitHub.
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- async margin_v1_get_loan_income(**params)[source]
Placeholder function for GET /sapi/v1/loan/income. Note: This function was auto-generated. Any issue please open an issue on GitHub.
https://developers.binance.com/docs/crypto_loan/stable-rate/market-data
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- async margin_v1_get_loan_loanable_data(**params)[source]
Placeholder function for GET /sapi/v1/loan/loanable/data. Note: This function was auto-generated. Any issue please open an issue on GitHub.
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- async margin_v1_get_loan_ltv_adjustment_history(**params)[source]
Placeholder function for GET /sapi/v1/loan/ltv/adjustment/history. Note: This function was auto-generated. Any issue please open an issue on GitHub.
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- async margin_v1_get_loan_ongoing_orders(**params)[source]
Placeholder function for GET /sapi/v1/loan/ongoing/orders. Note: This function was auto-generated. Any issue please open an issue on GitHub.
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- async margin_v1_get_loan_repay_collateral_rate(**params)[source]
Placeholder function for GET /sapi/v1/loan/repay/collateral/rate. Note: This function was auto-generated. Any issue please open an issue on GitHub.
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- async margin_v1_get_loan_repay_history(**params)[source]
Placeholder function for GET /sapi/v1/loan/repay/history. Note: This function was auto-generated. Any issue please open an issue on GitHub.
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- async margin_v1_get_loan_vip_collateral_account(**params)[source]
Placeholder function for GET /sapi/v1/loan/vip/collateral/account. Note: This function was auto-generated. Any issue please open an issue on GitHub.
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- async margin_v1_get_loan_vip_loanable_data(**params)[source]
Placeholder function for GET /sapi/v1/loan/vip/loanable/data. Note: This function was auto-generated. Any issue please open an issue on GitHub.
https://developers.binance.com/docs/vip_loan/market-data/Get-Loanable-Assets-Data
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- async margin_v1_get_loan_vip_ongoing_orders(**params)[source]
Placeholder function for GET /sapi/v1/loan/vip/ongoing/orders. Note: This function was auto-generated. Any issue please open an issue on GitHub.
GET /sapi/v1/loan/vip/ongoing/orders
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- async margin_v1_get_loan_vip_repay_history(**params)[source]
Placeholder function for GET /sapi/v1/loan/vip/repay/history. Note: This function was auto-generated. Any issue please open an issue on GitHub.
https://developers.binance.com/docs/vip_loan/user-information/Get-VIP-Loan-Repayment-History
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- async margin_v1_get_loan_vip_request_interest_rate(**params)[source]
Placeholder function for GET /sapi/v1/loan/vip/request/interestRate. Note: This function was auto-generated. Any issue please open an issue on GitHub.
https://developers.binance.com/docs/vip_loan/market-data
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- async margin_v1_get_localentity_deposit_history(**params)[source]
Placeholder function for GET /sapi/v1/localentity/deposit/history. Note: This function was auto-generated. Any issue please open an issue on GitHub.
https://developers.binance.com/docs/wallet/travel-rule/deposit-history
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- async margin_v1_get_localentity_vasp(**params)[source]
Placeholder function for GET /sapi/v1/localentity/vasp. Note: This function was auto-generated. Any issue please open an issue on GitHub.
https://developers.binance.com/docs/wallet/travel-rule/onboarded-vasp-list
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- async margin_v1_get_localentity_withdraw_history(**params)[source]
Placeholder function for GET /sapi/v1/localentity/withdraw/history. Note: This function was auto-generated. Any issue please open an issue on GitHub.
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- async margin_v1_get_managed_subaccount_account_snapshot(**params)[source]
Placeholder function for GET /sapi/v1/managed-subaccount/accountSnapshot. Note: This function was auto-generated. Any issue please open an issue on GitHub.
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- async margin_v1_get_managed_subaccount_asset(**params)[source]
Placeholder function for GET /sapi/v1/managed-subaccount/asset. Note: This function was auto-generated. Any issue please open an issue on GitHub.
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- async margin_v1_get_managed_subaccount_deposit_address(**params)[source]
Placeholder function for GET /sapi/v1/managed-subaccount/deposit/address. Note: This function was auto-generated. Any issue please open an issue on GitHub.
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- async margin_v1_get_managed_subaccount_fetch_future_asset(**params)[source]
Placeholder function for GET /sapi/v1/managed-subaccount/fetch-future-asset. Note: This function was auto-generated. Any issue please open an issue on GitHub.
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- async margin_v1_get_managed_subaccount_info(**params)[source]
Placeholder function for GET /sapi/v1/managed-subaccount/info. Note: This function was auto-generated. Any issue please open an issue on GitHub.
https://developers.binance.com/docs/sub_account/managed-sub-account/Query-Managed-Sub-account-List
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- async margin_v1_get_managed_subaccount_margin_asset(**params)[source]
Placeholder function for GET /sapi/v1/managed-subaccount/marginAsset. Note: This function was auto-generated. Any issue please open an issue on GitHub.
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- async margin_v1_get_managed_subaccount_query_trans_log(**params)[source]
Placeholder function for GET /sapi/v1/managed-subaccount/query-trans-log. Note: This function was auto-generated. Any issue please open an issue on GitHub.
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- async margin_v1_get_managed_subaccount_query_trans_log_for_investor(**params)[source]
Placeholder function for GET /sapi/v1/managed-subaccount/queryTransLogForInvestor. Note: This function was auto-generated. Any issue please open an issue on GitHub.
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- async margin_v1_get_managed_subaccount_query_trans_log_for_trade_parent(**params)[source]
Placeholder function for GET /sapi/v1/managed-subaccount/queryTransLogForTradeParent. Note: This function was auto-generated. Any issue please open an issue on GitHub.
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- async margin_v1_get_margin_all_order_list(**params)[source]
Placeholder function for GET /sapi/v1/margin/allOrderList. Note: This function was auto-generated. Any issue please open an issue on GitHub.
https://developers.binance.com/docs/margin_trading/trade/Query-Margin-Account-All-OCO
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- async margin_v1_get_margin_available_inventory(**params)[source]
Placeholder function for GET /sapi/v1/margin/available-inventory. Note: This function was auto-generated. Any issue please open an issue on GitHub.
https://developers.binance.com/docs/margin_trading/market-data/Query-margin-avaliable-inventory
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- async margin_v1_get_margin_leverage_bracket(**params)[source]
Placeholder function for GET /sapi/v1/margin/leverageBracket. Note: This function was auto-generated. Any issue please open an issue on GitHub.
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- async margin_v1_get_margin_rate_limit_order(**params)[source]
Placeholder function for GET /sapi/v1/margin/rateLimit/order. Note: This function was auto-generated. Any issue please open an issue on GitHub.
https://developers.binance.com/docs/margin_trading/trade/Query-Current-Margin-Order-Count-Usage
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- async margin_v1_get_margin_trade_coeff(**params)[source]
Placeholder function for GET /sapi/v1/margin/tradeCoeff. Note: This function was auto-generated. Any issue please open an issue on GitHub.
https://developers.binance.com/docs/margin_trading/account/Get-Summary-Of-Margin-Account
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- async margin_v1_get_mining_hash_transfer_config_details_list(**params)[source]
Placeholder function for GET /sapi/v1/mining/hash-transfer/config/details/list. Note: This function was auto-generated. Any issue please open an issue on GitHub.
https://developers.binance.com/docs/mining/rest-api/Hashrate-Resale-List
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- async margin_v1_get_mining_hash_transfer_profit_details(**params)[source]
Placeholder function for GET /sapi/v1/mining/hash-transfer/profit/details. Note: This function was auto-generated. Any issue please open an issue on GitHub.
https://developers.binance.com/docs/mining/rest-api/Hashrate-Resale-Detail
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- async margin_v1_get_mining_payment_list(**params)[source]
Placeholder function for GET /sapi/v1/mining/payment/list. Note: This function was auto-generated. Any issue please open an issue on GitHub.
https://developers.binance.com/docs/mining/rest-api/Earnings-List
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- async margin_v1_get_mining_payment_other(**params)[source]
Placeholder function for GET /sapi/v1/mining/payment/other. Note: This function was auto-generated. Any issue please open an issue on GitHub.
https://developers.binance.com/docs/mining/rest-api/Extra-Bonus-List
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- async margin_v1_get_mining_payment_uid(**params)[source]
Placeholder function for GET /sapi/v1/mining/payment/uid. Note: This function was auto-generated. Any issue please open an issue on GitHub.
https://developers.binance.com/docs/mining/rest-api/Mining-Account-Earning
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- async margin_v1_get_mining_pub_algo_list(**params)[source]
Placeholder function for GET /sapi/v1/mining/pub/algoList. Note: This function was auto-generated. Any issue please open an issue on GitHub.
https://developers.binance.com/docs/mining/rest-api
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- async margin_v1_get_mining_pub_coin_list(**params)[source]
Placeholder function for GET /sapi/v1/mining/pub/coinList. Note: This function was auto-generated. Any issue please open an issue on GitHub.
https://developers.binance.com/docs/mining/rest-api/Acquiring-CoinName
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- async margin_v1_get_mining_statistics_user_list(**params)[source]
Placeholder function for GET /sapi/v1/mining/statistics/user/list. Note: This function was auto-generated. Any issue please open an issue on GitHub.
https://developers.binance.com/docs/mining/rest-api/Account-List
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- async margin_v1_get_mining_statistics_user_status(**params)[source]
Placeholder function for GET /sapi/v1/mining/statistics/user/status. Note: This function was auto-generated. Any issue please open an issue on GitHub.
https://developers.binance.com/docs/mining/rest-api/Statistic-List
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- async margin_v1_get_mining_worker_detail(**params)[source]
Placeholder function for GET /sapi/v1/mining/worker/detail. Note: This function was auto-generated. Any issue please open an issue on GitHub.
https://developers.binance.com/docs/mining/rest-api/Request-for-Detail-Miner-List
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- async margin_v1_get_mining_worker_list(**params)[source]
Placeholder function for GET /sapi/v1/mining/worker/list. Note: This function was auto-generated. Any issue please open an issue on GitHub.
https://developers.binance.com/docs/mining/rest-api/Request-for-Miner-List
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- async margin_v1_get_portfolio_balance(**params)[source]
Placeholder function for GET /sapi/v1/portfolio/balance. Note: This function was auto-generated. Any issue please open an issue on GitHub.
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- async margin_v1_get_simple_earn_flexible_history_redemption_record(**params)[source]
Placeholder function for GET /sapi/v1/simple-earn/flexible/history/redemptionRecord. Note: This function was auto-generated. Any issue please open an issue on GitHub.
https://developers.binance.com/docs/simple_earn/history/Get-Flexible-Redemption-Record
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- async margin_v1_get_simple_earn_flexible_history_subscription_record(**params)[source]
Placeholder function for GET /sapi/v1/simple-earn/flexible/history/subscriptionRecord. Note: This function was auto-generated. Any issue please open an issue on GitHub.
https://developers.binance.com/docs/simple_earn/history
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- async margin_v1_get_simple_earn_locked_history_redemption_record(**params)[source]
Placeholder function for GET /sapi/v1/simple-earn/locked/history/redemptionRecord. Note: This function was auto-generated. Any issue please open an issue on GitHub.
https://developers.binance.com/docs/simple_earn/history/Get-Locked-Redemption-Record
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- async margin_v1_get_simple_earn_locked_history_subscription_record(**params)[source]
Placeholder function for GET /sapi/v1/simple-earn/locked/history/subscriptionRecord. Note: This function was auto-generated. Any issue please open an issue on GitHub.
https://developers.binance.com/docs/simple_earn/history/Get-Locked-Subscription-Record
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- async margin_v1_get_sol_staking_account(**params)[source]
Placeholder function for GET /sapi/v1/sol-staking/account. Note: This function was auto-generated. Any issue please open an issue on GitHub.
https://developers.binance.com/docs/staking/sol-staking/account
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- async margin_v1_get_sol_staking_sol_history_bnsol_rewards_history(**params)[source]
Placeholder function for GET /sapi/v1/sol-staking/sol/history/bnsolRewardsHistory. Note: This function was auto-generated. Any issue please open an issue on GitHub.
https://developers.binance.com/docs/staking/sol-staking/history/Get-BNSOL-rewards-history
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- async margin_v1_get_sol_staking_sol_history_boost_rewards_history(**params)[source]
Placeholder function for GET /sapi/v1/sol-staking/sol/history/boostRewardsHistory. Note: This function was auto-generated. Any issue please open an issue on GitHub.
https://developers.binance.com/docs/staking/sol-staking/history/Get-Boost-rewards-History
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- async margin_v1_get_sol_staking_sol_history_rate_history(**params)[source]
Placeholder function for GET /sapi/v1/sol-staking/sol/history/rateHistory. Note: This function was auto-generated. Any issue please open an issue on GitHub.
https://developers.binance.com/docs/staking/sol-staking/history/Get-BNSOL-Rate-History
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- async margin_v1_get_sol_staking_sol_history_redemption_history(**params)[source]
Placeholder function for GET /sapi/v1/sol-staking/sol/history/redemptionHistory. Note: This function was auto-generated. Any issue please open an issue on GitHub.
https://developers.binance.com/docs/staking/sol-staking/history/Get-SOL-redemption-history
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- async margin_v1_get_sol_staking_sol_history_staking_history(**params)[source]
Placeholder function for GET /sapi/v1/sol-staking/sol/history/stakingHistory. Note: This function was auto-generated. Any issue please open an issue on GitHub.
https://developers.binance.com/docs/staking/sol-staking/history
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- async margin_v1_get_sol_staking_sol_history_unclaimed_rewards(**params)[source]
Placeholder function for GET /sapi/v1/sol-staking/sol/history/unclaimedRewards. Note: This function was auto-generated. Any issue please open an issue on GitHub.
https://developers.binance.com/docs/staking/sol-staking/history/Get-Unclaimed-rewards
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- async margin_v1_get_sol_staking_sol_quota(**params)[source]
Placeholder function for GET /sapi/v1/sol-staking/sol/quota. Note: This function was auto-generated. Any issue please open an issue on GitHub.
https://developers.binance.com/docs/staking/sol-staking/account/Get-SOL-staking-quota-details
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- async margin_v1_get_spot_delist_schedule(**params)[source]
Placeholder function for GET /sapi/v1/spot/delist-schedule. Note: This function was auto-generated. Any issue please open an issue on GitHub.
https://developers.binance.com/docs/wallet/asset/spot-delist-schedule
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- async margin_v1_get_staking_staking_record(**params)[source]
Placeholder function for GET /sapi/v1/staking/stakingRecord. Note: This function was auto-generated. Any issue please open an issue on GitHub.
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- async margin_v1_get_sub_account_sub_account_api_ip_restriction(**params)[source]
Placeholder function for GET /sapi/v1/sub-account/subAccountApi/ipRestriction. Note: This function was auto-generated. Any issue please open an issue on GitHub.
https://developers.binance.com/docs/sub_account/api-management
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- async margin_v1_get_sub_account_transaction_statistics(**params)[source]
Placeholder function for GET /sapi/v1/sub-account/transaction-statistics. Note: This function was auto-generated. Any issue please open an issue on GitHub.
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- async margin_v1_post_account_api_restrictions_ip_restriction(**params)[source]
Placeholder function for POST /sapi/v1/account/apiRestrictions/ipRestriction. Note: This function was auto-generated. Any issue please open an issue on GitHub.
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- async margin_v1_post_account_api_restrictions_ip_restriction_ip_list(**params)[source]
Placeholder function for POST /sapi/v1/account/apiRestrictions/ipRestriction/ipList. Note: This function was auto-generated. Any issue please open an issue on GitHub.
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- async margin_v1_post_account_disable_fast_withdraw_switch(**params)[source]
Placeholder function for POST /sapi/v1/account/disableFastWithdrawSwitch. Note: This function was auto-generated. Any issue please open an issue on GitHub.
https://developers.binance.com/docs/wallet/account/disable-fast-withdraw-switch
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- async margin_v1_post_account_enable_fast_withdraw_switch(**params)[source]
Placeholder function for POST /sapi/v1/account/enableFastWithdrawSwitch. Note: This function was auto-generated. Any issue please open an issue on GitHub.
https://developers.binance.com/docs/wallet/account/enable-fast-withdraw-switch
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- async margin_v1_post_algo_futures_new_order_twap(**params)[source]
Placeholder function for POST /sapi/v1/algo/futures/newOrderTwap. Note: This function was auto-generated. Any issue please open an issue on GitHub.
https://developers.binance.com/docs/algo/future-algo/Time-Weighted-Average-Price-New-Order
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- async margin_v1_post_algo_futures_new_order_vp(**params)[source]
Placeholder function for POST /sapi/v1/algo/futures/newOrderVp. Note: This function was auto-generated. Any issue please open an issue on GitHub.
https://developers.binance.com/docs/algo/future-algo
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- async margin_v1_post_algo_spot_new_order_twap(**params)[source]
Placeholder function for POST /sapi/v1/algo/spot/newOrderTwap. Note: This function was auto-generated. Any issue please open an issue on GitHub.
https://developers.binance.com/docs/algo/spot-algo/Time-Weighted-Average-Price-New-Order
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- async margin_v1_post_asset_convert_transfer(**params)[source]
Placeholder function for POST /sapi/v1/asset/convert-transfer. Note: This function was auto-generated. Any issue please open an issue on GitHub.
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- async margin_v1_post_asset_convert_transfer_query_by_page(**params)[source]
Placeholder function for POST /sapi/v1/asset/convert-transfer/queryByPage. Note: This function was auto-generated. Any issue please open an issue on GitHub.
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- async margin_v1_post_broker_sub_account(**params)[source]
Placeholder function for POST /sapi/v1/broker/subAccount. Note: This function was auto-generated. Any issue please open an issue on GitHub.
https://developers.binance.com/docs/binance_link/exchange-link/account
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- async margin_v1_post_broker_sub_account_api(**params)[source]
Placeholder function for POST /sapi/v1/broker/subAccountApi. Note: This function was auto-generated. Any issue please open an issue on GitHub.
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- async margin_v1_post_broker_sub_account_api_commission(**params)[source]
Placeholder function for POST /sapi/v1/broker/subAccountApi/commission. Note: This function was auto-generated. Any issue please open an issue on GitHub.
https://developers.binance.com/docs/binance_link/exchange-link/fee
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- async margin_v1_post_broker_sub_account_api_commission_coin_futures(**params)[source]
Placeholder function for POST /sapi/v1/broker/subAccountApi/commission/coinFutures. Note: This function was auto-generated. Any issue please open an issue on GitHub.
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- async margin_v1_post_broker_sub_account_api_commission_futures(**params)[source]
Placeholder function for POST /sapi/v1/broker/subAccountApi/commission/futures. Note: This function was auto-generated. Any issue please open an issue on GitHub.
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- async margin_v1_post_broker_sub_account_api_ip_restriction(**params)[source]
Placeholder function for POST /sapi/v1/broker/subAccountApi/ipRestriction. Note: This function was auto-generated. Any issue please open an issue on GitHub.
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- async margin_v1_post_broker_sub_account_api_ip_restriction_ip_list(**params)[source]
Placeholder function for POST /sapi/v1/broker/subAccountApi/ipRestriction/ipList. Note: This function was auto-generated. Any issue please open an issue on GitHub.
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- async margin_v1_post_broker_sub_account_api_permission(**params)[source]
Placeholder function for POST /sapi/v1/broker/subAccountApi/permission. Note: This function was auto-generated. Any issue please open an issue on GitHub.
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- async margin_v1_post_broker_sub_account_api_permission_universal_transfer(**params)[source]
Placeholder function for POST /sapi/v1/broker/subAccountApi/permission/universalTransfer. Note: This function was auto-generated. Any issue please open an issue on GitHub.
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- async margin_v1_post_broker_sub_account_api_permission_vanilla_options(**params)[source]
Placeholder function for POST /sapi/v1/broker/subAccountApi/permission/vanillaOptions. Note: This function was auto-generated. Any issue please open an issue on GitHub.
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- async margin_v1_post_broker_sub_account_blvt(**params)[source]
Placeholder function for POST /sapi/v1/broker/subAccount/blvt. Note: This function was auto-generated. Any issue please open an issue on GitHub.
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- async margin_v1_post_broker_sub_account_bnb_burn_margin_interest(**params)[source]
Placeholder function for POST /sapi/v1/broker/subAccount/bnbBurn/marginInterest. Note: This function was auto-generated. Any issue please open an issue on GitHub.
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- async margin_v1_post_broker_sub_account_bnb_burn_spot(**params)[source]
Placeholder function for POST /sapi/v1/broker/subAccount/bnbBurn/spot. Note: This function was auto-generated. Any issue please open an issue on GitHub.
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- async margin_v1_post_broker_transfer(**params)[source]
Placeholder function for POST /sapi/v1/broker/transfer. Note: This function was auto-generated. Any issue please open an issue on GitHub.
https://developers.binance.com/docs/binance_link/exchange-link/asset
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- async margin_v1_post_broker_transfer_futures(**params)[source]
Placeholder function for POST /sapi/v1/broker/transfer/futures. Note: This function was auto-generated. Any issue please open an issue on GitHub.
https://developers.binance.com/docs/binance_link/exchange-link/asset/Sub-Account-Transfer-Futures
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- async margin_v1_post_broker_universal_transfer(**params)[source]
Placeholder function for POST /sapi/v1/broker/universalTransfer. Note: This function was auto-generated. Any issue please open an issue on GitHub.
https://developers.binance.com/docs/binance_link/exchange-link/asset/Universal-Transfer
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- async margin_v1_post_capital_contract_convertible_coins(**params)[source]
Placeholder function for POST /sapi/v1/capital/contract/convertible-coins. Note: This function was auto-generated. Any issue please open an issue on GitHub.
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- async margin_v1_post_capital_deposit_credit_apply(**params)[source]
Placeholder function for POST /sapi/v1/capital/deposit/credit-apply. Note: This function was auto-generated. Any issue please open an issue on GitHub.
https://developers.binance.com/docs/wallet/capital/one-click-arrival-deposite-apply
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- async margin_v1_post_convert_limit_cancel_order(**params)[source]
Placeholder function for POST /sapi/v1/convert/limit/cancelOrder. Note: This function was auto-generated. Any issue please open an issue on GitHub.
https://developers.binance.com/docs/convert/trade/Cancel-Order
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- async margin_v1_post_convert_limit_place_order(**params)[source]
Placeholder function for POST /sapi/v1/convert/limit/placeOrder. Note: This function was auto-generated. Any issue please open an issue on GitHub.
https://developers.binance.com/docs/convert/trade/Place-Order
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- async margin_v1_post_dci_product_auto_compound_edit_status(**params)[source]
Placeholder function for POST /sapi/v1/dci/product/auto_compound/edit-status. Note: This function was auto-generated. Any issue please open an issue on GitHub.
https://developers.binance.com/docs/dual_investment/trade/Change-Auto-Compound-status
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- async margin_v1_post_dci_product_subscribe(**params)[source]
Placeholder function for POST /sapi/v1/dci/product/subscribe. Note: This function was auto-generated. Any issue please open an issue on GitHub.
https://developers.binance.com/docs/dual_investment/trade
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- async margin_v1_post_eth_staking_eth_redeem(**params)[source]
Placeholder function for POST /sapi/v1/eth-staking/eth/redeem. Note: This function was auto-generated. Any issue please open an issue on GitHub.
https://developers.binance.com/docs/staking/eth-staking/staking/Redeem-ETH
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- async margin_v1_post_eth_staking_wbeth_unwrap(**params)[source]
Placeholder function for POST /sapi/v1/eth-staking/wbeth/unwrap. Note: This function was auto-generated. Any issue please open an issue on GitHub.
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- async margin_v1_post_eth_staking_wbeth_wrap(**params)[source]
Placeholder function for POST /sapi/v1/eth-staking/wbeth/wrap. Note: This function was auto-generated. Any issue please open an issue on GitHub.
https://developers.binance.com/docs/staking/eth-staking/staking/Wrap-BETH
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- async margin_v1_post_lending_auto_invest_one_off(**params)[source]
Placeholder function for POST /sapi/v1/lending/auto-invest/one-off. Note: This function was auto-generated. Any issue please open an issue on GitHub.
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- async margin_v1_post_lending_auto_invest_plan_add(**params)[source]
Placeholder function for POST /sapi/v1/lending/auto-invest/plan/add. Note: This function was auto-generated. Any issue please open an issue on GitHub.
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- async margin_v1_post_lending_auto_invest_plan_edit_status(**params)[source]
Placeholder function for POST /sapi/v1/lending/auto-invest/plan/edit-status. Note: This function was auto-generated. Any issue please open an issue on GitHub.
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- async margin_v1_post_lending_auto_invest_redeem(**params)[source]
Placeholder function for POST /sapi/v1/lending/auto-invest/redeem. Note: This function was auto-generated. Any issue please open an issue on GitHub.
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- async margin_v1_post_lending_customized_fixed_purchase(**params)[source]
Placeholder function for POST /sapi/v1/lending/customizedFixed/purchase. Note: This function was auto-generated. Any issue please open an issue on GitHub.
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- async margin_v1_post_lending_daily_purchase(**params)[source]
Placeholder function for POST /sapi/v1/lending/daily/purchase. Note: This function was auto-generated. Any issue please open an issue on GitHub.
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- async margin_v1_post_lending_daily_redeem(**params)[source]
Placeholder function for POST /sapi/v1/lending/daily/redeem. Note: This function was auto-generated. Any issue please open an issue on GitHub.
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- async margin_v1_post_loan_adjust_ltv(**params)[source]
Placeholder function for POST /sapi/v1/loan/adjust/ltv. Note: This function was auto-generated. Any issue please open an issue on GitHub.
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- async margin_v1_post_loan_borrow(**params)[source]
Placeholder function for POST /sapi/v1/loan/borrow. Note: This function was auto-generated. Any issue please open an issue on GitHub.
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- async margin_v1_post_loan_customize_margin_call(**params)[source]
Placeholder function for POST /sapi/v1/loan/customize/margin_call. Note: This function was auto-generated. Any issue please open an issue on GitHub.
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- async margin_v1_post_loan_flexible_repay_history(**params)[source]
Placeholder function for POST /sapi/v1/loan/flexible/repay/history. Note: This function was auto-generated. Any issue please open an issue on GitHub.
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- async margin_v1_post_loan_repay(**params)[source]
Placeholder function for POST /sapi/v1/loan/repay. Note: This function was auto-generated. Any issue please open an issue on GitHub.
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- async margin_v1_post_loan_vip_borrow(**params)[source]
Placeholder function for POST /sapi/v1/loan/vip/borrow. Note: This function was auto-generated. Any issue please open an issue on GitHub.
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- async margin_v1_post_loan_vip_renew(**params)[source]
Placeholder function for POST /sapi/v1/loan/vip/renew. Note: This function was auto-generated. Any issue please open an issue on GitHub.
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- async margin_v1_post_loan_vip_repay(**params)[source]
Placeholder function for POST /sapi/v1/loan/vip/repay. Note: This function was auto-generated. Any issue please open an issue on GitHub.
https://developers.binance.com/docs/vip_loan/trade/VIP-Loan-Repay
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- async margin_v1_post_localentity_withdraw_apply(**params)[source]
Placeholder function for POST /sapi/v1/localentity/withdraw/apply. Note: This function was auto-generated. Any issue please open an issue on GitHub.
https://developers.binance.com/docs/wallet/travel-rule/withdraw
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- async margin_v1_post_managed_subaccount_deposit(**params)[source]
Placeholder function for POST /sapi/v1/managed-subaccount/deposit. Note: This function was auto-generated. Any issue please open an issue on GitHub.
https://developers.binance.com/docs/sub_account/managed-sub-account
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- async margin_v1_post_managed_subaccount_withdraw(**params)[source]
Placeholder function for POST /sapi/v1/managed-subaccount/withdraw. Note: This function was auto-generated. Any issue please open an issue on GitHub.
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- async margin_v1_post_mining_hash_transfer_config(**params)[source]
Placeholder function for POST /sapi/v1/mining/hash-transfer/config. Note: This function was auto-generated. Any issue please open an issue on GitHub.
https://developers.binance.com/docs/mining/rest-api/Hashrate-Resale-Request
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- async margin_v1_post_mining_hash_transfer_config_cancel(**params)[source]
Placeholder function for POST /sapi/v1/mining/hash-transfer/config/cancel. Note: This function was auto-generated. Any issue please open an issue on GitHub.
https://developers.binance.com/docs/mining/rest-api/Cancel-hashrate-resale-configuration
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- async margin_v1_post_portfolio_mint(**params)[source]
Placeholder function for POST /sapi/v1/portfolio/mint. Note: This function was auto-generated. Any issue please open an issue on GitHub.
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- async margin_v1_post_portfolio_redeem(**params)[source]
Placeholder function for POST /sapi/v1/portfolio/redeem. Note: This function was auto-generated. Any issue please open an issue on GitHub.
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- async margin_v1_post_portfolio_repay_futures_switch(**params)[source]
Placeholder function for POST /sapi/v1/portfolio/repay-futures-switch. Note: This function was auto-generated. Any issue please open an issue on GitHub.
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- async margin_v1_post_simple_earn_locked_set_redeem_option(**params)[source]
Placeholder function for POST /sapi/v1/simple-earn/locked/setRedeemOption. Note: This function was auto-generated. Any issue please open an issue on GitHub.
https://developers.binance.com/docs/simple_earn/earn/Set-Locked-Redeem-Option
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- async margin_v1_post_sol_staking_sol_claim(**params)[source]
Placeholder function for POST /sapi/v1/sol-staking/sol/claim. Note: This function was auto-generated. Any issue please open an issue on GitHub.
https://developers.binance.com/docs/staking/sol-staking/staking/Claim-Boost-rewards
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- async margin_v1_post_sol_staking_sol_redeem(**params)[source]
Placeholder function for POST /sapi/v1/sol-staking/sol/redeem. Note: This function was auto-generated. Any issue please open an issue on GitHub.
https://developers.binance.com/docs/staking/sol-staking/staking/Redeem-SOL
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- async margin_v1_post_sol_staking_sol_stake(**params)[source]
Placeholder function for POST /sapi/v1/sol-staking/sol/stake. Note: This function was auto-generated. Any issue please open an issue on GitHub.
https://developers.binance.com/docs/staking/sol-staking/staking
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- async margin_v1_post_sub_account_blvt_enable(**params)[source]
Placeholder function for POST /sapi/v1/sub-account/blvt/enable. Note: This function was auto-generated. Any issue please open an issue on GitHub.
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- async margin_v1_post_sub_account_eoptions_enable(**params)[source]
Placeholder function for POST /sapi/v1/sub-account/eoptions/enable. Note: This function was auto-generated. Any issue please open an issue on GitHub.
https://developers.binance.com/docs/sub_account/account-management/Enable-Options-for-Sub-account
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- async margin_v1_post_sub_account_sub_account_api_ip_restriction(**params)[source]
Placeholder function for POST /sapi/v1/sub-account/subAccountApi/ipRestriction. Note: This function was auto-generated. Any issue please open an issue on GitHub.
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- async margin_v1_post_sub_account_sub_account_api_ip_restriction_ip_list(**params)[source]
Placeholder function for POST /sapi/v1/sub-account/subAccountApi/ipRestriction/ipList. Note: This function was auto-generated. Any issue please open an issue on GitHub.
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- async margin_v1_post_sub_account_virtual_sub_account(**params)[source]
Placeholder function for POST /sapi/v1/sub-account/virtualSubAccount. Note: This function was auto-generated. Any issue please open an issue on GitHub.
https://developers.binance.com/docs/sub_account/account-management
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- async margin_v1_put_localentity_deposit_provide_info(**params)[source]
Placeholder function for PUT /sapi/v1/localentity/deposit/provide-info. Note: This function was auto-generated. Any issue please open an issue on GitHub.
https://developers.binance.com/docs/wallet/travel-rule/deposit-provide-info
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- async margin_v2_get_broker_sub_account_futures_summary(**params)[source]
Placeholder function for GET /sapi/v2/broker/subAccount/futuresSummary. Note: This function was auto-generated. Any issue please open an issue on GitHub.
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- async margin_v2_get_eth_staking_account(**params)[source]
Placeholder function for GET /sapi/v2/eth-staking/account. Note: This function was auto-generated. Any issue please open an issue on GitHub.
https://developers.binance.com/docs/staking/eth-staking/account
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- async margin_v2_get_loan_flexible_borrow_history(**params)[source]
Placeholder function for GET /sapi/v2/loan/flexible/borrow/history. Note: This function was auto-generated. Any issue please open an issue on GitHub.
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- async margin_v2_get_loan_flexible_collateral_data(**params)[source]
Placeholder function for GET /sapi/v2/loan/flexible/collateral/data. Note: This function was auto-generated. Any issue please open an issue on GitHub.
https://developers.binance.com/docs/crypto_loan/flexible-rate/market-data
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- async margin_v2_get_loan_flexible_loanable_data(**params)[source]
Placeholder function for GET /sapi/v2/loan/flexible/loanable/data. Note: This function was auto-generated. Any issue please open an issue on GitHub.
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- async margin_v2_get_loan_flexible_ltv_adjustment_history(**params)[source]
Placeholder function for GET /sapi/v2/loan/flexible/ltv/adjustment/history. Note: This function was auto-generated. Any issue please open an issue on GitHub.
https://developers.binance.com/docs/crypto_loan/flexible-rate/user-information
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- async margin_v2_get_loan_flexible_ongoing_orders(**params)[source]
Placeholder function for GET /sapi/v2/loan/flexible/ongoing/orders. Note: This function was auto-generated. Any issue please open an issue on GitHub.
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- async margin_v2_get_loan_flexible_repay_history(**params)[source]
Placeholder function for GET /sapi/v2/loan/flexible/repay/history. Note: This function was auto-generated. Any issue please open an issue on GitHub.
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- async margin_v2_get_loan_flexible_repay_rate(**params)[source]
Placeholder function for GET /sapi/v2/loan/flexible/repay/rate. Note: This function was auto-generated. Any issue please open an issue on GitHub.
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- async margin_v2_get_localentity_withdraw_history(**params)[source]
Placeholder function for GET /sapi/v2/localentity/withdraw/history. Note: This function was auto-generated. Any issue please open an issue on GitHub.
https://developers.binance.com/docs/wallet/travel-rule/withdraw-history-v2
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- async margin_v2_get_portfolio_account(**params)[source]
Placeholder function for GET /sapi/v2/portfolio/account. Note: This function was auto-generated. Any issue please open an issue on GitHub.
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- async margin_v2_get_portfolio_collateral_rate(**params)[source]
Placeholder function for GET /sapi/v2/portfolio/collateralRate. Note: This function was auto-generated. Any issue please open an issue on GitHub.
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- async margin_v2_post_broker_sub_account_api_ip_restriction(**params)[source]
Placeholder function for POST /sapi/v2/broker/subAccountApi/ipRestriction. Note: This function was auto-generated. Any issue please open an issue on GitHub.
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- async margin_v2_post_eth_staking_eth_stake(**params)[source]
Placeholder function for POST /sapi/v2/eth-staking/eth/stake. Note: This function was auto-generated. Any issue please open an issue on GitHub.
https://developers.binance.com/docs/staking/eth-staking/staking
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- async margin_v2_post_loan_flexible_adjust_ltv(**params)[source]
Placeholder function for POST /sapi/v2/loan/flexible/adjust/ltv. Note: This function was auto-generated. Any issue please open an issue on GitHub.
https://developers.binance.com/docs/crypto_loan/flexible-rate/trade/Flexible-Loan-Adjust-LTV
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- async margin_v2_post_loan_flexible_borrow(**params)[source]
Placeholder function for POST /sapi/v2/loan/flexible/borrow. Note: This function was auto-generated. Any issue please open an issue on GitHub.
https://developers.binance.com/docs/crypto_loan/flexible-rate/trade
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- async margin_v2_post_loan_flexible_repay(**params)[source]
Placeholder function for POST /sapi/v2/loan/flexible/repay. Note: This function was auto-generated. Any issue please open an issue on GitHub.
https://developers.binance.com/docs/crypto_loan/flexible-rate/trade/Flexible-Loan-Repay
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- async margin_v2_post_sub_account_sub_account_api_ip_restriction(**params)[source]
Placeholder function for POST /sapi/v2/sub-account/subAccountApi/ipRestriction. Note: This function was auto-generated. Any issue please open an issue on GitHub.
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- async margin_v3_get_broker_sub_account_futures_summary(**params)[source]
Placeholder function for GET /sapi/v3/broker/subAccount/futuresSummary. Note: This function was auto-generated. Any issue please open an issue on GitHub.
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- async new_transfer_history(**params)[source]
Get future account transaction history list
https://developers.binance.com/docs/wallet/asset/query-user-universal-transfer
- async options_accept_block_trade_order(**params)[source]
Accept Block Trade Order (TRADE)
Accept a block trade order.
- Parameters:
blockOrderMatchingKey (str) – required - Block Order Matching Key
recvWindow (int) – optional - The value cannot be greater than 60000
- Returns:
API response
- Raises:
BinanceRequestException, BinanceAPIException
- async options_account_get_block_trades(**params)[source]
Account Block Trade List (USER_DATA)
Gets block trades for a specific account.
- Parameters:
endTime (int) – optional
startTime (int) – optional
underlying (str) – optional
recvWindow (int) – optional - The value cannot be greater than 60000
- Returns:
API response
- Raises:
BinanceRequestException, BinanceAPIException
- async options_account_info(**params)[source]
Account asset info (USER_DATA)
https://developers.binance.com/docs/derivatives/option/account
- Parameters:
recvWindow (int) – optional
- async options_bill(**params)[source]
Account funding flow (USER_DATA)
https://binance-docs.github.io/apidocs/voptions/en/#account-funding-flow-user_data
- Parameters:
currency (str) – required - Asset type - USDT
recordId (int) – optional - Return the recordId and subsequent data, the latest data is returned by default - 100000
startTime (int) – optional - Start Time - 1593511200000
endTime (int) – optional - End Time - 1593511200000
limit (int) – optional - Number of result sets returned Default:100 Max:1000 - 100
recvWindow (int) – optional
- async options_cancel_all_orders(**params)[source]
Cancel all Option orders (TRADE)
- Parameters:
symbol (str) – required - Option trading pair - BTC-200730-9000-C
recvWindow (int) – optional
- async options_cancel_batch_order(**params)[source]
Cancel Multiple Option orders (TRADE)
https://developers.binance.com/docs/derivatives/option/trade/Cancel-Multiple-Option-Orders
- Parameters:
symbol (str) – required - Option trading pair - BTC-200730-9000-C
orderIds – optional - Order ID - [4611875134427365377,4611875134427365378]
clientOrderIds (list) – optional - User-defined order ID - [“my_id_1”,”my_id_2”]
recvWindow (int) – optional
- async options_cancel_block_trade_order(**params)[source]
Cancel Block Trade Order (TRADE)
- Parameters:
blockOrderMatchingKey (str) – required - Block Order Matching Key
recvWindow (int) – optional - The value cannot be greater than 60000
- Returns:
API response
- Raises:
BinanceRequestException, BinanceAPIException
- async options_cancel_order(**params)[source]
Cancel Option order (TRADE)
https://developers.binance.com/docs/derivatives/option/trade/Cancel-Option-Order
- Parameters:
symbol (str) – required - Option trading pair - BTC-200730-9000-C
orderId (str) – optional - Order ID - 4611875134427365377
clientOrderId (str) – optional - User-defined order ID - 10000
recvWindow (int) – optional
- async options_create_block_trade_order(**params)[source]
New Block Trade Order (TRADE)
https://developers.binance.com/docs/derivatives/option/market-maker-block-trade
- Parameters:
liquidity (str) – required - Taker or Maker
symbol (str) – required - Option trading pair, e.g BTC-200730-9000-C
side (str) – required - BUY or SELL
price (float) – required - Order Price
quantity (float) – required - Order Quantity
recvWindow (int) – optional - The value cannot be greater than 60000
- Returns:
API response
- Raises:
BinanceRequestException, BinanceAPIException
- async options_exchange_info()[source]
Get current limit info and trading pair info
https://developers.binance.com/docs/derivatives/option/market-data/Exchange-Information
- async options_extend_block_trade_order(**params)[source]
Extend Block Trade Order (TRADE)
Extends a block trade expire time by 30 mins from the current time.
- Parameters:
blockOrderMatchingKey (str) – required - Block Order Matching Key
recvWindow (int) – optional - The value cannot be greater than 60000
- Returns:
API response
- Raises:
BinanceRequestException, BinanceAPIException
- async options_funds_transfer(**params)[source]
Funds transfer (USER_DATA)
https://binance-docs.github.io/apidocs/voptions/en/#funds-transfer-user_data
- Parameters:
currency (str) – required - Asset type - USDT
type (str (ENUM)) – required - IN: Transfer from spot account to option account OUT: Transfer from option account to spot account - IN
amount (float) – required - Amount - 10000
recvWindow (int) – optional
- async options_get_block_trade_order(**params)[source]
Query Block Trade Details (USER_DATA)
Query block trade details; returns block trade details from counterparty’s perspective.
- Parameters:
blockOrderMatchingKey (str) – required - Block Order Matching Key
recvWindow (int) – optional - The value cannot be greater than 60000
- Returns:
API response
- Raises:
BinanceRequestException, BinanceAPIException
- async options_get_block_trade_orders(**params)[source]
Query Block Trade Order (TRADE)
Check block trade order status.
- Parameters:
blockOrderMatchingKey (str) – optional - Returns specific block trade for this key
endTime (int) – optional
startTime (int) – optional
underlying (str) – optional
recvWindow (int) – optional - The value cannot be greater than 60000
- Returns:
API response
- Raises:
BinanceRequestException, BinanceAPIException
- async options_historical_trades(**params)[source]
Query trade history
https://developers.binance.com/docs/derivatives/option/market-data/Old-Trades-Lookup
- Parameters:
symbol (str) – required - Option trading pair - BTC-200730-9000-C
fromId (int) – optional - The deal ID from which to return. The latest deal record is returned by default - 1592317127349
limit (int) – optional - Number of records Default:100 Max:500 - 100
- async options_index_price(**params)[source]
Get the spot index price
https://developers.binance.com/docs/derivatives/option/market-data/Symbol-Price-Ticker
- Parameters:
underlying (str) – required - Spot pair(Option contract underlying asset)- BTCUSDT
- async options_info()[source]
Get current trading pair info
https://binance-docs.github.io/apidocs/voptions/en/#get-current-trading-pair-info
- async options_klines(**params)[source]
Candle data
https://developers.binance.com/docs/derivatives/option/market-data/Kline-Candlestick-Data
- Parameters:
symbol (str) – required - Option trading pair - BTC-200730-9000-C
interval (str) – required - Time interval - 5m
startTime (int) – optional - Start Time - 1592317127349
endTime (int) – optional - End Time - 1592317127349
limit (int) – optional - Number of records Default:500 Max:1500 - 500
- async options_mark_price(**params)[source]
Get the latest mark price
https://developers.binance.com/docs/derivatives/option/market-data/Option-Mark-Price
- Parameters:
symbol (str) – optional - Option trading pair - BTC-200730-9000-C
- async options_order_book(**params)[source]
Depth information
https://developers.binance.com/docs/derivatives/option/market-data/Order-Book
- Parameters:
symbol (str) – required - Option trading pair - BTC-200730-9000-C
limit (int) – optional - Default:100 Max:1000.Optional value:[10, 20, 50, 100, 500, 1000] - 100
- async options_ping()[source]
Test connectivity
https://developers.binance.com/docs/derivatives/option/market-data/Test-Connectivity
- async options_place_batch_order(**params)[source]
Place Multiple Option orders (TRADE)
https://developers.binance.com/docs/derivatives/option/trade/Place-Multiple-Orders
- Parameters:
orders (list) – required - order list. Max 5 orders - [{“symbol”:”BTC-210115-35000-C”,”price”:”100”,”quantity”:”0.0001”,”side”:”BUY”,”type”:”LIMIT”}]
recvWindow (int) – optional
- async options_place_order(**params)[source]
Option order (TRADE)
https://developers.binance.com/docs/derivatives/option/trade
- Parameters:
symbol (str) – required - Option trading pair - BTC-200730-9000-C
side (str (ENUM)) – required - Buy/sell direction: SELL, BUY - BUY
type (str (ENUM)) – required - Order Type: LIMIT, MARKET - LIMIT
quantity (float) – required - Order Quantity - 3
price (float) – optional - Order Price - 1000
timeInForce (str (ENUM)) – optional - Time in force method(Default GTC) - GTC
reduceOnly (bool) – optional - Reduce Only (Default false) - false
postOnly (bool) – optional - Post Only (Default false) - false
newOrderRespType (str (ENUM)) – optional - “ACK”, “RESULT”, Default “ACK” - ACK
clientOrderId (str) – optional - User-defined order ID cannot be repeated in pending orders - 10000
recvWindow (int) – optional
- async options_positions(**params)[source]
Option holdings info (USER_DATA)
https://developers.binance.com/docs/derivatives/option/trade/Option-Position-Information
- Parameters:
symbol (str) – optional - Option trading pair - BTC-200730-9000-C
recvWindow (int) – optional
- async options_price(**params)[source]
Get the latest price
- Parameters:
symbol (str) – optional - Option trading pair - BTC-200730-9000-C
- async options_query_order(**params)[source]
Query Option order (TRADE)
https://developers.binance.com/docs/derivatives/option/trade/Query-Single-Order
- Parameters:
symbol (str) – required - Option trading pair - BTC-200730-9000-C
orderId (str) – optional - Order ID - 4611875134427365377
clientOrderId (str) – optional - User-defined order ID - 10000
recvWindow (int) – optional
- async options_query_order_history(**params)[source]
Query Option order history (TRADE)
https://developers.binance.com/docs/derivatives/option/trade/Query-Option-Order-History
- Parameters:
symbol (str) – required - Option trading pair - BTC-200730-9000-C
orderId (str) – optional - Returns the orderId and subsequent orders, the most recent order is returned by default - 100000
startTime (int) – optional - Start Time - 1593511200000
endTime (int) – optional - End Time - 1593511200000
limit (int) – optional - Number of result sets returned Default:100 Max:1000 - 100
recvWindow (int) – optional
- async options_query_pending_orders(**params)[source]
Query current pending Option orders (TRADE)
https://developers.binance.com/docs/derivatives/option/trade/Query-Current-Open-Option-Orders
- Parameters:
symbol (str) – required - Option trading pair - BTC-200730-9000-C
orderId (str) – optional - Returns the orderId and subsequent orders, the most recent order is returned by default - 100000
startTime (int) – optional - Start Time - 1593511200000
endTime (int) – optional - End Time - 1593511200000
limit (int) – optional - Number of result sets returned Default:100 Max:1000 - 100
recvWindow (int) – optional
- async options_recent_trades(**params)[source]
Recently completed Option trades
https://developers.binance.com/docs/derivatives/option/market-data/Recent-Trades-List
- Parameters:
symbol (str) – required - Option trading pair - BTC-200730-9000-C
limit (int) – optional - Number of records Default:100 Max:500 - 100
- async options_time()[source]
Get server time
https://developers.binance.com/docs/derivatives/option/market-data
- async options_user_trades(**params)[source]
Option Trade List (USER_DATA)
https://developers.binance.com/docs/derivatives/option/trade/Account-Trade-List
- Parameters:
symbol (str) – required - Option trading pair - BTC-200730-9000-C
fromId (int) – optional - Trade id to fetch from. Default gets most recent trades. - 4611875134427365376
startTime (int) – optional - Start Time - 1593511200000
endTime (int) – optional - End Time - 1593511200000
limit (int) – optional - Number of result sets returned Default:100 Max:1000 - 100
recvWindow (int) – optional
- async options_v1_delete_all_open_orders_by_underlying(**params)[source]
Placeholder function for DELETE /eapi/v1/allOpenOrdersByUnderlying. Note: This function was auto-generated. Any issue please open an issue on GitHub.
https://developers.binance.com/docs/derivatives/option/trade/Cancel-All-Option-Orders-By-Underlying
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- async options_v1_get_block_trades(**params)[source]
Placeholder function for GET /eapi/v1/blockTrades. Note: This function was auto-generated. Any issue please open an issue on GitHub.
https://developers.binance.com/docs/derivatives/option/market-data/Recent-Block-Trade-List
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- async options_v1_get_countdown_cancel_all(**params)[source]
Placeholder function for GET /eapi/v1/countdownCancelAll. Note: This function was auto-generated. Any issue please open an issue on GitHub.
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- async options_v1_get_exercise_history(**params)[source]
Placeholder function for GET /eapi/v1/exerciseHistory. Note: This function was auto-generated. Any issue please open an issue on GitHub.
https://developers.binance.com/docs/derivatives/option/market-data/Historical-Exercise-Records
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- async options_v1_get_income_asyn(**params)[source]
Placeholder function for GET /eapi/v1/income/asyn. Note: This function was auto-generated. Any issue please open an issue on GitHub.
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- async options_v1_get_income_asyn_id(**params)[source]
Placeholder function for GET /eapi/v1/income/asyn/id. Note: This function was auto-generated. Any issue please open an issue on GitHub.
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- async options_v1_get_margin_account(**params)[source]
Placeholder function for GET /eapi/v1/marginAccount. Note: This function was auto-generated. Any issue please open an issue on GitHub.
https://developers.binance.com/docs/derivatives/option/market-maker-endpoints
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- async options_v1_post_countdown_cancel_all(**params)[source]
Placeholder function for POST /eapi/v1/countdownCancelAll. Note: This function was auto-generated. Any issue please open an issue on GitHub.
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- async options_v1_post_countdown_cancel_all_heart_beat(**params)[source]
Placeholder function for POST /eapi/v1/countdownCancelAllHeartBeat. Note: This function was auto-generated. Any issue please open an issue on GitHub.
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- async order_limit(timeInForce='GTC', **params)[source]
Send in a new limit order
https://developers.binance.com/docs/binance-spot-api-docs/rest-api/trading-endpoints#new-order-trade
Any order with an icebergQty MUST have timeInForce set to GTC.
- Parameters:
symbol (str) – required
side (str) – required
quantity (decimal) – required
price (str) – required
timeInForce (str) – default Good till cancelled
newClientOrderId (str) – A unique id for the order. Automatically generated if not sent.
icebergQty (decimal) – Used with LIMIT, STOP_LOSS_LIMIT, and TAKE_PROFIT_LIMIT to create an iceberg order.
newOrderRespType (str) – Set the response JSON. ACK, RESULT, or FULL; default: RESULT.
recvWindow (int) – the number of milliseconds the request is valid for
- Returns:
API response
See order endpoint for full response options
- Raises:
BinanceRequestException, BinanceAPIException, BinanceOrderException, BinanceOrderMinAmountException, BinanceOrderMinPriceException, BinanceOrderMinTotalException, BinanceOrderUnknownSymbolException, BinanceOrderInactiveSymbolException
- async order_limit_buy(timeInForce='GTC', **params)[source]
Send in a new limit buy order
https://developers.binance.com/docs/binance-spot-api-docs/rest-api/trading-endpoints#new-order-trade
Any order with an icebergQty MUST have timeInForce set to GTC.
- Parameters:
symbol (str) – required
quantity (decimal) – required
price (str) – required
timeInForce (str) – default Good till cancelled
newClientOrderId (str) – A unique id for the order. Automatically generated if not sent.
stopPrice (decimal) – Used with stop orders
icebergQty (decimal) – Used with iceberg orders
newOrderRespType (str) – Set the response JSON. ACK, RESULT, or FULL; default: RESULT.
recvWindow (int) – the number of milliseconds the request is valid for
- Returns:
API response
See order endpoint for full response options
- Raises:
BinanceRequestException, BinanceAPIException, BinanceOrderException, BinanceOrderMinAmountException, BinanceOrderMinPriceException, BinanceOrderMinTotalException, BinanceOrderUnknownSymbolException, BinanceOrderInactiveSymbolException
- async order_limit_sell(timeInForce='GTC', **params)[source]
Send in a new limit sell order
https://developers.binance.com/docs/binance-spot-api-docs/rest-api/trading-endpoints#new-order-trade
- Parameters:
symbol (str) – required
quantity (decimal) – required
price (str) – required
timeInForce (str) – default Good till cancelled
newClientOrderId (str) – A unique id for the order. Automatically generated if not sent.
stopPrice (decimal) – Used with stop orders
icebergQty (decimal) – Used with iceberg orders
newOrderRespType (str) – Set the response JSON. ACK, RESULT, or FULL; default: RESULT.
recvWindow (int) – the number of milliseconds the request is valid for
- Returns:
API response
See order endpoint for full response options
- Raises:
BinanceRequestException, BinanceAPIException, BinanceOrderException, BinanceOrderMinAmountException, BinanceOrderMinPriceException, BinanceOrderMinTotalException, BinanceOrderUnknownSymbolException, BinanceOrderInactiveSymbolException
- async order_market(**params)[source]
Send in a new market order
https://developers.binance.com/docs/binance-spot-api-docs/rest-api/trading-endpoints#new-order-trade
- Parameters:
symbol (str) – required
side (str) – required
quantity (decimal) – required
quoteOrderQty (decimal) – amount the user wants to spend (when buying) or receive (when selling) of the quote asset
newClientOrderId (str) – A unique id for the order. Automatically generated if not sent.
newOrderRespType (str) – Set the response JSON. ACK, RESULT, or FULL; default: RESULT.
recvWindow (int) – the number of milliseconds the request is valid for
- Returns:
API response
See order endpoint for full response options
- Raises:
BinanceRequestException, BinanceAPIException, BinanceOrderException, BinanceOrderMinAmountException, BinanceOrderMinPriceException, BinanceOrderMinTotalException, BinanceOrderUnknownSymbolException, BinanceOrderInactiveSymbolException
- async order_market_buy(**params)[source]
Send in a new market buy order
https://developers.binance.com/docs/binance-spot-api-docs/rest-api/trading-endpoints#new-order-trade
- Parameters:
symbol (str) – required
quantity (decimal) – required
quoteOrderQty (decimal) – the amount the user wants to spend of the quote asset
newClientOrderId (str) – A unique id for the order. Automatically generated if not sent.
newOrderRespType (str) – Set the response JSON. ACK, RESULT, or FULL; default: RESULT.
recvWindow (int) – the number of milliseconds the request is valid for
- Returns:
API response
See order endpoint for full response options
- Raises:
BinanceRequestException, BinanceAPIException, BinanceOrderException, BinanceOrderMinAmountException, BinanceOrderMinPriceException, BinanceOrderMinTotalException, BinanceOrderUnknownSymbolException, BinanceOrderInactiveSymbolException
- async order_market_sell(**params)[source]
Send in a new market sell order
https://developers.binance.com/docs/binance-spot-api-docs/rest-api/trading-endpoints#new-order-trade
- Parameters:
symbol (str) – required
quantity (decimal) – required
quoteOrderQty (decimal) – the amount the user wants to receive of the quote asset
newClientOrderId (str) – A unique id for the order. Automatically generated if not sent.
newOrderRespType (str) – Set the response JSON. ACK, RESULT, or FULL; default: RESULT.
recvWindow (int) – the number of milliseconds the request is valid for
- Returns:
API response
See order endpoint for full response options
- Raises:
BinanceRequestException, BinanceAPIException, BinanceOrderException, BinanceOrderMinAmountException, BinanceOrderMinPriceException, BinanceOrderMinTotalException, BinanceOrderUnknownSymbolException, BinanceOrderInactiveSymbolException
- async order_oco_buy(**params)[source]
Send in a new OCO buy order
- Parameters:
symbol (str) – required
listClientOrderId (str) – A unique id for the list order. Automatically generated if not sent.
quantity (decimal) – required
limitClientOrderId (str) – A unique id for the limit order. Automatically generated if not sent.
price (str) – required
limitIcebergQty (decimal) – Used to make the LIMIT_MAKER leg an iceberg order.
stopClientOrderId (str) – A unique id for the stop order. Automatically generated if not sent.
stopPrice (str) – required
stopLimitPrice (str) – If provided, stopLimitTimeInForce is required.
stopIcebergQty (decimal) – Used with STOP_LOSS_LIMIT leg to make an iceberg order.
stopLimitTimeInForce (str) – Valid values are GTC/FOK/IOC.
newOrderRespType (str) – Set the response JSON. ACK, RESULT, or FULL; default: RESULT.
recvWindow (int) – the number of milliseconds the request is valid for
- Returns:
API response
See OCO order endpoint for full response options
- Raises:
BinanceRequestException, BinanceAPIException, BinanceOrderException, BinanceOrderMinAmountException, BinanceOrderMinPriceException, BinanceOrderMinTotalException, BinanceOrderUnknownSymbolException, BinanceOrderInactiveSymbolException
- async order_oco_sell(**params)[source]
Send in a new OCO sell order
- Parameters:
symbol (str) – required
listClientOrderId (str) – A unique id for the list order. Automatically generated if not sent.
quantity (decimal) – required
limitClientOrderId (str) – A unique id for the limit order. Automatically generated if not sent.
price (str) – required
limitIcebergQty (decimal) – Used to make the LIMIT_MAKER leg an iceberg order.
stopClientOrderId (str) – A unique id for the stop order. Automatically generated if not sent.
stopPrice (str) – required
stopLimitPrice (str) – If provided, stopLimitTimeInForce is required.
stopIcebergQty (decimal) – Used with STOP_LOSS_LIMIT leg to make an iceberg order.
stopLimitTimeInForce (str) – Valid values are GTC/FOK/IOC.
newOrderRespType (str) – Set the response JSON. ACK, RESULT, or FULL; default: RESULT.
recvWindow (int) – the number of milliseconds the request is valid for
- Returns:
API response
See OCO order endpoint for full response options
- Raises:
BinanceRequestException, BinanceAPIException, BinanceOrderException, BinanceOrderMinAmountException, BinanceOrderMinPriceException, BinanceOrderMinTotalException, BinanceOrderUnknownSymbolException, BinanceOrderInactiveSymbolException
- async papi_bnb_transfer(**params)[source]
Transfer BNB in and out of UM.
https://developers.binance.com/docs/derivatives/portfolio-margin/account/BNB-transfer
- Parameters:
recvWindow (int) – optional
- Returns:
API response
- async papi_cancel_cm_all_open_orders(**params)[source]
Cancel an active CM LIMIT order.
https://developers.binance.com/docs/derivatives/portfolio-margin/trade/Cancel-All-CM-Open-Orders
- Returns:
API response
- async papi_cancel_cm_conditional_all_open_orders(**params)[source]
Cancel All CM Open Conditional Orders.
- Returns:
API response
- async papi_cancel_cm_conditional_order(**params)[source]
Cancel CM Conditional Order.
https://developers.binance.com/docs/derivatives/portfolio-margin/trade/Cancel-CM-Conditional-Order
- Returns:
API response
- async papi_cancel_cm_order(**params)[source]
Cancel an active CM LIMIT order.
https://developers.binance.com/docs/derivatives/portfolio-margin/trade/Cancel-CM-Order
- Returns:
API response
- async papi_cancel_margin_all_open_orders(**params)[source]
Cancel Margin Account All Open Orders on a Symbol.
- Returns:
API response
- async papi_cancel_margin_order(**params)[source]
Cancel Margin Account Order.
https://developers.binance.com/docs/derivatives/portfolio-margin/trade/Cancel-Margin-Account-Order
- Returns:
API response
- async papi_cancel_margin_order_list(**params)[source]
Cancel Margin Account OCO Orders.
- Returns:
API response
- async papi_cancel_um_all_open_orders(**params)[source]
Cancel an active UM LIMIT order.
https://developers.binance.com/docs/derivatives/portfolio-margin/trade/Cancel-All-UM-Open-Orders
- Returns:
API response
- async papi_cancel_um_conditional_all_open_orders(**params)[source]
Cancel All UM Open Conditional Orders.
- Returns:
API response
- async papi_cancel_um_conditional_order(**params)[source]
Cancel UM Conditional Order.
https://developers.binance.com/docs/derivatives/portfolio-margin/trade/Cancel-UM-Conditional-Order
- Returns:
API response
- async papi_cancel_um_order(**params)[source]
Cancel an active UM LIMIT order.
https://developers.binance.com/docs/derivatives/portfolio-margin/trade/Cancel-UM-Order
- Returns:
API response
- async papi_change_um_position_side_dual(**params)[source]
Change user’s position mode (Hedge Mode or One-way Mode ) on EVERY symbol in UM.
https://developers.binance.com/docs/derivatives/portfolio-margin/account/Change-UM-Position-Mode
- Parameters:
dualSidePosition (str) – required
recvWindow (int) – optional
- Returns:
API response
- async papi_create_cm_conditional_order(**params)[source]
Place new CM Conditional order.
https://developers.binance.com/docs/derivatives/portfolio-margin/trade/New-CM-Conditional-Order
- Returns:
API response
- async papi_create_cm_order(**params)[source]
Place new CM order.
https://developers.binance.com/docs/derivatives/portfolio-margin/trade/New-CM-Order
- Returns:
API response
- async papi_create_margin_order(**params)[source]
New Margin Order.
https://developers.binance.com/docs/derivatives/portfolio-margin/trade/New-Margin-Order
- Returns:
API response
- async papi_create_um_conditional_order(**params)[source]
Place new UM Conditional order.
https://developers.binance.com/docs/derivatives/portfolio-margin/trade/New-UM-Conditional-Order
- Returns:
API response
- async papi_create_um_order(**params)[source]
Place new UM order.
https://developers.binance.com/docs/derivatives/portfolio-margin/trade
- Returns:
API response
- async papi_fund_asset_collection(**params)[source]
Transfers specific asset from Futures Account to Margin account.
https://developers.binance.com/docs/derivatives/portfolio-margin/account/Fund-Collection-by-Asset
- Parameters:
recvWindow (int) – optional
- Returns:
API response
- async papi_fund_auto_collection(**params)[source]
Fund collection for Portfolio Margin.
https://developers.binance.com/docs/derivatives/portfolio-margin/account/Fund-Auto-collection
- Parameters:
recvWindow (int) – optional
- Returns:
API response
- async papi_get_account(**params)[source]
Query account information.
https://developers.binance.com/docs/derivatives/portfolio-margin/account/Account-Information
- Parameters:
recvWindow (int) – optional
- Returns:
API response
- async papi_get_balance(**params)[source]
Query account balance.
https://developers.binance.com/docs/derivatives/portfolio-margin/account
- Parameters:
asset (str) – required
recvWindow (int) – optional
- Returns:
API response
- async papi_get_cm_account(**params)[source]
Get current CM account asset and position information.
https://developers.binance.com/docs/derivatives/portfolio-margin/account/Get-CM-Account-Detail
- Parameters:
recvWindow (int) – optional
- Returns:
API response
- async papi_get_cm_adl_quantile(**params)[source]
Query CM Position ADL Quantile Estimation.
- Returns:
API response
- async papi_get_cm_all_orders(**params)[source]
Get all account CM orders; active, canceled, or filled.
https://developers.binance.com/docs/derivatives/portfolio-margin/trade/Query-CM-Order
- Returns:
API response
- async papi_get_cm_comission_rate(**params)[source]
Get User Commission Rate for CM.
- Parameters:
symbol (str) – required
recvWindow (int) – optional
- Returns:
API response
- async papi_get_cm_conditional_all_orders(**params)[source]
Query All CM Conditional Orders.
- Returns:
API response
- async papi_get_cm_conditional_open_order(**params)[source]
Query Current UM Open Conditional Order.
- Returns:
API response
- async papi_get_cm_conditional_open_orders(**params)[source]
Get all open conditional orders on a symbol.
- Returns:
API response
- async papi_get_cm_conditional_order_history(**params)[source]
Get all open conditional orders on a symbol.
- Returns:
API response
- async papi_get_cm_force_orders(**params)[source]
Query User’s CM Force Orders.
https://developers.binance.com/docs/derivatives/portfolio-margin/trade/Query-Users-CM-Force-Orders
- Returns:
API response
- async papi_get_cm_income_history(**params)[source]
Get CM Income History.
https://developers.binance.com/docs/derivatives/portfolio-margin/account/Get-CM-Income-History
- Parameters:
recvWindow (int) – optional
- Returns:
API response
- async papi_get_cm_leverage_bracket(**params)[source]
Query CM notional and leverage brackets.
- Parameters:
symbol (str) – optional
recvWindow (int) – optional
- Returns:
API response
- async papi_get_cm_open_order(**params)[source]
Query current CM open order.
https://developers.binance.com/docs/derivatives/portfolio-margin/trade/Query-Current-CM-Open-Order
- Returns:
API response
- async papi_get_cm_open_orders(**params)[source]
Get all open orders on a symbol.
- Returns:
API response
- async papi_get_cm_order(**params)[source]
Check an CM order’s status.
https://developers.binance.com/docs/derivatives/portfolio-margin/trade/Query-CM-Order
- Returns:
API response
- async papi_get_cm_order_amendment(**params)[source]
Get order modification history.
https://developers.binance.com/docs/derivatives/portfolio-margin/trade/Query-CM-Modify-Order-History
- Returns:
API response
- async papi_get_cm_position_risk(**params)[source]
Query margin max borrow.
- Parameters:
asset (str) – required
recvWindow (int) – optional
- Returns:
API response
- async papi_get_cm_position_side_dual(**params)[source]
Get user’s position mode (Hedge Mode or One-way Mode ) on EVERY symbol in CM.
- Parameters:
recvWindow (int) – optional
- Returns:
API response
- async papi_get_cm_user_trades(**params)[source]
Get trades for a specific account and CM symbol.
https://developers.binance.com/docs/derivatives/portfolio-margin/trade/CM-Account-Trade-List
- Returns:
API response
- async papi_get_margin_all_order_list(**params)[source]
Query all OCO for a specific margin account based on provided optional parameters.
https://developers.binance.com/docs/derivatives/portfolio-margin/trade/Query-Margin-Account-all-OCO
- Returns:
API response
- async papi_get_margin_all_orders(**params)[source]
Query All Margin Account Orders.
- Returns:
API response
- async papi_get_margin_force_orders(**params)[source]
Query user’s margin force orders.
- Returns:
API response
- async papi_get_margin_interest_history(**params)[source]
Get Margin Borrow/Loan Interest History.
- Parameters:
recvWindow (int) – optional
- Returns:
API response
- async papi_get_margin_margin_loan(**params)[source]
Query margin loan record.
https://developers.binance.com/docs/derivatives/portfolio-margin/account/Query-Margin-Loan-Record
- Parameters:
asset (str) – required
recvWindow (int) – optional
- Returns:
API response
- async papi_get_margin_max_borrowable(**params)[source]
Query margin max borrow.
https://developers.binance.com/docs/derivatives/portfolio-margin/account/Margin-Max-Borrow
- Parameters:
asset (str) – required
recvWindow (int) – optional
- Returns:
API response
- async papi_get_margin_max_withdraw(**params)[source]
Query margin max borrow.
https://developers.binance.com/docs/derivatives/portfolio-margin/account/Query-Margin-Max-Withdraw
- Parameters:
asset (str) – required
recvWindow (int) – optional
- Returns:
API response
- async papi_get_margin_my_trades(**params)[source]
Margin Account Trade List.
https://developers.binance.com/docs/derivatives/portfolio-margin/trade/Margin-Account-Trade-List
- Returns:
API response
- async papi_get_margin_open_order_list(**params)[source]
Query Margin Account’s Open OCO.
https://developers.binance.com/docs/derivatives/portfolio-margin/trade/Query-Margin-Account-Open-OCO
- Returns:
API response
- async papi_get_margin_open_orders(**params)[source]
Query Current Margin Open Order.
https://developers.binance.com/docs/derivatives/portfolio-margin/trade/Query-Margin-Account-Order
- Returns:
API response
- async papi_get_margin_order(**params)[source]
Query Margin Account Order.
https://developers.binance.com/docs/derivatives/portfolio-margin/trade/Query-Margin-Account-Order
- Returns:
API response
- async papi_get_margin_order_list(**params)[source]
Retrieves a specific OCO based on provided optional parameters.
https://developers.binance.com/docs/derivatives/portfolio-margin/trade/Query-Margin-Account-OCO
- Returns:
API response
- async papi_get_margin_repay_debt(**params)[source]
Repay debt for a margin loan.
https://developers.binance.com/docs/derivatives/portfolio-margin/trade/Margin-Account-Trade-List
- Returns:
API response
- async papi_get_margin_repay_loan(**params)[source]
Query margin repay record.
https://developers.binance.com/docs/derivatives/portfolio-margin/account/Query-Margin-repay-Record
- Parameters:
asset (str) – required
recvWindow (int) – optional
- Returns:
API response
- async papi_get_portfolio_interest_history(**params)[source]
Query interest history of negative balance for portfolio margin.
- Parameters:
recvWindow (int) – optional
- Returns:
API response
- async papi_get_portfolio_negative_balance_exchange_record(**params)[source]
Query user negative balance auto exchange record.
- Parameters:
recvWindow (int) – optional
- Returns:
API response
- async papi_get_rate_limit(**params)[source]
Query User Rate Limit
https://developers.binance.com/docs/derivatives/portfolio-margin/account/Query-User-Rate-Limit
- Parameters:
recvWindow (int) – optional
- Returns:
API response
- async papi_get_repay_futures_switch(**params)[source]
Query Auto-repay-futures Status.
- Parameters:
recvWindow (int) – optional
- Returns:
API response
- async papi_get_um_account(**params)[source]
Get current UM account asset and position information.
https://developers.binance.com/docs/derivatives/portfolio-margin/account/Get-UM-Account-Detail
- Parameters:
recvWindow (int) – optional
- Returns:
API response
- async papi_get_um_account_config(**params)[source]
Query UM Futures account configuration.
- Parameters:
recvWindow (int) – optional
- Returns:
API response
- async papi_get_um_account_v2(**params)[source]
Get current UM account asset and position information.
https://developers.binance.com/docs/derivatives/portfolio-margin/account/Get-UM-Account-Detail-V2
- Parameters:
recvWindow (int) – optional
- Returns:
API response
- async papi_get_um_adl_quantile(**params)[source]
Query UM Position ADL Quantile Estimation.
- Returns:
API response
- async papi_get_um_all_orders(**params)[source]
Get all account UM orders; active, canceled, or filled.
https://developers.binance.com/docs/derivatives/portfolio-margin/trade/Query-UM-Order
- Returns:
API response
- async papi_get_um_api_trading_status(**params)[source]
Portfolio Margin UM Trading Quantitative Rules Indicators.
- Parameters:
symbol (str) – optional
recvWindow (int) – optional
- Returns:
API response
- async papi_get_um_comission_rate(**params)[source]
Get User Commission Rate for UM.
- Parameters:
symbol (str) – required
recvWindow (int) – optional
- Returns:
API response
- async papi_get_um_conditional_all_orders(**params)[source]
Query All UM Conditional Orders.
- Returns:
API response
- async papi_get_um_conditional_open_order(**params)[source]
Query Current UM Open Conditional Order.
- Returns:
API response
- async papi_get_um_conditional_open_orders(**params)[source]
Get all open conditional orders on a symbol.
- Returns:
API response
- async papi_get_um_conditional_order_history(**params)[source]
Get all open conditional orders on a symbol.
- Returns:
API response
- async papi_get_um_fee_burn(**params)[source]
Get user’s BNB Fee Discount for UM Futures (Fee Discount On or Fee Discount Off).
- Returns:
API response
- async papi_get_um_force_orders(**params)[source]
Query User’s UM Force Orders.
https://developers.binance.com/docs/derivatives/portfolio-margin/trade/Query-Users-UM-Force-Orders
- Returns:
API response
- async papi_get_um_income_asyn(**params)[source]
Get download id for UM futures transaction history.
- Parameters:
recvWindow (int) – optional
- Returns:
API response
- async papi_get_um_income_asyn_id(**params)[source]
Get UM futures Transaction download link by Id.
- Parameters:
recvWindow (int) – optional
- Returns:
API response
- async papi_get_um_income_history(**params)[source]
Get UM Income History.
https://developers.binance.com/docs/derivatives/portfolio-margin/account/Get-UM-Income-History
- Parameters:
recvWindow (int) – optional
- Returns:
API response
- async papi_get_um_leverage_bracket(**params)[source]
Query UM notional and leverage brackets.
- Parameters:
symbol (str) – optional
recvWindow (int) – optional
- Returns:
API response
- async papi_get_um_open_order(**params)[source]
Query current UM open order.
https://developers.binance.com/docs/derivatives/portfolio-margin/trade/Query-Current-UM-Open-Order
- Returns:
API response
- async papi_get_um_open_orders(**params)[source]
Get all open orders on a symbol.
- Returns:
API response
- async papi_get_um_order(**params)[source]
Check an UM order’s status.
https://developers.binance.com/docs/derivatives/portfolio-margin/trade/Query-UM-Order
- Returns:
API response
- async papi_get_um_order_amendment(**params)[source]
Get order modification history.
https://developers.binance.com/docs/derivatives/portfolio-margin/trade/Query-UM-Modify-Order-History
- Returns:
API response
- async papi_get_um_order_asyn(**params)[source]
Get download id for UM futures order history.
- Parameters:
recvWindow (int) – optional
- Returns:
API response
- async papi_get_um_order_asyn_id(**params)[source]
Get UM futures order download link by Id.
- Parameters:
recvWindow (int) – optional
- Returns:
API response
- async papi_get_um_position_risk(**params)[source]
Query margin max borrow.
- Parameters:
symbol (str) – required
recvWindow (int) – optional
- Returns:
API response
- async papi_get_um_position_side_dual(**params)[source]
Get user’s position mode (Hedge Mode or One-way Mode ) on EVERY symbol in UM.
- Parameters:
recvWindow (int) – optional
- Returns:
API response
- async papi_get_um_symbol_config(**params)[source]
Get current UM account symbol configuration.
- Parameters:
recvWindow (int) – optional
- Returns:
API response
- async papi_get_um_trade_asyn(**params)[source]
Get download id for UM futures trade history.
- Parameters:
recvWindow (int) – optional
- Returns:
API response
- async papi_get_um_trade_asyn_id(**params)[source]
Get UM futures trade download link by Id.
- Parameters:
recvWindow (int) – optional
- Returns:
API response
- async papi_get_um_user_trades(**params)[source]
Get trades for a specific account and UM symbol.
https://developers.binance.com/docs/derivatives/portfolio-margin/trade/UM-Account-Trade-List
- Returns:
API response
- async papi_margin_loan(**params)[source]
Apply for a margin loan.
https://developers.binance.com/docs/derivatives/portfolio-margin/trade/Margin-Account-Borrow
- Returns:
API response
- async papi_margin_order_oco(**params)[source]
Send in a new OCO for a margin account.
https://developers.binance.com/docs/derivatives/portfolio-margin/trade/Margin-Account-New-OCO
- Returns:
API response
- async papi_modify_cm_order(**params)[source]
Order modify function, currently only LIMIT order modification is supported, modified orders will be reordered in the match queue.
https://developers.binance.com/docs/derivatives/portfolio-margin/trade/Modify-CM-Order
- Returns:
API response
- async papi_modify_um_order(**params)[source]
Order modify function, currently only LIMIT order modification is supported, modified orders will be reordered in the match queue.
https://developers.binance.com/docs/derivatives/portfolio-margin/trade/Modify-UM-Order
- Returns:
API response
- async papi_ping(**params)[source]
Test connectivity to the Rest API.
https://developers.binance.com/docs/derivatives/portfolio-margin/market-data
- Returns:
API response
- async papi_repay_futures_negative_balance(**params)[source]
Repay futures Negative Balance.
- Parameters:
recvWindow (int) – optional
- Returns:
API response
- async papi_repay_futures_switch(**params)[source]
Change Auto-repay-futures Status.
- Parameters:
autoRepay (str) – required
recvWindow (int) – optional
- Returns:
API response
- async papi_repay_loan(**params)[source]
Repay for a margin loan.
https://developers.binance.com/docs/derivatives/portfolio-margin/trade/Margin-Account-Repay
- Returns:
API response
- async papi_set_cm_leverage(**params)[source]
Query margin max borrow.
https://developers.binance.com/docs/derivatives/portfolio-margin/account/Change-CM-Initial-Leverage
- Parameters:
asset (str) – required
leverage (int) – required
recvWindow (int) – optional
- Returns:
API response
- async papi_set_um_fee_burn(**params)[source]
Change user’s BNB Fee Discount for UM Futures (Fee Discount On or Fee Discount Off ) on EVERY symbol.
- Returns:
API response
- async papi_set_um_leverage(**params)[source]
Query margin max borrow.
https://developers.binance.com/docs/derivatives/portfolio-margin/account/Change-UM-Initial-Leverage
- Parameters:
asset (str) – required
leverage (int) – required
recvWindow (int) – optional
- Returns:
API response
- async papi_stream_close(listenKey)[source]
Close out a user data stream.
- Returns:
API response
{}
Weight: 1
- async papi_stream_get_listen_key()[source]
Start a new user data stream for Portfolio Margin account.
- Returns:
API response
- {
“listenKey”: “pM_XXXXXXX”
}
The stream will close after 60 minutes unless a keepalive is sent. If the account has an active listenKey, that listenKey will be returned and its validity will be extended for 60 minutes.
Weight: 1
- async papi_stream_keepalive(listenKey)[source]
Keepalive a user data stream to prevent a time out.
- Returns:
API response
{}
User data streams will close after 60 minutes. It’s recommended to send a ping about every 60 minutes.
Weight: 1
- async papi_v1_post_ping(**params)[source]
Placeholder function for POST /papi/v1/ping. Note: This function was auto-generated. Any issue please open an issue on GitHub.
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- async ping() Dict[source]
Test connectivity to the Rest API.
- Returns:
Empty array
{}- Raises:
BinanceRequestException, BinanceAPIException
- async purchase_staking_product(**params)[source]
Purchase Staking Product
https://binance-docs.github.io/apidocs/spot/en/#purchase-staking-product-user_data
- async query_subaccount_spot_summary(**params)[source]
Query Sub-account Spot Assets Summary (For Master Account)
- Parameters:
email (str) – optional - Sub account email
page (int) – optional - default 1
size (int) – optional - default 10, max 20
recvWindow (int) – optional
- Returns:
API response
{ "totalCount":2, "masterAccountTotalAsset": "0.23231201", "spotSubUserAssetBtcVoList":[ { "email":"sub123@test.com", "totalAsset":"9999.00000000" }, { "email":"test456@test.com", "totalAsset":"0.00000000" } ] }
- Raises:
BinanceRequestException, BinanceAPIException
- async query_universal_transfer_history(**params)[source]
Query User Universal Transfer History
https://developers.binance.com/docs/wallet/asset/query-user-universal-transfer
- Parameters:
type (str (ENUM)) – required
startTime (int) – optional
endTime (int) – optional
current (int) – optional - Default 1
size (int) – required - Default 10, Max 100
recvWindow (int) – the number of milliseconds the request is valid for
transfer_status = client.query_universal_transfer_history(params)
- Returns:
API response
{ "total":2, "rows":[ { "asset":"USDT", "amount":"1", "type":"MAIN_UMFUTURE" "status": "CONFIRMED", "tranId": 11415955596, "timestamp":1544433328000 }, { "asset":"USDT", "amount":"2", "type":"MAIN_UMFUTURE", "status": "CONFIRMED", "tranId": 11366865406, "timestamp":1544433328000 } ] }
- Raises:
BinanceRequestException, BinanceAPIException
- async redeem_simple_earn_flexible_product(**params)[source]
Redeem a simple earn flexible product
https://binance-docs.github.io/apidocs/spot/en/#redeem-flexible-product-trade
- Parameters:
productId (str) – required
amount (str) – optional
redeemAll (bool) – optional - Default False
recvWindow (int) – the number of milliseconds the request is valid for
- Returns:
API response
{ "redeemId": 40607, "success": true }
- Raises:
BinanceRequestException, BinanceAPIException
- async redeem_simple_earn_locked_product(**params)[source]
Redeem a simple earn locked product
https://binance-docs.github.io/apidocs/spot/en/#redeem-locked-product-trade
- Parameters:
productId (str) – required
recvWindow (int) – the number of milliseconds the request is valid for
- Returns:
API response
{ "redeemId": 40607, "success": true }
- Raises:
BinanceRequestException, BinanceAPIException
- async redeem_staking_product(**params)[source]
Redeem Staking Product
https://binance-docs.github.io/apidocs/spot/en/#redeem-staking-product-user_data
- async repay_margin_loan(**params)[source]
Repay loan in cross-margin or isolated-margin account.
If amount is more than the amount borrowed, the full loan will be repaid.
https://binance-docs.github.io/apidocs/spot/en/#margin-account-repay-margin
- Parameters:
asset (str) – name of the asset
amount (str) – amount to transfer
isIsolated (str) – set to ‘TRUE’ for isolated margin (default ‘FALSE’)
symbol (str) – Isolated margin symbol (default blank for cross-margin)
recvWindow (int) – the number of milliseconds the request is valid for
transaction = client.margin_repay_loan(asset='BTC', amount='1.1') transaction = client.margin_repay_loan(asset='BTC', amount='1.1', isIsolated='TRUE', symbol='ETHBTC')
- Returns:
API response
{ "tranId": 100000001 }
- Raises:
BinanceRequestException, BinanceAPIException
- async set_auto_staking(**params)[source]
Set Auto Staking on Locked Staking or Locked DeFi Staking
https://binance-docs.github.io/apidocs/spot/en/#set-auto-staking-user_data
- async set_margin_max_leverage(**params)[source]
Adjust cross margin max leverage
https://developers.binance.com/docs/margin_trading/account
- Parameters:
maxLeverage (int) – required Can only adjust 3 or 5,Example: maxLeverage=3
- Returns:
API response
- {
“success”: true
}
- Raises:
BinanceRequestException, BinanceAPIException
- async stake_asset_us(**params)[source]
Stake a supported asset.
https://docs.binance.us/#stake-asset
- Raises:
BinanceRegionException – If client is not configured for binance.us
- async stream_close(listenKey)[source]
Close out a user data stream.
https://binance-docs.github.io/apidocs/spot/en/#listen-key-spot
- Parameters:
listenKey (str) – required
- Returns:
API response
{}- Raises:
BinanceRequestException, BinanceAPIException
- async stream_get_listen_key()[source]
Start a new user data stream and return the listen key If a stream already exists it should return the same key. If the stream becomes invalid a new key is returned.
Can be used to keep the user stream alive.
https://binance-docs.github.io/apidocs/spot/en/#listen-key-spot
- Returns:
API response
{ "listenKey": "pqia91ma19a5s61cv6a81va65sdf19v8a65a1a5s61cv6a81va65sdf19v8a65a1" }
- Raises:
BinanceRequestException, BinanceAPIException
- async stream_keepalive(listenKey)[source]
PING a user data stream to prevent a time out.
https://binance-docs.github.io/apidocs/spot/en/#listen-key-spot
- Parameters:
listenKey (str) – required
- Returns:
API response
{}- Raises:
BinanceRequestException, BinanceAPIException
- async subscribe_simple_earn_flexible_product(**params)[source]
Subscribe to a simple earn flexible product
https://binance-docs.github.io/apidocs/spot/en/#subscribe-locked-product-trade
- Parameters:
productId (str) – required
amount (str) – required
autoSubscribe (bool) – optional - Default True
recvWindow (int) – the number of milliseconds the request is valid for
- Returns:
API response
{ "purchaseId": 40607, "success": true }
- Raises:
BinanceRequestException, BinanceAPIException
- async subscribe_simple_earn_locked_product(**params)[source]
Subscribe to a simple earn locked product
https://binance-docs.github.io/apidocs/spot/en/#subscribe-locked-product-trade
- Parameters:
productId (str) – required
amount (str) – required
autoSubscribe (bool) – optional - Default True
recvWindow (int) – the number of milliseconds the request is valid for
- Returns:
API response
{ "purchaseId": 40607, "positionId": "12345", "success": true }
- Raises:
BinanceRequestException, BinanceAPIException
- async toggle_bnb_burn_spot_margin(**params)[source]
Toggle BNB Burn On Spot Trade And Margin Interest
https://developers.binance.com/docs/wallet/asset/Toggle-BNB-Burn-On-Spot-Trade-And-Margin-Interest
- Parameters:
spotBNBBurn (bool) – Determines whether to use BNB to pay for trading fees on SPOT
interestBNBBurn (bool) – Determines whether to use BNB to pay for margin loan’s interest
response = client.toggle_bnb_burn_spot_margin()
- Returns:
API response
{ "spotBNBBurn":true, "interestBNBBurn": false }
- Raises:
BinanceRequestException, BinanceAPIException
- async transfer_dust(**params)[source]
Convert dust assets to BNB.
https://developers.binance.com/docs/wallet/asset/dust-transfer
- Parameters:
asset (str) – The asset being converted. e.g: ‘ONE’
recvWindow (int) – the number of milliseconds the request is valid for
result = client.transfer_dust(asset='ONE')
- Returns:
API response
{ "totalServiceCharge":"0.02102542", "totalTransfered":"1.05127099", "transferResult":[ { "amount":"0.03000000", "fromAsset":"ETH", "operateTime":1563368549307, "serviceChargeAmount":"0.00500000", "tranId":2970932918, "transferedAmount":"0.25000000" } ] }
- Raises:
BinanceRequestException, BinanceAPIException
- async transfer_isolated_margin_to_spot(**params)[source]
Execute transfer between isolated margin account and spot account.
https://binance-docs.github.io/apidocs/spot/en/#isolated-margin-account-transfer-margin
- Parameters:
asset (str) – name of the asset
symbol (str) – pair symbol
amount (str) – amount to transfer
recvWindow (int) – the number of milliseconds the request is valid for
transfer = client.transfer_isolated_margin_to_spot(asset='BTC', symbol='ETHBTC', amount='1.1')
- Returns:
API response
{ "tranId": 100000001 }
- Raises:
BinanceRequestException, BinanceAPIException
- async transfer_margin_dust(**params)[source]
Convert dust assets to BNB.
https://binance-docs.github.io/apidocs/spot/en/#dust-transfer-trade
- Returns:
API response
- async transfer_margin_to_spot(**params)[source]
Execute transfer between cross-margin account and spot account.
https://binance-docs.github.io/apidocs/spot/en/#cross-margin-account-transfer-margin
- Parameters:
asset (str) – name of the asset
amount (str) – amount to transfer
recvWindow (int) – the number of milliseconds the request is valid for
transfer = client.transfer_margin_to_spot(asset='BTC', amount='1.1')
- Returns:
API response
{ "tranId": 100000001 }
- Raises:
BinanceRequestException, BinanceAPIException
- async transfer_spot_to_isolated_margin(**params)[source]
Execute transfer between spot account and isolated margin account.
https://binance-docs.github.io/apidocs/spot/en/#isolated-margin-account-transfer-margin
- Parameters:
asset (str) – name of the asset
symbol (str) – pair symbol
amount (str) – amount to transfer
recvWindow (int) – the number of milliseconds the request is valid for
transfer = client.transfer_spot_to_isolated_margin(asset='BTC', symbol='ETHBTC', amount='1.1')
- Returns:
API response
{ "tranId": 100000001 }
- Raises:
BinanceRequestException, BinanceAPIException
- async transfer_spot_to_margin(**params)[source]
Execute transfer between spot account and cross-margin account.
https://binance-docs.github.io/apidocs/spot/en/#cross-margin-account-transfer-margin
- Parameters:
asset (str) – name of the asset
amount (str) – amount to transfer
recvWindow (int) – the number of milliseconds the request is valid for
transfer = client.transfer_spot_to_margin(asset='BTC', amount='1.1')
- Returns:
API response
{ "tranId": 100000001 }
- Raises:
BinanceRequestException, BinanceAPIException
- async universal_transfer(**params)[source]
Unviversal transfer api accross different binance account types
https://developers.binance.com/docs/wallet/asset/user-universal-transfer
- async unstake_asset_us(**params)[source]
Unstake a staked asset
https://docs.binance.us/#unstake-asset
- Raises:
BinanceRegionException – If client is not configured for binance.us
- async v3_delete_order_list(**params)[source]
Placeholder function for DELETE /api/v3/orderList. Note: This function was auto-generated. Any issue please open an issue on GitHub.
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- async v3_get_account_commission(**params)[source]
Placeholder function for GET /api/v3/account/commission. Note: This function was auto-generated. Any issue please open an issue on GitHub.
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- async v3_get_all_order_list(**params)[source]
Placeholder function for GET /api/v3/allOrderList. Note: This function was auto-generated. Any issue please open an issue on GitHub.
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- async v3_get_order_list(**params)[source]
Placeholder function for GET /api/v3/orderList. Note: This function was auto-generated. Any issue please open an issue on GitHub.
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- async v3_get_ticker_trading_day(**params)[source]
Placeholder function for GET /api/v3/ticker/tradingDay. Note: This function was auto-generated. Any issue please open an issue on GitHub.
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- async v3_post_cancel_replace(**params)[source]
Placeholder function for POST /api/v3/cancelReplace. Note: This function was auto-generated. Any issue please open an issue on GitHub.
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- async v3_post_order_list_oto(**params)[source]
Placeholder function for POST /api/v3/orderList/oto. Note: This function was auto-generated. Any issue please open an issue on GitHub.
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- async v3_post_order_list_otoco(**params)[source]
Placeholder function for POST /api/v3/orderList/otoco. Note: This function was auto-generated. Any issue please open an issue on GitHub.
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- async v3_post_sor_order(**params)[source]
Placeholder function for POST /api/v3/sor/order. Note: This function was auto-generated. Any issue please open an issue on GitHub.
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- async v3_post_sor_order_test(**params)[source]
Placeholder function for POST /api/v3/sor/order/test. Note: This function was auto-generated. Any issue please open an issue on GitHub.
- Parameters:
params (dict) – parameters required by the endpoint
- Returns:
API response
- async withdraw(**params)[source]
Submit a withdraw request.
https://developers.binance.com/docs/wallet/capital/withdraw
Assumptions:
You must have Withdraw permissions enabled on your API key
You must have withdrawn to the address specified through the website and approved the transaction via email
- Parameters:
coin (str) – required
withdrawOrderId (str) – optional - client id for withdraw
network (str) – optional
address (str) – optional
amount (decimal) – required
transactionFeeFlag (bool) – required - When making internal transfer, true for returning the fee to the destination account; false for returning the fee back to the departure account. Default false.
name (str) – optional - Description of the address, default asset value passed will be used
recvWindow (int) – the number of milliseconds the request is valid for
- Returns:
API response
{ "id":"7213fea8e94b4a5593d507237e5a555b" }
- Raises:
BinanceRequestException, BinanceAPIException
- async ws_cancel_all_open_orders(**params)[source]
Cancel all open orders on a symbol or all symbols. https://developers.binance.com/docs/binance-spot-api-docs/testnet/web-socket-api/public-api-requests#cancel-open-orders-trade
- Parameters:
symbol (str) – optional - Symbol to cancel orders for
recvWindow (int) – optional - The value cannot be greater than 60000
- Returns:
Websocket message
Response format: [
- {
“symbol”: “BTCUSDT”, “origClientOrderId”: “4d96324ff9d44481926157”, “orderId”: 12569099453, “orderListId”: -1, “clientOrderId”: “91fe37ce9e69c90d6358c0”, “price”: “23416.10000000”, “origQty”: “0.00847000”, “executedQty”: “0.00847000”, “cummulativeQuoteQty”: “198.33521500”, “status”: “CANCELED”, “timeInForce”: “GTC”, “type”: “LIMIT”, “side”: “SELL”, “stopPrice”: “0.00000000”, “trailingDelta”: 0, “trailingTime”: -1, “icebergQty”: “0.00000000”, “strategyId”: 37463720, “strategyType”: 1000000, “selfTradePreventionMode”: “NONE”
}
]
Weight: 1
- async ws_cancel_and_replace_order(**params)[source]
Cancels an existing order and places a new order on the same symbol. https://developers.binance.com/docs/binance-spot-api-docs/testnet/web-socket-api/public-api-requests#cancel-and-replace-order-trade
- Parameters:
symbol (str) – required - Trading symbol, e.g. ‘BTCUSDT’
cancelReplaceMode (str) – required - The mode of cancel-replace: STOP_ON_FAILURE - If the cancel request fails, new order placement will not be attempted. ALLOW_FAILURE - New order placement will be attempted even if cancel request fails
cancelOrderId (int) – optional - The order ID to cancel
cancelOrigClientOrderId (str) – optional - The original client order ID to cancel
cancelNewClientOrderId (str) – optional - Used to uniquely identify this cancel. Automatically generated if not sent
side (str) – required - BUY or SELL
type (str) – required - Order type, e.g. LIMIT, MARKET
timeInForce (str) – optional - GTC, IOC, FOK
price (str) – optional - Order price
quantity (str) – optional - Order quantity
quoteOrderQty (str) – optional - Quote quantity
newClientOrderId (str) – optional - Used to uniquely identify this new order
newOrderRespType (str) – optional - ACK, RESULT, or FULL
stopPrice (str) – optional - Used with STOP_LOSS, STOP_LOSS_LIMIT, TAKE_PROFIT, and TAKE_PROFIT_LIMIT orders
trailingDelta (int) – optional - Used with TAKE_PROFIT, TAKE_PROFIT_LIMIT, STOP_LOSS, STOP_LOSS_LIMIT orders
icebergQty (str) – optional - Used with iceberg orders
strategyId (int) – optional - Arbitrary numeric value identifying the order within an order strategy
strategyType (int) – optional - Arbitrary numeric value identifying the order strategy
selfTradePreventionMode (str) – optional - The allowed enums is dependent on what is configured on the symbol
cancelRestrictions (str) – optional - ONLY_NEW - Cancel will succeed if order status is NEW. ONLY_PARTIALLY_FILLED - Cancel will succeed if order status is PARTIALLY_FILLED
recvWindow (int) – optional - The number of milliseconds the request is valid for
Either cancelOrderId or cancelOrigClientOrderId must be provided. Price is required for LIMIT orders. Either quantity or quoteOrderQty must be provided.
Weight: 1
Returns: .. code-block:: python
- {
“id”: “99de6b92-0eda-4154-9c8d-a51d93c6f92e”, “status”: 200, “result”: {
“cancelResult”: “SUCCESS”, “newOrderResult”: “SUCCESS”, “cancelResponse”: {
“symbol”: “BTCUSDT”, “origClientOrderId”: “4d96324ff9d44481926157”, “orderId”: 12569099453, “orderListId”: -1, “clientOrderId”: “91fe37ce9e69c90d6358c0”, “price”: “23416.10000000”, “origQty”: “0.00847000”, “executedQty”: “0.00001000”, “cummulativeQuoteQty”: “0.23416100”, “status”: “CANCELED”, “timeInForce”: “GTC”, “type”: “LIMIT”, “side”: “SELL”, “selfTradePreventionMode”: “NONE”
}, “newOrderResponse”: {
“symbol”: “BTCUSDT”, “orderId”: 12569099454, “orderListId”: -1, “clientOrderId”: “bX5wROblo6YeDwa9iTLeyY”, “transactTime”: 1660801715639
}
}
}
- async ws_cancel_oco_order(**params)[source]
Cancel an OCO (One-Cancels-the-Other) order list.
- Parameters:
symbol (str) – required - Trading symbol
orderListId (int) – optional - The ID of the OCO order list to cancel
listClientOrderId (str) – optional - The client-specified ID of the OCO order list
newClientOrderId (str) – optional - Client ID to identify the cancel request
apiKey (str) – required - Your API key
recvWindow (int) – optional - Number of milliseconds the request is valid for
signature (str) – required - HMAC SHA256 signature
timestamp (int) – required - Current timestamp in milliseconds
- Notes:
Either orderListId or listClientOrderId must be provided
newClientOrderId will be auto-generated if not provided
Response example: .. code-block:: python
- {
“id”: “c5899911-d3f4-47ae-8835-97da553d27d0”, “status”: 200, “result”: {
“orderListId”: 1274512, “contingencyType”: “OCO”, “listStatusType”: “ALL_DONE”, “listOrderStatus”: “ALL_DONE”, “listClientOrderId”: “6023531d7edaad348f5aff”, “transactionTime”: 1660801720215, “symbol”: “BTCUSDT”, “orders”: [
- {
“symbol”: “BTCUSDT”, “orderId”: 12569138901, “clientOrderId”: “BqtFCj5odMoWtSqGk2X9tU”
}, {
“symbol”: “BTCUSDT”, “orderId”: 12569138902, “clientOrderId”: “jLnZpj5enfMXTuhKB1d0us”
}
], “orderReports”: [
- {
“symbol”: “BTCUSDT”, “orderId”: 12569138901, “orderListId”: 1274512, “clientOrderId”: “BqtFCj5odMoWtSqGk2X9tU”, “transactTime”: 1660801720215, “price”: “23416.10000000”, “origQty”: “0.00847000”, “executedQty”: “0.00000000”, “cummulativeQuoteQty”: “0.00000000”, “status”: “CANCELED”, “timeInForce”: “GTC”, “type”: “STOP_LOSS_LIMIT”, “side”: “SELL”, “stopPrice”: “23416.10000000”, “selfTradePreventionMode”: “NONE”
}, {
“symbol”: “BTCUSDT”, “orderId”: 12569138902, “orderListId”: 1274512, “clientOrderId”: “jLnZpj5enfMXTuhKB1d0us”, “transactTime”: 1660801720215, “price”: “23416.10000000”, “origQty”: “0.00847000”, “executedQty”: “0.00000000”, “cummulativeQuoteQty”: “0.00000000”, “status”: “CANCELED”, “timeInForce”: “GTC”, “type”: “LIMIT_MAKER”, “side”: “SELL”, “selfTradePreventionMode”: “NONE”
}
]
}, “rateLimits”: [
- {
“rateLimitType”: “REQUEST_WEIGHT”, “interval”: “MINUTE”, “intervalNum”: 1, “limit”: 6000, “count”: 1
}
]
}
- async ws_cancel_order(**params)[source]
Cancel an active order. https://developers.binance.com/docs/binance-spot-api-docs/testnet/web-socket-api/public-api-requests#cancel-order-trade
- Parameters:
symbol (str) – required - Trading symbol, e.g. ‘BTCUSDT’
orderId (int) – optional - The unique order id
origClientOrderId (str) – optional - The original client order id
newClientOrderId (str) – optional - Used to uniquely identify this cancel. Automatically generated if not sent
cancelRestrictions (str) – optional - ONLY_NEW - Cancel will succeed if the order status is NEW. ONLY_PARTIALLY_FILLED - Cancel will succeed if order status is PARTIALLY_FILLED.
recvWindow (int) – optional - The number of milliseconds the request is valid for
Either orderId or origClientOrderId must be sent.
Weight: 1
Returns: .. code-block:: python
- {
“id”: “5633b6a2-90a9-4192-83e7-925c90b6a2fd”, “method”: “order.cancel”, “params”: {
“symbol”: “BTCUSDT”, “origClientOrderId”: “4d96324ff9d44481926157”, “apiKey”: “vmPUZE6mv9SD5VNHk4HlWFsOr6aKE2zvsw0MuIgwCIPy6utIco14y7Ju91duEh8A”, “signature”: “33d5b721f278ae17a52f004a82a6f68a70c68e7dd6776ed0be77a455ab855282”, “timestamp”: 1660801715830
}
}
- async ws_create_oco_order(**params)[source]
Create a new OCO (One-Cancels-the-Other) order. https://developers.binance.com/docs/binance-spot-api-docs/testnet/web-socket-api/public-api-requests#place-new-order-list—oco-trade
- Parameters:
symbol (str) – required - Trading symbol
side (str) – required - BUY or SELL
quantity (decimal) – required - Order quantity
price (decimal) – required - Order price for limit leg
stopPrice (decimal) – required - Stop trigger price for stop leg
stopLimitPrice (decimal) – optional - Stop limit price for stop leg
stopLimitTimeInForce (str) – optional - Time in force for stop leg
listClientOrderId (str) – optional - Unique ID for the entire orderList
limitClientOrderId (str) – optional - Unique ID for the limit order
stopClientOrderId (str) – optional - Unique ID for the stop order
limitStrategyId (int) – optional - Arbitrary numeric value identifying the limit order within an order strategy
limitStrategyType (int) – optional - Arbitrary numeric value identifying the limit order strategy
stopStrategyId (int) – optional - Arbitrary numeric value identifying the stop order within an order strategy
stopStrategyType (int) – optional - Arbitrary numeric value identifying the stop order strategy
limitIcebergQty (decimal) – optional - Iceberg quantity for the limit leg
stopIcebergQty (decimal) – optional - Iceberg quantity for the stop leg
recvWindow (int) – optional - The value cannot be greater than 60000
- Returns:
Websocket message
Response format: .. code-block:: python
- {
“id”: “56374a46-3261-486b-a211-99ed972eb648”, “status”: 200, “result”: {
“orderListId”: 2, “contingencyType”: “OCO”, “listStatusType”: “EXEC_STARTED”, “listOrderStatus”: “EXECUTING”, “listClientOrderId”: “cKPMnDCbcLQILtDYM4f4fX”, “transactionTime”: 1711062760648, “symbol”: “LTCBNB”, “orders”: [ {
“symbol”: “LTCBNB”, “orderId”: 2, “clientOrderId”: “0m6I4wfxvTUrOBSMUl0OPU”
}, {
“symbol”: “LTCBNB”, “orderId”: 3, “clientOrderId”: “Z2IMlR79XNY5LU0tOxrWyW”
} ], “orderReports”: [ {
“symbol”: “LTCBNB”, “orderId”: 2, “orderListId”: 2, “clientOrderId”: “0m6I4wfxvTUrOBSMUl0OPU”, “transactTime”: 1711062760648, “price”: “1.50000000”, “origQty”: “1.000000”, “executedQty”: “0.000000”, “origQuoteOrderQty”: “0.000000”, “cummulativeQuoteQty”: “0.00000000”, “status”: “NEW”, “timeInForce”: “GTC”, “type”: “STOP_LOSS_LIMIT”, “side”: “BUY”, “stopPrice”: “1.50000001”, “workingTime”: -1, “selfTradePreventionMode”: “NONE”
}, {
“symbol”: “LTCBNB”, “orderId”: 3, “orderListId”: 2, “clientOrderId”: “Z2IMlR79XNY5LU0tOxrWyW”, “transactTime”: 1711062760648, “price”: “1.49999999”, “origQty”: “1.000000”, “executedQty”: “0.000000”, “origQuoteOrderQty”: “0.000000”, “cummulativeQuoteQty”: “0.00000000”, “status”: “NEW”, “timeInForce”: “GTC”, “type”: “LIMIT_MAKER”, “side”: “BUY”, “workingTime”: 1711062760648, “selfTradePreventionMode”: “NONE”
}, “rateLimits”: [
{ “rateLimitType”: “ORDERS”, “interval”: “SECOND”, “intervalNum”: 10, “limit”: 50, “count”: 2 }, { “rateLimitType”: “ORDERS”, “interval”: “DAY”, “intervalNum”: 1, “limit”: 160000, “count”: 2 }, { “rateLimitType”: “REQUEST_WEIGHT”, “interval”: “MINUTE”, “intervalNum”: 1, “limit”: 6000, “count”: 1 }
]
}
Weight: 2
- async ws_create_order(**params)[source]
Create an order via WebSocket. https://binance-docs.github.io/apidocs/websocket_api/en/#place-new-order-trade :param id: The request ID to be used. By default uuid22() is used. :param symbol: The symbol to create an order for :param side: BUY or SELL :param type: Order type (e.g., LIMIT, MARKET) :param quantity: The amount to buy or sell :param kwargs: Additional order parameters
- async ws_create_oto_order(**params)[source]
Create a new OTO (One-Triggers-Other) order list. https://developers.binance.com/docs/binance-spot-api-docs/testnet/web-socket-api/public-api-requests#place-new-order-list—oto-trade
An OTO order list consists of two orders: 1. Primary order that must be filled first 2. Secondary order that is placed only after the primary order is filled
- Parameters:
symbol (str) – required - Trading symbol
orders (list) –
required - Array of order objects containing: [
- { # Primary order
”type”: required - Order type (e.g. LIMIT, MARKET), “side”: required - BUY or SELL, “price”: required for LIMIT orders, “quantity”: required - Order quantity, “timeInForce”: required for LIMIT orders, “icebergQty”: optional, “strategyId”: optional, “strategyType”: optional, “selfTradePreventionMode”: optional
}, { # Secondary order - same parameters as primary
…
}
]
listClientOrderId (str) – optional - Unique ID for the entire order list
limitClientOrderId (str) – optional - Client order ID for the LIMIT leg
limitStrategyId (int) – optional - Strategy ID for the LIMIT leg
limitStrategyType (int) – optional - Strategy type for the LIMIT leg
stopClientOrderId (str) – optional - Client order ID for the STOP_LOSS/STOP_LOSS_LIMIT leg
stopStrategyId (int) – optional - Strategy ID for the STOP_LOSS/STOP_LOSS_LIMIT leg
stopStrategyType (int) – optional - Strategy type for the STOP_LOSS/STOP_LOSS_LIMIT leg
newOrderRespType (str) – optional - Set the response JSON
Response example: .. code-block:: python
- {
“id”: “c5899911-d3f4-47ae-8835-97da553d27d0”, “status”: 200, “result”: {
“orderListId”: 1, “contingencyType”: “OTO”, “listStatusType”: “EXEC_STARTED”, “listOrderStatus”: “EXECUTING”, “listClientOrderId”: “C3wyRVh3aqKyI2RpBZYmFz”, “transactionTime”: 1669632210676, “symbol”: “BTCUSDT”, “orders”: [
- {
“symbol”: “BTCUSDT”, “orderId”: 12569099453, “clientOrderId”: “bX5wROblo6YeDwa9iTLeyY”
}, {
“symbol”: “BTCUSDT”, “orderId”: 12569099454, “clientOrderId”: “Tnu2IP0J5Y4mxw3IxZYeFi”
}
], “orderReports”: [
- {
“symbol”: “BTCUSDT”, “orderId”: 12569099453, “orderListId”: 1, “clientOrderId”: “bX5wROblo6YeDwa9iTLeyY”, “transactTime”: 1669632210676, “price”: “23416.10000000”, “origQty”: “0.00847000”, “executedQty”: “0.00847000”, “cummulativeQuoteQty”: “198.33521500”, “status”: “FILLED”, “timeInForce”: “GTC”, “type”: “LIMIT”, “side”: “SELL”, “stopPrice”: “0.00000000”, “workingTime”: 1669632210676, “selfTradePreventionMode”: “NONE”
}, {
“symbol”: “BTCUSDT”, “orderId”: 12569099454, “orderListId”: 1, “clientOrderId”: “Tnu2IP0J5Y4mxw3IxZYeFi”, “transactTime”: 1669632210676, “price”: “0.00000000”, “origQty”: “0.00847000”, “executedQty”: “0.00000000”, “cummulativeQuoteQty”: “0.00000000”, “status”: “NEW”, “timeInForce”: “GTC”, “type”: “MARKET”, “side”: “BUY”, “stopPrice”: “0.00000000”, “workingTime”: -1, “selfTradePreventionMode”: “NONE”
}
]
}, “rateLimits”: [
- {
“rateLimitType”: “ORDERS”, “interval”: “SECOND”, “intervalNum”: 10, “limit”: 50, “count”: 1
}, {
“rateLimitType”: “ORDERS”, “interval”: “DAY”, “intervalNum”: 1, “limit”: 160000, “count”: 1
}, {
“rateLimitType”: “REQUEST_WEIGHT”, “interval”: “MINUTE”, “intervalNum”: 1, “limit”: 6000, “count”: 1
}
]
}
Weight: 1
- async ws_create_otoco_order(**params)[source]
Returns: Websocket message .. code-block:: python
- {
“id”: “1712544408508”, “status”: 200, “result”: {
“orderListId”: 629, “contingencyType”: “OTO”, “listStatusType”: “EXEC_STARTED”, “listOrderStatus”: “EXECUTING”, “listClientOrderId”: “GaeJHjZPasPItFj4x7Mqm6”, “transactionTime”: 1712544408537, “symbol”: “1712544378871”, “orders”: [ {
“symbol”: “1712544378871”, “orderId”: 23, “clientOrderId”: “OVQOpKwfmPCfaBTD0n7e7H”
}, {
“symbol”: “1712544378871”, “orderId”: 24, “clientOrderId”: “YcCPKCDMQIjNvLtNswt82X”
}, {
“symbol”: “1712544378871”, “orderId”: 25, “clientOrderId”: “ilpIoShcFZ1ZGgSASKxMPt”
} ], “orderReports”: [ {
“symbol”: “LTCBNB”, “orderId”: 23, “orderListId”: 629, “clientOrderId”: “OVQOpKwfmPCfaBTD0n7e7H”, “transactTime”: 1712544408537, “price”: “1.500000”, “origQty”: “1.000000”, “executedQty”: “0.000000”, “origQuoteOrderQty”: “0.000000”, “cummulativeQuoteQty”: “0.000000”, “status”: “NEW”, “timeInForce”: “GTC”, “type”: “LIMIT”, “side”: “BUY”, “workingTime”: 1712544408537, “selfTradePreventionMode”: “NONE”
}, {
“symbol”: “LTCBNB”, “orderId”: 24, “orderListId”: 629, “clientOrderId”: “YcCPKCDMQIjNvLtNswt82X”, “transactTime”: 1712544408537, “price”: “0.000000”, “origQty”: “5.000000”, “executedQty”: “0.000000”, “origQuoteOrderQty”: “0.000000”, “cummulativeQuoteQty”: “0.000000”, “status”: “PENDING_NEW”, “timeInForce”: “GTC”, “type”: “STOP_LOSS”, “side”: “SELL”, “stopPrice”: “0.500000”, “workingTime”: -1, “selfTradePreventionMode”: “NONE”
}, {
“symbol”: “LTCBNB”, “orderId”: 25, “orderListId”: 629, “clientOrderId”: “ilpIoShcFZ1ZGgSASKxMPt”, “transactTime”: 1712544408537, “price”: “5.000000”, “origQty”: “5.000000”, “executedQty”: “0.000000”, “origQuoteOrderQty”: “0.000000”, “cummulativeQuoteQty”: “0.000000”, “status”: “PENDING_NEW”, “timeInForce”: “GTC”, “type”: “LIMIT_MAKER”, “side”: “SELL”, “workingTime”: -1, “selfTradePreventionMode”: “NONE”
}, “rateLimits”: [
{ “rateLimitType”: “ORDERS”, “interval”: “MINUTE”, “intervalNum”: 1, “limit”: 10000000, “count”: 18 }, { “rateLimitType”: “REQUEST_WEIGHT”, “interval”: “MINUTE”, “intervalNum”: 1, “limit”: 1000, “count”: 65 }
]
}
Weight: 1
- async ws_create_sor_order(**params)[source]
Place a new order using Smart Order Routing (SOR).
- Parameters:
symbol (str) – required - Trading symbol, e.g. BTCUSDT
side (str) – required - Order side: BUY or SELL
type (str) – required - Order type: LIMIT or MARKET
quantity (float) – required - Order quantity
timeInForce (str) – required for LIMIT orders - Time in force: GTC, IOC, FOK
price (float) – required for LIMIT orders - Order price
newClientOrderId (str) – optional - Unique order ID. Automatically generated if not sent
newOrderRespType (str) – optional - Response format: ACK, RESULT, FULL. MARKET and LIMIT orders use FULL by default
strategyId (int) – optional - Arbitrary numeric value identifying the order within an order strategy
strategyType (int) – optional - Arbitrary numeric value identifying the order strategy. Values < 1000000 are reserved
selfTradePreventionMode (str) – optional - Supported values depend on exchange configuration: EXPIRE_TAKER, EXPIRE_MAKER, EXPIRE_BOTH, NONE
recvWindow (int) – optional - Number of milliseconds after timestamp the request is valid for. Default 5000, max 60000
- Returns:
Websocket message
- Notes:
SOR only supports LIMIT and MARKET orders
quoteOrderQty is not supported
Weight: 1
Data Source: Matching Engine
- async ws_create_test_order(**params)[source]
Test new order creation and signature/recvWindow long. Creates and validates a new order but does not send it into the matching engine. https://binance-docs.github.io/apidocs/websocket_api/en/#test-new-order-trade :param symbol: required :type symbol: str :param side: required :type side: str :param type: required :type type: str :param timeInForce: required if limit order :type timeInForce: str :param quantity: required :type quantity: decimal :param price: required :type price: str :param newClientOrderId: A unique id for the order. Automatically generated if not sent. :type newClientOrderId: str :param icebergQty: Used with iceberg orders :type icebergQty: decimal :param newOrderRespType: Set the response JSON. ACK, RESULT, or FULL; default: RESULT. :type newOrderRespType: str :param recvWindow: The number of milliseconds the request is valid for :type recvWindow: int :returns: WS response .. code-block:: python
{}
- async ws_create_test_sor_order(**params)[source]
Test new order creation using Smart Order Routing (SOR). Creates and validates a new order but does not send it into the matching engine.
- Parameters:
symbol (str) – required - Trading symbol, e.g. BTCUSDT
side (str) – required - Order side: BUY or SELL
type (str) – required - Order type: LIMIT or MARKET
quantity (float) – required - Order quantity
timeInForce (str) – required for LIMIT orders - Time in force: GTC, IOC, FOK
price (float) – required for LIMIT orders - Order price
newClientOrderId (str) – optional - Unique order ID. Generated automatically if not sent
strategyId (int) – optional - Arbitrary numeric value identifying the order within an order strategy
strategyType (int) – optional - Arbitrary numeric value identifying the order strategy. Values < 1000000 are reserved
selfTradePreventionMode (str) – optional - EXPIRE_TAKER, EXPIRE_MAKER, EXPIRE_BOTH, NONE
computeCommissionRates (bool) – optional - Calculate commission rates. Default: False
- Returns:
Websocket message
Without computeCommissionRates:
{ "id": "3a4437e2-41a3-4c19-897c-9cadc5dce8b6", "status": 200, "result": {}, "rateLimits": [ { "rateLimitType": "REQUEST_WEIGHT", "interval": "MINUTE", "intervalNum": 1, "limit": 6000, "count": 1 } ] }
With computeCommissionRates:
{ "id": "3a4437e2-41a3-4c19-897c-9cadc5dce8b6", "status": 200, "result": { "standardCommissionForOrder": { "maker": "0.00000112", "taker": "0.00000114" }, "taxCommissionForOrder": { "maker": "0.00000112", "taker": "0.00000114" }, "discount": { "enabledForAccount": true, "enabledForSymbol": true, "discountAsset": "BNB", "discount": "0.25" } }, "rateLimits": [...] }
- Notes:
SOR only supports LIMIT and MARKET orders
quoteOrderQty is not supported
Weight: 1 (without computeCommissionRates), 20 (with computeCommissionRates)
Data Source: Memory
- async ws_futures_account_balance(**params)[source]
Get current account information. https://developers.binance.com/docs/derivatives/usds-margined-futures/account/websocket-api/Futures-Account-Balance
- async ws_futures_account_position(**params)[source]
Get current position information. https://developers.binance.com/docs/derivatives/usds-margined-futures/trade/websocket-api/Position-Information
- async ws_futures_account_status(**params)[source]
Get current account information. User in single-asset/ multi-assets mode will see different value, see comments in response section for detail. https://developers.binance.com/docs/derivatives/usds-margined-futures/account/websocket-api/Account-Information
- async ws_futures_cancel_algo_order(**params)[source]
Cancel an active algo order.
https://developers.binance.com/docs/derivatives/usds-margined-futures/trade/websocket-api
- Parameters:
symbol (str) – required
algoId (int) – optional - Either algoId or clientAlgoId must be sent
clientAlgoId (str) – optional - Either algoId or clientAlgoId must be sent
recvWindow (int) – optional - the number of milliseconds the request is valid for
- Returns:
WS response
- async ws_futures_cancel_order(**params)[source]
cancel an order https://developers.binance.com/docs/derivatives/usds-margined-futures/trade/websocket-api/Cancel-Order
- async ws_futures_create_algo_order(**params)[source]
Send in a new algo order (conditional order).
https://developers.binance.com/docs/derivatives/usds-margined-futures/trade/websocket-api
- Parameters:
symbol (str) – required
side (str) – required - BUY or SELL
type (str) – required - STOP, TAKE_PROFIT, STOP_MARKET, TAKE_PROFIT_MARKET, TRAILING_STOP_MARKET
algoType (str) – required - Only support CONDITIONAL
positionSide (str) – optional - Default BOTH for One-way Mode; LONG or SHORT for Hedge Mode
timeInForce (str) – optional - IOC or GTC or FOK, default GTC
quantity (decimal) – optional - Cannot be sent with closePosition=true
price (decimal) – optional
triggerPrice (decimal) – optional - Used with STOP, STOP_MARKET, TAKE_PROFIT, TAKE_PROFIT_MARKET
workingType (str) – optional - triggerPrice triggered by: MARK_PRICE, CONTRACT_PRICE. Default CONTRACT_PRICE
priceMatch (str) – optional - only available for LIMIT/STOP/TAKE_PROFIT order
closePosition (bool) – optional - true or false; Close-All, used with STOP_MARKET or TAKE_PROFIT_MARKET
priceProtect (str) – optional - “TRUE” or “FALSE”, default “FALSE”
reduceOnly (str) – optional - “true” or “false”, default “false”
activationPrice (decimal) – optional - Used with TRAILING_STOP_MARKET orders
callbackRate (decimal) – optional - Used with TRAILING_STOP_MARKET orders, min 0.1, max 10
clientAlgoId (str) – optional - A unique id among open orders
selfTradePreventionMode (str) – optional - EXPIRE_TAKER, EXPIRE_MAKER, EXPIRE_BOTH; default NONE
goodTillDate (int) – optional - order cancel time for timeInForce GTD
newOrderRespType (str) – optional - “ACK”, “RESULT”, default “ACK”
recvWindow (int) – optional - the number of milliseconds the request is valid for
- Returns:
WS response
- async ws_futures_create_order(**params)[source]
Send in a new order https://developers.binance.com/docs/derivatives/usds-margined-futures/trade/websocket-api
- async ws_futures_edit_order(**params)[source]
Edit an order https://developers.binance.com/docs/derivatives/usds-margined-futures/trade/websocket-api/Modify-Order
- async ws_futures_get_all_tickers(**params)[source]
Latest price for a symbol or symbols https://developers.binance.com/docs/derivatives/usds-margined-futures/market-data/websocket-api/Symbol-Price-Ticker
- async ws_futures_get_order(**params)[source]
Get an order https://developers.binance.com/docs/derivatives/usds-margined-futures/trade/websocket-api/Query-Order
Note: Algo/conditional orders cannot be queried via websocket API
- async ws_futures_get_order_book(**params)[source]
Get the order book for a symbol https://developers.binance.com/docs/derivatives/usds-margined-futures/market-data/websocket-api
- async ws_futures_get_order_book_ticker(**params)[source]
Best price/qty on the order book for a symbol or symbols. https://developers.binance.com/docs/derivatives/usds-margined-futures/market-data/websocket-api/Symbol-Order-Book-Ticker
- async ws_futures_v2_account_balance(**params)[source]
Get current account information. https://developers.binance.com/docs/derivatives/usds-margined-futures/account/websocket-api#api-description
- async ws_futures_v2_account_position(**params)[source]
Get current position information(only symbol that has position or open orders will be return awaited). https://developers.binance.com/docs/derivatives/usds-margined-futures/trade/websocket-api/Position-Info-V2
- async ws_futures_v2_account_status(**params)[source]
Get current account information. User in single-asset/ multi-assets mode will see different value, see comments in response section for detail. https://developers.binance.com/docs/derivatives/usds-margined-futures/account/websocket-api/Account-Information-V2
- async ws_get_account(**params)[source]
Get current account information.
- Parameters:
omitZeroBalances (bool) – optional - When set to true, emits only the non-zero balances of an account. Default: false
recvWindow (int) – optional - The value cannot be greater than 60000
- Returns:
Websocket message
{ "makerCommission": 15, "takerCommission": 15, "buyerCommission": 0, "sellerCommission": 0, "canTrade": true, "canWithdraw": true, "canDeposit": true, "commissionRates": { "maker": "0.00150000", "taker": "0.00150000", "buyer": "0.00000000", "seller": "0.00000000" }, "brokered": false, "requireSelfTradePrevention": false, "preventSor": false, "updateTime": 1660801833000, "accountType": "SPOT", "balances": [ { "asset": "BNB", "free": "0.00000000", "locked": "0.00000000" }, { "asset": "BTC", "free": "1.34471120", "locked": "0.08600000" } ], "permissions": [ "SPOT" ], "uid": 354937868 }
- Notes:
Weight: 20
Data Source: Memory => Database
- async ws_get_account_rate_limits_orders(**params)[source]
Query your current unfilled order count for all intervals.
- Parameters:
recvWindow (int) – optional - The value cannot be greater than 60000
- Returns:
Websocket response
{ "result": [ { "rateLimitType": "ORDERS", "interval": "SECOND", "intervalNum": 10, "limit": 50, "count": 0 }, { "rateLimitType": "ORDERS", "interval": "DAY", "intervalNum": 1, "limit": 160000, "count": 0 } ], "id": "d3783d8d-f8d1-4d2c-b8a0-b7596af5a664" }
- Raises:
BinanceRequestException, BinanceAPIException
- Notes:
Weight: 40
Data Source: Memory
- async ws_get_aggregate_trades(**params)[source]
Get aggregate trades.
An aggregate trade represents one or more individual trades that fill at the same time, from the same taker order, with the same price.
- Parameters:
symbol (str) – STRING - Required - Trading symbol
fromId (int) – INT - Optional - Aggregate trade ID to begin at
startTime (int) – INT - Optional - Start time in milliseconds
endTime (int) – INT - Optional - End time in milliseconds
limit (int) – INT - Optional - Default 500; max 1000
- Returns:
API response
{ "id": "...", "status": 200, "result": [ { "a": 50000000, # Aggregate trade ID "p": "0.00274100", # Price "q": "57.19000000", # Quantity "f": 59120167, # First trade ID "l": 59120170, # Last trade ID "T": 1565877971222, # Timestamp "m": true, # Was the buyer the maker? "M": true # Was the trade the best price match? } ] }
- Raises:
BinanceRequestException, BinanceAPIException
- Notes:
If fromId is specified, return aggtrades with aggregate trade ID >= fromId.
Use fromId and limit to page through all aggtrades. - If startTime and/or endTime are specified, aggtrades are filtered by execution time (T). fromId cannot be used together with startTime and endTime. - If no condition is specified, the most recent aggregate trades are returned. - For real-time updates, consider using WebSocket Streams: <symbol>@aggTrade - For historical data, consider using data.binance.vision
Weight: 2 Data Source: Database
- async ws_get_all_orders(**params)[source]
Query information about all your orders – active, canceled, filled – filtered by time range.
- Parameters:
symbol (str) – STRING - Required
orderId (int) – optional - Order ID to begin at
startTime (int) – optional
endTime (int) – optional
limit (int) – optional - Default 500; max 1000
recvWindow (int) – optional - The value cannot be greater than 60000
- Returns:
Websocket response
{ "id": "734235c2-13d2-4574-be68-723e818c08f3", "status": 200, "result": [ { "symbol": "BTCUSDT", "orderId": 12569099453, "orderListId": -1, "clientOrderId": "4d96324ff9d44481926157", "price": "23416.10000000", "origQty": "0.00847000", "executedQty": "0.00847000", "cummulativeQuoteQty": "198.33521500", "status": "FILLED", "timeInForce": "GTC", "type": "LIMIT", "side": "SELL", "stopPrice": "0.00000000", "icebergQty": "0.00000000", "time": 1660801715639, "updateTime": 1660801717945, "isWorking": true, "workingTime": 1660801715639, "origQuoteOrderQty": "0.00000000", "selfTradePreventionMode": "NONE", "preventedMatchId": 0, // Only appears if order expired due to STP "preventedQuantity": "1.200000" // Only appears if order expired due to STP } ] }
- Notes:
Weight: 20
Data Source: Database
If startTime and/or endTime are specified, orderId is ignored
Orders are filtered by time of the last execution status update
If orderId is specified, return orders with order ID >= orderId
If no condition is specified, the most recent orders are returned
For some historical orders the cummulativeQuoteQty response field may be negative
The time between startTime and endTime can’t be longer than 24 hours
- async ws_get_allocations(**params)[source]
Get information about orders that were expired due to STP (Self-Trade Prevention).
- Parameters:
symbol (str) – STRING - Required - Trading symbol
preventedMatchId (int) – LONG - Optional - Get specific prevented match by ID
orderId (int) – LONG - Optional - Get prevented matches for specific order
fromPreventedMatchId (int) – LONG - Optional - Get prevented matches from this ID
limit (int) – INT - Optional - Default 500; max 1000
recvWindow (int) – LONG - Optional - The value cannot be greater than 60000
timestamp (int) – LONG - Required
- Returns:
API response
- Supported parameter combinations:
symbol + preventedMatchId
symbol + orderId
symbol + orderId + fromPreventedMatchId (limit defaults to 500)
symbol + orderId + fromPreventedMatchId + limit
- Weight:
2 if symbol is invalid
2 when querying by preventedMatchId
20 when querying by orderId
Data Source: Database
- async ws_get_avg_price(**params)[source]
Get current average price for a symbol.
- Parameters:
symbol (str) – STRING - Required - Trading symbol
- Returns:
Websocket message
Weight: 2
- async ws_get_commission_rates(**params)[source]
Get current account commission rates for a symbol.
- Parameters:
symbol (str) – STRING - Required - Trading symbol
recvWindow (int) – LONG - Optional - The value cannot be greater than 60000
- Returns:
API response dict with commission rates:
- {
“symbol”: “BTCUSDT”, “standardCommission”: { # Standard commission rates on trades
”maker”: “0.00000010”, “taker”: “0.00000020”, “buyer”: “0.00000030”, “seller”: “0.00000040”
}, “taxCommission”: { # Tax commission rates on trades
”maker”: “0.00000112”, “taker”: “0.00000114”, “buyer”: “0.00000118”, “seller”: “0.00000116”
}, “discount”: { # Discount on standard commissions when paying in BNB
”enabledForAccount”: true, “enabledForSymbol”: true, “discountAsset”: “BNB”, “discount”: “0.75000000” # Standard commission reduction rate when paying in BNB
}
}
- Raises:
BinanceRequestException, BinanceAPIException
Weight: 20
Data Source: Database
- async ws_get_exchange_info(**params)[source]
Query current exchange trading rules, rate limits, and symbol information.
- Parameters:
symbol – str - Filter by single symbol (optional)
symbols – list - Filter by multiple symbols (optional)
permissions – list or str - Filter symbols by permissions (optional)
- Returns:
API response containing exchange information including: - Rate limits - Exchange filters - Symbol information including:
Status
Base/quote assets
Order types allowed
Filters (price, lot size, etc)
Trading permissions
Self-trade prevention modes
Example response: {
”timezone”: “UTC”, “serverTime”: 1655969291181, “rateLimits”: [
- {
“rateLimitType”: “REQUEST_WEIGHT”, “interval”: “MINUTE”, “intervalNum”: 1, “limit”: 6000
], “exchangeFilters”: [], “symbols”: [
- {
“symbol”: “BTCUSDT”, “status”: “TRADING”, “baseAsset”: “BTC”, “baseAssetPrecision”: 8, …
}
]
}
- Raises:
BinanceRequestException, BinanceAPIException
- Notes:
Only one of symbol, symbols, permissions parameters can be specified
Without parameters, displays all symbols with [“SPOT”, “MARGIN”, “LEVERAGED”] permissions
To list all active symbols, explicitly request all permissions
Permissions accepts either a list or single permission name (e.g. “SPOT”)
Weight: 20 Data Source: Memory
- async ws_get_historical_trades(**params)[source]
Get historical trades.
- Parameters:
symbol (str) – STRING - Required - Trading symbol
fromId (int) – INT - Optional - Trade ID to begin at
limit (int) – INT - Optional - Default 500; max 1000
- Returns:
Websocket message
{ "id": "cffc9c7d-4efc-4ce0-b587-6b87448f052a", "result": [ { "id": 0, # Trade ID "price": "0.00005000", # Price "qty": "40.00000000", # Quantity "quoteQty": "0.00200000", # Quote quantity "time": 1500004800376, # Trade time "isBuyerMaker": true, # Was the buyer the maker? "isBestMatch": true # Was this the best price match? } ] }
- Raises:
BinanceRequestException, BinanceAPIException
- Notes:
If fromId is not specified, the most recent trades are returned
Weight: 25 Data Source: Database
- async ws_get_klines(**params)[source]
Get klines (candlestick bars).
Klines are uniquely identified by their open & close time.
- Parameters:
symbol (str) – STRING - Required - Trading symbol
interval (str) – ENUM - Required - Kline interval
startTime (int) – INT - Optional - Start time in milliseconds
endTime (int) – INT - Optional - End time in milliseconds
timeZone (str) – STRING - Optional - Default: 0 (UTC)
limit (int) – INT - Optional - Default 500; max 1000
- Supported kline intervals:
seconds: 1s
minutes: 1m, 3m, 5m, 15m, 30m
hours: 1h, 2h, 4h, 6h, 8h, 12h
days: 1d, 3d
weeks: 1w
months: 1M
- Notes:
If startTime/endTime not specified, returns most recent klines
- Supported timeZone values:
Hours and minutes (e.g. “-1:00”, “05:45”)
Only hours (e.g. “0”, “8”, “4”)
Accepted range is strictly [-12:00 to +14:00] inclusive
If timeZone provided, kline intervals interpreted in that timezone instead of UTC
startTime and endTime always interpreted in UTC, regardless of timeZone
For real-time updates, consider using WebSocket Streams: <symbol>@kline_<interval>
For historical data, consider using data.binance.vision
Weight: 2 Data Source: Database
- Returns:
API response
{ "id": "1dbbeb56-8eea-466a-8f6e-86bdcfa2fc0b", "status": 200, "result": [ [ 1655971200000, # Kline open time "0.01086000", # Open price "0.01086600", # High price "0.01083600", # Low price "0.01083800", # Close price "2290.53800000", # Volume 1655974799999, # Kline close time "24.85074442", # Quote asset volume 2283, # Number of trades "1171.64000000", # Taker buy base asset volume "12.71225884", # Taker buy quote asset volume "0" # Unused field, ignore ] ] }
- Raises:
BinanceRequestException, BinanceAPIException
- async ws_get_my_trades(**params)[source]
Query information about your trades, filtered by time range.
- Parameters:
symbol (str) – STRING - Required
orderId (int) – optional - Get trades for a specific order
startTime (int) – optional
endTime (int) – optional
fromId (int) – optional - Trade ID to fetch from
limit (int) – optional - Default 500; max 1000
recvWindow (int) – optional - The value cannot be greater than 60000
- Returns:
Websocket response
[ { "symbol": "BTCUSDT", "id": 1650422481, "orderId": 12569099453, "orderListId": -1, "price": "23416.10000000", "qty": "0.00635000", "quoteQty": "148.69223500", "commission": "0.00000000", "commissionAsset": "BNB", "time": 1660801715793, "isBuyer": false, "isMaker": true, "isBestMatch": true } ]
- Notes:
Weight: 20
Data Source: Memory => Database
If fromId is specified, return trades with trade ID >= fromId
If startTime and/or endTime are specified, trades are filtered by execution time (time)
fromId cannot be used together with startTime and endTime
If orderId is specified, only trades related to that order are returned
startTime and endTime cannot be used together with orderId
If no condition is specified, the most recent trades are returned
The time between startTime and endTime can’t be longer than 24 hours
- async ws_get_oco_open_orders(**params)[source]
Query current open OCO (One-Cancels-the-Other) order lists.
- Parameters:
recvWindow (int) – optional - Number of milliseconds after timestamp the request is valid for. Default 5000, max 60000
apiKey (str) – required - Your API key
signature (str) – required - HMAC SHA256 signature
timestamp (int) – required - Current timestamp in milliseconds
- Returns:
API response in JSON format with open OCO orders
- {
“id”: “c5899911-d3f5-47b3-9b67-4c1342f2a7e1”, “status”: 200, “result”: [
- {
“orderListId”: 1274512, “contingencyType”: “OCO”, “listStatusType”: “EXEC_STARTED”, “listOrderStatus”: “EXECUTING”, “listClientOrderId”: “08985fedd9ea2cf6b28996”, “transactionTime”: 1660801713793, “symbol”: “BTCUSDT”, “orders”: [
- {
“symbol”: “BTCUSDT”, “orderId”: 12569138901, “clientOrderId”: “BqtFCj5odMoWtSqGk2X9tU”
}, {
”symbol”: “BTCUSDT”, “orderId”: 12569138902, “clientOrderId”: “jLnZpj5enfMXTuhKB1d0us”
}
]
}
], “rateLimits”: [
- {
“rateLimitType”: “REQUEST_WEIGHT”, “interval”: “MINUTE”, “intervalNum”: 1, “limit”: 6000, “count”: 10
}
]
}
- Raises:
BinanceRequestException, BinanceAPIException
Weight: 10 Data Source: Memory
- async ws_get_oco_order(**params)[source]
Query information about a specific OCO order list.
- Parameters:
orderListId – int - The identifier for the OCO order list (optional)
origClientOrderId – str - The client-specified OCO order list ID (optional)
- Returns:
API response containing OCO order list information including:
- Notes:
Either orderListId or origClientOrderId must be provided
Weight: 4
Data Source: Database
- async ws_get_open_orders(**params)[source]
Get all open orders on a symbol or all symbols. https://developers.binance.com/docs/binance-spot-api-docs/testnet/web-socket-api/public-api-requests#current-open-orders-user_data
- Parameters:
symbol (str) – optional - Symbol to get open orders for
recvWindow (int) – optional - The value cannot be greater than 60000
- Returns:
API response
Response format: [
- {
“symbol”: “BTCUSDT”, “orderId”: 12569099453, “orderListId”: -1, “clientOrderId”: “4d96324ff9d44481926157”, “price”: “23416.10000000”, “origQty”: “0.00847000”, “executedQty”: “0.00720000”, “cummulativeQuoteQty”: “168.59532000”, “status”: “PARTIALLY_FILLED”, “timeInForce”: “GTC”, “type”: “LIMIT”, “side”: “SELL”, “stopPrice”: “0.00000000”, “icebergQty”: “0.00000000”, “time”: 1660801715639, “updateTime”: 1660801717945, “isWorking”: true, “workingTime”: 1660801715639, “origQuoteOrderQty”: “0.00000000”, “selfTradePreventionMode”: “NONE”
}
]
Weight: Adjusted based on parameters: - With symbol: 6 - Without symbol: 12
- async ws_get_order(**params)[source]
Check an order’s status. Either orderId or origClientOrderId must be sent. https://binance-docs.github.io/apidocs/websocket_api/en/#query-order-user_data :param symbol: required :type symbol: str :param orderId: The unique order id :type orderId: int :param origClientOrderId: optional :type origClientOrderId: str :param recvWindow: the number of milliseconds the request is valid for :type recvWindow: int
- async ws_get_order_book(**params)[source]
Get current order book for a symbol.
Note that this request returns limited market depth. If you need to continuously monitor order book updates, consider using WebSocket Streams: - <symbol>@depth<levels> - <symbol>@depth
You can use depth request together with <symbol>@depth streams to maintain a local order book.
- Parameters:
symbol (str) – STRING - Required - Trading symbol
limit (int) – INT - Optional - Default 100; max 5000
- Returns:
Websocket message
- {
“lastUpdateId”: 2731179239, “bids”: [ // Bid levels sorted from highest to lowest price
- [
“0.01379900”, // Price level “3.43200000” // Quantity
], “asks”: [ // Ask levels sorted from lowest to highest price
- [
“0.01380000”, // Price level “5.91700000” // Quantity
]
}
- Weight: Adjusted based on limit:
1-100: 5
101-500: 25
501-1000: 50
1001-5000: 250
Data Source: Memory
- async ws_get_orderbook_ticker(**params)[source]
Get the best price/quantity on the order book for a symbol or symbols.
- Parameters:
symbol (str) – STRING - Optional - Query ticker of a single symbol
symbols (list) – ARRAY of STRING - Optional - Query ticker for multiple symbols
- Returns:
Websocket response
With symbol parameter: {
”symbol”: “BNBBTC”, “bidPrice”: “0.01358000”, “bidQty”: “0.95200000”, “askPrice”: “0.01358100”, “askQty”: “11.91700000”
}
With symbols parameter: [
- {
“symbol”: “BNBBTC”, “bidPrice”: “0.01358000”, “bidQty”: “0.95200000”, “askPrice”: “0.01358100”, “askQty”: “11.91700000”
}, {
”symbol”: “BTCUSDT”, “bidPrice”: “23440.90000000”, “bidQty”: “0.00200000”, “askPrice”: “23440.91000000”, “askQty”: “0.00200000”
}
]
- Weight:
2 for a single symbol
4 for up to 100 symbols
40 for 101 or more symbols
- async ws_get_prevented_matches(**params)[source]
Displays the list of orders that were expired due to STP (Self-Trade Prevention).
- Parameters:
symbol (str) – STRING - Required
preventedMatchId (int) – optional - Get specific prevented match by ID
orderId (int) – optional - Get prevented matches for specific order
fromPreventedMatchId (int) – optional - Get prevented matches from this ID
limit (int) – optional - Default 500; max 1000
recvWindow (int) – optional - The value cannot be greater than 60000
- Returns:
Websocket response
- Supported parameter combinations:
symbol + preventedMatchId
symbol + orderId
symbol + orderId + fromPreventedMatchId (limit defaults to 500)
symbol + orderId + fromPreventedMatchId + limit
- Weight:
2 if symbol is invalid
2 when querying by preventedMatchId
20 when querying by orderId
Data Source: Database
- async ws_get_recent_trades(**params)[source]
Get recent trades for a symbol.
If you need access to real-time trading activity, please consider using WebSocket Streams: - <symbol>@trade
- Parameters:
symbol (str) – STRING - Required - Trading symbol
limit (int) – INT - Optional - Default 500; max 1000
- Returns:
API response
- Raises:
BinanceRequestException, BinanceAPIException
Weight: 25 Data Source: Memory
- async ws_get_symbol_ticker(**params)[source]
Get latest price for a symbol or symbols.
- Parameters:
symbol (str) – STRING - Optional - Query ticker of a single symbol
symbols (list) – ARRAY of STRING - Optional - Query ticker for multiple symbols
- Returns:
Websocket message
- With symbol parameter:
- {
“symbol”: “BNBBTC”, “price”: “0.01361000”
}
With symbols parameter: [
- {
“symbol”: “BNBBTC”, “price”: “0.01361000”
}, {
“symbol”: “BTCUSDT”, “price”: “23440.91000000”
}
]
- Weight:
1 for a single symbol
2 for up to 20 symbols
40 for 21 to 100 symbols
40 for all symbols
- async ws_get_symbol_ticker_window(**params)[source]
Get rolling window price change statistics.
- Parameters:
symbol (str) – STRING - Optional - Query ticker of a single symbol
symbols (list) – ARRAY of STRING - Optional - Query ticker for multiple symbols
windowSize (str) – STRING - Required - Supported windowSize values: - 1h, 2h, 4h, 6h, 12h - 1d, 2d, 3d, 4d, 5d, 6d, 7d, 14d, 30d
type (str) – ENUM - Optional - FULL (default) or MINI
- Returns:
Websocket message
With symbol parameter: .. code-block:: python
- {
“symbol”: “BTCUSDT”, “priceChange”: “-83.13000000”, # Absolute price change “priceChangePercent”: “-0.317”, # Relative price change in percent “weightedAvgPrice”: “26234.58803036”, # quoteVolume / volume “openPrice”: “26304.80000000”, “highPrice”: “26397.46000000”, “lowPrice”: “26088.34000000”, “lastPrice”: “26221.67000000”, “volume”: “18495.35066000”, # Volume in base asset “quoteVolume”: “485217905.04210480”, # Volume in quote asset “openTime”: 1695686400000, “closeTime”: 1695772799999, “firstId”: 3220151555, # Trade ID of first trade in the interval “lastId”: 3220849281, # Trade ID of last trade in the interval “count”: 697727 # Number of trades in the interval
}
With symbols parameter: .. code-block:: python
- [
- {
# Same fields as above
}, {
# Same fields as above for next symbol
}
]
For MINI type response: .. code-block:: python
- {
“symbol”: “BTCUSDT”, “openPrice”: “26304.80000000”, “highPrice”: “26397.46000000”, “lowPrice”: “26088.34000000”, “lastPrice”: “26221.67000000”, “volume”: “18495.35066000”, “quoteVolume”: “485217905.04210480”, “openTime”: 1695686400000, “closeTime”: 1695772799999, “firstId”: 3220151555, “lastId”: 3220849281, “count”: 697727
}
- Weight:
4 for each requested symbol
Weight caps at 200 once number of symbols > 50
- async ws_get_ticker(**params)[source]
Get 24-hour rolling window price change statistics.
- Parameters:
symbol (str) – STRING - Optional - Query ticker for a single symbol
symbols (list) – ARRAY of STRING - Optional - Query ticker for multiple symbols
type (str) – ENUM - Optional - Ticker type: FULL (default) or MINI
- Note:
symbol and symbols cannot be used together
If no symbol is specified, returns information about all symbols currently trading on the exchange
- Weight:
Adjusted based on the number of requested symbols: - 1-20 symbols: 2 - 21-100 symbols: 40 - 101 or more symbols: 80 - all symbols: 80
- Returns:
Websocket message
For a single symbol with type=FULL: .. code-block:: python
- {
“symbol”: “BNBBTC”, “priceChange”: “0.00013900”, # Absolute price change “priceChangePercent”: “1.020”, # Relative price change in percent “weightedAvgPrice”: “0.01382453”, # Quote volume divided by volume “prevClosePrice”: “0.01362800”, # Previous day’s close price “lastPrice”: “0.01376700”, # Latest price “lastQty”: “1.78800000”, # Latest quantity “bidPrice”: “0.01376700”, # Best bid price “bidQty”: “4.64600000”, # Best bid quantity “askPrice”: “0.01376800”, # Best ask price “askQty”: “14.31400000”, # Best ask quantity “openPrice”: “0.01362800”, # Open price 24 hours ago “highPrice”: “0.01414900”, # Highest price in the last 24 hours “lowPrice”: “0.01346600”, # Lowest price in the last 24 hours “volume”: “69412.40500000”, # Trading volume in base asset “quoteVolume”: “959.59411487”, # Trading volume in quote asset “openTime”: 1660014164909, # Open time for 24hr rolling window “closeTime”: 1660100564909, # Close time for 24hr rolling window “firstId”: 194696115, # First trade ID “lastId”: 194968287, # Last trade ID “count”: 272173 # Number of trades
}
For a single symbol with type=MINI: .. code-block:: python
- {
“symbol”: “BNBBTC”, “openPrice”: “0.01362800”, “highPrice”: “0.01414900”, “lowPrice”: “0.01346600”, “lastPrice”: “0.01376700”, “volume”: “69412.40500000”, “quoteVolume”: “959.59411487”, “openTime”: 1660014164909, “closeTime”: 1660100564909, “firstId”: 194696115, “lastId”: 194968287, “count”: 272173
}
- async ws_get_time(**params)[source]
Test connectivity to the WebSocket API and get the current server time.
- Returns:
API response with server time
- {
“id”: “187d3cb2-942d-484c-8271-4e2141bbadb1”, “status”: 200, “result”: {
”serverTime”: 1656400526260
}, “rateLimits”: [
- {
“rateLimitType”: “REQUEST_WEIGHT”, “interval”: “MINUTE”, “intervalNum”: 1, “limit”: 6000, “count”: 1
}
]
}
Weight: 1 Data Source: Memory
- async ws_get_trading_day_ticker(**params)[source]
Price change statistics for a trading day.
- Parameters:
symbol (str) – STRING - Optional - Query ticker of a single symbol
symbols (list) – ARRAY of STRING - Optional - Query ticker for multiple symbols
timeZone (str) – STRING - Optional - Default: 0 (UTC) Supported values: - Hours and minutes (e.g. “-1:00”, “05:45”) - Only hours (e.g. “0”, “8”, “4”) - Accepted range is strictly [-12:00 to +14:00] inclusive
type (str) – ENUM - Optional - FULL (default) or MINI
- Returns:
Websocket message
Response FULL type example: {
“symbol”: “BTCUSDT”, “priceChange”: “-83.13000000”, # Absolute price change “priceChangePercent”: “-0.317”, # Relative price change in percent “weightedAvgPrice”: “26234.58803036”, # quoteVolume / volume “openPrice”: “26304.80000000”, “highPrice”: “26397.46000000”, “lowPrice”: “26088.34000000”, “lastPrice”: “26221.67000000”, “volume”: “18495.35066000”, # Volume in base asset “quoteVolume”: “485217905.04210480”, “openTime”: 1695686400000, “closeTime”: 1695772799999, “firstId”: 3220151555, “lastId”: 3220849281, “count”: 697727
}
Response MINI type example: {
“symbol”: “BTCUSDT”, “openPrice”: “26304.80000000”, “highPrice”: “26397.46000000”, “lowPrice”: “26088.34000000”, “lastPrice”: “26221.67000000”, “volume”: “18495.35066000”, # Volume in base asset “quoteVolume”: “485217905.04210480”, # Volume in quote asset “openTime”: 1695686400000, “closeTime”: 1695772799999, “firstId”: 3220151555, # Trade ID of the first trade in the interval “lastId”: 3220849281, # Trade ID of the last trade in the interval “count”: 697727 # Number of trades in the interval
}
- Weight:
4 for each requested symbol
Weight caps at 200 once number of symbols > 50
- async ws_get_uiKlines(**params)[source]
Get klines (candlestick bars) optimized for presentation.
This request is similar to klines, having the same parameters and response. uiKlines return modified kline data, optimized for presentation of candlestick charts.
- Parameters:
symbol (str) – STRING - Required - Trading symbol
interval (str) – ENUM - Required - Kline interval
startTime (int) – INT - Optional - Start time in milliseconds
endTime (int) – INT - Optional - End time in milliseconds
timeZone (str) – STRING - Optional - Default: 0 (UTC)
limit (int) – INT - Optional - Default 500; max 1000
- Supported kline intervals:
seconds: 1s
minutes: 1m, 3m, 5m, 15m, 30m
hours: 1h, 2h, 4h, 6h, 8h, 12h
days: 1d, 3d
weeks: 1w
months: 1M
- Notes:
If startTime/endTime not specified, returns most recent klines
- Supported timeZone values:
Hours and minutes (e.g. “-1:00”, “05:45”)
Only hours (e.g. “0”, “8”, “4”)
Accepted range is strictly [-12:00 to +14:00] inclusive
If timeZone provided, kline intervals are interpreted in that timezone instead of UTC
startTime and endTime are always interpreted in UTC, regardless of timeZone
- Returns:
API response
{ "id": "b137468a-fb20-4c06-bd6b-625148eec958", "result": [ [ 1655971200000, # Kline open time "0.01086000", # Open price "0.01086600", # High price "0.01083600", # Low price "0.01083800", # Close price "2290.53800000", # Volume 1655974799999, # Kline close time "24.85074442", # Quote asset volume 2283, # Number of trades "1171.64000000", # Taker buy base asset volume "12.71225884", # Taker buy quote asset volume "0" # Unused field, ignore ] ] }
- Raises:
BinanceRequestException, BinanceAPIException
- async ws_order_limit(timeInForce='GTC', **params)[source]
Send in a new limit order Any order with an icebergQty MUST have timeInForce set to GTC. :param symbol: required :type symbol: str :param side: required :type side: str :param quantity: required :type quantity: decimal :param price: required :type price: str :param timeInForce: default Good till cancelled :type timeInForce: str :param newClientOrderId: A unique id for the order. Automatically generated if not sent. :type newClientOrderId: str :param icebergQty: Used with LIMIT, STOP_LOSS_LIMIT, and TAKE_PROFIT_LIMIT to create an iceberg order. :type icebergQty: decimal :param newOrderRespType: Set the response JSON. ACK, RESULT, or FULL; default: RESULT. :type newOrderRespType: str :param recvWindow: the number of milliseconds the request is valid for :type recvWindow: int :returns: WS response See order endpoint for full response options
- async ws_order_limit_buy(timeInForce='GTC', **params)[source]
Send in a new limit buy order Any order with an icebergQty MUST have timeInForce set to GTC. :param symbol: required :type symbol: str :param quantity: required :type quantity: decimal :param price: required :type price: str :param timeInForce: default Good till cancelled :type timeInForce: str :param newClientOrderId: A unique id for the order. Automatically generated if not sent. :type newClientOrderId: str :param stopPrice: Used with stop orders :type stopPrice: decimal :param icebergQty: Used with iceberg orders :type icebergQty: decimal :param newOrderRespType: Set the response JSON. ACK, RESULT, or FULL; default: RESULT. :type newOrderRespType: str :param recvWindow: the number of milliseconds the request is valid for :type recvWindow: int :returns: WS response See order endpoint for full response options
- async ws_order_limit_sell(timeInForce='GTC', **params)[source]
Send in a new limit sell order :param symbol: required :type symbol: str :param quantity: required :type quantity: decimal :param price: required :type price: str :param timeInForce: default Good till cancelled :type timeInForce: str :param newClientOrderId: A unique id for the order. Automatically generated if not sent. :type newClientOrderId: str :param stopPrice: Used with stop orders :type stopPrice: decimal :param icebergQty: Used with iceberg orders :type icebergQty: decimal :param newOrderRespType: Set the response JSON. ACK, RESULT, or FULL; default: RESULT. :type newOrderRespType: str :param recvWindow: the number of milliseconds the request is valid for :type recvWindow: int :returns: WS response See order endpoint for full response options
- async ws_order_market(**params)[source]
Send in a new market order :param symbol: required :type symbol: str :param side: required :type side: str :param quantity: required :type quantity: decimal :param quoteOrderQty: amount the user wants to spend (when buying) or receive (when selling)
of the quote asset
- Parameters:
newClientOrderId (str) – A unique id for the order. Automatically generated if not sent.
newOrderRespType (str) – Set the response JSON. ACK, RESULT, or FULL; default: RESULT.
recvWindow (int) – the number of milliseconds the request is valid for
- Returns:
WS response
See order endpoint for full response options
- async ws_order_market_buy(**params)[source]
Send in a new market buy order :param symbol: required :type symbol: str :param quantity: required :type quantity: decimal :param quoteOrderQty: the amount the user wants to spend of the quote asset :type quoteOrderQty: decimal :param newClientOrderId: A unique id for the order. Automatically generated if not sent. :type newClientOrderId: str :param newOrderRespType: Set the response JSON. ACK, RESULT, or FULL; default: RESULT. :type newOrderRespType: str :param recvWindow: the number of milliseconds the request is valid for :type recvWindow: int :returns: WS response See order endpoint for full response options
- async ws_order_market_sell(**params)[source]
Send in a new market sell order :param symbol: required :type symbol: str :param quantity: required :type quantity: decimal :param quoteOrderQty: the amount the user wants to receive of the quote asset :type quoteOrderQty: decimal :param newClientOrderId: A unique id for the order. Automatically generated if not sent. :type newClientOrderId: str :param newOrderRespType: Set the response JSON. ACK, RESULT, or FULL; default: RESULT. :type newOrderRespType: str :param recvWindow: the number of milliseconds the request is valid for :type recvWindow: int :returns: WS response See order endpoint for full response options
- async ws_ping(**params)[source]
Test connectivity to the WebSocket API.
- Returns:
API response
- {
“id”: “922bcc6e-9de8-440d-9e84-7c80933a8d0d”, “status”: 200, “result”: {}, “rateLimits”: [
- {
“rateLimitType”: “REQUEST_WEIGHT”, “interval”: “MINUTE”, “intervalNum”: 1, “limit”: 6000, “count”: 1
}
]
}
Weight: 1
Websockets module
- class binance.ws.streams.BinanceSocketManager(client: AsyncClient, user_timeout=300, max_queue_size: int = 100, verbose: bool = False)[source]
Bases:
object- DSTREAM_DEMO_URL = 'wss://dstream.binancefuture.com/'
- DSTREAM_TESTNET_URL = 'wss://dstream.binancefuture.com/'
- DSTREAM_URL = 'wss://dstream.binance.{}/'
- FSTREAM_DEMO_URL = 'wss://fstream.binancefuture.com/'
- FSTREAM_TESTNET_URL = 'wss://fstream.binancefuture.com/'
- FSTREAM_URL = 'wss://fstream.binance.{}/'
- STREAM_DEMO_URL = 'wss://demo-stream.binance.com/'
- STREAM_TESTNET_URL = 'wss://stream.testnet.binance.vision/'
- STREAM_URL = 'wss://stream.binance.{}:9443/'
- WEBSOCKET_DEPTH_10 = '10'
- WEBSOCKET_DEPTH_20 = '20'
- WEBSOCKET_DEPTH_5 = '5'
- __init__(client: AsyncClient, user_timeout=300, max_queue_size: int = 100, verbose: bool = False)[source]
Initialise the BinanceSocketManager
- Parameters:
client (binance.AsyncClient) – Binance API client
user_timeout – Timeout for user socket in seconds
max_queue_size (int) – Max size of the websocket queue, defaults to 100
verbose (bool) – Enable verbose logging for WebSocket connections
- aggtrade_futures_socket(symbol: str, futures_type: FuturesType = FuturesType.USD_M)[source]
Start a websocket for aggregate symbol trade data for the futures stream
- Parameters:
symbol – required
futures_type – use USD-M or COIN-M futures default USD-M
- Returns:
connection key string if successful, False otherwise
Message Format
{ "e": "aggTrade", // Event type "E": 123456789, // Event time "s": "BTCUSDT", // Symbol "a": 5933014, // Aggregate trade ID "p": "0.001", // Price "q": "100", // Quantity "f": 100, // First trade ID "l": 105, // Last trade ID "T": 123456785, // Trade time "m": true, // Is the buyer the market maker? }
- aggtrade_socket(symbol: str)[source]
Start a websocket for symbol trade data
- Parameters:
symbol (str) – required
- Returns:
connection key string if successful, False otherwise
Message Format
{ "e": "aggTrade", # event type "E": 1499405254326, # event time "s": "ETHBTC", # symbol "a": 70232, # aggregated tradeid "p": "0.10281118", # price "q": "8.15632997", # quantity "f": 77489, # first breakdown trade id "l": 77489, # last breakdown trade id "T": 1499405254324, # trade time "m": false, # whether buyer is a maker "M": true # can be ignored }
- all_mark_price_socket(fast: bool = True, futures_type: FuturesType = FuturesType.USD_M)[source]
Start a websocket for all futures mark price data By default all symbols are included in an array. https://binance-docs.github.io/apidocs/futures/en/#mark-price-stream-for-all-market :param fast: use faster or 1s default :param futures_type: use USD-M or COIN-M futures default USD-M :returns: connection key string if successful, False otherwise Message Format .. code-block:: python
- [
- {
“e”: “markPriceUpdate”, // Event type “E”: 1562305380000, // Event time “s”: “BTCUSDT”, // Symbol “p”: “11185.87786614”, // Mark price “r”: “0.00030000”, // Funding rate “T”: 1562306400000 // Next funding time
}
]
- all_ticker_futures_socket(channel: str = '!bookTicker', futures_type: FuturesType = FuturesType.USD_M)[source]
Start a websocket for all ticker data By default all markets are included in an array.
https://binance-docs.github.io/apidocs/futures/en/#all-book-tickers-stream
https://binance-docs.github.io/apidocs/futures/en/#all-market-tickers-streams
- Parameters:
channel – optional channel type, default ‘!bookTicker’, but ‘!ticker@arr’ is also available
- Param:
futures_type: use USD-M or COIN-M futures default USD-M
- Returns:
connection key string if successful, False otherwise
Message Format .. code-block:: python
- [
- {
“u”:400900217, // order book updateId “s”:”BNBUSDT”, // symbol “b”:”25.35190000”, // best bid price “B”:”31.21000000”, // best bid qty “a”:”25.36520000”, // best ask price “A”:”40.66000000” // best ask qty
}
]
- book_ticker_socket()[source]
Start a websocket for the best bid or ask’s price or quantity for all symbols.
- Returns:
connection key string if successful, False otherwise
Message Format
{ // Same as <symbol>@bookTicker payload }
- coin_futures_socket()[source]
Start a websocket for coin futures data
- Returns:
connection key string if successful, False otherwise
Message Format - see Binance API docs for all types
- coin_futures_user_socket()[source]
Start a websocket for coin futures user data
https://binance-docs.github.io/apidocs/delivery/en/#user-data-streams
- Returns:
connection key string if successful, False otherwise
Message Format - see Binanace API docs for all types
- depth_socket(symbol: str, depth: str | None = None, interval: int | None = None)[source]
Start a websocket for symbol market depth returning either a diff or a partial book
- Parameters:
symbol (str) – required
depth (str) – optional Number of depth entries to return, default None. If passed returns a partial book instead of a diff
interval (int) – optional interval for updates, default None. If not set, updates happen every second. Must be 0, None (1s) or 100 (100ms)
- Returns:
connection key string if successful, False otherwise
Partial Message Format
{ "lastUpdateId": 160, # Last update ID "bids": [ # Bids to be updated [ "0.0024", # price level to be updated "10", # quantity [] # ignore ] ], "asks": [ # Asks to be updated [ "0.0026", # price level to be updated "100", # quantity [] # ignore ] ] }
Diff Message Format
{ "e": "depthUpdate", # Event type "E": 123456789, # Event time "s": "BNBBTC", # Symbol "U": 157, # First update ID in event "u": 160, # Final update ID in event "b": [ # Bids to be updated [ "0.0024", # price level to be updated "10", # quantity [] # ignore ] ], "a": [ # Asks to be updated [ "0.0026", # price level to be updated "100", # quantity [] # ignore ] ] }
- futures_coin_ticker_socket()[source]
Start a websocket for all ticker data
By default all markets are included in an array.
https://binance-docs.github.io/apidocs/delivery/en/#all-market-tickers-streams
- Returns:
connection key string if successful, False otherwise
Message Format
[ { "e": "24hrTicker", // Event type "E": 123456789, // Event time "s": "BTCUSDT", // Symbol "p": "0.0015", // Price change "P": "250.00", // Price change percent "w": "0.0018", // Weighted average price "c": "0.0025", // Last price "Q": "10", // Last quantity "o": "0.0010", // Open price "h": "0.0025", // High price "l": "0.0010", // Low price "v": "10000", // Total traded base asset volume "q": "18", // Total traded quote asset volume "O": 0, // Statistics open time "C": 86400000, // Statistics close time "F": 0, // First trade ID "L": 18150, // Last trade Id "n": 18151 // Total number of trades } ]
- futures_depth_socket(symbol: str, depth: str = '10', futures_type=FuturesType.USD_M)[source]
Subscribe to a futures depth data stream
https://binance-docs.github.io/apidocs/futures/en/#partial-book-depth-streams
- Parameters:
symbol (str) – required
depth (str) – optional Number of depth entries to return, default 10.
futures_type – use USD-M or COIN-M futures default USD-M
- futures_multiplex_socket(streams: List[str], futures_type: FuturesType = FuturesType.USD_M, category: str = 'market')[source]
Start a multiplexed socket using a list of socket names. User stream sockets can not be included.
Symbols in socket name must be lowercase i.e bnbbtc@aggTrade, neobtc@ticker
Combined stream events are wrapped as follows: {“stream”:”<streamName>”,”data”:<rawPayload>}
https://github.com/binance-exchange/binance-official-api-docs/blob/master/web-socket-streams.md
- Parameters:
streams – list of stream names in lower case
futures_type – use USD-M or COIN-M futures default USD-M
category – stream category for USD-M futures URL routing (“public”, “market”, or “private”), default “market”
- Returns:
connection key string if successful, False otherwise
Message Format - see Binance API docs for all types
- futures_rpi_depth_socket(symbol: str, futures_type=FuturesType.USD_M)[source]
Subscribe to a futures RPI (Retail Price Improvement) depth data stream
RPI orders are included and aggregated in the stream. Crossed price levels are hidden. Updates every 500ms.
- Parameters:
symbol (str) – required
futures_type – use USD-M or COIN-M futures default USD-M
- futures_socket()[source]
Start a websocket for futures data
- Returns:
connection key string if successful, False otherwise
Message Format - see Binance API docs for all types
- futures_ticker_socket()[source]
Start a websocket for all ticker data
By default all markets are included in an array.
https://binance-docs.github.io/apidocs/futures/en/#all-market-tickers-streams
- Returns:
connection key string if successful, False otherwise
Message Format
[ { "e": "24hrTicker", // Event type "E": 123456789, // Event time "s": "BTCUSDT", // Symbol "p": "0.0015", // Price change "P": "250.00", // Price change percent "w": "0.0018", // Weighted average price "c": "0.0025", // Last price "Q": "10", // Last quantity "o": "0.0010", // Open price "h": "0.0025", // High price "l": "0.0010", // Low price "v": "10000", // Total traded base asset volume "q": "18", // Total traded quote asset volume "O": 0, // Statistics open time "C": 86400000, // Statistics close time "F": 0, // First trade ID "L": 18150, // Last trade Id "n": 18151 // Total number of trades } ]
- futures_user_socket()[source]
Start a websocket for futures user data
https://binance-docs.github.io/apidocs/futures/en/#user-data-streams
- Returns:
connection key string if successful, False otherwise
Message Format - see Binanace API docs for all types
- index_price_socket(symbol: str, fast: bool = True)[source]
Start a websocket for a symbol’s futures mark price https://binance-docs.github.io/apidocs/delivery/en/#index-price-stream :param symbol: required :param fast: use faster or 1s default :returns: connection key string if successful, False otherwise
Message Format .. code-block:: python
- {
“e”: “indexPriceUpdate”, // Event type “E”: 1591261236000, // Event time “i”: “BTCUSD”, // Pair “p”: “9636.57860000”, // Index Price
}
- individual_symbol_ticker_futures_socket(symbol: str, futures_type: FuturesType = FuturesType.USD_M)[source]
Start a futures websocket for a single symbol’s ticker data https://binance-docs.github.io/apidocs/futures/en/#individual-symbol-ticker-streams :param symbol: required :type symbol: str :param futures_type: use USD-M or COIN-M futures default USD-M :returns: connection key string if successful, False otherwise .. code-block:: python
- {
“e”: “24hrTicker”, // Event type “E”: 123456789, // Event time “s”: “BTCUSDT”, // Symbol “p”: “0.0015”, // Price change
}
- isolated_margin_socket(symbol: str)[source]
Start a websocket for isolated margin data
https://binance-docs.github.io/apidocs/spot/en/#listen-key-isolated-margin
- Parameters:
symbol (str) – required - symbol for the isolated margin account
- Returns:
connection key string if successful, False otherwise
Message Format - see Binance API docs for all types
- kline_futures_socket(symbol: str, interval='1m', futures_type: FuturesType = FuturesType.USD_M, contract_type: ContractType = ContractType.PERPETUAL)[source]
Start a websocket for symbol kline data for the perpeual futures stream
https://binance-docs.github.io/apidocs/futures/en/#continuous-contract-kline-candlestick-streams
- Parameters:
symbol (str) – required
interval (str) – Kline interval, default KLINE_INTERVAL_1MINUTE
futures_type – use USD-M or COIN-M futures default USD-M
contract_type – use PERPETUAL or CURRENT_QUARTER or NEXT_QUARTER default PERPETUAL
- Returns:
connection key string if successful, False otherwise
Message Format
{ "e":"continuous_kline", // Event type "E":1607443058651, // Event time "ps":"BTCUSDT", // Pair "ct":"PERPETUAL" // Contract type "k":{ "t":1607443020000, // Kline start time "T":1607443079999, // Kline close time "i":"1m", // Interval "f":116467658886, // First trade ID "L":116468012423, // Last trade ID "o":"18787.00", // Open price "c":"18804.04", // Close price "h":"18804.04", // High price "l":"18786.54", // Low price "v":"197.664", // volume "n": 543, // Number of trades "x":false, // Is this kline closed? "q":"3715253.19494", // Quote asset volume "V":"184.769", // Taker buy volume "Q":"3472925.84746", //Taker buy quote asset volume "B":"0" // Ignore } } <pair>_<contractType>@continuousKline_<interval>
- kline_socket(symbol: str, interval='1m')[source]
Start a websocket for symbol kline data
- Parameters:
symbol (str) – required
interval (str) – Kline interval, default KLINE_INTERVAL_1MINUTE
- Returns:
connection key string if successful, False otherwise
Message Format
{ "e": "kline", # event type "E": 1499404907056, # event time "s": "ETHBTC", # symbol "k": { "t": 1499404860000, # start time of this bar "T": 1499404919999, # end time of this bar "s": "ETHBTC", # symbol "i": "1m", # interval "f": 77462, # first trade id "L": 77465, # last trade id "o": "0.10278577", # open "c": "0.10278645", # close "h": "0.10278712", # high "l": "0.10278518", # low "v": "17.47929838", # volume "n": 4, # number of trades "x": false, # whether this bar is final "q": "1.79662878", # quote volume "V": "2.34879839", # volume of active buy "Q": "0.24142166", # quote volume of active buy "B": "13279784.01349473" # can be ignored } }
- margin_socket()[source]
Start a websocket for cross-margin data
https://binance-docs.github.io/apidocs/spot/en/#listen-key-margin
- Returns:
connection key string if successful, False otherwise
Message Format - see Binance API docs for all types
- miniticker_socket(update_time: int = 1000)[source]
Start a miniticker websocket for all trades
This is not in the official Binance api docs, but this is what feeds the right column on a ticker page on Binance.
- Parameters:
update_time (int) – time between callbacks in milliseconds, must be 1000 or greater
- Returns:
connection key string if successful, False otherwise
Message Format
[ { 'e': '24hrMiniTicker', # Event type 'E': 1515906156273, # Event time 's': 'QTUMETH', # Symbol 'c': '0.03836900', # close 'o': '0.03953500', # open 'h': '0.04400000', # high 'l': '0.03756000', # low 'v': '147435.80000000', # volume 'q': '5903.84338533' # quote volume } ]
- multiplex_socket(streams: List[str])[source]
Start a multiplexed socket using a list of socket names. User stream sockets can not be included.
Symbols in socket name must be lowercase i.e bnbbtc@aggTrade, neobtc@ticker
Combined stream events are wrapped as follows: {“stream”:”<streamName>”,”data”:<rawPayload>}
https://github.com/binance-exchange/binance-official-api-docs/blob/master/web-socket-streams.md
- Parameters:
streams (list) – list of stream names in lower case
- Returns:
connection key string if successful, False otherwise
Message Format - see Binance API docs for all types
- options_book_ticker_socket(symbol: str)[source]
Subscribe to an options book ticker stream.
Pushes any update to the best bid or ask’s price or quantity in real-time for a specified symbol.
URL PATH: /public Stream Name: <symbol>@bookTicker
API Reference: https://developers.binance.com/docs/derivatives/options-trading/websocket-market-streams/Bookticker
Response fields include: - Event type: ‘bookTicker’ - Order book updateId - Symbol - Best bid price and quantity - Best ask price and quantity - Transaction time and event time
- Parameters:
symbol (str) – The option symbol (e.g., “BTC-251226-110000-C”)
- options_depth_socket(symbol: str, depth: str = '10', speed: str = '500ms')[source]
Subscribe to partial book depth stream for options trading.
Top <levels> bids and asks. Valid levels are 5, 10, 20. Updates every 100ms or 500ms.
URL PATH: /public Stream Name: <symbol>@depth<level>@100ms or <symbol>@depth<level>@500ms
API Reference: https://developers.binance.com/docs/derivatives/options-trading/websocket-market-streams/Partial-Book-Depth-Streams
- Parameters:
symbol (str) – The option symbol (e.g., “BTC-200630-9000-P”)
depth (str) – Number of price levels. Valid values: “5”, “10”, “20”
speed (str) – Update speed. Valid values: “100ms” or “500ms”, default “500ms”
- options_index_price_socket()[source]
Subscribe to an options index price stream.
Underlying (e.g., ETHUSDT, BTCUSDT) index stream for all symbols. Updates every 1000ms.
URL PATH: /market Stream Name: !index@arr
API Reference: https://developers.binance.com/docs/derivatives/options-trading/websocket-market-streams/Index-Price-Streams
Response is an array with index price for all underlying assets: - Event type: ‘indexPrice’ - Event time - Underlying symbol (e.g., ‘ETHUSDT’, ‘BTCUSDT’) - Index price
- options_kline_socket(symbol: str, interval='1m')[source]
Subscribe to a Kline/Candlestick data stream.
The Kline/Candlestick Stream push updates to the current klines/candlestick every 1000ms (if existing).
URL PATH: /market Stream Name: <symbol>@kline_<interval>
Available intervals: “1m”, “3m”, “5m”, “15m”, “30m”, “1h”, “2h”, “4h”, “6h”, “12h”, “1d”, “3d”, “1w”
API Reference: https://developers.binance.com/docs/derivatives/options-trading/websocket-market-streams/Kline-Candlestick-Streams
- Parameters:
symbol (str) – The option symbol (e.g., “BTC-200630-9000-P”)
interval (str) – Kline interval, default KLINE_INTERVAL_1MINUTE
- options_mark_price_socket(symbol: str)[source]
Subscribe to an options mark price stream.
The mark price for all option symbols on specific underlying asset. Updates every 1000ms.
URL PATH: /market Stream Name: <underlying>@optionMarkPrice Example: btcusdt@optionMarkPrice
API Reference: https://developers.binance.com/docs/derivatives/options-trading/websocket-market-streams/Mark-Price
Response fields include: - Event type and timestamps - Option symbol (e.g., ‘BTC-251120-126000-C’) - Mark price, index price - Best bid/ask prices and quantities - Implied volatility, delta, theta, gamma, vega
- Parameters:
symbol (str) – The underlying asset (e.g., “BTCUSDT”, “ETHUSDT”)
- options_multiplex_socket(streams: List[str])[source]
Start a multiplexed socket using a list of socket names.
Combined streams are accessed at /stream?streams=<streamName1>/<streamName2>/<streamName3> All symbols in stream names must be lowercase, but stream type names (like @optionTicker) preserve their original case.
URL PATH: /market
API Reference: https://developers.binance.com/docs/derivatives/options-trading/websocket-market-streams
- Parameters:
streams (List[str]) – List of stream names (e.g., [”btcusdt@optionTicker”, “ethusdt@optionMarkPrice”]) Note: Symbols should be lowercase, but stream types keep original case
- options_new_symbol_socket()[source]
Subscribe to a new symbol listing information stream.
Stream provides real-time notifications when new option symbols are listed. Updates every 50ms.
URL PATH: /market Stream Name: !optionSymbol
API Reference: https://developers.binance.com/docs/derivatives/options-trading/websocket-market-streams/New-Symbol-Info
Response fields include: - Event type and timestamps - Underlying index (e.g., ‘BTCUSDT’) - Quotation asset (e.g., ‘USDT’) - Trading pair name (e.g., ‘BTC-221116-21000-C’) - Conversion ratio and minimum trade volume - Option type (CALL/PUT) - Strike price and expiration time
- options_open_interest_socket(symbol: str, expiration_date: str)[source]
Subscribe to an options open interest stream.
Option open interest for specific underlying asset on specific expiration date. Updates every 60 seconds.
URL PATH: /market Stream Name: underlying@optionOpenInterest@<expirationDate> Example: ethusdt@optionOpenInterest@221125
API Reference: https://developers.binance.com/docs/derivatives/options-trading/websocket-market-streams/Open-Interest
Response fields include: - Event type and timestamps - Option symbol (e.g., ‘ETH-221125-2700-C’) - Open interest in contracts - Open interest in USDT
- Parameters:
symbol (str) – The underlying asset (e.g., “ETHUSDT”)
expiration_date (str) – The expiration date (e.g., “221125” for Nov 25, 2022)
- options_recent_trades_socket(symbol: str)[source]
Subscribe to a real-time trade information stream.
The Trade Streams push raw trade information for specific symbol or underlying asset. Updates every 50ms.
URL PATH: /public Stream Name: <symbol>@optionTrade or <underlying>@optionTrade
API Reference: https://developers.binance.com/docs/derivatives/options-trading/websocket-market-streams/Trade-Streams
- Parameters:
symbol (str) – The option symbol or underlying asset (e.g., “BTC-200630-9000-P” or “BTCUSDT”)
- options_ticker_by_expiration_socket(symbol: str, expiration_date: str)[source]
Subscribe to a 24-hour ticker info stream by underlying asset and expiration date.
24hr ticker info for underlying asset and expiration date. Updates every 1000ms.
URL PATH: /public Stream Name: <underlying>@optionTicker@<expirationDate>
API Reference: https://developers.binance.com/docs/derivatives/options-trading/websocket-market-streams/24-hour-TICKER
- Parameters:
symbol (str) – The underlying asset (e.g., “BTCUSDT”)
expiration_date (str) – The expiration date (e.g., “251230” for Dec 30, 2025)
- options_ticker_socket(symbol: str)[source]
Subscribe to a 24-hour ticker info stream for options trading.
24hr ticker info for all symbols. Only symbols whose ticker info changed will be sent. Updates every 1000ms.
URL PATH: /public Stream Name: <symbol>@optionTicker
API Reference: https://developers.binance.com/docs/derivatives/options-trading/websocket-market-streams/24-hour-TICKER
- Parameters:
symbol (str) – The option symbol to subscribe to (e.g. “BTC-220930-18000-C”)
- portfolio_margin_socket()[source]
Start a websocket for portfolio margin user data
- Returns:
connection key string if successful, False otherwise
Message Format - see Binance API docs for all types
- symbol_book_ticker_socket(symbol: str)[source]
Start a websocket for the best bid or ask’s price or quantity for a specified symbol.
- Parameters:
symbol (str) – required
- Returns:
connection key string if successful, False otherwise
Message Format
{ "u":400900217, // order book updateId "s":"BNBUSDT", // symbol "b":"25.35190000", // best bid price "B":"31.21000000", // best bid qty "a":"25.36520000", // best ask price "A":"40.66000000" // best ask qty }
- symbol_mark_price_socket(symbol: str, fast: bool = True, futures_type: FuturesType = FuturesType.USD_M)[source]
Start a websocket for a symbol’s futures mark price https://binance-docs.github.io/apidocs/futures/en/#mark-price-stream :param symbol: required :param fast: use faster or 1s default :param futures_type: use USD-M or COIN-M futures default USD-M :returns: connection key string if successful, False otherwise Message Format .. code-block:: python
- {
“e”: “markPriceUpdate”, // Event type “E”: 1562305380000, // Event time “s”: “BTCUSDT”, // Symbol “p”: “11185.87786614”, // Mark price “r”: “0.00030000”, // Funding rate “T”: 1562306400000 // Next funding time
}
- symbol_miniticker_socket(symbol: str)[source]
Start a websocket for a symbol’s miniTicker data
https://binance-docs.github.io/apidocs/spot/en/#individual-symbol-mini-ticker-stream
- Parameters:
symbol (str) – required
- Returns:
connection key string if successful, False otherwise
Message Format
{ "e": "24hrMiniTicker", // Event type "E": 123456789, // Event time "s": "BNBBTC", // Symbol "c": "0.0025", // Close price "o": "0.0010", // Open price "h": "0.0025", // High price "l": "0.0010", // Low price "v": "10000", // Total traded base asset volume "q": "18" // Total traded quote asset volume }
- symbol_ticker_futures_socket(symbol: str, futures_type: FuturesType = FuturesType.USD_M)[source]
Start a websocket for a symbol’s ticker data By default all markets are included in an array. https://binance-docs.github.io/apidocs/futures/en/#individual-symbol-book-ticker-streams :param symbol: required :param futures_type: use USD-M or COIN-M futures default USD-M :returns: connection key string if successful, False otherwise .. code-block:: python
- [
- {
“u”:400900217, // order book updateId “s”:”BNBUSDT”, // symbol “b”:”25.35190000”, // best bid price “B”:”31.21000000”, // best bid qty “a”:”25.36520000”, // best ask price “A”:”40.66000000” // best ask qty
}
]
- symbol_ticker_socket(symbol: str)[source]
Start a websocket for a symbol’s ticker data
- Parameters:
symbol (str) – required
- Returns:
connection key string if successful, False otherwise
Message Format
{ "e": "24hrTicker", # Event type "E": 123456789, # Event time "s": "BNBBTC", # Symbol "p": "0.0015", # Price change "P": "250.00", # Price change percent "w": "0.0018", # Weighted average price "x": "0.0009", # Previous day's close price "c": "0.0025", # Current day's close price "Q": "10", # Close trade's quantity "b": "0.0024", # Best bid price "B": "10", # Bid bid quantity "a": "0.0026", # Best ask price "A": "100", # Best ask quantity "o": "0.0010", # Open price "h": "0.0025", # High price "l": "0.0010", # Low price "v": "10000", # Total traded base asset volume "q": "18", # Total traded quote asset volume "O": 0, # Statistics open time "C": 86400000, # Statistics close time "F": 0, # First trade ID "L": 18150, # Last trade Id "n": 18151 # Total number of trades }
- ticker_socket()[source]
Start a websocket for all ticker data
By default all markets are included in an array.
- Parameters:
coro (function) – callback function to handle messages
- Returns:
connection key string if successful, False otherwise
Message Format
[ { 'F': 278610, 'o': '0.07393000', 's': 'BCCBTC', 'C': 1509622420916, 'b': '0.07800800', 'l': '0.07160300', 'h': '0.08199900', 'L': 287722, 'P': '6.694', 'Q': '0.10000000', 'q': '1202.67106335', 'p': '0.00494900', 'O': 1509536020916, 'a': '0.07887800', 'n': 9113, 'B': '1.00000000', 'c': '0.07887900', 'x': '0.07399600', 'w': '0.07639068', 'A': '2.41900000', 'v': '15743.68900000' } ]
- trade_socket(symbol: str)[source]
Start a websocket for symbol trade data
- Parameters:
symbol (str) – required
- Returns:
connection key string if successful, False otherwise
Message Format
{ "e": "trade", # Event type "E": 123456789, # Event time "s": "BNBBTC", # Symbol "t": 12345, # Trade ID "p": "0.001", # Price "q": "100", # Quantity "b": 88, # Buyer order Id "a": 50, # Seller order Id "T": 123456785, # Trade time "m": true, # Is the buyer the market maker? "M": true # Ignore. }
- user_socket()[source]
Start a websocket for user data
https://github.com/binance-exchange/binance-official-api-docs/blob/master/user-data-stream.md https://binance-docs.github.io/apidocs/spot/en/#listen-key-spot
- Returns:
connection key string if successful, False otherwise
Message Format - see Binance API docs for all types
- class binance.ws.streams.BinanceSocketType(value, names=<not given>, *values, module=None, qualname=None, type=None, start=1, boundary=None)[source]
Bases:
str,Enum- ACCOUNT = 'Account'
- COIN_M_FUTURES = 'Coin_M_Futures'
- OPTIONS = 'Vanilla_Options'
- SPOT = 'Spot'
- USD_M_FUTURES = 'USD_M_Futures'
- class binance.ws.streams.ThreadedWebsocketManager(api_key: str | None = None, api_secret: str | None = None, requests_params: Dict[str, Any] | None = None, tld: str = 'com', testnet: bool = False, session_params: Dict[str, Any] | None = None, https_proxy: str | None = None, loop: AbstractEventLoop | None = None, max_queue_size: int = 100)[source]
Bases:
ThreadedApiManager- __init__(api_key: str | None = None, api_secret: str | None = None, requests_params: Dict[str, Any] | None = None, tld: str = 'com', testnet: bool = False, session_params: Dict[str, Any] | None = None, https_proxy: str | None = None, loop: AbstractEventLoop | None = None, max_queue_size: int = 100)[source]
Initialise the ThreadedApiManager
- Parameters:
api_key – Binance API key
api_secret – Binance API secret
requests_params – optional - Dictionary of requests params
tld – optional - Top level domain, default is ‘com’
testnet – optional - Use testnet endpoint
session_params – optional - Session params for aiohttp
https_proxy – optional - Proxy URL
_loop – optional - Event loop
verbose (bool) – Enable verbose logging for WebSocket connections
- start_aggtrade_futures_socket(callback: Callable, symbol: str, futures_type: FuturesType = FuturesType.USD_M) str[source]
- start_all_mark_price_socket(callback: Callable, fast: bool = True, futures_type: FuturesType = FuturesType.USD_M) str[source]
- start_all_ticker_futures_socket(callback: Callable, futures_type: FuturesType = FuturesType.USD_M) str[source]
- start_depth_socket(callback: Callable, symbol: str, depth: str | None = None, interval: int | None = None) str[source]
- start_futures_depth_socket(callback: Callable, symbol: str, depth: str = '10', futures_type=FuturesType.USD_M) str[source]
- start_futures_multiplex_socket(callback: Callable, streams: List[str], futures_type: FuturesType = FuturesType.USD_M) str[source]
- start_individual_symbol_ticker_futures_socket(callback: Callable, symbol: str, futures_type: FuturesType = FuturesType.USD_M) str[source]
- start_kline_futures_socket(callback: Callable, symbol: str, interval='1m', futures_type: FuturesType = FuturesType.USD_M, contract_type: ContractType = ContractType.PERPETUAL) str[source]
- start_options_ticker_by_expiration_socket(callback: Callable, symbol: str, expiration_date: str) str[source]
- start_symbol_mark_price_socket(callback: Callable, symbol: str, fast: bool = True, futures_type: FuturesType = FuturesType.USD_M) str[source]
Threaded streams module
- class binance.ws.threaded_stream.ThreadedApiManager(api_key: str | None = None, api_secret: str | None = None, requests_params: Dict[str, Any] | None = None, tld: str = 'com', testnet: bool = False, session_params: Dict[str, Any] | None = None, https_proxy: str | None = None, _loop: AbstractEventLoop | None = None, verbose: bool = False)[source]
Bases:
Thread- __init__(api_key: str | None = None, api_secret: str | None = None, requests_params: Dict[str, Any] | None = None, tld: str = 'com', testnet: bool = False, session_params: Dict[str, Any] | None = None, https_proxy: str | None = None, _loop: AbstractEventLoop | None = None, verbose: bool = False)[source]
Initialise the ThreadedApiManager
- Parameters:
api_key – Binance API key
api_secret – Binance API secret
requests_params – optional - Dictionary of requests params
tld – optional - Top level domain, default is ‘com’
testnet – optional - Use testnet endpoint
session_params – optional - Session params for aiohttp
https_proxy – optional - Proxy URL
_loop – optional - Event loop
verbose (bool) – Enable verbose logging for WebSocket connections
- run()[source]
Method representing the thread’s activity.
You may override this method in a subclass. The standard run() method invokes the callable object passed to the object’s constructor as the target argument, if any, with sequential and keyword arguments taken from the args and kwargs arguments, respectively.
depthcache module
- class binance.ws.depthcache.BaseDepthCacheManager(client, symbol, loop=None, refresh_interval: int | None = 1800, bm=None, limit=10, conv_type=<class 'float'>)[source]
Bases:
object- TIMEOUT = 60
- __init__(client, symbol, loop=None, refresh_interval: int | None = 1800, bm=None, limit=10, conv_type=<class 'float'>)[source]
Create a DepthCacheManager instance
- Parameters:
client (binance.Client) – Binance API client
loop
symbol (string) – Symbol to create depth cache for
refresh_interval (int) – Optional number of seconds between cache refresh, use 0 or None to disable
bm (BinanceSocketManager) – Optional BinanceSocketManager
limit (int) – Optional number of orders to get from orderbook
conv_type (function.) – Optional type to represent price, and amount, default is float.
- class binance.ws.depthcache.DepthCache(symbol, conv_type: ~typing.Callable = <class 'float'>)[source]
Bases:
object- __init__(symbol, conv_type: ~typing.Callable = <class 'float'>)[source]
Initialise the DepthCache
- Parameters:
symbol (string) – Symbol to create depth cache for
conv_type (function.) – Optional type to represent price, and amount, default is float.
- get_asks()[source]
Get the current asks
- Returns:
list of asks with price and quantity as conv_type.
[ [ 0.0001955, # Price 57.0' # Quantity ], [ 0.00019699, 778.0 ], [ 0.000197, 64.0 ], [ 0.00019709, 1130.0 ], [ 0.0001971, 385.0 ] ]
- class binance.ws.depthcache.DepthCacheManager(client, symbol, loop=None, refresh_interval: int | None = None, bm=None, limit=500, conv_type=<class 'float'>, ws_interval=None)[source]
Bases:
BaseDepthCacheManager- __init__(client, symbol, loop=None, refresh_interval: int | None = None, bm=None, limit=500, conv_type=<class 'float'>, ws_interval=None)[source]
Initialise the DepthCacheManager
- Parameters:
client (binance.Client) – Binance API client
loop – asyncio loop
symbol (string) – Symbol to create depth cache for
refresh_interval (int) – Optional number of seconds between cache refresh, use 0 or None to disable
limit (int) – Optional number of orders to get from orderbook
conv_type (function.) – Optional type to represent price, and amount, default is float.
ws_interval (int) – Optional interval for updates on websocket, default None. If not set, updates happen every second. Must be 0, None (1s) or 100 (100ms).
- class binance.ws.depthcache.FuturesDepthCacheManager(client, symbol, loop=None, refresh_interval: int | None = 1800, bm=None, limit=10, conv_type=<class 'float'>)[source]
Bases:
BaseDepthCacheManager
- class binance.ws.depthcache.OptionsDepthCacheManager(client, symbol, loop=None, refresh_interval: int | None = 1800, bm=None, limit=10, conv_type=<class 'float'>)[source]
Bases:
BaseDepthCacheManager
- class binance.ws.depthcache.ThreadedDepthCacheManager(api_key: str | None = None, api_secret: str | None = None, requests_params: Dict[str, str] | None = None, tld: str = 'com', testnet: bool = False)[source]
Bases:
ThreadedApiManager- __init__(api_key: str | None = None, api_secret: str | None = None, requests_params: Dict[str, str] | None = None, tld: str = 'com', testnet: bool = False)[source]
Initialise the ThreadedApiManager
- Parameters:
api_key – Binance API key
api_secret – Binance API secret
requests_params – optional - Dictionary of requests params
tld – optional - Top level domain, default is ‘com’
testnet – optional - Use testnet endpoint
session_params – optional - Session params for aiohttp
https_proxy – optional - Proxy URL
_loop – optional - Event loop
verbose (bool) – Enable verbose logging for WebSocket connections
- start_depth_cache(callback: ~typing.Callable, symbol: str, refresh_interval=None, bm=None, limit=10, conv_type=<class 'float'>, ws_interval=0) str[source]
exceptions module
- exception binance.exceptions.BinanceAPIException(response, status_code, text)[source]
Bases:
Exception
- exception binance.exceptions.BinanceOrderInactiveSymbolException(value)[source]
Bases:
BinanceOrderException
- exception binance.exceptions.BinanceOrderMinAmountException(value)[source]
Bases:
BinanceOrderException
- exception binance.exceptions.BinanceOrderMinPriceException(value)[source]
Bases:
BinanceOrderException
- exception binance.exceptions.BinanceOrderMinTotalException(value)[source]
Bases:
BinanceOrderException
- exception binance.exceptions.BinanceOrderUnknownSymbolException(value)[source]
Bases:
BinanceOrderException
- exception binance.exceptions.BinanceRegionException(required_tld: str, actual_tld: str, endpoint_name: str = 'endpoint')[source]
Bases:
ExceptionRaised when using a region-specific endpoint with incompatible client.
- exception binance.exceptions.BinanceWebsocketClosed[source]
Bases:
ExceptionRaised when websocket connection is closed.
- exception binance.exceptions.BinanceWebsocketQueueOverflow[source]
Bases:
ExceptionRaised when the websocket message queue exceeds its maximum size.
helpers module
- binance.helpers.date_to_milliseconds(date_str: str) int[source]
Convert UTC date to milliseconds
If using offset strings add “UTC” to date string e.g. “now UTC”, “11 hours ago UTC”
See dateparse docs for formats http://dateparser.readthedocs.io/en/latest/
- Parameters:
date_str – date in readable format, i.e. “January 01, 2018”, “11 hours ago UTC”, “now UTC”
- binance.helpers.get_loop()[source]
check if there is an event loop in the current thread, if not create one inspired by https://stackoverflow.com/questions/46727787/runtimeerror-there-is-no-current-event-loop-in-thread-in-async-apscheduler
- binance.helpers.interval_to_milliseconds(interval: str) int | None[source]
Convert a Binance interval string to milliseconds
- Parameters:
interval – Binance interval string, e.g.: 1m, 3m, 5m, 15m, 30m, 1h, 2h, 4h, 6h, 8h, 12h, 1d, 3d, 1w
- Returns:
int value of interval in milliseconds None if interval prefix is not a decimal integer None if interval suffix is not one of m, h, d, w