Binance Public API Connector Python
This is a lightweight library that works as a connector to Binance public API. It’s designed to be simple, clean, and easy to use with minimal dependencies.
Source Code: https://github.com/binance/binance-connector-python
Official API document:
Support channels:
Binance developer forum: https://dev.binance.vision/
Telegram Channel: https://t.me/binance_api_english
API key setup: https://www.binance.com/en-NG/support/faq/360002502072
Testnet API key setup: https://dev.binance.vision/t/99
Features
Supported APIs:
/api/*
/sapi/*
Spot Websocket Market Stream
Spot User Data Stream
Inclusion of test cases and examples
Customizable base URL, request timeout and HTTP proxy
Response metadata can be displayed
Quick Start
Installation
Install via package name
pip install binance-connector
Alternatively, install with git repository path
python -m pip install git+https://github.com/binance/binance-connector-python.git
Usage
RESTful APIs
from binance.spot import Spot
client = Spot()
print(client.time())
client = Spot(key='<api_key>', secret='<api_secret>')
# Get account information
print(client.account())
# Post a new order
params = {
'symbol': 'BTCUSDT',
'side': 'SELL',
'type': 'LIMIT',
'timeInForce': 'GTC',
'quantity': 0.002,
'price': 9500
}
response = client.new_order(**params)
print(response)
Please find examples folder to check for more endpoints.
Websocket
from binance.websocket.spot.websocket_client import SpotWebsocketClient as WebsocketClient
def message_handler(message):
print(message)
ws_client = WebsocketClient()
ws_client.start()
ws_client.mini_ticker(
symbol='bnbusdt',
id=1,
callback=message_handler,
)
# Combine selected streams
ws_client.instant_subscribe(
stream=['bnbusdt@bookTicker', 'ethusdt@bookTicker'],
callback=message_handler,
)
ws_client.stop()
More websocket examples are available in the examples folder
Contents
Changelog
1.13.0 - 2022-05-23
Added
New endpoint for Gift Card:
GET /sapi/v1/giftcard/cryptography/rsa-public-key
to fetch RSA public key.
New endpoints for Staking:
GET /sapi/v1/staking/productList
to get Staking product listPOST /sapi/v1/staking/purchase
to stake productPOST /sapi/v1/staking/redeem
to redeem productGET /sapi/v1/staking/position
to get Staking product holding positionGET /sapi/v1/staking/stakingRecord
to inquiry Staking history recordsPOST /sapi/v1/staking/setAutoStaking
to set Auto Staking functionGET /sapi/v1/staking/personalLeftQuota
to inquiry Staking left quota
Changed
Update endpoints for Market:
GET /api/v3/ticker/24hr
,GET /api/v3/ticker/price
andGET /api/v3/ticker/bookTicker
new optional parameter symbols.
Update endpoint for Gift Card:
POST /sapi/v1/giftcard/redeemCode
: new optional parameter externalUid. Each external unique ID represents a unique user on the partner platform. The function helps you to identify the redemption behavior of different users.
1.12.0 - 2022-05-03
Added
New endpoint
GET /sapi/v1/managed-subaccount/accountSnapshot
to support investor master account query asset snapshot of managed sub-account.New endpoint
GET /sapi/v1/portfolio/account
to support query portfolio margin account infoNew endpoint
GET /sapi/v1/margin/rateLimit/order
, which will display the user’s current margin order count usage for all intervals.
1.11.0 - 2022-02-23
Added
New endpoints for Gift Card (Binance Code in the API Documentation):
POST /sapi/v1/giftcard/createCode
to create a Binance CodePOST /sapi/v1/giftcard/redeemCode
to redeem a Binance CodeGET /sapi/v1/giftcard/verify
to verify a Binance Code
New endpoint for Wallet:
POST /sapi/v1/asset/dust-btc
to get assets that can be converted into BNB
1.10.0 - 2022-01-11
Added
New endpoint for Mining:
GET /sapi/v1/mining/payment/uid
to get Mining account earning
New endpoint for BSwap:
GET /sapi/v1/bswap/unclaimedRewards
to get unclaimed rewards recordPOST /sapi/v1/bswap/claimRewards
to claim swap rewards or liquidity rewardsGET /sapi/v1/bswap/claimedHistory
to get history of claimed rewards
Removed
Transfer types
MAIN_MINING
,MINING_MAIN
,MINING_UMFUTURE
,MARGIN_MINING
, andMINING_MARGIN
as they are discontinued in Universal Transfer endpointPOST /sapi/v1/asset/transfer
from January 05, 2022 08:00 AM UTC
1.9.0 - 2021-12-22
Added
New endpoint for Convert:
GET /sapi/v1/convert/tradeFlow
to support user query convert trade history records
New endpoint for Rebate:
GET /sapi/v1/rebate/taxQuery
to support user query spot rebate history records
New endpoints for Margin:
GET /sapi/v1/margin/crossMarginData
to get cross margin fee data collectionGET /sapi/v1/margin/isolatedMarginData
to get isolated margin fee data collectionGET /sapi/v1/margin/isolatedMarginTier
to get isolated margin tier data collection
New endpoints for NFT:
GET /sapi/v1/nft/history/transactions
to get NFT transaction historyGET /sapi/v1/nft/history/deposit
to get NFT deposit historyGET /sapi/v1/nft/history/withdraw
to get NFT withdraw historyGET /sapi/v1/nft/user/getAsset
to get NFT asset
1.8.0 - 2021-11-25
Added
New endpoint for Crypto Loans:
GET /sapi/v1/loan/income
to query an asset’s loan history
New endpoints for Sub-Account:
POST /sapi/v1/sub-account/subAccountApi/ipRestriction
to support master account enable and disable IP restriction for a sub-account API KeyPOST /sapi/v1/sub-account/subAccountApi/ipRestriction/ipList
to support master account add IP list for a sub-account API KeyGET /sapi/v1/sub-account/subAccountApi/ipRestriction
to support master account query IP restriction for a sub-account API KeyDELETE /sapi/v1/sub-account/subAccountApi/ipRestriction/ipList
to support master account delete IP list for a sub-account API Key
New endpoint for Pay:
GET /sapi/v1/pay/transactions
to support user query Pay trade history
Fixed
Removed epoch time in util method
config_logging
to provide compatibility with Windows OSAllow optional parameter for method
isolated_margin_account_limit
1.7.0 - 2021-11-04
Updated
Universal transfer types:
Added
MAIN_FUNDING
,FUNDING_MAIN
,FUNDING_UMFUTURE
,UMFUTURE_FUNDING
,MARGIN_FUNDING
,FUNDING_MARGIN
,FUNDING_CMFUTURE
andCMFUTURE_FUNDING
to support transfer assets among funding account and other accountsDeleted
MAIN_C2C
,C2C_MAIN
,C2C_UMFUTURE
,C2C_MINING
,UMFUTURE_C2C
,MINING_C2C
,MARGIN_C2C
,C2C_MARGIN
,MAIN_PAY
andPAY_MAIN
as C2C account, Binance Payment, Binance Card and other business accounts are merged into a Funding account and they’ll be discontinued on November 04, 2021 08:00 AM UTC
Util method
config_logging
can now provide date time in UTC and epoch time
Added
New endpoint
GET api/v3/rateLimit/order
to display the user’s current order count usage for all intervals
1.6.0 - 2021-09-24
Added
Universal transfer types
MAIN_PAY
,PAY_MAIN
,ISOLATEDMARGIN_MARGIN
,MARGIN_ISOLATEDMARGIN
,ISOLATEDMARGIN_ISOLATEDMARGIN
New endpoints for Margin OCO orders:
POST /sapi/v1/margin/order/oco
to send new margin OCO orderDELETE /sapi/v1/margin/orderList
to cancel margin OCO orderGET /sapi/v1/margin/orderList
to query a margin OCO orderGET /sapi/v1/margin/allOrderList
to query all margin OCO ordersGET /sapi/v1/margin/openOrderList
to query open margin OCO orders
New endpoints for Isolated Margin:
DELETE /sapi/v1/margin/isolated/account
to disable isolated margin account for a specific symbolPOST /sapi/v1/margin/isolated/account
to enable isolated margin account for a specific symbolGET /sapi/v1/margin/isolated/accountLimit
to query num of enabled isolated margin accounts and its max limit
New endpoints for BSwap:
GET /sapi/v1/bswap/poolConfigure
to get pool configureGET /sapi/v1/bswap/addLiquidityPreview
to calculate expected share amount for adding liquidity in single or dual tokenGET /sapi/v1/bswap/removeLiquidityPreview
to calculate expected asset amount of single token redemption or dual token redemption
1.5.0 - 2021-08-17
Changed
GET api/v3/exchangeInfo
now supports single or multi-symbol queryGET api/v3/myTrades
has a new optional fieldorderId
Added
GET /sapi/v1/c2c/orderMatch/listUserOrderHistory
to query user C2C trade history
1.4.0 - 2021-07-30
Added
New Fiat endpoints:
GET /sapi/v1/fiat/orders
to query user fiat deposit and withdraw historyGET /sapi/v1/fiat/payments
to query user fiat payments history
Fixed
Typo in
margin_max_transferable
1.3.0 - 2021-07-22
Added
New endpoints for Wallet:
POST /sapi/v1/asset/get-funding-asset
to query funding wallet, includes Binance Pay, Binance Card, Binance Gift Card, Stock TokenGET /sapi/v1/account/apiRestrictions
to query user API Key permission
1.2.0 - 2021-07-12
Changed
Remove default value in the parameters
1.1.1 - 2021-06-24
Changed
Upgrade the dependency packages
1.1.0 - 2021-06-23
Added
A link to the document on
README.md
Enabled the sub menu on document nav bar.
GET /sapi/v1/lending/daily/product/list
includes new parameters, current and size.New endpoints for Sub-Account:
POST /sapi/v1/managed-subaccount/deposit
to deposit assets into the managed sub-account (only for investor master account)GET /sapi/v1/managed-subaccount/asset
to query managed sub-account asset details (only for investor master account)POST /sapi/v1/managed-subaccount/withdraw
to withdrawal assets from the managed sub-account (only for investor master account)
1.0.0 - 2021-06-15
Added
First release, please find details from
README.md
Getting Started
Installation
pip install binance-connector
How to Generate the API key
One account can have multiple API key and secret key pairs. Please follow the step by step tutorial and create the key on web site or mobile app.
How to Use This Connector
RESTful APIs
Usage example:
from binance.spot import Spot
client = Spot()
# Get server timestamp
print(client.time())
# Get klines of BTCUSDT at 1m interval
print(client.klines("BTCUSDT", "1m"))
# Get last 10 klines of BNBUSDT at 1h interval
print(client.klines("BNBUSDT", "1h", limit=10))
# api key/secret are required for user data endpoints
client = Spot(key='<api_key>', secret='<api_secret>')
# Get account and balance information
print(client.account())
# Post a new order
params = {
'symbol': 'BTCUSDT',
'side': 'SELL',
'type': 'LIMIT',
'timeInForce': 'GTC',
'quantity': 0.002,
'price': 9500
}
response = client.new_order(**params)
print(response)
Please find examples folder to check for more endpoints.
Base URL
If base_url
is not provided, it defaults to api.binance.com
.
from binance.spot import Spot as Client
client = Client(base_url='https://api.binance.com')
It’s recommended to pass in the base_url
parameter, even in production as Binance provides alternative URLs
in case of performance issues:
https://api1.binance.com
https://api2.binance.com
https://api3.binance.com
Optional parameters
PEP8 suggests lowercase with words separated by underscores, but for this connector, the methods’ optional parameters should follow their exact naming as in the API documentation, aka camel case.
# Recognised parameter name
response = client.cancel_oco_order('BTCUSDT', orderListId=1)
# Unrecognised parameter name
response = client.cancel_oco_order('BTCUSDT', order_list_id=1)
RecvWindow parameter
An optional parameter recvWindow
is available for endpoints requiring timestamp and signature.
It defaults to 5000
(milliseconds) and can be any value lower than 60000
(milliseconds).
Anything beyond the limit will result in an error response from Binance server.
from binance.spot import Spot as Client
client = Client(key, secret)
response = client.get_order('BTCUSDT', orderId=11, recvWindow=10000)
Websocket
Usage example:
from binance.websocket.spot.websocket_client import SpotWebsocketClient as WebsocketClient
def message_handler(message):
print(message)
ws_client = WebsocketClient()
ws_client.start()
ws_client.mini_ticker(
symbol='bnbusdt',
id=1,
callback=message_handler,
)
# Combine selected streams
ws_client.instant_subscribe(
stream=['bnbusdt@bookTicker', 'ethusdt@bookTicker'],
callback=message_handler,
)
ws_client.stop()
The stream_url
defaults to wss://stream.binance.com:9443
.
More websocket examples are available in the examples folder.
Heartbeat
Once connected, the websocket server sends a ping frame every 3 minutes and requires a response pong frame back within a 10 minutes period. This package handles the pong responses automatically.
Testnet
Testnet is an environment provided for the traders to get familiar with the API usage and behaviour without the risk of losing funds. It is possible that the price and liquidity are different from the real trading environment due to the scale difference and the regular data reset.
/api/*
endpoints can be tested in Spot Test Network (Spot Testnet).
After creating the API key from Spot Testnet, you can access it
by changing the base URL while initiating the API client.
Note: /sapi/*
endpoints don’t have testnet environment yet.
API
from binance.spot import Spot as Client
client = Client(base_url='https://testnet.binance.vision')
print(client.time())
WebSocket
from binance.websocket.spot.websocket_client import SpotWebsocketClient as WebsocketClient
ws_client = WebsocketClient(stream_url='wss://testnet.binance.vision')
Errors
There are 2 types of error returned from the library with respect to server response:
binance.error.ClientError
This is thrown when server returns
4XX
, it’s an issue from client side.It has 4 properties:
status_code
- HTTP status codeerror_code
- Server’s error code, e.g.-1102
error_message
- Server’s error message, e.g.Unknown order sent.
header
- Full response header.
binance.error.ServerError
This is thrown when server returns
5XX
, it’s an issue from server side.
The library also provides some basic validation towards the required arguments before it sends out the request to the server. The violation results in any one of the following errors:
binance.error.ParameterRequiredError
This means one (or more) required parameter is missing.
binance.error.ParameterValueError
This means the provided enum value is invalid.
Proxy
Proxy is supported.
from binance.spot import Spot as Client
proxies = { 'https': 'http://1.2.3.4:8080' }
client= Client(proxies=proxies)
Timeout
timeout
is available to be assigned with the number of seconds you find most appropriate to wait for a server response.
Please remember the value as it won’t be shown in error message no bytes have been received on the underlying socket for timeout seconds.
By default, timeout
is None. Hence, requests do not time out.
from binance.spot import Spot as Client
client= Client(timeout=1)
Spot APIs
Blvt Endpoints
Get BLVT Info (MARKET_DATA)
- blvt_info(self, tokenName: Optional[str] = None)
Get BLVT Info (MARKET_DATA)
GET /sapi/v1/blvt/tokenInfo
https://binance-docs.github.io/apidocs/spot/en/#get-blvt-info-market_data
- Parameters
tokenName (str, optional) – BTCDOWN, BTCUP
Subscribe BLVT (USER_DATA)
- subscribe_blvt(self, tokenName: str, cost, **kwargs)
Subscribe BLVT (USER_DATA)
POST /sapi/v1/blvt/subscribe (HMAC SHA256)
https://binance-docs.github.io/apidocs/spot/en/#subscribe-blvt-user_data
- Parameters
tokenName (str) – BTCDOWN, BTCUP.
cost (str) – spot balance.
- Keyword Arguments
recvWindow (int, optional) –
Query Subscription Record (USER_DATA)
- subscription_record(self, **kwargs)
Query Subscription Record (USER_DATA)
GET /sapi/v1/blvt/subscribe/record (HMAC SHA256)
https://binance-docs.github.io/apidocs/spot/en/#query-subscription-record-user_data
- Keyword Arguments
tokenName (str, optional) – BTCDOWN, BTCUP.
id (int, optional) –
startTime (int, optional) –
endTime (int, optional) –
limit (int, optional) – default 1000, max 1000.
recvWindow (int, optional) –
Redeem BLVT (USER_DATA)
- redeem_blvt(self, tokenName: str, amount, **kwargs)
Redeem BLVT (USER_DATA)
POST /sapi/v1/blvt/redeem (HMAC SHA256)
https://binance-docs.github.io/apidocs/spot/en/#redeem-blvt-user_data
- Parameters
tokenName (str) – BTCDOWN, BTCUP
amount (str) –
- Keyword Arguments
recvWindow (int, optional) –
Query Redemption Record (USER_DATA)
- redemption_record(self, **kwargs)
Query Redemption Record (USER_DATA)
GET /sapi/v1/blvt/redeem/record (HMAC SHA256)
https://binance-docs.github.io/apidocs/spot/en/#query-redemption-record-user_data
- Keyword Arguments
tokenName (str, optional) – BTCDOWN, BTCUP
id (int, optional) –
startTime (int, optional) –
endTime (int, optional) –
limit (int, optional) – default 1000, max 1000
recvWindow (int, optional) –
Get BLVT User Limit Info
- user_limit_info(self, **kwargs)
Get BLVT User Limit Info
GET /sapi/v1/blvt/userLimit
https://binance-docs.github.io/apidocs/spot/en/#get-blvt-user-limit-info
- Keyword Arguments
tokenName (str, optional) – BTCDOWN, BTCUP
recvWindow (int, optional) –
Bswap Endpoints
List All Swap Pools (MARKET_DATA)
- bswap_pools(self)
List All Swap Pools (MARKET_DATA) Get metadata about all swap pools.
GET /sapi/v1/bswap/pools
https://binance-docs.github.io/apidocs/spot/en/#list-all-swap-pools-market_data
Get liquidity information of a pool (USER_DATA)
- bswap_liquidity(self, **kwargs)
Get liquidity information of a pool (USER_DATA) Get liquidity information and user share of a pool
GET /sapi/v1/bswap/liquidity
https://binance-docs.github.io/apidocs/spot/en/#get-liquidity-information-of-a-pool-user_data
- Keyword Arguments
poolId (int, optional) –
recvWindow (int, optional) – The value cannot be greater than 60000
Add Liquidity (TRADE)
- bswap_liquidity_add(self, poolId: int, asset: str, quantity: float, **kwargs)
Add Liquidity (TRADE) Add liquidity to a pool.
POST /sapi/v1/bswap/liquidityAdd
https://binance-docs.github.io/apidocs/spot/en/#add-liquidity-trade
- Parameters
poolId (int) –
asset (str) –
quantity (float) –
- Keyword Arguments
type (str, optional) – “Single” to add a single token; “Combination” to add dual tokens. Default “Single”
recvWindow (int, optional) – The value cannot be greater than 60000
Remove Liquidity (TRADE)
- bswap_liquidity_remove(self, poolId: str, type: str, asset: list, shareAmount, **kwargs)
Remove Liquidity (TRADE) Remove liquidity from a pool, type include SINGLE and COMBINATION, asset is mandatory for single asset removal
POST /sapi/v1/bswap/liquidityRemove
https://binance-docs.github.io/apidocs/spot/en/#remove-liquidity-trade
- Parameters
poolId (int) –
type (str) – SINGLE for single asset removal, COMBINATION for combination of all coins removal
asset (str) –
shareAmount (float) – Mandatory for liquidity removal
- Keyword Arguments
recvWindow (int, optional) – The value cannot be greater than 60000
Get Liquidity Operation Record (USER_DATA)
- bswap_liquidity_operation_record(self, **kwargs)
Get Liquidity Operation Record (USER_DATA) Get liquidity operation (add/remove) records.
GET /sapi/v1/bswap/liquidityOps
https://binance-docs.github.io/apidocs/spot/en/#get-liquidity-operation-record-user_data
- Keyword Arguments
operationId (int, optional) –
poolId (int, optional) –
operation (str, optional) – ADD or REMOVE
startTime (int, optional) –
endTime (int, optional) –
limit (int, optional) – default 3, max 100
recvWindow (int, optional) – The value cannot be greater than 60000
Request Quote (USER_DATA)
- bswap_request_quote(self, quoteAsset: str, baseAsset: str, quoteQty: float, **kwargs)
Request Quote (USER_DATA) Request a quote for swap quote asset (selling asset) for base asset (buying asset), essentially price/exchange rates. quoteQty is quantity of quote asset (to sell).
Please be noted the quote is for reference only, the actual price will change as the liquidity changes, it’s recommended to swap immediate after request a quote for slippage prevention.
GET /sapi/v1/bswap/quote
https://binance-docs.github.io/apidocs/spot/en/#request-quote-user_data
- Parameters
quoteAsset (str) –
baseAsset (str) –
quoteQty (float) –
- Keyword Arguments
recvWindow (int, optional) – The value cannot be greater than 60000
Swap (TRADE)
- bswap_swap(self, quoteAsset: str, baseAsset: str, quoteQty: float, **kwargs)
Swap (TRADE) Swap quoteAsset for baseAsset.
POST /sapi/v1/bswap/swap
https://binance-docs.github.io/apidocs/spot/en/#swap-trade
- Parameters
baseAsset (str) –
quoteAsset (str) –
quoteQty (float) –
- Keyword Arguments
recvWindow (int, optional) – The value cannot be greater than 60000
Get Swap History (USER_DATA)
- bswap_swap_history(self, **kwargs)
Get Swap History (USER_DATA) Get swap history.
GET /sapi/v1/bswap/swap
https://binance-docs.github.io/apidocs/spot/en/#get-swap-history-user_data
- Keyword Arguments
swapId (int, optional) –
startTime (int, optional) –
endTime (int, optional) –
status (int, optional) –
baseAsset (str, optional) –
quoteAsset (str, optional) –
limit (int, optional) –
recvWindow (int, optional) – The value cannot be greater than 60000
Get Pool Configure (USER_DATA)
- bswap_pool_configure(self, **kwargs)
Get Pool Configure (USER_DATA)
GET /sapi/v1/bswap/poolConfigure
https://binance-docs.github.io/apidocs/spot/en/#get-pool-configure-user_data
- Keyword Arguments
poolId (int, optional) –
recvWindow (int, optional) – The value cannot be greater than 60000
Add Liquidity Preview (USER_DATA)
- bswap_add_liquidity_preview(self, poolId: int, type: str, quoteAsset: str, quoteQty: float, **kwargs)
Add Liquidity Preview (USER_DATA) Calculate expected share amount for adding liquidity in single or dual token.
GET /sapi/v1/bswap/addLiquidityPreview
https://binance-docs.github.io/apidocs/spot/en/#add-liquidity-preview-user_data
- Parameters
poolId (int) –
type (str) – “SINGLE” for adding a single token;”COMBINATION” for adding dual tokens
quoteAsset (str) –
quoteQty (float) –
- Keyword Arguments
recvWindow (int, optional) – The value cannot be greater than 60000
Remove Liquidity Preview (USER_DATA)
- bswap_remove_liquidity_preview(self, poolId: int, type: str, quoteAsset: str, shareAmount: float, **kwargs)
Remove Liquidity Preview (USER_DATA) Calculate the expected asset amount of single token redemption or dual token redemption.
GET /sapi/v1/bswap/removeLiquidityPreview
https://binance-docs.github.io/apidocs/spot/en/#remove-liquidity-preview-user_data
- Parameters
poolId (int) –
type (str) – Type is “SINGLE”, remove and obtain a single token;Type is “COMBINATION”, remove and obtain dual token
quoteAsset (str) –
shareAmount (float) –
- Keyword Arguments
recvWindow (int, optional) – The value cannot be greater than 60000
Get Unclaimed Rewards Record (USER_DATA)
- bswap_unclaimed_rewards(self, **kwargs)
Get Unclaimed Rewards Record (USER_DATA) Get unclaimed rewards record.
GET /sapi/v1/bswap/unclaimedRewards
https://binance-docs.github.io/apidocs/spot/en/#get-unclaimed-rewards-record-user_data
- Keyword Arguments
type (int, optional) – 0: Swap rewards,1:Liquidity rewards, default to 0
recvWindow (int, optional) – The value cannot be greater than 60000
Claim rewards (TRADE)
- bswap_claim_rewards(self, **kwargs)
Claim rewards (TRADE) Claim swap rewards or liquidity rewards
POST /sapi/v1/bswap/claimRewards
https://binance-docs.github.io/apidocs/spot/en/#claim-rewards-trade
- Keyword Arguments
type (int, optional) – 0: Swap rewards,1:Liquidity rewards, default to 0
recvWindow (int, optional) – The value cannot be greater than 60000
Get Claimed History (USER_DATA)
- bswap_claimed_rewards(self, **kwargs)
Get Claimed History (USER_DATA) Get history of claimed rewards.
GET /sapi/v1/bswap/claimedHistory
https://binance-docs.github.io/apidocs/spot/en/#get-claimed-history-user_data
- Keyword Arguments
poolId (int, optional) –
assetRewards (str, optional) –
type (int, optional) – 0: Swap rewards,1:Liquidity rewards, default to 0
startTime (int, optional) –
endTime (int, optional) –
limit (int, optional) – default 3, max 100
recvWindow (int, optional) – The value cannot be greater than 60000
C2C Endpoints
Get C2C Trade History (USER_DATA)
- c2c_trade_history(self, tradeType: str, **kwargs)
Get C2C Trade History (USER_DATA)
GET /sapi/v1/c2c/orderMatch/listUserOrderHistory
https://binance-docs.github.io/apidocs/spot/en/#get-c2c-trade-history-user_data
- Parameters
tradeType (str) – BUY, SELL
- Keyword Arguments
startTimestamp (int, optional) –
endTimestamp (int, optional) –
page (int, optional) – default 1
rows (int, optional) – default 100, max 100
recvWindow (int, optional) – The value cannot be greater than 60000
Convert Endpoints
Get Convert Trade History (USER_DATA)
- convert_trade_history(self, startTime: int, endTime: int, **kwargs)
Convert Trade History (USER_DATA)
Get convert history for a specific account.
GET /sapi/v1/convert/tradeFlow
https://binance-docs.github.io/apidocs/spot/en/#convert-endpoints
- Parameters
startTime (int) –
endTime (int) –
- Keyword Arguments
limit (int, optional) – Default Value: 100; Max Value: 1000
recvWindow (int, optional) –
Data Stream Endpoints
Create a ListenKey (USER_STREAM)
- new_listen_key(self)
Create a ListenKey (USER_STREAM)
POST /api/v3/userDataStream
https://binance-docs.github.io/apidocs/spot/en/#listen-key-spot
Ping/Keep-alive a ListenKey (USER_STREAM)
- renew_listen_key(self, listenKey: str)
Ping/Keep-alive a ListenKey (USER_STREAM)
PUT /api/v3/userDataStream
https://binance-docs.github.io/apidocs/spot/en/#listen-key-spot
- Parameters
listenKey (str) –
Close a ListenKey (USER_STREAM)
- close_listen_key(self, listenKey: str)
Close a ListenKey (USER_STREAM)
DELETE /api/v3/userDataStream
https://binance-docs.github.io/apidocs/spot/en/#listen-key-spot
- Parameters
listenKey (str) –
Create a margin ListenKey (USER_STREAM)
- new_margin_listen_key(self)
Create a margin ListenKey (USER_STREAM)
POST /sapi/v1/userDataStream
https://binance-docs.github.io/apidocs/spot/en/#listen-key-margin
Renew a margin ListenKey (USER_STREAM)
- renew_margin_listen_key(self, listenKey: str)
Renew a margin ListenKey (USER_STREAM)
PUT /sapi/v1/userDataStream
https://binance-docs.github.io/apidocs/spot/en/#listen-key-margin
- Parameters
listenKey (str) –
Close a margin ListenKey (USER_STREAM)
- close_margin_listen_key(self, listenKey: str)
Close a margin ListenKey (USER_STREAM)
DELETE /sapi/v1/userDataStream
https://binance-docs.github.io/apidocs/spot/en/#listen-key-margin
- Parameters
listenKey (str) –
Create an isolated margin ListenKey (USER_STREAM)
- new_isolated_margin_listen_key(self, symbol: str)
Create an isolated margin ListenKey (USER_STREAM)
POST /sapi/v1/userDataStream/isolated
https://binance-docs.github.io/apidocs/spot/en/#listen-key-margin
- Parameters
symbol (str) –
Renew an isolated ListenKey (USER_STREAM)
- renew_isolated_margin_listen_key(self, listenKey: str, symbol: str)
Renew an isolated ListenKey (USER_STREAM)
PUT /sapi/v1/userDataStream/isolated
https://binance-docs.github.io/apidocs/spot/en/#listen-key-margin
- Parameters
listenKey (str) –
symbol (str) –
Close an isolated margin ListenKey (USER_STREAM)
- close_isolated_margin_listen_key(self, listenKey: str, symbol: str)
Close an isolated margin ListenKey (USER_STREAM)
DELETE /sapi/v1/userDataStream/isolated
https://binance-docs.github.io/apidocs/spot/en/#listen-key-margin
- Parameters
listenKey (str) –
symbol (str) –
Fiat Endpoints
Get Fiat Order History (USER_DATA)
- fiat_order_history(self, transactionType: int, **kwargs)
Get Fiat Deposit/Withdraw History (USER_DATA)
GET /sapi/v1/fiat/orders
https://binance-docs.github.io/apidocs/spot/en/#get-fiat-deposit-withdraw-history-user_data
- Parameters
transactionType (int) – 0-deposit,1-withdraw
- Keyword Arguments
beginTime (int, optional) –
endTime (int, optional) –
page (int, optional) – default 1
rows (int, optional) – default 100, max 500
recvWindow (int, optional) – The value cannot be greater than 60000
Get Fiat Payments History (USER_DATA)
- fiat_payment_history(self, transactionType: int, **kwargs)
Get Fiat Payments History (USER_DATA)
GET /sapi/v1/fiat/payments
https://binance-docs.github.io/apidocs/spot/en/#get-fiat-payments-history-user_data
- Parameters
transactionType (int) – 0-buy,1-sell
- Keyword Arguments
beginTime (int, optional) –
endTime (int, optional) –
page (int, optional) – default 1
rows (int, optional) – default 100, max 500
recvWindow (int, optional) – The value cannot be greater than 60000
Futures Endpoints
New Future Account Transfer (USER_DATA)
- futures_transfer(self, asset: str, amount: float, type: int, **kwargs)
New Future Account Transfer (USER_DATA) Execute transfer between spot account and futures account.
POST /sapi/v1/futures/transfer
https://binance-docs.github.io/apidocs/spot/en/#new-future-account-transfer-futures
- Parameters
asset (str) – The asset being transferred, e.g. USDT
amount (float) – The amount to be transferred
type (int) – 1: transfer from spot account to USDT-Ⓜ futures account. 2: transfer from USDT-Ⓜ futures account to spot account. 3: transfer from spot account to COIN-Ⓜ futures account. 4: transfer from COIN-Ⓜ futures account to spot account.
- Keyword Arguments
recvWindow (int, optional) – The value cannot be greater than 60000
Get Future Account Transaction History List (USER_DATA)
- futures_transfer_history(self, asset: str, startTime, **kwargs)
Get Future Account Transaction History List (USER_DATA)
GET /sapi/v1/futures/transfer
- Parameters
asset (str) – The asset being transferred, e.g. USDT
startTime (int) –
- Keyword Arguments
endTime (int, optional) –
current (int, optional) – Currently querying page. Start from 1. Default:1
size (int, optional) –
recvWindow (int, optional) – The value cannot be greater than 60000
Borrow For Cross-Collateral (TRADE)
- futures_loan_borrow(self, coin: str, collateralCoin: str, **kwargs)
Borrow For Cross-Collateral (TRADE)
POST /sapi/v1/futures/loan/borrow
https://binance-docs.github.io/apidocs/spot/en/#borrow-for-cross-collateral-trade
- Parameters
coin (str) –
collateralCoin (str) –
- Keyword Arguments
amount (float, optional) – mandatory when collateralAmount is empty
collateralAmount (float, optional) – mandatory when amount is empty
recvWindow (int, optional) – The value cannot be greater than 60000
Cross-Collateral Borrow History (USER_DATA)
- futures_loan_borrow_history(self, **kwargs)
Cross-Collateral Borrow History (USER_DATA)
GET /sapi/v1/futures/loan/borrow/history
https://binance-docs.github.io/apidocs/spot/en/#cross-collateral-borrow-history-user_data
- Keyword Arguments
coin (str, optional) –
startTime (int, optional) –
endTime (int, optional) –
limit (int, optional) – default 500, max 1000
recvWindow (int, optional) – The value cannot be greater than 60000
Repay For Cross-Collateral (TRADE)
- futures_loan_repay(self, coin: str, collateralCoin: str, amount: float, **kwargs)
Repay For Cross-Collateral (TRADE)
POST /sapi/v1/futures/loan/repay
https://binance-docs.github.io/apidocs/spot/en/#repay-for-cross-collateral-trade
- Parameters
coin (str) –
collateralCoin (str) –
amount (float) –
- Keyword Arguments
recvWindow (int, optional) – The value cannot be greater than 60000
Cross-Collateral Repayment History (USER_DATA)
- futures_loan_repay_history(self, **kwargs)
Cross-Collateral Repayment History (USER_DATA)
GET /sapi/v1/futures/loan/repay/history
https://binance-docs.github.io/apidocs/spot/en/#cross-collateral-repayment-history-user_data
- Keyword Arguments
coin (str, optional) –
startTime (int, optional) –
endTime (int, optional) –
limit (int, optional) – default 500, max 1000
recvWindow (int, optional) – The value cannot be greater than 60000
Cross-Collateral Wallet (USER_DATA)
- futures_loan_wallet(self, **kwargs)
Cross-Collateral Wallet (USER_DATA)
GET /sapi/v2/futures/loan/wallet
https://binance-docs.github.io/apidocs/spot/en/#cross-collateral-wallet-v2-user_data
- Keyword Arguments
recvWindow (int, optional) – The value cannot be greater than 60000
Cross-Collateral Information (USER_DATA)
- futures_loan_configs(self, **kwargs)
Cross-Collateral Information (USER_DATA)
GET /sapi/v2/futures/loan/configs
https://binance-docs.github.io/apidocs/spot/en/#cross-collateral-information-v2-user_data
- Keyword Arguments
loanCoin (str, optional) –
collateralCoin (str, optional) –
recvWindow (int, optional) – The value cannot be greater than 60000
Calculate Rate After Adjust Cross-Collateral LTV (USER_DATA)
- futures_loan_calc_adjust_level(self, loanCoin: str, collateralCoin: str, amount: float, direction: str, **kwargs)
Calculate Rate After Adjust Cross-Collateral LTV (USER_DATA)
GET /sapi/v2/futures/loan/calcAdjustLevel
- Parameters
loanCoin (str) –
collateralCoin (str) –
amount (float) –
direction (str) – “ADDITIONAL”, “REDUCED”
- Keyword Arguments
recvWindow (int, optional) – The value cannot be greater than 60000
Get Max Amount for Adjust Cross-Collateral LTV (USER_DATA)
- futures_loan_calc_max_adjust_amount(self, loanCoin: str, collateralCoin: str, **kwargs)
Get Max Amount for Adjust Cross-Collateral LTV (USER_DATA)
GET /sapi/v2/futures/loan/calcMaxAdjustAmount
- Parameters
loanCoin (str) –
collateralCoin (str) –
- Keyword Arguments
recvWindow (int, optional) – The value cannot be greater than 60000
Adjust Cross-Collateral LTV (TRADE)
- futures_loan_adjust_collateral(self, loanCoin: str, collateralCoin: str, amount: float, direction: str, **kwargs)
Adjust Cross-Collateral LTV (TRADE)
POST /sapi/v2/futures/loan/adjustCollateral
https://binance-docs.github.io/apidocs/spot/en/#adjust-cross-collateral-ltv-v2-trade
- Parameters
loanCoin (str) –
collateralCoin (str) –
amount (float) –
direction (str) – “ADDITIONAL”, “REDUCED”
- Keyword Arguments
recvWindow (int, optional) – The value cannot be greater than 60000
Adjust Cross-Collateral LTV History (USER_DATA)
- futures_loan_adjust_collateral_history(self, **kwargs)
Adjust Cross-Collateral LTV History (USER_DATA)
GET /sapi/v1/futures/loan/adjustCollateral/history
https://binance-docs.github.io/apidocs/spot/en/#adjust-cross-collateral-ltv-history-user_data
- Keyword Arguments
loanCoin (str, optional) –
collateralCoin (str, optional) –
startTime (int, optional) –
endTime (int, optional) –
limit (int, optional) – default 500, max 1000
recvWindow (int, optional) – The value cannot be greater than 60000
Cross-Collateral Liquidation History (USER_DATA)
- futures_loan_liquidation_history(self, **kwargs)
Cross-Collateral Liquidation History (USER_DATA)
GET /sapi/v1/futures/loan/liquidationHistory
https://binance-docs.github.io/apidocs/spot/en/#cross-collateral-liquidation-history-user_data
- Keyword Arguments
loanCoin (str, optional) –
collateralCoin (str, optional) –
startTime (int, optional) –
endTime (int, optional) –
limit (int, optional) – default 500, max 1000
recvWindow (int, optional) – The value cannot be greater than 60000
Check Collateral Repay Limit (USER_DATA)
- futures_loan_collateral_repay_limit(self, coin: str, collateralCoin: str, **kwargs)
Check Collateral Repay Limit (USER_DATA)
GET /sapi/v1/futures/loan/collateralRepayLimit
https://binance-docs.github.io/apidocs/spot/en/#check-collateral-repay-limit-user_data
- Parameters
coin (str) –
collateralCoin (str) –
- Keyword Arguments
recvWindow (int, optional) – The value cannot be greater than 60000
Get Collateral Repay Quote (USER_DATA)
- futures_loan_collateral_repay_quote(self, coin: str, collateralCoin: str, amount, **kwargs)
Get Collateral Repay Quote (USER_DATA)
GET /sapi/v1/futures/loan/collateralRepay
https://binance-docs.github.io/apidocs/spot/en/#get-collateral-repay-quote-user_data
- Parameters
coin (str) –
collateralCoin (str) –
amount (float) – repay amount
- Keyword Arguments
recvWindow (int, optional) – The value cannot be greater than 60000
Repay with Collateral (USER_DATA)
- futures_loan_collateral_repay(self, quoteId: str, **kwargs)
Repay with Collateral (USER_DATA)
POST /sapi/v1/futures/loan/collateralRepay
https://binance-docs.github.io/apidocs/spot/en/#repay-with-collateral-user_data
- Parameters
quoteId (str) –
- Keyword Arguments
recvWindow (int, optional) – The value cannot be greater than 60000
Collateral Repayment Result (USER_DATA)
- futures_loan_collateral_repay_result(self, quoteId: str, **kwargs)
Collateral Repayment Result (USER_DATA)
GET /sapi/v1/futures/loan/collateralRepayResult
https://binance-docs.github.io/apidocs/spot/en/#collateral-repayment-result-user_data
- Parameters
quoteId (str) –
- Keyword Arguments
recvWindow (int, optional) – The value cannot be greater than 60000
Cross-Collateral Interest History (USER_DATA)
- futures_loan_interest_history(self, **kwargs)
Cross-Collateral Interest History (USER_DATA)
GET /sapi/v1/futures/loan/interestHistory
https://binance-docs.github.io/apidocs/spot/en/#cross-collateral-interest-history-user_data
- Keyword Arguments
collateralCoin (str, optional) –
startTime (int, optional) –
endTime (int, optional) –
current (int, optional) – Currently querying page. Start from 1. Default:1
limit (int, optional) – default 500, max 1000
recvWindow (int, optional) – The value cannot be greater than 60000
Card Gift Endpoints
Create a Binance Code (USER_DATA)
- gift_card_create_code(self, token: str, amount: float, **kwargs)
Create a Binance Code (USER_DATA)
POST /sapi/v1/giftcard/createCode
This API is for creating a Binance Code. To get started with, please make sure:
You have a sufficient balance in your Binance funding wallet
You need Enable Withdrawals for the API Key which requests this endpoint.
https://binance-docs.github.io/apidocs/spot/en/#create-a-binance-code-user_data
- Parameters
token (str) – The coin type contained in the Binance Code
amount (float) – The amount of the coin
- Keyword Arguments
recvWindow (int, optional) – The value cannot be greater than 60000
Redeem a Binance Code (USER_DATA)
- gift_card_redeem_code(self, code: str, **kwargs)
Redeem a Binance Code (USER_DATA)
POST /sapi/v1/giftcard/redeemCode
This API is for redeeming the Binance Code. Once redeemed, the coins will be deposited in your funding wallet.
Please note that if you enter the wrong code 5 times within 24 hours, you will no longer be able to redeem any Binance Code that day.
https://binance-docs.github.io/apidocs/spot/en/#redeem-a-binance-code-user_data
- Parameters
code (str) – Binance Code
- Keyword Arguments
externalUid (str, optional) – Each external unique ID represents a unique user on the partner platform. The function helps you to identify the redemption behavior of different users, such as redemption frequency and amount. It also helps risk and limit control of a single account, such as daily limit on redemption volume, frequency, and incorrect number of entries. This will also prevent a single user account reach the partner’s daily redemption limits. We strongly recommend you to use this feature and transfer us the User ID of your users if you have different users redeeming Binance codes on your platform. To protect user data privacy, you may choose to transfer the user id in any desired format (max. 400 characters).
recvWindow (int, optional) – The value cannot be greater than 60000
Verify a Binance Code (USER_DATA)
- gift_card_verify_code(self, referenceNo: str, **kwargs)
Verify a Binance Code (USER_DATA)
GET /sapi/v1/giftcard/verify
This API is for verifying whether the Binance Code is valid or not by entering Binance Code or reference number.
Please note that if you enter the wrong binance code 5 times within an hour, you will no longer be able to verify any binance code for that hour.
https://binance-docs.github.io/apidocs/spot/en/#verify-a-binance-code-user_data
- Parameters
referenceNo (str) – reference number
- Keyword Arguments
recvWindow (int, optional) – The value cannot be greater than 60000
Gift Card RSA Public Key (USER_DATA)
- gift_card_rsa_public_key(self, **kwargs)
Fetch RSA Public Key (USER_DATA)
This API is for fetching the RSA Public Key. This RSA Public key will be used to encrypt the card code. Please note that the RSA Public key fetched is valid only for the current day.
Weight(IP): 1
GET /sapi/v1/giftcard/cryptography/rsa-public-key
https://binance-docs.github.io/apidocs/spot/en/#fetch-rsa-public-key-user_data
- Keyword Arguments
recvWindow (int, optional) – The value cannot be greater than 60000
Crypto Loans Endpoints
Get Crypto Loans Income History (USER_DATA)
- loan_history(self, asset: str, **kwargs)
Get Crypto Loans Income History (USER_DATA)
GET /sapi/v1/loan/income
https://binance-docs.github.io/apidocs/spot/en/#get-crypto-loans-income-history-user_data
- Parameters
asset (str) –
- Keyword Arguments
type (str, optional) – All types will be returned by default. borrowIn, collateralSpent, repayAmount, collateralReturn (collateral return after repayment), addCollateral, removeCollateral, collateralReturnAfterLiquidation
startTime (int, optional) –
endTime (int, optional) –
limit (int, optional) – default 20, max 100
recvWindow (int, optional) – The value cannot be greater than 60000
Margin Endpoints
Margin Account Transfer (MARGIN)
- margin_transfer(self, asset: str, amount, type: int, **kwargs)
Margin Account Transfer (MARGIN) Execute transfer between spot account and margin account.
POST /sapi/v1/margin/transfer
https://binance-docs.github.io/apidocs/spot/en/#margin-account-transfer-margin
- Parameters
asset (str) – The asset being transferred, e.g., BTC.
amount (float) – The amount to be transferred
type (int) – 1: transfer from main account to cross margin account 2: transfer from cross margin account to main account
- Keyword Arguments
recvWindow (int, optional) – The value cannot be greater than 60000
Margin Account Borrow (MARGIN)
- margin_borrow(self, asset: str, amount, **kwargs)
Margin Account Borrow (MARGIN) Apply for a loan.
POST /sapi/v1/margin/load
https://binance-docs.github.io/apidocs/spot/en/#margin-account-borrow-margin
- Parameters
asset (str) – The asset being transferred, e.g., BTC.
amount (float) – The amount to be transferred
- Keyword Arguments
isIsolated (str, optional) – for isolated margin or not,”TRUE”, “FALSE”,default “FALSE”.
symbol (str, optional) – isolated symbol
recvWindow (int, optional) – The value cannot be greater than 60000
Margin Account Repay(MARGIN)
- margin_repay(self, asset: str, amount, **kwargs)
Margin Account Repay(MARGIN) Repay loan for margin account.
POST /sapi/v1/margin/repay
https://binance-docs.github.io/apidocs/spot/en/#margin-account-repay-margin
- Parameters
asset (str) – The asset being transferred, e.g., BTC.
amount (float) – The amount to be transferred
- Keyword Arguments
isIsolated (str, optional) – for isolated margin or not,”TRUE”, “FALSE”,default “FALSE”.
symbol (str, optional) – isolated symbol
recvWindow (int, optional) – The value cannot be greater than 60000
Query Margin Asset (MARKET_DATA)
- margin_asset(self, asset: str)
Query Margin Asset (MARKET_DATA)
GET /sapi/v1/margin/asset
https://binance-docs.github.io/apidocs/spot/en/#query-margin-asset-market_data
- Parameters
asset (str) – The asset being transferred, e.g., BTC.
Query Margin Pair (MARKET_DATA)
- margin_pair(self, symbol: str)
Query Margin Pair (MARKET_DATA)
GET /sapi/v1/margin/pair
https://binance-docs.github.io/apidocs/spot/en/#query-margin-pair-market_data
- Parameters
symbol (str) –
Get All Margin Assets (MARKET_DATA)
- margin_all_assets(self)
Get All Margin Assets (MARKET_DATA)
GET /sapi/v1/margin/allAssets
https://binance-docs.github.io/apidocs/spot/en/#get-all-margin-assets-market_data
Get All Margin Pairs (MARKET_DATA)
- margin_all_pairs(self)
Get All Margin Pairs (MARKET_DATA)
GET /sapi/v1/margin/allPairs
https://binance-docs.github.io/apidocs/spot/en/#get-all-margin-pairs-market_data
Query Margin PriceIndex (MARKET_DATA)
- margin_pair_index(self, symbol: str, **kwargs)
Query Margin PriceIndex (MARKET_DATA)
GET /sapi/v1/margin/priceIndex
https://binance-docs.github.io/apidocs/spot/en/#query-margin-priceindex-market_data
- Parameters
symbol (str) –
Margin Account New Order (TRADE)
- new_margin_order(self, symbol: str, side: str, type: str, **kwargs)
Margin Account New Order (TRADE)
Post a new order for margin account.
POST /sapi/v1/margin/order
https://binance-docs.github.io/apidocs/spot/en/#margin-account-new-order-trade
- Parameters
symbol (str) –
side (str) – BUY or SELL
type (str) –
- Keyword Arguments
quantity (float, optional) –
quoteOrderQty (float, optional) –
price (float, optional) –
stopPrice (float, optional) – Used with STOP_LOSS,STOP_LOSS_LIMIT,TAKE_PROFIT and TAKE_PROFIT_LIMIT orders.
newClientOrderId (str, optional) – A unique id among open orders. Automatically generated if not sent.
icebergQty (float, optional) – Used with LIMIT, STOP_LOSS_LIMIT and TAKE_PROFIT_LIMIT to create an iceberg order.
newOrderRespType (str, optional) – Set the response JSON. ACK, RESULT or FULL; MARKET and LIMIT order types default to FULL, all other orders default to ACK.
sideEffectType (str, optional) – NO_SIDE_EFFECT, MARGIN_BUY, AUTO_REPAY; default NO_SIDE_EFFECT.
timeInForce (str, optional) – GTC,IOC,FOK
isIsolated (str, optional) – for isolated margin or not,”TRUE”, “FALSE”,default “FALSE”.
recvWindow (int, optional) – The value cannot be greater than 60000
Margin Account Cancel Order (TRADE)
- cancel_margin_order(self, symbol: str, **kwargs)
Margin Account Cancel Order (TRADE)
Cancel an active order for margin account.
DELETE /sapi/v1/margin/order
https://binance-docs.github.io/apidocs/spot/en/#margin-account-cancel-order-trade
- Parameters
symbol (str) –
- Keyword Arguments
orderId (int, optional) –
origClientOrderId (str, optional) –
newClientOrderId (str, optional) – Used to uniquely identify this cancel. Automatically generated by default.
isIsolated (str, optional) – for isolated margin or not,”TRUE”, “FALSE”,default “FALSE”.
recvWindow (int, optional) – The value cannot be greater than 60000
Get Transfer History (USER_DATA)
- margin_transfer_history(self, asset: str, **kwargs)
Get Transfer History (USER_DATA)
GET /sapi/v1/margin/transfer
https://binance-docs.github.io/apidocs/spot/en/#get-transfer-history-user_data
- Parameters
asset (str) –
- Keyword Arguments
type (str, optional) – Transfer Type: ROLL_IN, ROLL_OUT
startTime (int, optional) –
endTime (int, optional) –
current (int, optional) – Currently querying page. Start from 1. Default:1
size (int, optional) – Default:10 Max:100
archived (str, optional) – Default: false. Set to true for archived data from 6 months ago
recvWindow (int, optional) – The value cannot be greater than 60000
Query Loan Record (USER_DATA)
- margin_load_record(self, asset: str, **kwargs)
Query Loan Record (USER_DATA)
GET /sapi/v1/margin/loan
https://binance-docs.github.io/apidocs/spot/en/#query-loan-record-user_data
- Parameters
asset (str) –
- Keyword Arguments
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
archived (str, optional) – Default: false. Set to true for archived data from 6 months ago
recvWindow (int, optional) – The value cannot be greater than 60000
Query Repay Record (USER_DATA)
- margin_repay_record(self, asset: str, **kwargs)
Query Repay Record (USER_DATA)
GET /sapi/v1/margin/repay
https://binance-docs.github.io/apidocs/spot/en/#query-repay-record-user_data
- Parameters
asset (str) –
- Keyword Arguments
isolatedSymbol (str, optional) – isolated symbol
txId (int, optional) – return of /sapi/v1/margin/repay
startTime (int, optional) –
endTime (int, optional) –
current (int, optional) – Currently querying page. Start from 1. Default:1
size (int, optional) – Default:10 Max:100
archived (str, optional) – Default: false. Set to true for archived data from 6 months ago
recvWindow (int, optional) – The value cannot be greater than 60000
Get Interest History (USER_DATA)
- margin_interest_history(self, **kwargs)
Get Interest History (USER_DATA)
GET /sapi/v1/margin/interestHistory
https://binance-docs.github.io/apidocs/spot/en/#get-interest-history-user_data
- Keyword Arguments
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
archived (str, optional) – Default: false. Set to true for archived data from 6 months ago
recvWindow (int, optional) – The value cannot be greater than 60000
Get Force Liquidation Record (USER_DATA)
- margin_force_liquidation_record(self, **kwargs)
Get Force Liquidation Record (USER_DATA)
GET /sapi/v1/margin/forceLiquidationRec
https://binance-docs.github.io/apidocs/spot/en/#get-force-liquidation-record-user_data
- Keyword Arguments
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
recvWindow (int, optional) – The value cannot be greater than 60000
Query Cross Margin Account Details (USER_DATA)
- margin_account(self, **kwargs)
Query Cross Margin Account Details (USER_DATA)
GET /sapi/v1/margin/account
https://binance-docs.github.io/apidocs/spot/en/#query-margin-account-details-user_data
- Keyword Arguments
recvWindow (int, optional) – The value cannot be greater than 60000
Query Margin Account’s Order (USER_DATA)
- margin_order(self, symbol: str, **kwargs)
Query Margin Account’s Order (USER_DATA)
GET /sapi/v1/margin/order
https://binance-docs.github.io/apidocs/spot/en/#query-margin-account-39-s-order-user_data
- Parameters
symbol (str) –
- Keyword Arguments
orderId (str, optional) –
origClientOrderId (str, optional) –
isIsolated (str, optional) – for isolated margin or not,”TRUE”, “FALSE”,default “FALSE”.
recvWindow (int, optional) – The value cannot be greater than 60000
Query Margin Account’s Open Order (USER_DATA)
- margin_open_orders(self, **kwargs)
Query Margin Account’s Open Order (USER_DATA)
GET /sapi/v1/margin/openOrders
https://binance-docs.github.io/apidocs/spot/en/#query-margin-account-39-s-open-order-user_data
- Keyword Arguments
symbol (str, optional) –
isIsolated (str, optional) – for isolated margin or not,”TRUE”, “FALSE”,default “FALSE”.
recvWindow (int, optional) – The value cannot be greater than 60000
Margin Account Cancel all Open Orders on a Symbol (USER_DATA)
- margin_open_orders_cancellation(self, symbol: str, **kwargs)
Margin Account Cancel all Open Orders on a Symbol (USER_DATA)
DELETE /sapi/v1/margin/openOrders
- Parameters
symbol (str) –
- Keyword Arguments
isIsolated (str, optional) – for isolated margin or not,”TRUE”, “FALSE”,default “FALSE”.
recvWindow (int, optional) – The value cannot be greater than 60000
Query Margin Account’s All Orders (USER_DATA)
- margin_all_orders(self, symbol: str, **kwargs)
Query Margin Account’s All Orders (USER_DATA)
GET /sapi/v1/margin/allOrders
https://binance-docs.github.io/apidocs/spot/en/#query-margin-account-39-s-all-order-user_data
- Parameters
symbol (str) –
- Keyword Arguments
orderId (int, optional) –
isIsolated (str, optional) – for isolated margin or not,”TRUE”, “FALSE”,default “FALSE”.
startTime (int, optional) –
endTime (int, optional) –
limit (int, optional) – Default 500; max 500.
recvWindow (int, optional) – The value cannot be greater than 60000
Query Margin Account’s Trade List (USER_DATA)
- margin_my_trades(self, symbol: str, **kwargs)
Query Margin Account’s Trade List (USER_DATA)
GET /sapi/v1/margin/myTrades
https://binance-docs.github.io/apidocs/spot/en/#query-margin-account-39-s-trade-list-user_data
- Parameters
symbol (str) –
- Keyword Arguments
fromID (int, optional) – TradeId to fetch from. Default gets most recent trades.
isIsolated (str, optional) – for isolated margin or not,”TRUE”, “FALSE”,default “FALSE”.
startTime (int, optional) –
endTime (int, optional) –
limit (int, optional) – Default 500; max 500.
recvWindow (int, optional) – The value cannot be greater than 60000
Query Max Borrow (USER_DATA)
- margin_max_borrowable(self, asset: str, **kwargs)
Query Max Borrow (USER_DATA)
GET /sapi/v1/margin/maxBorrowable
https://binance-docs.github.io/apidocs/spot/en/#query-max-borrow-user_data
- Parameters
asset (str) –
- Keyword Arguments
isolatedSymbol (str, optional) – isolated symbol
recvWindow (int, optional) – The value cannot be greater than 60000
Query Max Transfer-Out Amount (USER_DATA)
- margin_max_transferable(self, asset: str, **kwargs)
Query Max Transfer-Out Amount (USER_DATA)
GET /sapi/v1/margin/maxTransferable
https://binance-docs.github.io/apidocs/spot/en/#query-max-transfer-out-amount-user_data
- Parameters
asset (str) –
- Keyword Arguments
isolatedSymbol (str, optional) – isolated symbol
recvWindow (int, optional) – The value cannot be greater than 60000
Isolated Margin Account Transfer (MARGIN)
- isolated_margin_transfer(self, asset: str, symbol: str, transFrom: str, transTo: str, amount, **kwargs)
Isolated Margin Account Transfer (MARGIN)
POST /sapi/v1/margin/isolated/transfer
https://binance-docs.github.io/apidocs/spot/en/#isolated-margin-account-transfer-margin
- Parameters
asset (str) –
symbol (str) –
amount (float) –
transFrom (str) – “SPOT”, “ISOLATED_MARGIN”
transTo (str) – “SPOT”, “ISOLATED_MARGIN”
- Keyword Arguments
recvWindow (int, optional) – The value cannot be greater than 60000
Get Isolated Margin Transfer History (USER_DATA)
- isolated_margin_transfer_history(self, symbol: str, **kwargs)
Get Isolated Margin Transfer History (USER_DATA)
GET /sapi/v1/margin/isolated/transfer
https://binance-docs.github.io/apidocs/spot/en/#get-isolated-margin-transfer-history-user_data
- Parameters
symbol (str) –
- Keyword Arguments
asset (str, optional) – asset,such as BTC
transFrom (str, optional) – “SPOT”, “ISOLATED_MARGIN”
transTo (str, optional) – “SPOT”, “ISOLATED_MARGIN”
startTime (int, optional) –
endTime (int, optional) –
current (int, optional) – Currently querying page. Start from 1. Default:1
size (int, optional) – Default:10 Max:100
recvWindow (int, optional) – The value cannot be greater than 60000
Query Isolated Margin Account Info (USER_DATA)
- isolated_margin_account(self, **kwargs)
Query Isolated Margin Account Info (USER_DATA)
GET /sapi/v1/margin/isolated/account
https://binance-docs.github.io/apidocs/spot/en/#query-isolated-margin-account-info-user_data
- Keyword Arguments
symbols (str, optional) – Max 5 symbols can be sent; separated by “,”. e.g. “BTCUSDT,BNBUSDT,ADAUSDT”
recvWindow (int, optional) – The value cannot be greater than 60000
Query Isolated Margin Symbol (USER_DATA)
- isolated_margin_pair(self, symbol: str, **kwargs)
Query Isolated Margin Symbol (USER_DATA)
GET /sapi/v1/margin/isolated/pair
https://binance-docs.github.io/apidocs/spot/en/#query-isolated-margin-account-info-user_data
- Parameters
symbol (str) –
- Keyword Arguments
recvWindow (int, optional) – The value cannot be greater than 60000
Get All Isolated Margin Symbol(USER_DATA)
- isolated_margin_all_pairs(self, **kwargs)
Get All Isolated Margin Symbol(USER_DATA)
GET /sapi/v1/margin/isolated/allPairs
https://binance-docs.github.io/apidocs/spot/en/#get-all-isolated-margin-symbol-user_data
- Keyword Arguments
recvWindow (int, optional) – The value cannot be greater than 60000
Toggle BNB Burn On Spot Trade And Margin Interest (USER_DATA)
- toggle_bnbBurn(self, **kwargs)
Toggle BNB Burn On Spot Trade And Margin Interest (USER_DATA)
POST /sapi/v1/bnbBurn
- Keyword Arguments
spotBNBBurn (str, optional) – “true” or “false”; Determines whether to use BNB to pay for trading fees on SPOT
interestBNBBurn (str, optional) – “true” or “false”; Determines whether to use BNB to pay for margin loan’s interest
recvWindow (int, optional) – The value cannot be greater than 60000
Get BNB Burn Status (USER_DATA)
- bnbBurn_status(self, **kwargs)
Get BNB Burn Status (USER_DATA)
GET /sapi/v1/bnbBurn
https://binance-docs.github.io/apidocs/spot/en/#get-bnb-burn-status-user_data
- Keyword Arguments
recvWindow (int, optional) – The value cannot be greater than 60000
Get Margin Interest Rate History (USER_DATA)
- margin_interest_rate_history(self, asset: str, **kwargs)
Get Margin Interest Rate History (USER_DATA)
GET /sapi/v1/margin/interestRateHistory
https://binance-docs.github.io/apidocs/spot/en/#query-margin-interest-rate-history-user_data
- Parameters
asset (str) –
- Keyword Arguments
vipLevel (str, optional) – Default: user’s vip level
startTime (int, optional) – Default: 7 days ago.
endTime (int, optional) – Default: present. Maximum range: 1 month.
recvWindow (int, optional) – The value cannot be greater than 60000
Margin Account New OCO (TRADE)
- new_margin_oco_order(self, symbol: str, side: str, quantity: float, price: float, stopPrice: float, **kwargs)
Margin Account New OCO (TRADE)
Send in a new OCO for a margin account
POST /sapi/v1/margin/order/oco
https://binance-docs.github.io/apidocs/spot/en/#margin-account-new-oco-trade
- Parameters
symbol (str) –
side (str) –
quantity (float) –
price (float) –
stopPrice (float) –
- Keyword Arguments
isIsolated (str, optional) – For isolated margin or not “TRUE”, “FALSE”,default “FALSE”
listClientOrderId (str, optional) – A unique Id for the entire orderList
limitClientOrderId (str, optional) – A unique Id for the limit order
limitIcebergQty (float, optional) –
stopClientOrderId (str, optional) – A unique Id for the stop loss/stop loss limit leg
stopLimitPrice (float, optional) – If provided, stopLimitTimeInForce is required
stopIcebergQty (float, optional) –
stopLimitTimeInForce (str, optional) – Valid values are GTC/FOK/IOC
newOrderRespType (str, optional) – Set the response JSON
sideEffectType (str, optional) – NO_SIDE_EFFECT, MARGIN_BUY, AUTO_REPAY; default NO_SIDE_EFFECT
recvWindow (int, optional) – The value cannot be greater than 60000
Margin Account Cancel OCO (TRADE)
- cancel_margin_oco_order(self, symbol, orderListId: Optional[int] = None, listClientOrderId: Optional[str] = None, **kwargs)
Margin Account Cancel OCO (TRADE)
Cancel an entire Order List for a margin account.
DELETE /sapi/v1/margin/orderList
https://binance-docs.github.io/apidocs/spot/en/#margin-account-cancel-oco-trade
- Parameters
symbol (str) –
orderListId (int, optional) – Either orderListId or listClientOrderId must be provided
listClientOrderId (str, optional) – Either orderListId or listClientOrderId must be provided
- Keyword Arguments
isIsolated (str, optional) – For isolated margin or not “TRUE”, “FALSE”,default “FALSE”
newClientOrderId (str, optional) – Used to uniquely identify this cancel. Automatically generated by default.
recvWindow (int, optional) – The value cannot be greater than 60000
Query Margin Account’s OCO (USER_DATA)
- get_margin_oco_order(self, orderListId: Optional[int] = None, origClientOrderId: Optional[str] = None, **kwargs)
Query Margin Account’s OCO (USER_DATA)
Retrieves a specific OCO based on provided optional parameters
GET /sapi/v1/margin/orderList
https://binance-docs.github.io/apidocs/spot/en/#query-margin-account-39-s-oco-user_data
- Parameters
orderListId (int, optional) – Either orderListId or origClientOrderId must be provided
origClientOrderId (str, optional) – Either orderListId or origClientOrderId must be provided.
- Keyword Arguments
isIsolated (str, optional) – For isolated margin or not “TRUE”, “FALSE”,default “FALSE”
symbol (str, optional) – Mandatory for isolated margin, not supported for cross margin
recvWindow (int, optional) – The value cannot be greater than 60000
Query Margin Account’s all OCO (USER_DATA)
- get_margin_oco_orders(self, **kwargs)
Query Margin Account’s all OCO (USER_DATA)
Retrieves all OCO for a specific margin account based on provided optional parameters
GET /sapi/v1/margin/allOrderList
https://binance-docs.github.io/apidocs/spot/en/#query-margin-account-39-s-all-oco-user_data
- Keyword Arguments
isIsolated (str, optional) – For isolated margin or not “TRUE”, “FALSE”,default “FALSE”
symbol (str, optional) – Mandatory for isolated margin, not supported for cross margin
fromId (int, optional) – 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, optional) – The value cannot be greater than 60000
Query Margin Account’s Open OCO (USER_DATA)
- get_margin_open_oco_orders(self, **kwargs)
Query Margin Account’s Open OCO (USER_DATA)
GET /sapi/v1/margin/openOrderList
https://binance-docs.github.io/apidocs/spot/en/#query-margin-account-39-s-open-oco-user_data
- Keyword Arguments
isIsolated (str, optional) – For isolated margin or not “TRUE”, “FALSE”,default “FALSE”
symbol (str, optional) – Mandatory for isolated margin, not supported for cross margin
recvWindow (int, optional) – The value cannot be greater than 60000
Disable Isolated Margin Account (TRADE)
- cancel_isolated_margin_account(self, symbol: str, **kwargs)
Disable Isolated Margin Account (TRADE) Disable isolated margin account for a specific symbol. Each trading pair can only be deactivated once every 24 hours.
DELETE /sapi/v1/margin/isolated/account
https://binance-docs.github.io/apidocs/spot/en/#disable-isolated-margin-account-trade
- Parameters
symbol (str) –
- Keyword Arguments
recvWindow (int, optional) – The value cannot be greater than 60000
Enable Isolated Margin Account (TRADE)
- enable_isolated_margin_account(self, symbol: str, **kwargs)
Enable Isolated Margin Account (TRADE) Enable isolated margin account for a specific symbol (Only supports activation of previously disabled accounts).
POST /sapi/v1/margin/isolated/account
https://binance-docs.github.io/apidocs/spot/en/#enable-isolated-margin-account-trade
- Parameters
symbol (str) –
- Keyword Arguments
recvWindow (int, optional) – The value cannot be greater than 60000
Query Enabled Isolated Margin Account Limit (USER_DATA)
- isolated_margin_account_limit(self, **kwargs)
Query Enabled Isolated Margin Account Limit (USER_DATA) Query enabled isolated margin account limit.
GET /sapi/v1/margin/isolated/accountLimit
- Keyword Arguments
recvWindow (int, optional) – The value cannot be greater than 60000
Query Cross Margin Fee Data (USER_DATA)
- margin_fee(self, **kwargs)
Query Cross Margin Fee Data (USER_DATA) Get cross margin fee data collection with any vip level or user’s current specific data as https://www.binance.com/en/margin-fee
GET /sapi/v1/margin/crossMarginData
https://binance-docs.github.io/apidocs/spot/en/#query-cross-margin-fee-data-user_data
- Keyword Arguments
vipLevel (int, optional) – User’s current specific margin data will be returned if vipLevel is omitted
coin (str, optional) –
recvWindow (int, optional) – The value cannot be greater than 60000
Query Isolated Margin Fee Data (USER_DATA)
- isolated_margin_fee(self, **kwargs)
Query Isolated Margin Fee Data (USER_DATA) Get isolated margin fee data collection with any vip level or user’s current specific data as https://www.binance.com/en/margin-fee
GET /sapi/v1/margin/isolatedMarginData
https://binance-docs.github.io/apidocs/spot/en/#query-isolated-margin-fee-data-user_data
- Keyword Arguments
vipLevel (int, optional) – User’s current specific margin data will be returned if vipLevel is omitted
symbol (str, optional) –
recvWindow (int, optional) – The value cannot be greater than 60000
Query Isolated Margin Tier Data (USER_DATA)
- isolated_margin_tier(self, symbol: str, **kwargs)
Query Isolated Margin Tier Data (USER_DATA) Get isolated margin tier data collection with any tier as https://www.binance.com/en/margin-data
GET /sapi/v1/margin/isolatedMarginTier
https://binance-docs.github.io/apidocs/spot/en/#query-isolated-margin-tier-data-user_data
- Parameters
symbol (str) –
- Keyword Arguments
tier (int, optional) – All margin tier data will be returned if tier is omitted
recvWindow (int, optional) – The value cannot be greater than 60000
Query Current Margin Order Count Usage (TRADE)
- margin_order_usage(self, **kwargs)
Query Current Margin Order Count Usage (TRADE) Displays the user’s current margin order count usage for all intervals.
GET /sapi/v1/margin/rateLimit/order
https://binance-docs.github.io/apidocs/spot/en/#query-current-margin-order-count-usage-trade
- Keyword Arguments
isIsolated (str, optional) – for isolated margin or not, “TRUE”, “FALSE”, default “FALSE”
symbol (str, optional) – isolated symbol, mandatory for isolated margin
recvWindow (int, optional) – The value cannot be greater than 60000
Market Endpoints
Test Connectivity
- ping(self)
Test Connectivity Test connectivity to the Rest API.
GET /api/v3/ping
https://binance-docs.github.io/apidocs/spot/en/#test-connectivity
Check Server Time
- time(self)
Check Server Time Test connectivity to the Rest API and get the current server time.
GET /api/v3/time
https://binance-docs.github.io/apidocs/spot/en/#check-server-time
Exchange Information
- exchange_info(self, symbol: Optional[str] = None, symbols: Optional[list] = None)
Exchange Information Current exchange trading rules and symbol information
GET /api/v3/exchangeinfo
https://binance-docs.github.io/apidocs/spot/en/#exchange-information
- Args:
symbol (str, optional): the trading pair symbols (list, optional): list of trading pairs
Get orderbook
- depth(self, symbol: str, **kwargs)
Get orderbook.
GET /api/v3/depth
https://binance-docs.github.io/apidocs/spot/en/#order-book
- Parameters
symbol (str) – the trading pair
- Keyword Arguments
limit (int, optional) – limit the results. Default 100; max 5000. If limit > 5000, then the response will truncate to 5000.
Recent Trades List
- trades(self, symbol: str, **kwargs)
Recent Trades List Get recent trades (up to last 500).
GET /api/v3/trades
https://binance-docs.github.io/apidocs/spot/en/#recent-trades-list
- Parameters
symbol (str) – the trading pair
- Keyword Arguments
limit (int, optional) – limit the results. Default 500; max 1000.
Old Trade Lookup
- historical_trades(self, symbol: str, **kwargs)
Old Trade Lookup Get older market trades.
GET /api/v3/historicalTrades
https://binance-docs.github.io/apidocs/spot/en/#old-trade-lookup
- Parameters
symbol (str) – the trading pair
- Keyword Arguments
limit (int, optional) – limit the results. Default 500; max 1000.
formId (int, optional) – trade id to fetch from. Default gets most recent trades.
Compressed/Aggregate Trades List
- agg_trades(self, symbol: str, **kwargs)
Compressed/Aggregate Trades List
GET /api/v3/aggTrades
https://binance-docs.github.io/apidocs/spot/en/#compressed-aggregate-trades-list
- Parameters
symbol (str) – the trading pair
- Keyword Arguments
limit (int, optional) – limit the results. Default 500; max 1000.
formId (int, optional) – id to get aggregate trades from INCLUSIVE.
startTime (int, optional) – Timestamp in ms to get aggregate trades from INCLUSIVE.
endTime (int, optional) – Timestamp in ms to get aggregate trades until INCLUSIVE.
Kline/Candlestick Data
- klines(self, symbol: str, interval: str, **kwargs)
Kline/Candlestick Data
GET /api/v3/klines
https://binance-docs.github.io/apidocs/spot/en/#kline-candlestick-data
- Parameters
symbol (str) – the trading pair
interval (str) – the interval of kline, e.g 1m, 5m, 1h, 1d, etc.
- Keyword Arguments
limit (int, optional) – limit the results. Default 500; max 1000.
startTime (int, optional) – Timestamp in ms to get aggregate trades from INCLUSIVE.
endTime (int, optional) – Timestamp in ms to get aggregate trades until INCLUSIVE.
Current Average Price
- avg_price(self, symbol: str)
Current Average Price
GET /api/v3/avgPrice
https://binance-docs.github.io/apidocs/spot/en/#current-average-price
- Parameters
symbol (str) – the trading pair
24hr Ticker Price Change Statistics
- ticker_24hr(self, symbol: Optional[str] = None, symbols: Optional[list] = None)
24hr Ticker Price Change Statistics
GET /api/v3/ticker/24hr
https://binance-docs.github.io/apidocs/spot/en/#24hr-ticker-price-change-statistics
- Parameters
symbol (str, optional) – the trading pair
symbols (list, optional) – list of trading pairs
Symbol Price Ticker
- ticker_price(self, symbol: Optional[str] = None, symbols: Optional[list] = None)
Symbol Price Ticker
GET /api/v3/ticker/price
https://binance-docs.github.io/apidocs/spot/en/#symbol-price-ticker
- Parameters
symbol (str, optional) – the trading pair
symbols (list, optional) – list of trading pairs
Symbol Order Book Ticker
- book_ticker(self, symbol: Optional[str] = None, symbols: Optional[list] = None)
Symbol Order Book Ticker
GET /api/v3/ticker/bookTicker
https://binance-docs.github.io/apidocs/spot/en/#symbol-order-book-ticker
- Parameters
symbol (str, optional) – the trading pair
symbols (list, optional) – list of trading pairs
Mining Endpoints
Acquiring Algorithm (MARKET_DATA)
- mining_algo_list(self)
Acquiring Algorithm (MARKET_DATA)
GET /sapi/v1/mining/pub/algoList
https://binance-docs.github.io/apidocs/spot/en/#acquiring-algorithm-market_data
Acquiring CoinName (MARKET_DATA)
- mining_coin_list(self)
Acquiring CoinName (MARKET_DATA)
GET /sapi/v1/mining/pub/coinList
https://binance-docs.github.io/apidocs/spot/en/#acquiring-coinname-market_data
Request for Detail Miner List (USER_DATA)
- mining_worker(self, algo: str, userName: str, workerName: str, **kwargs)
Request for Detail Miner List (USER_DATA)
GET /sapi/v1/mining/worker/detail
https://binance-docs.github.io/apidocs/spot/en/#request-for-detail-miner-list-user_data
- Parameters
algo (str) –
userName (str) – Mining account
workerName (str) –
- Keyword Arguments
recvWindow (int, optional) – The value cannot be greater than 60000
Request for Miner List (USER_DATA)
- mining_worker_list(self, algo: str, userName: str, **kwargs)
Request for Miner List (USER_DATA)
GET /sapi/v1/mining/worker/list
https://binance-docs.github.io/apidocs/spot/en/#request-for-miner-list-user_data
- Parameters
algo (str) –
userName (str) – Mining account
- Keyword Arguments
pageIndex (int, optional) – Page number,default is first page,start form 1
sort (int, optional) – sort sequence (default=0)0 positive sequence,1 negative sequence
sortColumn (int, optional) – Sort by (default 1): 1: miner name, 2: real-time computing power, 3: daily average computing power, 4: real-time rejection rate, 5: last submission time
workerStatus (int, optional) – miners status (default = 0) 0 all, 1 valid, 2 invalid, 3 failure
recvWindow (int, optional) – The value cannot be greater than 60000
Revenue List (USER_DATA)
- mining_earnings_list(self, algo: str, userName: str, **kwargs)
Revenue List (USER_DATA)
GET /sapi/v1/mining/payment/list
https://binance-docs.github.io/apidocs/spot/en/#earnings-list-user_data
- Parameters
algo (str) –
userName (str) – Mining account
- Keyword Arguments
coin (str, optional) – Coin Name
startDate (int, optional) – Search date, millisecond timestamp, while empty query all
endDate (int, optional) – Search date, millisecond timestamp, while empty query all
pageIndex (int, optional) – Page number, empty default first page, starting from 1
pageSize (int, optional) – Number of pages, minimum 10, maximum 200
recvWindow (int, optional) – The value cannot be greater than 60000
Extra Bonus List (USER_DATA)
- mining_bonus_list(self, algo: str, userName: str, **kwargs)
Extra Bonus List (USER_DATA)
GET /sapi/v1/mining/payment/other
https://binance-docs.github.io/apidocs/spot/en/#extra-bonus-list-user_data
- Parameters
algo (str) –
userName (str) – Mining account
- Keyword Arguments
coin (str, optional) – Coin Name
startDate (int, optional) – Search date, millisecond timestamp, while empty query all
endDate (int, optional) – Search date, millisecond timestamp, while empty query all
pageIndex (int, optional) – Page number, empty default first page, starting from 1
pageSize (int, optional) – Number of pages, minimum 10, maximum 200
recvWindow (int, optional) – The value cannot be greater than 60000
Statistic List (USER_DATA)
- mining_statistics_list(self, algo: str, userName: str, **kwargs)
Statistic List (USER_DATA)
GET /sapi/v1/mining/statistics/user/status
https://binance-docs.github.io/apidocs/spot/en/#statistic-list-user_data
- Parameters
algo (str) –
userName (str) – Mining account
- Keyword Arguments
recvWindow (int, optional) – The value cannot be greater than 60000
Account List (USER_DATA)
- mining_account_list(self, algo: str, userName: str, **kwargs)
Account List (USER_DATA)
GET /sapi/v1/mining/statistics/user/list
https://binance-docs.github.io/apidocs/spot/en/#account-list-user_data
- Parameters
algo (str) –
userName (str) – Mining account
- Keyword Arguments
recvWindow (int, optional) – The value cannot be greater than 60000
Hashrate Resale Request (USER_DATA)
- mining_hashrate_resale_request(self, algo: str, userName: str, startDate: int, endDate: int, toPoolUser: str, hashRate: int, **kwargs)
Hashrate Resale Request (USER_DATA)
POST /sapi/v1/mining/hash-transfer/config
https://binance-docs.github.io/apidocs/spot/en/#hashrate-resale-request-user_data
- Parameters
algo (str) –
userName (str) – Mining account
startDate (int) – Resale Start Time(Millisecond timestamp)
endDate (int) – Resale End Time (Millisecond timestamp)
toPoolUser (str) – Mining Account
hashRate (int) – Resale hashrate h/s must be transferred
- Keyword Arguments
recvWindow (int, optional) – The value cannot be greater than 60000
Cancel hashrate resale configuration(USER_DATA)
- mining_hashrate_resale_cancellation(self, configId: int, userName: str, **kwargs)
Cancel hashrate resale configuration(USER_DATA)
POST /sapi/v1/mining/hash-transfer/config/cancel
https://binance-docs.github.io/apidocs/spot/en/#cancel-hashrate-resale-configuration-user_data
- Parameters
configId (int) – Mining ID
userName (str) – Mining account
- Keyword Arguments
recvWindow (int, optional) – The value cannot be greater than 60000
Hashrate Resale List (USER_DATA)
- mining_hashrate_resale_list(self, **kwargs)
Hashrate Resale List (USER_DATA)
GET /sapi/v1/mining/hash-transfer/config/details/list
https://binance-docs.github.io/apidocs/spot/en/#hashrate-resale-list-user_data
- Keyword Arguments
pageIndex (int, optional) – Page number, empty default first page, starting from 1
pageSize (int, optional) – Number of pages, minimum 10, maximum 200
recvWindow (int, optional) – The value cannot be greater than 60000
Hashrate Resale Detail (USER_DATA)
- mining_hashrate_resale_details(self, configId: int, userName: str, **kwargs)
Hashrate Resale Detail (USER_DATA)
GET /sapi/v1/mining/hash-transfer/profit/details
https://binance-docs.github.io/apidocs/spot/en/#hashrate-resale-detail-user_data
- Parameters
configId (int) – Mining ID
userName (str) – Mining account
- Keyword Arguments
pageIndex (int, optional) – Page number, empty default first page, starting from 1
pageSize (int, optional) – Number of pages, minimum 10, maximum 200
recvWindow (int, optional) – The value cannot be greater than 60000
Mining Account Earning (USER_DATA)
- mining_account_earning(self, algo: str, **kwargs)
Mining Account Earning (USER_DATA)
GET /sapi/v1/mining/payment/uid
https://binance-docs.github.io/apidocs/spot/en/#mining-account-earning-user_data
- Parameters
algo (str) – Algorithm(sha256)
- Keyword Arguments
startDate (int, optional) – Millisecond timestamp
endDate (int, optional) – Millisecond timestamp
pageIndex (int, optional) – Default 1
pageSize (int, optional) – Min 10,Max 200
recvWindow (int, optional) – The value cannot be greater than 60000
NFT Endpoints
Get NFT Transaction History (USER_DATA)
- nft_transaction_history(self, orderType: int, **kwargs)
Get NFT Transaction History (USER_DATA)
GET /sapi/v1/nft/history/transactions
https://binance-docs.github.io/apidocs/spot/en/#get-nft-transaction-history-user_data
- Parameters
orderType (int) – 0: purchase order, 1: sell order, 2: royalty income, 3: primary market order, 4: mint fee
- Keyword Arguments
startTime (int, optional) –
endTime (int, optional) –
limit (int, optional) – Default 50, Max 50
page (int, optional) – Default 1
recvWindow (int, optional) – The value cannot be greater than 60000
Get NFT Deposit History(USER_DATA)
- nft_deposit_history(self, **kwargs)
Get NFT Deposit History(USER_DATA)
GET /sapi/v1/nft/history/deposit
https://binance-docs.github.io/apidocs/spot/en/#get-nft-deposit-history-user_data
- Keyword Arguments
startTime (int, optional) –
endTime (int, optional) –
limit (int, optional) – Default 50, Max 50
page (int, optional) – Default 1
recvWindow (int, optional) – The value cannot be greater than 60000
Get NFT Withdraw History (USER_DATA)
- nft_withdraw_history(self, **kwargs)
Get NFT Withdraw History (USER_DATA)
GET /sapi/v1/nft/history/withdraw
https://binance-docs.github.io/apidocs/spot/en/#get-nft-withdraw-history-user_data
- Keyword Arguments
startTime (int, optional) –
endTime (int, optional) –
limit (int, optional) – Default 50, Max 50
page (int, optional) – Default 1
recvWindow (int, optional) – The value cannot be greater than 60000
Get NFT Asset (USER_DATA)
- nft_asset(self, **kwargs)
Get NFT Asset (USER_DATA)
GET /sapi/v1/nft/user/getAsset
https://binance-docs.github.io/apidocs/spot/en/#get-nft-asset-user_data
- Keyword Arguments
limit (int, optional) – Default 50, Max 50
page (int, optional) – Default 1
recvWindow (int, optional) – The value cannot be greater than 60000
Pay Endpoints
Get Pay Trade History (USER_DATA)
- pay_history(self, **kwargs)
Get Pay Trade History (USER_DATA)
GET /sapi/v1/pay/transactions
https://binance-docs.github.io/apidocs/spot/en/#get-pay-trade-history-user_data
- Keyword Arguments
startTimestamp (int, optional) –
endTimestamp (int, optional) –
limit (int, optional) – default 100, max 100
recvWindow (int, optional) – The value cannot be greater than 60000
Portfolio Margin Endpoints
Get Portfolio Margin Account Info (USER_DATA)
- portfolio_margin_account(self, **kwargs)
Get Portfolio Margin Account Info (USER_DATA)
GET /sapi/v1/portfolio/account
https://binance-docs.github.io/apidocs/spot/en/#get-portfolio-margin-account-info-user_data
- Keyword Arguments
recvWindow (int, optional) – The value cannot be greater than 60000
Rebate Endpoints
Get Spot Rebate History Records (USER_DATA)
- rebate_spot_history(self, **kwargs)
Get Spot Rebate History Records (USER_DATA)
GET /sapi/v1/rebate/taxQuery
https://binance-docs.github.io/apidocs/spot/en/#get-spot-rebate-history-records-user_data
- Keyword Arguments
startTime (int, optional) –
endTime (int, optional) –
page (int, optional) – default 1
recvWindow (int, optional) – The value cannot be greater than 60000
Savings Endpoints
Get Flexible Product List (USER_DATA)
- savings_flexible_products(self, **kwargs)
Get Flexible Product List (USER_DATA)
GET /sapi/v1/lending/daily/product/list
https://binance-docs.github.io/apidocs/spot/en/#get-flexible-product-list-user_data
- Keyword Arguments
status (str, optional) – “ALL”, “SUBSCRIBABLE”, “UNSUBSCRIBABLE”; default “ALL”
featured (str, optional) – “ALL”, “true”; default “ALL”
current (int, optional) – Current query page. Default: 1, Min: 1
size (int, optional) – Default: 50, Max: 100
recvWindow (int, optional) – The value cannot be greater than 60000
Get Left Daily Purchase Quota of Flexible Product (USER_DATA)
- savings_flexible_user_left_quota(self, productId: str, **kwargs)
Get Left Daily Purchase Quota of Flexible Product (USER_DATA)
GET /sapi/v1/lending/daily/userLeftQuota
- Parameters
productId (str) –
- Keyword Arguments
recvWindow (int, optional) – The value cannot be greater than 60000
POST Purchase Flexible Product (USER_DATA)
- savings_purchase_flexible_product(self, productId: str, amount: float, **kwargs)
POST Purchase Flexible Product (USER_DATA)
POST /sapi/v1/lending/daily/purchase
https://binance-docs.github.io/apidocs/spot/en/#purchase-flexible-product-user_data
- Parameters
productId (str) –
amount (float) –
- Keyword Arguments
recvWindow (int, optional) – The value cannot be greater than 60000
Get Left Daily Redemption Quota of Flexible Product (USER_DATA)
- savings_flexible_user_redemption_quota(self, productId: str, type: str, **kwargs)
Get Left Daily Redemption Quota of Flexible Product (USER_DATA)
GET /sapi/v1/lending/daily/userRedemptionQuota
- Parameters
productId (str) –
type (str) –
- Keyword Arguments
recvWindow (int, optional) – The value cannot be greater than 60000
Redeem Flexible Product (USER_DATA)
- savings_flexible_redeem(self, productId: str, amount: float, type: str, **kwargs)
Redeem Flexible Product (USER_DATA)
POST /sapi/v1/lending/daily/redeem
https://binance-docs.github.io/apidocs/spot/en/#redeem-flexible-product-user_data
- Parameters
productId (str) –
amount (float) –
type (str) –
- Keyword Arguments
recvWindow (int, optional) – The value cannot be greater than 60000
Get Flexible Product Position (USER_DATA)
- savings_flexible_product_position(self, asset: str, **kwargs)
Get Flexible Product Position (USER_DATA)
GET /sapi/v1/lending/daily/token/position
https://binance-docs.github.io/apidocs/spot/en/#get-flexible-product-position-user_data
- Parameters
asset (str) –
- Keyword Arguments
recvWindow (int, optional) – The value cannot be greater than 60000
Get Fixed and Activity Project List(USER_DATA)
- savings_project_list(self, type: str, **kwargs)
Get Fixed and Activity Project List(USER_DATA)
GET /sapi/v1/lending/project/list
https://binance-docs.github.io/apidocs/spot/en/#get-fixed-and-activity-project-list-user_data
- Parameters
type (str) –
- Keyword Arguments
asset (str, optional) –
status (str, optional) – “ALL”, “SUBSCRIBABLE”, “UNSUBSCRIBABLE”; default “ALL”
isSortAsc (bool, optional) – default “true”
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, optional) – The value cannot be greater than 60000
Purchase Fixed/Activity Project (USER_DATA)
- savings_purchase_project(self, projectId: str, lot: int, **kwargs)
Purchase Fixed/Activity Project (USER_DATA)
POST /sapi/v1/lending/customizedFixed/purchase
https://binance-docs.github.io/apidocs/spot/en/#purchase-fixed-activity-project-user_data
- Parameters
projectId (str) –
lot (int) –
- Keyword Arguments
recvWindow (int, optional) – The value cannot be greater than 60000
Get Fixed/Activity Project Position (USER_DATA)
- savings_project_position(self, asset: str, **kwargs)
Get Fixed/Activity Project Position (USER_DATA)
GET /sapi/v1/lending/project/position/list
https://binance-docs.github.io/apidocs/spot/en/#get-fixed-activity-project-position-user_data
- Parameters
asset (str) –
- Keyword Arguments
projectId (str, optional) –
status (str, optional) – “HOLDING”, “REDEEMED”
recvWindow (int, optional) – The value cannot be greater than 60000
Lending Account (USER_DATA)
- savings_account(self, **kwargs)
Lending Account (USER_DATA)
GET /sapi/v1/lending/union/account
https://binance-docs.github.io/apidocs/spot/en/#lending-account-user_data
- Keyword Arguments
recvWindow (int, optional) – The value cannot be greater than 60000
Get Purchase Record (USER_DATA)
- savings_purchase_record(self, lendingType: str, **kwargs)
Get Purchase Record (USER_DATA)
GET /sapi/v1/lending/union/purchaseRecord
https://binance-docs.github.io/apidocs/spot/en/#get-purchase-record-user_data
- Parameters
lendingType (str) – “DAILY” for flexible, “ACTIVITY” for activity, “CUSTOMIZED_FIXED” for fixed
- Keyword Arguments
asset (str, optional) –
startTime (int, optional) –
endTime (int, optional) –
current (int, optional) – Currently querying page. Start from 1. Default:1
size (int, optional) – Default:10 Max:100
recvWindow (int, optional) – The value cannot be greater than 60000
Get Redemption Record (USER_DATA)
- savings_redemption_record(self, lendingType: str, **kwargs)
Get Redemption Record (USER_DATA)
GET /sapi/v1/lending/union/redemptionRecord
https://binance-docs.github.io/apidocs/spot/en/#get-redemption-record-user_data
- Parameters
lendingType (str) – “DAILY” for flexible, “ACTIVITY” for activity, “CUSTOMIZED_FIXED” for fixed
- Keyword Arguments
asset (str, optional) –
startTime (int, optional) –
endTime (int, optional) –
current (int, optional) – Currently querying page. Start from 1. Default:1
size (int, optional) – Default:10 Max:100
recvWindow (int, optional) – The value cannot be greater than 60000
Get Interest History (USER_DATA)
- savings_interest_history(self, lendingType: str, **kwargs)
Get Interest History (USER_DATA)
GET /sapi/v1/lending/union/interestHistory
https://binance-docs.github.io/apidocs/spot/en/#get-interest-history-user_data-2
- Parameters
lendingType (str) – “DAILY” for flexible, “ACTIVITY” for activity, “CUSTOMIZED_FIXED” for fixed
- Keyword Arguments
asset (str, optional) –
startTime (int, optional) –
endTime (int, optional) –
current (int, optional) – Currently querying page. Start from 1. Default:1
size (int, optional) – Default:10 Max:100
recvWindow (int, optional) – The value cannot be greater than 60000
Change Fixed/Activity Position to Daily Position(USER_DATA)
- savings_change_position(self, projectId: str, lot: int, **kwargs)
Change Fixed/Activity Position to Daily Position(USER_DATA)
POST /sapi/v1/lending/positionChanged
- Parameters
projectId (str) –
lot (int) –
- Keyword Arguments
positionId (int, optional) – for fixed position
recvWindow (int, optional) – The value cannot be greater than 60000
Staking Endpoints
Get Staking Product List (USER_DATA)
- staking_product_list(self, product: str, **kwargs)
Get Staking Product List (USER_DATA)
Get available Staking product list.
Weight(IP): 1
GET /sapi/v1/staking/productList
https://binance-docs.github.io/apidocs/spot/en/#get-staking-product-list-user_data
- Parameters
product (str) –
- Keyword Arguments
asset (str, optional) –
current (int, optional) – Currently querying page. Start from 1. Default:1
size (int, optional) – Default:10, Max:100
recvWindow (int, optional) – The value cannot be greater than 60000
Purchase Staking Product (USER_DATA)
- staking_purchase_product(self, product: str, productId: str, amount: float, **kwargs)
Purchase Staking Product (USER_DATA)
Weight(IP): 1
POST /sapi/v1/staking/purchase
https://binance-docs.github.io/apidocs/spot/en/#purchase-staking-product-user_data
- Parameters
product (str) –
productId (str) –
amount (float) –
- Keyword Arguments
renewable (str, optional) – true or false, default false. Active if product is STAKING or L_DEFI
recvWindow (int, optional) – The value cannot be greater than 60000
Redeem Staking Product (USER_DATA)
- staking_redeem_product(self, product: str, productId: str, **kwargs)
Redeem Staking Product (USER_DATA)
Redeem Staking product. Locked staking and Locked DeFI staking belong to early redemption, redeeming in advance will result in loss of interest that you have earned.
Weight(IP): 1
POST /sapi/v1/staking/redeem
https://binance-docs.github.io/apidocs/spot/en/#redeem-staking-product-user_data
- Parameters
product (str) –
productId (str) –
- Keyword Arguments
positionId (str, optional) – Mandatory if product is STAKING or L_DEFI
amount (float, optional) – Mandatory if product is F_DEFI
recvWindow (int, optional) – The value cannot be greater than 60000
Get Staking Product Position (USER_DATA)
- staking_product_position(self, product: str, **kwargs)
Get Staking Product Position (USER_DATA)
Weight(IP): 1
GET /sapi/v1/staking/position
https://binance-docs.github.io/apidocs/spot/en/#get-staking-product-position-user_data
- Parameters
product (str) –
- Keyword Arguments
productId (str, optional) –
asset (str, optional) –
current (int, optional) – Currently querying the page. Start from 1. Default:1
size (int, optional) – Default:10, Max:100
recvWindow (int, optional) – The value cannot be greater than 60000
Get Staking History (USER_DATA)
- staking_history(self, product: str, txnType: str, **kwargs)
Get Staking History (USER_DATA)
Weight(IP): 1
GET /sapi/v1/staking/stakingRecord
https://binance-docs.github.io/apidocs/spot/en/#get-staking-history-user_data
- Parameters
product (str) –
txnType (str) –
- Keyword Arguments
asset (str, optional) –
startTime (int, optional) –
endTime (int, optional) –
current (int, optional) – Currently querying the page. Start from 1. Default:1
size (int, optional) – Default:10, Max:100
recvWindow (int, optional) – The value cannot be greater than 60000
Set Auto Staking (USER_DATA)
- staking_set_auto_staking(self, product: str, positionId: str, renewable: str, **kwargs)
Set Auto Staking (USER_DATA)
Set auto staking on Locked Staking or Locked DeFi Staking
Weight(IP): 1
POST /sapi/v1/staking/setAutoStaking
https://binance-docs.github.io/apidocs/spot/en/#set-auto-staking-user_data
- Parameters
product (str) –
positionId (str) –
renewable (str) –
- Keyword Arguments
recvWindow (int, optional) – The value cannot be greater than 60000
Get Personal Left Quota of Staking Product (USER_DATA)
- staking_product_quota(self, product: str, productId: str, **kwargs)
Get Personal Left Quota of Staking Product (USER_DATA)
Weight(IP): 1
GET /sapi/v1/staking/personalLeftQuota
https://binance-docs.github.io/apidocs/spot/en/#get-personal-left-quota-of-staking-product-user_data
- Parameters
product (str) –
productId (str) –
- Keyword Arguments
recvWindow (int, optional) – The value cannot be greater than 60000
Sub Account Endpoints
Create a Virtual Sub-account(For Master Account)
- sub_account_create(self, subAccountString: str, **kwargs)
Create a Virtual Sub-account(For Master Account) Generate a virtual sub account under the master account
POST /sapi/v1/sub-account/virtualSubAccount
https://binance-docs.github.io/apidocs/spot/en/#create-a-virtual-sub-account-for-master-account
- Parameters
subAccountString (str) – Please input a string. We will create a virtual email using that string for you to register
- Keyword Arguments
recvWindow (int, optional) – The value cannot be greater than 60000
Query Sub-account List(For Master Account)
- sub_account_list(self, **kwargs)
Query Sub-account List(For Master Account) Fetch sub account list.
GET /sapi/v1/sub-account/list
https://binance-docs.github.io/apidocs/spot/en/#query-sub-account-list-sapi-for-master-account
- Keyword Arguments
email (str, optional) – Sub-account email
isFreeze (str, optional) – true or false
page (int, optional) – default 1
limit (int, optional) – default 10, max 200
recvWindow (int, optional) – The value cannot be greater than 60000
Query Sub-account Assets(For Master Account)
- sub_account_assets(self, email: str, **kwargs)
Query Sub-account Assets(For Master Account) Fetch sub-account assets
GET /sapi/v3/sub-account/assets
https://binance-docs.github.io/apidocs/spot/en/#query-sub-account-assets-sapi-for-master-account
- Parameters
email (str) –
- Keyword Arguments
recvWindow (int, optional) – The value cannot be greater than 60000
Get Sub-account Deposit Address (For Master Account)
- sub_account_deposit_address(self, email: str, coin: str, **kwargs)
Get Sub-account Deposit Address (For Master Account) Fetch sub-account deposit address
GET /sapi/v1/capital/deposit/subAddress
https://binance-docs.github.io/apidocs/spot/en/#get-sub-account-deposit-address-for-master-account
- Parameters
email (str) –
coin (str) –
- Keyword Arguments
network (str, optional) –
recvWindow (int, optional) – The value cannot be greater than 60000
Get Sub-account Deposit History (For Master Account)
- sub_account_deposit_history(self, email: str, **kwargs)
Get Sub-account Deposit History (For Master Account) Fetch sub-account deposit history
GET /sapi/v1/capital/deposit/subHisrec
https://binance-docs.github.io/apidocs/spot/en/#get-sub-account-deposit-address-for-master-account
- Parameters
email (str) –
- Keyword Arguments
coin (str, optional) –
status (int, optional) – Default 0 (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) – The value cannot be greater than 60000
Get Sub-account’s Status on Margin/Futures(For Master Account)
- sub_account_status(self, **kwargs)
Get Sub-account’s Status on Margin/Futures(For Master Account)
GET /sapi/v1/sub-account/status
- Keyword Arguments
email (str, optional) – Sub-account email
recvWindow (int, optional) – The value cannot be greater than 60000
Enable Margin for Sub-account (For Master Account)
- sub_account_enable_margin(self, email: str, **kwargs)
Enable Margin for Sub-account (For Master Account)
POST /sapi/v1/sub-account/margin/enable
https://binance-docs.github.io/apidocs/spot/en/#enable-margin-for-sub-account-for-master-account
- Parameters
email (str) –
- Keyword Arguments
recvWindow (int, optional) – The value cannot be greater than 60000
Get Detail on Sub-account’s Margin Account (For Master Account)
- sub_account_margin_account(self, email: str, **kwargs)
Get Detail on Sub-account’s Margin Account (For Master Account)
GET /sapi/v1/sub-account/margin/account
- Parameters
email (str) –
- Keyword Arguments
recvWindow (int, optional) – The value cannot be greater than 60000
Get Summary of Sub-account’s Margin Account (For Master Account)
- sub_account_margin_account_summary(self, **kwargs)
Get Summary of Sub-account’s Margin Account (For Master Account)
GET /sapi/v1/sub-account/margin/accountSummary
- Keyword Arguments
recvWindow (int, optional) – The value cannot be greater than 60000
Enable Futures for Sub-account (For Master Account)
- sub_account_enable_futures(self, email: str, **kwargs)
Enable Futures for Sub-account (For Master Account)
POST /sapi/v1/sub-account/futures/enable
https://binance-docs.github.io/apidocs/spot/en/#enable-futures-for-sub-account-for-master-account
- Parameters
email (str) –
- Keyword Arguments
recvWindow (int, optional) – The value cannot be greater than 60000
Futures Transfer for Sub-account(For Master Account)
- sub_account_futures_transfer(self, email: str, asset: str, amount: float, type: int, **kwargs)
Futures Transfer for Sub-account(For Master Account)
GET /sapi/v1/sub-account/futures/transfer
https://binance-docs.github.io/apidocs/spot/en/#futures-transfer-for-sub-account-for-master-account
- Parameters
email (str) –
asset (str) –
amount (float) –
type (int) –
Margin Transfer for Sub-account(For Master Account)
- sub_account_margin_transfer(self, email: str, asset: str, amount: float, type: int, **kwargs)
Margin Transfer for Sub-account(For Master Account)
GET /sapi/v1/sub-account/margin/transfer
https://binance-docs.github.io/apidocs/spot/en/#margin-transfer-for-sub-account-for-master-account
- Parameters
email (str) –
asset (str) –
amount (float) –
type (int) –
Transfer to Sub-account of Same Master(For Sub-account)
- sub_account_transfer_to_sub(self, toEmail: str, asset: str, amount: float, **kwargs)
Transfer to Sub-account of Same Master(For Sub-account)
POST /sapi/v1/sub-account/transfer/subToSub
- Parameters
toEmail (str) –
asset (str) –
amount (float) –
- Keyword Arguments
recvWindow (int, optional) – The value cannot be greater than 60000
Transfer to Master(For Sub-account)
- sub_account_transfer_to_master(self, asset: str, amount: float, **kwargs)
Transfer to Master(For Sub-account)
POST /sapi/v1/sub-account/transfer/subToMaster
https://binance-docs.github.io/apidocs/spot/en/#transfer-to-master-for-sub-account
- Parameters
asset (str) –
amount (float) –
- Keyword Arguments
recvWindow (int, optional) – The value cannot be greater than 60000
Sub-account Transfer History (For Sub-account)
- sub_account_transfer_sub_account_history(self, **kwargs)
Sub-account Transfer History (For Sub-account)
POST /sapi/v1/sub-account/transfer/subUserHistory
https://binance-docs.github.io/apidocs/spot/en/#sub-account-transfer-history-for-sub-account
- Keyword Arguments
asset (str, optional) – If not sent, result of all assets will be returned
type (int, optional) – 1: transfer in, 2: transfer out
startTime (int, optional) –
endTime (int, optional) –
limit (int, optional) – Default 500
recvWindow (int, optional) – The value cannot be greater than 60000
Query Sub-account Futures Asset Transfer History(For Master Account)
- sub_account_futures_asset_transfer_history(self, email: str, futuresType: int, **kwargs)
Query Sub-account Futures Asset Transfer History(For Master Account)
GET /sapi/v1/sub-account/futures/internalTransfer
- Parameters
email (str) – Sub-account email
futuresType (int) – 1 : USDT-maringed Futues, 2: Coin-margined Futures
- Keyword Arguments
startTime (int, optional) – Default return the history with in 100 days
endTime (int, optional) – Default return the history with in 100 days
page (int, optional) – Default value: 1
limit (int, optional) – Default value: 50, Max value: 500
recvWindow (int, optional) – The value cannot be greater than 60000
Query Sub-account Futures Asset Transfer History(For Master Account)
- sub_account_futures_asset_transfer(self, fromEmail: str, toEmail: str, futuresType: int, asset: str, amount: float, **kwargs)
Query Sub-account Futures Asset Transfer History(For Master Account)
POST /sapi/v1/sub-account/futures/internalTransfer
- Parameters
fromEmail (str) – Sender email
toEmail (str) – Recipient email
futuresType (int) – 1 : USDT-maringed Futues, 2: Coin-margined Futures
asset (str) –
amount (float) –
- Keyword Arguments
recvWindow (int, optional) – The value cannot be greater than 60000
Query Sub-account Spot Assets Summary (For Master Account)
- sub_account_spot_summary(self, **kwargs)
Query Sub-account Spot Assets Summary (For Master Account)
GET /sapi/v1/sub-account/spotSummary
- Keyword Arguments
email (str, optional) – Sub account email
page (int, optional) – Default: 1
size (int, optional) – Default 10, max 20
recvWindow (int, optional) – The value cannot be greater than 60000
Universal Transfer (For Master Account)
- sub_account_universal_transfer(self, fromAccountType: str, toAccountType: str, asset: str, amount: float, **kwargs)
Universal Transfer (For Master Account)
POST /sapi/v1/sub-account/universalTransfer
https://binance-docs.github.io/apidocs/spot/en/#universal-transfer-for-master-account
You need to enable “internal transfer” option for the api key which requests this endpoint. Transfer from master account by default if fromEmail is not sent. Transfer to master account by default if toEmail is not sent. Supported transfer scenarios: - Master account SPOT transfer to sub-account SPOT, USDT_FUTURE, COIN_FUTURE, MARGIN(Cross), ISOLATED_MARGIN - Sub-account SPOT, USDT_FUTURE, COIN_FUTURE, MARGIN(Cross), ISOLATED_MARGIN transfer to master account SPOT - Transfer between two SPOT sub-accounts
- Parameters
fromAccountType (str) – “SPOT”, “USDT_FUTURE”, “COIN_FUTURE”, “MARGIN”(Cross), “ISOLATED_MARGIN”
toAccountType (str) – “SPOT”, “USDT_FUTURE”, “COIN_FUTURE”, “MARGIN”(Cross), “ISOLATED_MARGIN”
asset (str) –
amount (float) –
- Keyword Arguments
fromEmail (str, optional) –
toEmail (str, optional) –
clientTranId (str, optional) – Must be unique
symbol (str, optional) – Only supported under ISOLATED_MARGIN type
recvWindow (int, optional) – The value cannot be greater than 60000
Query Universal Transfer History (For Master Account)
- sub_account_universal_transfer_history(self, **kwargs)
Query Universal Transfer History (For Master Account)
GET /sapi/v1/sub-account/universalTransfer
https://binance-docs.github.io/apidocs/spot/en/#query-universal-transfer-history-for-master-account
fromEmail and toEmail cannot be sent at the same time. Return fromEmail equal master account email by default. Only get the latest history of past 30 days.
- Keyword Arguments
fromEmail (str, optional) –
toEmail (str, optional) –
clientTranId (str, optional) –
startTime (int, optional) –
endTime (int, optional) –
page (int, optional) –
limit (int, optional) – Default 10, max 20
recvWindow (int, optional) – The value cannot be greater than 60000
Get Detail on Sub-account’s Futures Account V2 (For Master Account)
- sub_account_futures_account(self, email: str, futuresType: int, **kwargs)
Get Detail on Sub-account’s Futures Account V2 (For Master Account)
GET /sapi/v2/sub-account/futures/account
- Parameters
email (str) – Sub-account email
futuresType (int) – 1 : USDT-maringed Futues, 2: Coin-margined Futures
- Keyword Arguments
recvWindow (int, optional) – The value cannot be greater than 60000
Get Summary of Sub-account’s Futures Account V2 (For Master Account)
- sub_account_futures_account_summary(self, futuresType: int, **kwargs)
Get Summary of Sub-account’s Futures Account V2 (For Master Account)
GET /sapi/v2/sub-account/futures/accountSummary
- Parameters
futuresType (int) – 1 : USDT-maringed Futues, 2: Coin-margined Futures
- Keyword Arguments
page (int, optional) – Default:1
limit (int, optional) – Default 10, max 20
recvWindow (int, optional) – The value cannot be greater than 60000
Get Futures Position-Risk of Sub-account V2 (For Master Account)
- sub_account_futures_position_risk(self, email: str, futuresType: str, **kwargs)
Get Futures Position-Risk of Sub-account V2 (For Master Account)
GET /sapi/v2/sub-account/futures/positionRisk
- Parameters
email (str) – Sub-account email
futuresType (int) – 1 : USDT-maringed Futues, 2: Coin-margined Futures
- Keyword Arguments
recvWindow (int, optional) – The value cannot be greater than 60000
Query Sub-account Spot Asset Transfer History (SAPI For Master Account)
- sub_account_spot_transfer_history(self, **kwargs)
Query Sub-account Spot Asset Transfer History (SAPI For Master Account)
GET /sapi/v1/sub-account/sub/transfer/history
- Keyword Arguments
fromEmail (str, optional) –
toEmail (str, optional) –
startTime (int, optional) – Default return the history with in 100 days
endTime (int, optional) – Default return the history with in 100 days
page (int, optional) – Default value: 1
limit (int, optional) – Default value: 500
recvWindow (int, optional) – The value cannot be greater than 60000
Enable Leverage Token for Sub-account(For Master Account)
- sub_account_enable_leverage_token(self, email: str, enableBlvt: bool, **kwargs)
Enable Leverage Token for Sub-account(For Master Account) Enable leverage token for sub-account
POST /sapi/v1/sub-account/blvt/enable
- Parameters
email (str) – Sub-account email
enableBlvt (bool) – Only true for now
- Keyword Arguments
recvWindow (int, optional) – The value cannot be greater than 60000
Deposit assets into the managed sub-account (For Investor Master Account)
- managed_sub_account_deposit(self, toEmail: str, asset: str, amount: float, **kwargs)
Deposit assets into the managed sub-account(For Investor Master Account)
POST /sapi/v1/managed-subaccount/deposit
- Parameters
toEmail (str) – Sub-account email
asset (str) –
amount (float) –
- Keyword Arguments
recvWindow (int, optional) – The value cannot be greater than 60000
Query managed sub-account asset details (For Investor Master Account)
- managed_sub_account_assets(self, email: str, **kwargs)
Query managed sub-account asset details(For Investor Master Account)
GET /sapi/v1/managed-subaccount/asset
- Parameters
email (str) – Sub-account email
- Keyword Arguments
recvWindow (int, optional) – The value cannot be greater than 60000
Withdrawl assets from the managed sub-account (For Investor Master Account)
- managed_sub_account_withdraw(self, fromEmail: str, asset: str, amount: float, **kwargs)
Withdrawl assets from the managed sub-account(For Investor Master Account)
POST /sapi/v1/managed-subaccount/withdraw
- Parameters
fromEmail (str) – Sub-account email
asset (str) –
amount (float) –
- Keyword Arguments
transferDate (int, optional) – Withdrawals is automatically occur on the transfer date(UTC0).
now (If a date is not selected, the withdrawal occurs right) –
recvWindow (int, optional) – The value cannot be greater than 60000
Enable or Disable IP Restriction for a Sub-account API Key (For Master Account)
- sub_account_api_toggle_ip_restriction(self, email: str, subAccountApiKey: str, ipRestrict: bool, **kwargs)
Enable or Disable IP Restriction for a Sub-account API Key (For Master Account)
POST /sapi/v1/sub-account/subAccountApi/ipRestriction
- Parameters
email (str) – Sub-account email
subAccountApiKey (str) –
ipRestrict (bool) – True or False
- Keyword Arguments
recvWindow (int, optional) –
Add IP List for a Sub-account API Key (For Master Account)
- sub_account_api_add_ip(self, email: str, subAccountApiKey: str, ipAddress: str, **kwargs)
Add IP List for a Sub-account API Key (For Master Account)
Before the usage of this endpoint, please ensure POST /sapi/v1/sub-account/subAccountApi/ipRestriction was used to enable the IP restriction.
POST /sapi/v1/sub-account/subAccountApi/ipRestriction/ipList
- Parameters
email (str) – Sub-account email
subAccountApiKey (str) –
ipAddress (str) – Can be added in batches, separated by commas
- Keyword Arguments
recvWindow (int, optional) –
Get IP Restriction for a Sub-account API Key (For Master Account)
- sub_account_api_get_ip_restriction(self, email: str, subAccountApiKey: str, **kwargs)
Get IP Restriction for a Sub-account API Key (For Master Account)
GET /sapi/v1/sub-account/subAccountApi/ipRestriction
- Parameters
email (str) – Sub-account email
subAccountApiKey (str) –
- Keyword Arguments
recvWindow (int, optional) –
Delete IP List for a Sub-account API Key (For Master Account)
- sub_account_api_delete_ip(self, email: str, subAccountApiKey: str, ipAddress: str, **kwargs)
Delete IP List for a Sub-account API Key (For Master Account)
DELETE /sapi/v1/sub-account/subAccountApi/ipRestriction/ipList
- Parameters
email (str) – Sub-account email
subAccountApiKey (str) –
ipAddress (str) – Can be added in batches, separated by commas
- Keyword Arguments
recvWindow (int, optional) –
Query Managed Sub-account Snapshot (For Investor Master Account)
- managed_sub_account_get_snapshot(self, email: str, type: str, **kwargs)
Query Managed Sub-account Snapshot(For Investor Master Account)
GET /sapi/v1/managed-subaccount/accountSnapshot (HMAC SHA256)
- Parameters
email (str) – email
type (str) – “SPOT”, “MARGIN”(cross), “FUTURES”(UM)
- Keyword Arguments
startTime (int, optional) –
endTime (int, optional) –
limit (int, optional) – min 7, max 30, default 7
recvWindow (int, optional) –
Account / Trade Endpoints
Test New Order (TRADE)
- new_order_test(self, symbol: str, side: str, type: str, **kwargs)
Test New Order (TRADE)
Test new order creation and signature/recvWindow. Creates and validates a new order but does not send it into the matching engine.
POST /api/v3/order/test
https://binance-docs.github.io/apidocs/spot/en/#test-new-order-trade
- Parameters
symbol (str) –
side (str) –
type (str) –
- Keyword Arguments
timeInForce (str, optional) –
quantity (float, optional) –
quoteOrderQty (float, optional) –
price (float, optional) –
newClientOrderId (str, optional) – A unique id among open orders. Automatically generated if not sent.
stopPrice (float, optional) – Used with STOP_LOSS, STOP_LOSS_LIMIT, TAKE_PROFIT, and TAKE_PROFIT_LIMIT orders.
icebergQty (float, optional) – Used with LIMIT, STOP_LOSS_LIMIT, and TAKE_PROFIT_LIMIT to create an iceberg order.
newOrderRespType (str, optional) – Set the response JSON. ACK, RESULT, or FULL; MARKET and LIMIT order types default to FULL, all other orders default to ACK.
recvWindow (int, optional) – The value cannot be greater than 60000
New Order (TRADE)
- new_order(self, symbol: str, side: str, type: str, **kwargs)
New Order (TRADE)
Post a new order
POST /api/v3/order
https://binance-docs.github.io/apidocs/spot/en/#new-order-trade
- Parameters
symbol (str) –
side (str) –
type (str) –
- Keyword Arguments
timeInForce (str, optional) –
quantity (float, optional) –
quoteOrderQty (float, optional) –
price (float, optional) –
newClientOrderId (str, optional) – A unique id among open orders. Automatically generated if not sent.
stopPrice (float, optional) – Used with STOP_LOSS, STOP_LOSS_LIMIT, TAKE_PROFIT, and TAKE_PROFIT_LIMIT orders.
icebergQty (float, optional) – Used with LIMIT, STOP_LOSS_LIMIT, and TAKE_PROFIT_LIMIT to create an iceberg order.
newOrderRespType (str, optional) – Set the response JSON. ACK, RESULT, or FULL; MARKET and LIMIT order types default to FULL, all other orders default to ACK.
recvWindow (int, optional) – The value cannot be greater than 60000
Cancel Order (TRADE)
- cancel_order(self, symbol: str, **kwargs)
Cancel Order (TRADE)
Cancel an active order.
DELETE /api/v3/order
https://binance-docs.github.io/apidocs/spot/en/#cancel-order-trade
- Parameters
symbol (str) –
- Keyword Arguments
orderId (int, optional) –
origClientOrderId (str, optional) –
newClientOrderId (str, optional) –
recvWindow (int, optional) – The value cannot be greater than 60000
Cancel all Open Orders on a Symbol (TRADE)
- cancel_open_orders(self, symbol: str, **kwargs)
Cancel all Open Orders on a Symbol (TRADE)
Cancels all active orders on a symbol. This includes OCO orders.
DELETE api/v3/openOrders
https://binance-docs.github.io/apidocs/spot/en/#cancel-all-open-orders-on-a-symbol-trade
- Parameters
symbol (str) –
- Keyword Arguments
recvWindow (int, optional) – The value cannot be greater than 60000
Query Order (USER_DATA)
- get_order(self, symbol, **kwargs)
Query Order (USER_DATA)
Check an order’s status.
GET /api/v3/order
https://binance-docs.github.io/apidocs/spot/en/#query-order-user_data
- Parameters
symbol (str) –
- Keyword Arguments
orderId (int, optional) –
origClientOrderId (str, optional) –
recvWindow (int, optional) – The value cannot be greater than 60000
Current Open Orders (USER_DATA)
- get_open_orders(self, symbol=None, **kwargs)
Current Open Orders (USER_DATA)
Get all open orders on a symbol.
GET /api/v3/openOrders
https://binance-docs.github.io/apidocs/spot/en/#current-open-orders-user_data
- Parameters
symbol (str, optional) –
- Keyword Arguments
recvWindow (int, optional) – The value cannot be greater than 60000
All Orders (USER_DATA)
- get_orders(self, symbol: str, **kwargs)
All Orders (USER_DATA)
Get all account orders; active, canceled, or filled.
GET /api/v3/allOrders
https://binance-docs.github.io/apidocs/spot/en/#all-orders-user_data
- Parameters
symbol (str) –
- Keyword Arguments
orderId (int, optional) –
startTime (int, optional) –
endTime (int, optional) –
limit (int, optional) – Default 500; max 1000.
recvWindow (int, optional) – The value cannot be greater than 60000
New OCO (TRADE)
- new_oco_order(self, symbol: str, side: str, quantity: float, price: float, stopPrice: float, **kwargs)
New OCO (TRADE)
Post a new oco order
POST /api/v3/order/oco
https://binance-docs.github.io/apidocs/spot/en/#new-oco-trade
- Parameters
symbol (str) –
side (str) –
quantity (float) –
price (float) –
stopPrice (float) –
- Keyword Arguments
listClientOrderId (str, optional) – A unique Id for the entire orderList
limitClientOrderId (str, optional) –
limitIcebergQty (float, optional) –
stopClientOrderId (str, optional) –
stopLimitPrice (float, optional) –
stopIcebergQty (float, optional) –
stopLimitTimeInForce (str, optional) –
newOrderRespType (str, optional) – Set the response JSON.
recvWindow (int, optional) – The value cannot be greater than 60000
Cancel OCO (TRADE)
- cancel_oco_order(self, symbol, **kwargs)
Cancel OCO (TRADE)
Cancel an entire Order List
DELETE /api/v3/orderList
https://binance-docs.github.io/apidocs/spot/en/#cancel-oco-trade
- Parameters
symbol (str) –
- Keyword Arguments
orderListId (int, optional) – Either orderListId or listClientOrderId must be provided
listClientOrderId (str, optional) – Either orderListId or listClientOrderId must be provided
newClientOrderId (str, optional) – Used to uniquely identify this cancel. Automatically generated by default.
recvWindow (int, optional) – The value cannot be greater than 60000
Query OCO (USER_DATA)
- get_oco_order(self, **kwargs)
Query OCO (USER_DATA)
Retrieves a specific OCO based on provided optional parameters
GET /api/v3/orderList
https://binance-docs.github.io/apidocs/spot/en/#query-oco-user_data
- Keyword Arguments
orderListId (int, optional) – Either orderListId or listClientOrderId must be provided
origClientOrderId (str, optional) – Either orderListId or listClientOrderId must be provided.
recvWindow (int, optional) – The value cannot be greater than 60000
Query all OCO (USER_DATA)
- get_oco_orders(self, **kwargs)
Query all OCO (USER_DATA)
Retrieves all OCO based on provided optional parameters
GET /api/v3/allOrderList
https://binance-docs.github.io/apidocs/spot/en/#query-all-oco-user_data
- Keyword Arguments
fromId (int, optional) – 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, optional) – The value cannot be greater than 60000
Query Open OCO (USER_DATA)
- get_oco_open_orders(self, **kwargs)
Query Open OCO (USER_DATA)
GET /api/v3/openOrderList
https://binance-docs.github.io/apidocs/spot/en/#query-open-oco-user_data
- Keyword Arguments
recvWindow (int, optional) – The value cannot be greater than 60000
Account Information (USER_DATA)
- account(self, **kwargs)
Account Information (USER_DATA)
Get current account information
GET /api/v3/account
https://binance-docs.github.io/apidocs/spot/en/#account-information-user_data
- Keyword Arguments
recvWindow (int, optional) – The value cannot be greater than 60000
Account Trade List (USER_DATA)
- my_trades(self, symbol: str, **kwargs)
Account Trade List (USER_DATA)
Get trades for a specific account and symbol.
GET /api/v3/myTrades
https://binance-docs.github.io/apidocs/spot/en/#account-trade-list-user_data
- Parameters
symbol (str) –
- Keyword Arguments
fromId (int, optional) – TradeId to fetch from. Default gets most recent trades.
orderId (int, optional) – This can only be used in combination with symbol
startTime (int, optional) –
endTime (int, optional) –
limit (int, optional) – Default Value: 500; Max Value: 1000
recvWindow (int, optional) – The value cannot be greater than 60000
Query Current Order Count Usage (TRADE)
- get_order_rate_limit(self, **kwargs)
Query Current Order Count Usage (TRADE)
Displays the user’s current order count usage for all intervals.
GET /api/v3/rateLimit/order
https://binance-docs.github.io/apidocs/spot/en/#query-current-order-count-usage-trade
- Keyword Arguments
recvWindow (int, optional) – The value cannot be greater than 60000
Wallet Endpoints
System Status (System)
- system_status(self)
System Status (System) Fetch system status.
GET /sapi/v1/system/status
https://binance-docs.github.io/apidocs/spot/en/#system-status-sapi-system
All Coins’ Information (USER_DATA)
- coin_info(self, **kwargs)
All Coins’ Information (USER_DATA) Get information of coins (available for deposit and withdraw) for user.
GET /sapi/v1/capital/config/getall
https://binance-docs.github.io/apidocs/spot/en/#all-coins-39-information-user_data
- Keyword Arguments
recvWindow (int, optional) – The value cannot be greater than 60000
Daily Account Snapshot (USER_DATA)
- account_snapshot(self, type: str, **kwargs)
Daily Account Snapshot (USER_DATA)
GET /sapi/v1/accountSnapshot
https://binance-docs.github.io/apidocs/spot/en/#daily-account-snapshot-user_data
Parameteres: type – mandatory/string – “SPOT”, “MARGIN”, “FUTURES”
- Parameters
type (str) – “SPOT”, “MARGIN”, “FUTURES”
- Keyword Arguments
startTime (int, optional) –
endTime (int, optional) –
limit (int, optional) – min 7, max 30, default 7
recvWindow (int, optional) – The value cannot be greater than 60000
Disable Fast Withdraw Switch (USER_DATA)
- disable_fast_withdraw(self, **kwargs)
Disable Fast Withdraw Switch (USER_DATA)
POST /sapi/v1/account/disableFastWithdrawSwitch
https://binance-docs.github.io/apidocs/spot/en/#disable-fast-withdraw-switch-user_data
- Keyword Arguments
recvWindow (int, optional) – The value cannot be greater than 60000
Enable Fast Withdraw Switch (USER_DATA)
- enable_fast_withdraw(self, **kwargs)
Enable Fast Withdraw Switch (USER_DATA)
POST /sapi/v1/account/enableFastWithdrawSwitch
https://binance-docs.github.io/apidocs/spot/en/#enable-fast-withdraw-switch-user_data
- Keyword Arguments
recvWindow (int, optional) – The value cannot be greater than 60000
Withdraw (USER_DATA)
- withdraw(self, coin: str, amount: float, address: str, **kwargs)
Withdraw (USER_DATA) Submit a withdraw request.
POST /sapi/v1/capital/withdraw/apply
https://binance-docs.github.io/apidocs/spot/en/#withdraw-user_data
- Parameters
coin (str) –
amount (float) –
address (str) –
- Keyword Arguments
withdrawOrderId (str, optional) – Client id for withdraw
network (str, optional) –
addressTag (str, optional) – Secondary address identifier for coins like XRP,XMR etc.
transactionFeeFlag (bool, optional) – 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. Space in name should be encoded into %20.
walletType (int, optional) – The wallet type for withdraw,0-spot wallet,1-funding wallet. Default is spot wallet
recvWindow (int, optional) – The value cannot be greater than 60000
Deposit History(supporting network) (USER_DATA)
- deposit_history(self, **kwargs)
Deposit History(supporting network) (USER_DATA) Fetch deposit history.
GET /sapi/v1/capital/deposit/hisrec
https://binance-docs.github.io/apidocs/spot/en/#deposit-history-supporting-network-user_data
- Keyword Arguments
coin (str, optional) –
status (int, optional) – Default 0 (0:pending, 6: credited but cannot withdraw, 1:success)
startTime (int, optional) – Default: 90 days from current timestamp
endTime (int, optional) – Default: present timestamp
offset (int, optional) – Default value: 0
limit (int, optional) – Default:1000, Max:1000
recvWindow (int, optional) – The value cannot be greater than 60000
Withdraw History (supporting network) (USER_DATA)
- withdraw_history(self, **kwargs)
Withdraw History (supporting network) (USER_DATA) Fetch withdraw history.
GET /sapi/v1/capital/withdraw/history
https://binance-docs.github.io/apidocs/spot/en/#deposit-history-user_data
- Keyword Arguments
coin (str, optional) –
withdrawOrderId (str, optional) –
status (int, optional) – Default 0 (0:Email Sent,1:Cancelled, 2:Awaiting Approval, 3:Rejected, 4:Processing, 5:Failure, 6:Completed)
offset (int, optional) –
limit (int, optional) – Default: 1000, Max: 1000
startTime (int, optional) – Default: 90 days from current timestamp
endTime (int, optional) – Default: present timestamp
recvWindow (int, optional) – The value cannot be greater than 60000
Deposit Address (supporting network) (USER_DATA)
- deposit_address(self, coin: str, **kwargs)
Deposit Address (supporting network) (USER_DATA) Fetch deposit address with network.
GET /sapi/v1/capital/deposit/address
https://binance-docs.github.io/apidocs/spot/en/#deposit-address-supporting-network-user_data
- Keyword Arguments
coin (str, optional) –
network (str, optional) –
recvWindow (int, optional) – The value cannot be greater than 60000
Account Status (USER_DATA)
- account_status(self, **kwargs)
Account Status (USER_DATA) Fetch account status detail.
GET /sapi/v1/account/status
https://binance-docs.github.io/apidocs/spot/en/#account-status-sapi-user_data
- Keyword Arguments
recvWindow (int, optional) – The value cannot be greater than 60000
Account API Trading Status (USER_DATA)
- api_trading_status(self, **kwargs)
Account API Trading Status (USER_DATA) Fetch account api trading status detail.
GET /sapi/v1/account/apiTradingStatus
https://binance-docs.github.io/apidocs/spot/en/#account-api-trading-status-sapi-user_data
- Keyword Arguments
recvWindow (int, optional) – The value cannot be greater than 60000
DustLog (USER_DATA)
- dust_log(self, **kwargs)
DustLog (USER_DATA) Fetch small amounts of assets exchanged BNB records.
GET /sapi/v1/asset/dribblet
https://binance-docs.github.io/apidocs/spot/en/#dustlog-sapi-user_data
- Keyword Arguments
recvWindow (int, optional) – The value cannot be greater than 60000
User Universal Transfer
- user_universal_transfer(self, type: str, asset: str, amount: str, **kwargs)
User Universal Transfer
POST /sapi/v1/asset/transfer
https://binance-docs.github.io/apidocs/spot/en/#user-universal-transfer
- Parameters
type (str) –
asset (str) –
amount (str) –
- Keyword Arguments
fromSymbol (str, optional) – Must be sent when type are ISOLATEDMARGIN_MARGIN and ISOLATEDMARGIN_ISOLATEDMARGIN
toSymbol (str, optional) – Must be sent when type are MARGIN_ISOLATEDMARGIN and ISOLATEDMARGIN_ISOLATEDMARGIN
recvWindow (int, optional) – The value cannot be greater than 60000
Query User Universal Transfer History
- user_universal_transfer_history(self, type: str, **kwargs)
Query User Universal Transfer History
GET /sapi/v1/asset/transfer
https://binance-docs.github.io/apidocs/spot/en/#query-user-universal-transfer-history
- Args:
type (str)
- Keyword Args:
startTime (int, optional) endTime (int, optional) current (int, optional): Default 1 size (int, optional): Default 10, Max 100 fromSymbol (str, optional): Must be sent when type are ISOLATEDMARGIN_MARGIN and ISOLATEDMARGIN_ISOLATEDMARGIN toSymbol (str, optional): Must be sent when type are MARGIN_ISOLATEDMARGIN and ISOLATEDMARGIN_ISOLATEDMARGIN recvWindow (int, optional): The value cannot be greater than 60000
Dust Transfer (USER_DATA)
- transfer_dust(self, asset, **kwargs)
Dust Transfer (USER_DATA) Convert dust assets to BNB.
POST /sapi/v1/asset/dust
https://binance-docs.github.io/apidocs/spot/en/#dust-transfer-user_data
- Parameters
asset (str) –
- Keyword Arguments
recvWindow (int, optional) – The value cannot be greater than 60000
Asset Dividend Record (USER_DATA)
- asset_dividend_record(self, **kwargs)
Asset Dividend Record (USER_DATA) Query asset dividend record.
GET /sapi/v1/asset/assetDividend
https://binance-docs.github.io/apidocs/spot/en/#asset-dividend-record-user_data
- Keyword Arguments
asset (str, optional) –
startTime (int, optional) –
endTime (int, optional) –
limit (int, optional) – Default 20, max 500
recvWindow (int, optional) – The value cannot be greater than 60000
Asset Detail (USER_DATA)
- asset_detail(self, **kwargs)
Asset Detail (USER_DATA) Fetch details of assets supported on Binance.
GET /sapi/v1/asset/assetDetail
https://binance-docs.github.io/apidocs/spot/en/#asset-detail-sapi-user_data
- Keyword Arguments
recvWindow (int, optional) – The value cannot be greater than 60000
Trade Fee (USER_DATA)
- trade_fee(self, **kwargs)
Trade Fee (USER_DATA) Fetch trade fee, values in percentage.
GET /sapi/v1/asset/tradeFee
https://binance-docs.github.io/apidocs/spot/en/#trade-fee-sapi-user_data
- Keyword Arguments
symbol (str, optional) –
recvWindow (int, optional) – The value cannot be greater than 60000
Funding Wallet (USER_DATA)
- funding_wallet(self, **kwargs)
Funding Wallet (USER_DATA)
POST /sapi/v1/asset/get-funding-asset
https://binance-docs.github.io/apidocs/spot/en/#funding-wallet-user_data
- Keyword Arguments
asset (str, optional) –
needBtcValuation (str, optional) – true or false
recvWindow (int, optional) – The value cannot be greater than 60000
API Key Permission (USER_DATA)
- api_key_permissions(self, **kwargs)
Get API Key Permission (USER_DATA)
GET /sapi/v1/account/apiRestrictions
https://binance-docs.github.io/apidocs/spot/en/#get-api-key-permission-user_data
- Keyword Arguments
recvWindow (int, optional) – The value cannot be greater than 60000
Get Assets That Can Be Converted Into BNB (USER_DATA)
- bnb_convertible_assets(self, **kwargs)
Get Assets That Can Be Converted Into BNB (USER_DATA)
POST /sapi/v1/asset/dust-btc
https://binance-docs.github.io/apidocs/spot/en/#get-assets-that-can-be-converted-into-bnb-user_data
- Keyword Arguments
recvWindow (int, optional) – The value cannot be greater than 60000