diff --git a/utils/coin_docs.txt b/utils/coin_docs.txt new file mode 100644 index 000000000..b5f981595 --- /dev/null +++ b/utils/coin_docs.txt @@ -0,0 +1,4807 @@ +Logo +Spot/Margin/Savings/Mining +USDⓈ-M Futures +COIN-M Futures +European Options +WebSocket API +Portfolio Margin +简体中文 +Search +Change Log +General Info +Market Data Endpoints +Websocket Market Streams +Account/Trades Endpoints +User Data Streams +Classic Portfolio Margin Endpoints +Error Codes +Binance Futures +Change Log +Important Documentation Notice + +Binance has launched its new API Documentation Portal. The existing GitHub API documentation is now deprecated and set to go offline in the upcoming few months following user migration; the exact date will be determined and communicated in due course. + +During this transition phase, both sites will be maintained. However, any new services will only be published in the new portal moving forward. + +Here's a reference table of the links for the current and new API documentation: + +Functionality Current Documentation New Documentation +Spot Trading Current Documentation New Documentation +Spot Websocket API Current Documentation New Documentation +Margin Trading Current Documentation New Documentation +Derivative UM Futures Current Documentation New Documentation +Derivative CM Futures Current Documentation New Documentation +Derivative Options Current Documentation New Documentation +Derivative Portfolio Margin Current Documentation New Documentation +Wallet Current Documentation New Documentation +Sub Account Current Documentation New Documentation +Simple Earn Current Documentation New Documentation +Dual Investment Current Documentation New Documentation +Auto Invest Current Documentation New Documentation +Staking Current Documentation New Documentation +Mining Current Documentation New Documentation +Algo Trading Current Documentation New Documentation +Copy Trading Current Documentation New Documentation +Derivative Porfolio Margin Pro Current Documentation New Documentation +Fiat Current Documentation New Documentation +C2C Current Documentation New Documentation +VIP Loan Current Documentation New Documentation +Crypto Loan Current Documentation New Documentation +Pay Current Documentation New Documentation +Convert Current Documentation New Documentation +Rebate Current Documentation New Documentation +NFT Current Documentation New Documentation +Gift Card Current Documentation New Documentation +2024-04-09 + +Good-Till-Cancel (GTC) timeInForce will have a one-year validity period after order placement. GTC orders longer than one-year will be automatically canceled. This applies to all order types including reduceOnly but does not affect part-filled orders or strategy trading or copy-trading orders. +2023-11-01 + +REST + +Update on GET dapi/v1/fundingRate: +add response field markPrice to display mark price associated with a particular funding fee charge +2023-10-19 + +REST + +New Market Data Endpoints +GET /futures/data/delivery-price: query quarterly contract settlement price +Update Rate Limit to 1000/5min/IP on Market Data Endpoints below: +GET /futures/data/openInterestHist +GET /futures/data/topLongShortAccountRatio +GET /futures/data/topLongShortPositionRatio +GET /futures/data/globalLongShortAccountRatio +GET /futures/data/takerlongshortRatio +2023-10-16 + +REST + +New Market Data Endpoints +GET /dapi/v1/constituents: query index constituents +2023-09-25 + +REST + +New Market Data Endpoints Update +GET /dapi/v1/fundingInfo: query adjusted funding info +2023-09-20 + +REST + +Update on GET /dapi/v1/ticker/bookTicker: + +add response field lastUpdateId +Update on GET /dapi/v1/account: + +add response field updateTime in assets +2023-09-07 + +REST + +New endpointGET /dapi/v1/income/asynto get Download Id For Futures Transaction History +New endpointGET /dapi/v1/income/asyn/idto get Futures Transaction History Download Link by Id +2023-08-31 + +Binance Future is doing Websocket Service upgrade and the upgrade impacts the following: + +Before upgrade: + +The websocket server will send a ping frame every 5 minutes. If the websocket server does not receive a pong frame back from the connection within a 15 minute period, the connection will be disconnected. Unsolicited pong frames are allowed. +After upgrade: + +The websocket server will send a ping frame every 3 minutes. If the websocket server does not receive a pong frame back from the connection within a 10 minute period, the connection will be disconnected. Unsolicited pong frames are allowed. +2023-08-25 + +Binance Future is doing Websocket Service upgrade and the upgrade impacts the following: +Connect websocket server without subscription: +Before upgrade, user can connect by using: +wss://dstream.binance.com/ws +wss://dstream.binance.com/stream +wss://dstream.binance.com/ws/ +wss://dstream.binance.com/stream/ +After upgrade, user can connect by using: +wss://dstream.binance.com/ws +wss://dstream.binance.com/stream +/ at the end is no longer supported +Connect websocket server with subscription: +Raw stream like wss://dstream.binance.com/illegal_parameter/stream?steams= or wss://dstream.binance.com/illegal_parameter/ws/is not supported, please use remove illegal_parameter/ before /ws and /stream. +2023-08-14 + +Update endpoint for Account/Trade: +GET /dapi/v1/income: Add parameter page for pagination +2023-07-19 + +REST + +Add field notionalCoef in GET /dapi/v2/leverageBracket to show the bracket multiplier comparing to default leverage bracket +2023-07-12 + +REST + +New field breakEvenPrice represents Break-Even Price in position of response to: +GET /dapi/v1/account (HMAC SHA256) +GET /dapi/v1/positionRisk (HMAC SHA256) +WEBSOCKET + +New field bep represents Break-Even Price in position P of payload to event: Balance and Position Update – "e": "ACCOUNT_UPDATE" +2023-06-22 + +Notice: + +WEBSOCKET + +Raw stream like /ws? is not supported, for example wss://dstream.binance.com/ws?btcusd@depth is invalid. +Sending websocket message with invalid JSON format will cause disconnection now, returning this error {"error":{"code":3,"msg":"Invalid JSON: expected value at line 1 column 1"}} +2023-06-14 + +WEBSOCKET + +New field i for quote asset and index price added in streams @markPrice and @markPrice +2023-04-17 + +RELEASE DATE TBD + +The recvWindow check will also be performed when orders reach matching engine. The recvWindow will be checked more precisely on order placing endpoints. + +{ + "code": -4188, + "msg": "Timestamp for this request is outside of the ME recvWindow" +} +recvWindow Logic Before Release: + +The order placing requests are valid if recvWindow + timestamp => REST API service server timestamp +recvWindow Logic After Release: + +Add new recwWindow check: the order placing requests are valid if recvWindow + timestamp => matching engine timestamp + +Impacted Endpoints: + +POST /dapi/v1/order (HMAC SHA256) +PUT /dapi/v1/order (HMAC SHA256) +POST /dapi/v1/batchOrders (HMAC SHA256) +PUT /dapi/v1/batchOrders (HMAC SHA256) +2022-12-16 + +WEBSOCKET + +New WebSocket stream !contractInfo for symbol information update +2022-11-29 + +WEB SOCKET USER DATA STREAM + +New WebSocket stream STRATEGY_UPDATE in USER-DATA-STREAM: update when a strategy is created/cancelled/expired, ...etc. +New WebSocket stream GRID_UPDATE in USER-DATA-STREAM: update when a sub order of a grid is filled or partially filled. +2022-10-13 + +Note: This change will be effictive on 2022-10-17 + +REST RATE LIMIT WEIGHT + +Endpoint GET /dapi/v1/ticker/bookTicker + +Weight Update: + +2 for a single symbol; +5 when the symbol parameter is omitted + +2022-09-22 + +Add new endpoint for Portfolio Margin: +GET /dapi/v1/pmAccountInfo: Get Portfolio Margin current account information. +2022-07-27 + +REST RATE LIMIT WEIGHT + +The weight of endpoint GET /dapi/v1/trades is updated to 5 +2022-06-28 + +REST + +New endpoint GET /dapi/v1/pmExchangeInfo to get current Portfolio Margin exchange trading rules. +2022-04-28 + +REST + +New endpoints PUT /dapi/v1/order and PUT /dapi/v1/batchOrders to support limit order modify +New endpoint GET /dapi/v1/orderAmendment to get order modify history +WEBSOCKET + +New type "AMENDMENT" as order modify in Execution Type x of Order Update event ORDER_TRADE_UPDATE +2022-04-14 + +WEB SOCKET USER DATA STREAM + +New WebSocket stream ACCOUNT_CONFIG_UPDATE in USER-DATA-STREAM for leverage changed update +2022-02-18 + +REST + +The maximum value of limit in GET /dapi/v1/userTrades is adjusted to 1000 +2021-08-18 + +REST + +New field positionAmt as position amount in response of GET /dapi/v1/account +2021-08-17 + +REST + +New endpoints PUT /dapi/v1/order and PUT /dapi/v1/batchOrders to support limit order modify +New endpoint GET /dapi/v1/orderAmendment to get order modify history +WEBSOCKET + +New type "AMENDMENT" as order modify in Execution Type x of Order Update event ORDER_TRADE_UPDATE +2021-07-23 + +REST + +New field updateTime as last update time of asset and position in response of GET /dapi/v1/account and GET /dapi/v1/positionRisk +2021-07-06 + +REST + +New fields in the response of GET /dapi/v1/exchangeInfo: +"liquidationFee" for liquidation fee rate +"marketTakeBound" for he max price difference rate( from mark price) a market order can make +2021-05-06 + +WEBSOCKET + +New field "bc" for balance change in event "ACCOUNT_UPDATE" +2021-04-27 + +WEBSOCKET + +The following liquidation orders streams do not push realtime order data anymore. Instead, they push snapshot order data at a maximum frequency of 1 order push per second.: +@forceOrder +!forceOrder@arr +REST + +The endpoint GET /dapi/v1/allForceOrders stop being maintained and no longer accepts request. +2021-03-10 + +REST + +The query time period for endpoint GET /dapi/v1/allForceOrders must be less than 7 days (default as the recent 7 days). +2021-01-26 + +REST RATE LIMIT WEIGHT + +Following endpoints' weights will be updated to 20 with symbol and 50 without symbol: +GET /dapi/v1/allForceOrders +GET /dapi/v1/forceOrders +2021-01-21 + +The regular expression rule for newClientOrderId updated as ^[\.A-Z\:/a-z0-9_-]{1,36}$ + +2020-12-30 + +REST + +Following DAPI endpoints will use new weight rule based on the parameter "LIMIT" in the request: + +GET /dapi/v1/klines +GET /dapi/v1/continuousKlines +GET /dapi/v1/indexPriceKlines +GET /dapi/v1/markPriceKlines +Following DAPI endpoints' weights will be updated to 20: + +GET /dapi/v1/historicalTrades +GET /dapi/v1/allForceOrders +GET /dapi/v1/forceOrders +GET /dapi/v1/aggTrades +2020-11-27 + +New endpoint GET /dapi/v1/commissionRate to get user commission rate. +2020-08-16 + +WEBSOCKET + +Websocket Request for user data: +@account request for user's account information +@balance request for user's account balance +@balance request for user's position information +REST + +New endpoint GET /dapi/v1/adlQuantile to get the positions' ADL quantile estimation values +2020-08-12 + +New endpoint GET /dapi/v1/forceOrders to get the user's force orderes. +2020-08-11 + +COIN MARGINED PERPETUAL FUTURES + +New contract type ("contractType") PERPETUAL for coin margined perpetual futures countract. + +New fields in the reponse to endpoint GET /dapi/v1/premiumIndex: + +lastFundingRate for the lasted funding rate of the perpetual futures contract +nextFundingTime for the next funding time of the perpetual futures contract +New endpoint GET /dapi/v1/fundingRate to get funding rate history of perpetual futures + +New fields in the payload of WSS @markPrice, @markPrice@1s, @markPrice, and @markPrice@1s: + +r for the lasted funding rate of the perpetual futures contract +T for the next funding time of the perpetual futures contract +2020-07-22 + +New endpoints of coin margined futures trading data: +GET /futures/data/openInterestHist +GET /futures/data/topLongShortAccountRatio +GET /futures/data/topLongShortPositionRatio +GET /futures/data/globalLongShortAccountRatio +GET /futures/data/takerBuySellVol +GET /futures/data/basis +2020-07-17 + +Weights of endpoint GET /dapi/v1/income has been changed as 20 +General Info +testnet +Most of the endpoints can be also used in the testnet platform. +The REST baseurl for testnet is "https://testnet.binancefuture.com" +The Websocket baseurl for testnet is "wss://dstream.binancefuture.com" +General API Information +The base endpoint is: https://dapi.binance.com +All endpoints return either a JSON object or array. +Data is returned in ascending order. Oldest first, newest last. +All time and timestamp related fields are in milliseconds. +All data types adopt definition in JAVA. +HTTP Return Codes +HTTP 4XX return codes are used for for malformed requests; the issue is on the sender's side. +HTTP 403 return code is used when the WAF Limit (Web Application Firewall) has been violated. +HTTP 408 return code is used when a timeout has occurred while waiting for a response from the backend server. +HTTP 429 return code is used when breaking a request rate limit. +HTTP 418 return code is used when an IP has been auto-banned for continuing to send requests after receiving 429 codes. +HTTP 5XX return codes are used for internal errors; the issue is on Binance's side. +If there is an error message "Request occur unknown error.", please retry later. +HTTP 503 return code is used when: +If there is an error message "Unknown error, please check your request or try again later." returned in the response, the API successfully sent the request but not get a response within the timeout period. +It is important to NOT treat this as a failure operation; the execution status is UNKNOWN and could have been a success; +If there is an error message "Service Unavailable." returned in the response, it means this is a failure API operation and the service might be unavailable at the moment, you need to retry later. +If there is an error message "Internal error; unable to process your request. Please try again." returned in the response, it means this is a failure API operation and you can resend your request if you need. +Error Codes and Messages +Any endpoint can return an ERROR +The error payload is as follows: + +{ + "code": -1121, + "msg": "Invalid symbol." +} +Specific error codes and messages defined in Error Codes. +General Information on Endpoints +For GET endpoints, parameters must be sent as a query string. +For POST, PUT, and DELETE endpoints, the parameters may be sent as a query string or in the request body with content type application/x-www-form-urlencoded. You may mix parameters between both the query string and request body if you wish to do so. +Parameters may be sent in any order. +If a parameter sent in both the query string and request body, the query string parameter will be used. +LIMITS +The /dapi/v1/exchangeInfo rateLimits array contains objects related to the exchange's RAW_REQUEST, REQUEST_WEIGHT, and ORDER rate limits. These are further defined in the ENUM definitions section under Rate limiters (rateLimitType). +A 429 will be returned when either rate limit is violated. + Binance has the right to further tighten the rate limits on users with intent to attack. +IP Limits +Every request will contain X-MBX-USED-WEIGHT-(intervalNum)(intervalLetter) in the response headers which has the current used weight for the IP for all request rate limiters defined. +Each route has a weight which determines for the number of requests each endpoint counts for. Heavier endpoints and endpoints that do operations on multiple symbols will have a heavier weight. +When a 429 is received, it's your obligation as an API to back off and not spam the API. +Repeatedly violating rate limits and/or failing to back off after receiving 429s will result in an automated IP ban (HTTP status 418). +IP bans are tracked and scale in duration for repeat offenders, from 2 minutes to 3 days. +The limits on the API are based on the IPs, not the API keys. + It is strongly recommended to use websocket stream for getting data as much as possible, which can not only ensure the timeliness of the message, but also reduce the access restriction pressure caused by the request. +Order Rate Limits +Every order response will contain a X-MBX-ORDER-COUNT-(intervalNum)(intervalLetter) header which has the current order count for the account for all order rate limiters defined. +Rejected/unsuccessful orders are not guaranteed to have X-MBX-ORDER-COUNT-** headers in the response. +The order rate limit is counted against each account. +Endpoint Security Type +Each endpoint has a security type that determines the how you will interact with it. +API-keys are passed into the Rest API via the X-MBX-APIKEY header. +API-keys and secret-keys are case sensitive. +API-keys can be configured to only access certain types of secure endpoints. For example, one API-key could be used for TRADE only, while another API-key can access everything except for TRADE routes. +By default, API-keys can access all secure routes. +Security Type Description +NONE Endpoint can be accessed freely. +TRADE Endpoint requires sending a valid API-Key and signature. +USER_DATA Endpoint requires sending a valid API-Key and signature. +USER_STREAM Endpoint requires sending a valid API-Key. +MARKET_DATA Endpoint requires sending a valid API-Key. +TRADE and USER_DATA endpoints are SIGNED endpoints. +SIGNED (TRADE and USER_DATA) Endpoint Security +SIGNED endpoints require an additional parameter, signature, to be sent in the query string or request body. +Endpoints use HMAC SHA256 signatures. The HMAC SHA256 signature is a keyed HMAC SHA256 operation. Use your secretKey as the key and totalParams as the value for the HMAC operation. +The signature is not case sensitive. +Please make sure the signature is the end part of your query string or request body. +totalParams is defined as the query string concatenated with the request body. +Timing security +A SIGNED endpoint also requires a parameter, timestamp, to be sent which should be the millisecond timestamp of when the request was created and sent. +An additional parameter, recvWindow, may be sent to specify the number of milliseconds after timestamp the request is valid for. If recvWindow is not sent, it defaults to 5000. +If the server determines that the timestamp sent by the client is more than one second in the future of the server time, the request will also be rejected. +The logic is as follows: + + if (timestamp < (serverTime + 1000) && (serverTime - timestamp) <= recvWindow){ + // process request + } + else { + // reject request + } +Serious trading is about timing. Networks can be unstable and unreliable, which can lead to requests taking varying amounts of time to reach the servers. With recvWindow, you can specify that the request must be processed within a certain number of milliseconds or be rejected by the server. + + It is recommended to use a small recvWindow of 5000 or less! +SIGNED Endpoint Examples for POST /dapi/v1/order - HMAC Keys +Here is a step-by-step example of how to send a vaild signed payload from the Linux command line using echo, openssl, and curl. + +Key Value +apiKey dbefbc809e3e83c283a984c3a1459732ea7db1360ca80c5c2c8867408d28cc83 +secretKey 2b5eb11e18796d12d88f13dc27dbbd02c2cc51ff7059765ed9821957d82bb4d9 +Parameter Value +symbol BTCUSD_200925 +side BUY +type LIMIT +timeInForce GTC +quantity 1 +price 9000 +recvWindow 5000 +timestamp 1591702613943 +Example 1: As a query string +Example 1 + +HMAC SHA256 signature: + + $ echo -n "symbol=BTCUSD_200925&side=BUY&type=LIMIT&quantity=1&price=9000&timeInForce=GTC&recvWindow=5000×tamp=1591702613943" | openssl dgst -sha256 -hmac "2b5eb11e18796d12d88f13dc27dbbd02c2cc51ff7059765ed9821957d82bb4d9" + (stdin)= 21fd819734bf0e5c68740eed892909414d693635c5f7fffab1313925ae13556a +curl command: + + (HMAC SHA256) + $ curl -H "X-MBX-APIKEY: dbefbc809e3e83c283a984c3a1459732ea7db1360ca80c5c2c8867408d28cc83" -X POST 'https://dapi.binance.com/dapi/v1/order?symbol=BTCUSD_200925&side=BUY&type=LIMIT&quantity=1&price=9000&timeInForce=GTC&recvWindow=5000×tamp=1591702613943&signature= 21fd819734bf0e5c68740eed892909414d693635c5f7fffab1313925ae13556a' +queryString: + +symbol=BTCUSD_200925 +&side=BUY +&type=LIMIT +&timeInForce=GTC +&quantity=1 +&price=9000 +&recvWindow=5000 +×tamp=1591702613943 + +Example 2: As a request body +Example 2 + +HMAC SHA256 signature: + + $ echo -n "symbol=BTCUSD_200925&side=BUY&type=LIMIT&quantity=1&price=9000&timeInForce=GTC&recvWindow=5000×tamp=1591702613943" | openssl dgst -sha256 -hmac "2b5eb11e18796d12d88f13dc27dbbd02c2cc51ff7059765ed9821957d82bb4d9" + (stdin)= 21fd819734bf0e5c68740eed892909414d693635c5f7fffab1313925ae13556a +curl command: + + (HMAC SHA256) + $ curl -H "X-MBX-APIKEY: dbefbc809e3e83c283a984c3a1459732ea7db1360ca80c5c2c8867408d28cc83" -X POST 'https://dapi.binance.com/dapi/v1/order' -d 'symbol=BTCUSD_200925&side=BUY&type=LIMIT&quantity=1&price=9000&timeInForce=GTC&recvWindow=5000×tamp=1591702613943&signature= 21fd819734bf0e5c68740eed892909414d693635c5f7fffab1313925ae13556a' +requestBody: + +symbol=BTCUSD_200925 +&side=BUY +&type=LIMIT +&timeInForce=GTC +&quantity=1 +&price=9000 +&recvWindow=5000 +×tamp=1591702613943 + +Example 3: Mixed query string and request body +Example 3 + +HMAC SHA256 signature: + + $ echo -n "symbol=BTCUSD_200925&side=BUY&type=LIMIT&timeInForce=GTCquantity=1&price=9000&recvWindow=5000×tamp= 1591702613943" | openssl dgst -sha256 -hmac "2b5eb11e18796d12d88f13dc27dbbd02c2cc51ff7059765ed9821957d82bb4d9" + (stdin)= f3129e7c72c7727037891ad8a86b76a7dc514ba125a536775c8ba403b2d1b222 +curl command: + + (HMAC SHA256) + $ curl -H "X-MBX-APIKEY: dbefbc809e3e83c283a984c3a1459732ea7db1360ca80c5c2c8867408d28cc83" -X POST 'https://dapi.binance.com/dapi/v1/order?symbol=BTCUSD_200925&side=BUY&type=LIMIT&timeInForce=GTC' -d 'quantity=1&price=9000&recvWindow=5000×tamp= 1591702613943&signature=f3129e7c72c7727037891ad8a86b76a7dc514ba125a536775c8ba403b2d1b222' +queryString: symbol=BTCUSD_200925&side=BUY&type=LIMIT&timeInForce=GTC +requestBody: quantity=1&price=9000&recvWindow=5000×tamp= 1591702613943 +Note that the signature is different in example 3. +There is no & between "GTC" and "quantity=1". + +SIGNED Endpoint Examples for POST /dapi/v1/order - RSA Keys +This will be a step by step process how to create the signature payload to send a valid signed payload. +We support PKCS#8 currently. +To get your API key, you need to upload your RSA Public Key to your account and a corresponding API key will be provided for you. +For this example, the private key will be referenced as test-prv-key.pem + +Key Value +apiKey vE3BDAL1gP1UaexugRLtteaAHg3UO8Nza20uexEuW1Kh3tVwQfFHdAiyjjY428o2 +Parameter Value +symbol BTCUSD_PERP +side SELL +type MARKET +quantity 100 +recvWindow 9999999 +timestamp 1671090801999 +Signature payload (with the listed parameters): + +timestamp=1671090801999&recvWindow=9999999&symbol=BTCUSD_PERP&side=SELL&type=MARKET&quantity=100 +Step 1: Construct the payload + +Arrange the list of parameters into a string. Separate each parameter with a &. + +Step 2: Compute the signature: + +2.1 - Encode signature payload as ASCII data. + +Step 2.2 + + $ echo -n 'timestamp=1671090801999&recvWindow=9999999&symbol=BTCUSD_PERP&side=SELL&type=MARKET&quantity=100' | openssl dgst -keyform PEM -sha256 -sign ./test-prv-key.pem +2.2 - Sign payload using RSASSA-PKCS1-v1_5 algorithm with SHA-256 hash function. + +Step 2.3 + +$ echo -n 'timestamp=1671090801999&recvWindow=9999999&symbol=BTCUSD_PERP&side=SELL&type=MARKET&quantity=100' | openssl dgst -keyform PEM -sha256 -sign ./test-prv-key.pem | openssl enc -base64 +aap36wD5loVXizxvvPI3wz9Cjqwmb3KVbxoym0XeWG1jZq8umqrnSk8H8dkLQeySjgVY91Ufs%2BBGCW%2B4sZjQEpgAfjM76riNxjlD3coGGEsPsT2lG39R%2F1q72zpDs8pYcQ4A692NgHO1zXcgScTGgdkjp%2Brp2bcddKjyz5XBrBM%3D +2.3 - Encode output as base64 string. + +Step 2.4 + +$ echo -n 'timestamp=1671090801999&recvWindow=9999999&symbol=BTCUSD_PERP&side=SELL&type=MARKET&quantity=100' | openssl dgst -keyform PEM -sha256 -sign ./test-prv-key.pem | openssl enc -base64 | tr -d '\n' +aap36wD5loVXizxvvPI3wz9Cjqwmb3KVbxoym0XeWG1jZq8umqrnSk8H8dkLQeySjgVY91Ufs%2BBGCW%2B4sZjQEpgAfjM76riNxjlD3coGGEsPsT2lG39R%2F1q72zpDs8pYcQ4A692NgHO1zXcgScTGgdkjp%2Brp2bcddKjyz5XBrBM%3D +2.4 - Delete any newlines in the signature. + +Step 2.5 + +aap36wD5loVXizxvvPI3wz9Cjqwmb3KVbxoym0XeWG1jZq8umqrnSk8H8dkLQeySjgVY91Ufs%2BBGCW%2B4sZjQEpgAfjM76riNxjlD3coGGEsPsT2lG39R%2F1q72zpDs8pYcQ4A692NgHO1zXcgScTGgdkjp%2Brp2bcddKjyz5XBrBM%3D +2.5 - Since the signature may contain / and =, this could cause issues with sending the request. So the signature has to be URL encoded. + +Step 2.6 + + curl -H "X-MBX-APIKEY: vE3BDAL1gP1UaexugRLtteaAHg3UO8Nza20uexEuW1Kh3tVwQfFHdAiyjjY428o2" -X POST 'https://dapi.binance.com/dapi/v1/order?timestamp=1671090801999&recvWindow=9999999&symbol=BTCUSD_PERP&side=SELL&type=MARKET&quantity=100&signature=aap36wD5loVXizxvvPI3wz9Cjqwmb3KVbxoym0XeWG1jZq8umqrnSk8H8dkLQeySjgVY91Ufs%2BBGCW%2B4sZjQEpgAfjM76riNxjlD3coGGEsPsT2lG39R%2F1q72zpDs8pYcQ4A692NgHO1zXcgScTGgdkjp%2Brp2bcddKjyz5XBrBM%3D' +2.6 - curl command + +Bash script + +#!/usr/bin/env bash + +# Set up authentication: +apiKey="vE3BDAL1gP1UaexugRLtteaAHg3UO8Nza20uexEuW1Kh3tVwQfFHdAiyjjY428o2" ### REPLACE THIS WITH YOUR API KEY + +# Set up the request: +apiMethod="POST" +apiCall="v1/order" +apiParams="timestamp=1671090801999&recvWindow=9999999&symbol=BTCUSD_PERP&side=SELL&type=MARKET&quantity=100" +function rawurlencode { + local value="$1" + local len=${#value} + local encoded="" + local pos c o + for (( pos=0 ; pos minutes; h -> hours; d -> days; w -> weeks; M -> months + +1m +3m +5m +15m +30m +1h +2h +4h +6h +8h +12h +1d +3d +1w +1M +Rate limiters (rateLimitType) + +REQUEST_WEIGHT + + { + "rateLimitType": "REQUEST_WEIGHT", + "interval": "MINUTE", + "intervalNum": 1, + "limit": 6000 + } +ORDERS + + { + "rateLimitType": "ORDERS", + "interval": "MINUTE", + "intervalNum": 1, + "limit": 1200 + } +REQUEST_WEIGHT + +ORDERS + +Rate limit intervals (interval) + +MINUTE +Filters +Filters define trading rules on a symbol or an exchange. + +Symbol filters +PRICE_FILTER +/exchangeInfo format: + + { + "filterType": "PRICE_FILTER", + "minPrice": "0.00000100", + "maxPrice": "100000.00000000", + "tickSize": "0.00000100" + } +The PRICE_FILTER defines the price rules for a symbol. There are 3 parts: + +minPrice defines the minimum price/stopPrice allowed; disabled on minPrice == 0. +maxPrice defines the maximum price/stopPrice allowed; disabled on maxPrice == 0. +tickSize defines the intervals that a price/stopPrice can be increased/decreased by; disabled on tickSize == 0. +Any of the above variables can be set to 0, which disables that rule in the price filter. In order to pass the price filter, the following must be true for price/stopPrice of the enabled rules: + +price >= minPrice +price <= maxPrice +(price-minPrice) % tickSize == 0 +LOT_SIZE +/exchangeInfo format: + + { + "filterType": "LOT_SIZE", + "minQty": "0.00100000", + "maxQty": "100000.00000000", + "stepSize": "0.00100000" + } +The LOT_SIZE filter defines the quantity (aka "lots" in auction terms) rules for a symbol. There are 3 parts: + +minQty defines the minimum quantity allowed. +maxQty defines the maximum quantity allowed. +stepSize defines the intervals that a quantity can be increased/decreased by. +In order to pass the lot size, the following must be true for quantity: + +quantity >= minQty +quantity <= maxQty +(quantity-minQty) % stepSize == 0 +MARKET_LOT_SIZE +/exchangeInfo format: + + { + "filterType": "MARKET_LOT_SIZE", + "minQty": "0.00100000", + "maxQty": "100000.00000000", + "stepSize": "0.00100000" + } +The MARKET_LOT_SIZE filter defines the quantity (aka "lots" in auction terms) rules for MARKET orders on a symbol. There are 3 parts: + +minQty defines the minimum quantity allowed. +maxQty defines the maximum quantity allowed. +stepSize defines the intervals that a quantity can be increased/decreased by. +In order to pass the market lot size, the following must be true for quantity: + +quantity >= minQty +quantity <= maxQty +(quantity-minQty) % stepSize == 0 +MAX_NUM_ORDERS +/exchangeInfo format: + + { + "filterType": "MAX_NUM_ORDERS", + "limit": 200 + } +The MAX_NUM_ORDERS filter defines the maximum number of orders an account is allowed to have open on a symbol. + +Note that both "algo" orders and normal orders are counted for this filter. + +PERCENT_PRICE +/exchangeInfo format: + + { + "filterType": "PERCENT_PRICE", + "multiplierUp": "1.0500", + "multiplierDown": "0.9500", + "multiplierDecimal": 4 + } +The PERCENT_PRICE filter defines valid range for a price based on the mark price. + +In order to pass the percent price, the following must be true for price: + +BUY: price <= markPrice * multiplierUp +SELL: price >= markPrice * multiplierDown +Market Data Endpoints +Test Connectivity +Response: + +{} +GET /dapi/v1/ping + +Test connectivity to the Rest API. + +Weight: 1 + +Parameters: NONE + +Check Server time +Response: + +{ + "serverTime": 1499827319559 +} +GET /dapi/v1/time + +Test connectivity to the Rest API and get the current server time. + +Weight: 1 + +Parameters: NONE + +Exchange Information +Response: + +{ + "exchangeFilters": [], + "rateLimits": [ + { + "interval": "MINUTE", + "intervalNum": 1, + "limit": 6000, + "rateLimitType": "REQUEST_WEIGHT" + }, + { + "interval": "MINUTE", + "intervalNum": 1, + "limit": 6000, + "rateLimitType": "ORDERS" + } + ], + "serverTime": 1565613908500, // Ignore please. If you want to check current server time, please check via "GET /dapi/v1/time" + "symbols": [ // contract symbols + { + "filters": [ + { + "filterType": "PRICE_FILTER", + "maxPrice": "100000", + "minPrice": "0.1", + "tickSize": "0.1" + }, + { + "filterType": "LOT_SIZE", + "maxQty": "100000", + "minQty": "1", + "stepSize": "1" + }, + { + "filterType": "MARKET_LOT_SIZE", + "maxQty": "100000", + "minQty": "1", + "stepSize": "1" + }, + { + "filterType": "MAX_NUM_ORDERS", + "limit": 200 + }, + { + "filterType": "PERCENT_PRICE", + "multiplierUp": "1.0500", + "multiplierDown": "0.9500", + "multiplierDecimal": 4 + } + ], + "OrderType": [ + "LIMIT", + "MARKET", + "STOP", + "TAKE_PROFIT", + "TRAILING_STOP_MARKET" + ], + "timeInForce": [ + "GTC", + "IOC", + "FOK", + "GTX" + ], + "liquidationFee": "0.010000", // liquidation fee rate + "marketTakeBound": "0.30", // the max price difference rate( from mark price) a market order can make + "symbol": "BTCUSD_200925", // contract symbol name + "pair": "BTCUSD", // underlying symbol + "contractType": "CURRENT_QUARTER", + "deliveryDate": 1601020800000, + "onboardDate": 1590739200000, + "contractStatus": "TRADING", + "contractSize": 100, + "quoteAsset": "USD", + "baseAsset": "BTC", + "marginAsset": "BTC", + "pricePrecision": 1, // please do not use it as tickSize + "quantityPrecision": 0, // please do not use it as stepSize + "baseAssetPrecision": 8, + "quotePrecision": 8, + "equalQtyPrecision": 4, // ignore + "triggerProtect": "0.0500", // threshold for algo order with "priceProtect" + "maintMarginPercent": "2.5000", // ignore + "requiredMarginPercent": "5.0000", // ignore + "underlyingType": "COIN", + "underlyingSubType": [] + } + ], + "timezone": "UTC" +} + +GET /dapi/v1/exchangeInfo + +Current exchange trading rules and symbol information + +Weight: 1 + +Parameters: NONE + +Order Book +Response: + +{ + "lastUpdateId": 16769853, + "symbol": "BTCUSD_PERP", // Symbol + "pair": "BTCUSD", // Pair + "E": 1591250106370, // Message output time + "T": 1591250106368, // Transaction time + "bids": [ + [ + "9638.0", // PRICE + "431" // QTY + ] + ], + "asks": [ + [ + "9638.2", + "12" + ] + ] +} +GET /dapi/v1/depth + +Weight: + +Adjusted based on the limit: + +Update Speed: 15ms + +Limit Weight +5, 10, 20, 50 2 +100 5 +500 10 +1000 20 +Parameters: + +Name Type Mandatory Description +symbol STRING YES +limit INT NO Default 500; Valid limits:[5, 10, 20, 50, 100, 500, 1000] +Recent Trades List +Response: + +[ + { + "id": 28457, + "price": "9635.0", + "qty": "1", + "baseQty": "0.01037883", + "time": 1591250192508, + "isBuyerMaker": true, + } +] +GET /dapi/v1/trades + +Get recent market trades + +Weight: 5 + +Parameters: + +Name Type Mandatory Description +symbol STRING YES +limit INT NO Default 500; max 1000. +Market trades means trades filled in the order book. Only market trades will be returned, which means the insurance fund trades and ADL trades won't be returned. +Old Trades Lookup (MARKET_DATA) +Response: + +[ + { + "id": 595103, + "price": "9642.2", + "qty": "1", + "baseQty": "0.01037108", + "time": 1499865549590, + "isBuyerMaker": true, + } +] +GET /dapi/v1/historicalTrades + +Get older market historical trades. + +Weight: 20 + +Parameters: + +Name Type Mandatory Description +symbol STRING YES +limit INT NO Default 500; max 1000. +fromId LONG NO TradeId to fetch from. Default gets most recent trades. +Market trades means trades filled in the order book. Only market trades will be returned, which means the insurance fund trades and ADL trades won't be returned. +Only supports returning data from the last three months (the earliest available time is currently 2023/12/08 00:00:00). +Compressed/Aggregate Trades List +Response: + +[ + { + "a": 416690, // Aggregate tradeId + "p": "9642.4", // Price + "q": "3", // Quantity + "f": 595259, // First tradeId + "l": 595259, // Last tradeId + "T": 1591250548649, // Timestamp + "m": false, // Was the buyer the maker? + } +] +GET /dapi/v1/aggTrades + +Get compressed, aggregate trades. Market trades that fill in 100ms with the same price and the same taking side will have the quantity aggregated. + +Weight: 20 + +Parameters: + +Name Type Mandatory Description +symbol STRING YES +fromId LONG NO ID to get aggregate trades from INCLUSIVE. +startTime LONG NO Timestamp in ms to get aggregate trades from INCLUSIVE. +endTime LONG NO Timestamp in ms to get aggregate trades until INCLUSIVE. +limit INT NO Default 500; max 1000. +If both startTime and endTime are sent, time between startTime and endTime must be less than 1 hour. +If fromId, startTime, and endTime are not sent, the most recent aggregate trades will be returned. +Only market trades will be aggregated and returned, which means the insurance fund trades and ADL trades won't be aggregated. +Sending both startTime/endTime and fromId might cause response timeout, please send either fromId or startTime/endTime +Index Price and Mark Price +Response: + +[ + { + "symbol": "BTCUSD_PERP", + "pair": "BTCUSD", + "markPrice": "11029.69574559", // mark price + "indexPrice": "10979.14437500", // index price + "estimatedSettlePrice": "10981.74168236", // Estimated Settle Price, only useful in the last hour before the settlement starts. + "lastFundingRate": "0.00071003", // the lasted funding rate, for perpetual contract symbols only. For delivery symbols, "" will be shown. + "interestRate": "0.00010000", // the base asset interest rate, for perpetual contract symbols only. For delivery symbols, "" will be shown. + "nextFundingTime": 1596096000000, // For perpetual contract symbols only. For delivery symbols, 0 will be shown + "time": 1596094042000 + }, + { + "symbol": "BTCUSD_200925", + "pair": "BTCUSD", + "markPrice": "12077.01343750", + "indexPrice": "10979.10312500", + "estimatedSettlePrice": "10981.74168236", + "lastFundingRate": "", + "interestRate": "", + "nextFundingTime": 0, + "time": 1596094042000 + } +] +GET /dapi/v1/premiumIndex + +Weight: 10 + +Parameters: + +Name Type Mandatory Description +symbol STRING NO +pair STRING NO +Get Funding Rate History of Perpetual Futures +Response: + +[ + { + "symbol": "BTCUSD_PERP", + "fundingTime": 1698768000000, + "fundingRate": "-0.00300000", + "markPrice": "34651.40000000" // mark price associated with a particular funding fee charge + }, + { + "symbol": "BTCUSD_PERP", + "fundingTime": 1698796800000, + "fundingRate": "-0.00300000", + "markPrice": "34651.40000000" + } +] +GET /dapi/v1/fundingRate + +Weight: 1 + +Parameters: + +Name Type Mandatory Description +symbol STRING YES +startTime LONG NO Timestamp in ms to get funding rate from INCLUSIVE. +endTime LONG NO Timestamp in ms to get funding rate until INCLUSIVE. +limit INT NO Default 100; max 1000 +empty array will be returned for delivery symbols. +Get Funding Rate Info +Response: + +[ + { + "symbol": "BLZUSDT", + "adjustedFundingRateCap": "0.02500000", + "adjustedFundingRateFloor": "-0.02500000", + "fundingIntervalHours": 8, + "disclaimer": false // ingore + } +] +GET /dapi/v1/fundingInfo + +Query funding rate info for symbols that had FundingRateCap/ FundingRateFloor / fundingIntervalHours adjustment + +Kline/Candlestick Data +Response: + +[ + [ + 1591258320000, // Open time + "9640.7", // Open + "9642.4", // High + "9640.6", // Low + "9642.0", // Close (or latest price) + "206", // Volume + 1591258379999, // Close time + "2.13660389", // Base asset volume + 48, // Number of trades + "119", // Taker buy volume + "1.23424865", // Taker buy base asset volume + "0" // Ignore. + ] +] +GET /dapi/v1/klines + +Kline/candlestick bars for a symbol. + +Klines are uniquely identified by their open time. + +Weight: based on parameter LIMIT + +LIMIT weight +[1,100) 1 +[100, 500) 2 +[500, 1000] 5 +> 1000 10 +Parameters: + +Name Type Mandatory Description +symbol STRING YES +interval ENUM YES +startTime LONG NO +endTime LONG NO +limit INT NO Default 500; max 1500. +The difference between startTime and endTime can only be up to 200 days +Between startTime and endTime, the most recent limit data from endTime will be returned: + +If startTime and endTime are not sent, current timestamp will be set as endTime, and the most recent data will be returned. +If startTime is sent only, the timestamp of 200 days after startTime will be set as endTime(up to the current time) +If endTime is sent only, the timestamp of 200 days before endTime will be set as startTime +Kline/Candlestick chart intervals: +m -> minutes; h -> hours; d -> days; w -> weeks; M -> months + +1m +3m +5m +15m +30m +1h +2h +4h +6h +8h +12h +1d +3d +1w +1M +Continuous Contract Kline/Candlestick Data +Response: + +[ + [ + 1591258320000, // Open time + "9640.7", // Open + "9642.4", // High + "9640.6", // Low + "9642.0", // Close (or latest price) + "206", // Volume + 1591258379999, // Close time + "2.13660389", // Base asset volume + 48, // Number of trades + "119", // Taker buy volume + "1.23424865", // Taker buy base asset volume + "0" // Ignore. + ] +] +GET /dapi/v1/continuousKlines + +Kline/candlestick bars for a specific contract type. + +Klines are uniquely identified by their open time. + +Weight: based on parameter LIMIT + +LIMIT weight +[1,100) 1 +[100, 500) 2 +[500, 1000] 5 +> 1000 10 +Parameters: + +Name Type Mandatory Description +pair STRING YES +contractType ENUM YES +interval ENUM YES +startTime LONG NO +endTime LONG NO +limit INT NO Default 500; max 1500. +The difference between startTime and endTime can only be up to 200 days +Between startTime and endTime, the most recent limit data from endTime will be returned: + +If startTime and endTime are not sent, current timestamp will be set as endTime, and the most recent data will be returned. +If startTime is sent only, the timestamp of 200 days after startTime will be set as endTime(up to the current time) +If endTime is sent only, the timestamp of 200 days before endTime will be set as startTime +Contract type: + +PERPETUAL +CURRENT_QUARTER +NEXT_QUARTER +Index Price Kline/Candlestick Data +Response: + +[ + [ + 1591256400000, // Open time + "9653.69440000", // Open + "9653.69640000", // High + "9651.38600000", // Low + "9651.55200000", // Close (or latest price) + "0 ", // Ignore + 1591256459999, // Close time + "0", // Ignore + 60, // Number of bisic data + "0", // Ignore + "0", // Ignore + "0" // Ignore + ] +] +GET /dapi/v1/indexPriceKlines + +Kline/candlestick bars for the index price of a pair. + +Klines are uniquely identified by their open time. + +Weight: based on parameter LIMIT + +LIMIT weight +[1,100) 1 +[100, 500) 2 +[500, 1000] 5 +> 1000 10 +Parameters: + +Name Type Mandatory Description +pair STRING YES +interval ENUM YES +startTime LONG NO +endTime LONG NO +limit INT NO Default 500; max 1500. +The difference between startTime and endTime can only be up to 200 days +Between startTime and endTime, the most recent limit data from endTime will be returned: +If startTime and endTime are not sent, current timestamp will be set as endTime, and the most recent data will be returned. +If startTime is sent only, the timestamp of 200 days after startTime will be set as endTime(up to the current time) +If endTime is sent only, the timestamp of 200 days before endTime will be set as startTime +Mark Price Kline/Candlestick Data +Response: + +[ + [ + 1591256460000, // Open time + "9653.29201333", // Open + "9654.56401333", // High + "9653.07367333", // Low + "9653.07367333", // Close (or latest price) + "0 ", // Ignore + 1591256519999, // Close time + "0", // Ignore + 60, // Number of bisic data + "0", // Ignore + "0", // Ignore + "0" // Ignore + ] +] +GET /dapi/v1/markPriceKlines + +Kline/candlestick bars for the mark price of a symbol. + +Klines are uniquely identified by their open time. + +Weight: based on parameter LIMIT + +LIMIT weight +[1,100) 1 +[100, 500) 2 +[500, 1000] 5 +> 1000 10 +Parameters: + +Name Type Mandatory Description +symbol STRING YES +interval ENUM YES +startTime LONG NO +endTime LONG NO +limit INT NO Default 500; max 1500. +The difference between startTime and endTime can only be up to 200 days +Between startTime and endTime, the most recent limit data from endTime will be returned: +If startTime and endTime are not sent, current timestamp will be set as endTime, and the most recent data will be returned. +If startTime is sent only, the timestamp of 200 days after startTime will be set as endTime(up to the current time) +If endTime is sent only, the timestamp of 200 days before endTime will be set as startTime +Premium index Kline Data +Response: + +[ + [ + 1691603820000, // Open time + "-0.00042931", // Open + "-0.00023641", // High + "-0.00059406", // Low + "-0.00043659", // Close + "0", // Ignore + 1691603879999, // Close time + "0", // Ignore + 12, // Ignore + "0", // Ignore + "0", // Ignore + "0" // Ignore + ] +] +GET /dapi/v1/premiumIndexKlines + +Premium index kline bars of a symbol. + +Klines are uniquely identified by their open time. + +Weight: based on parameter LIMIT + +LIMIT weight +[1,100) 1 +[100, 500) 2 +[500, 1000] 5 +> 1000 10 +Parameters: + +Name Type Mandatory Description +symbol STRING YES +interval ENUM YES +startTime LONG NO +endTime LONG NO +limit INT NO Default 500; max 1500. +If startTime and endTime are not sent, the most recent klines are returned. +24hr Ticker Price Change Statistics +Response: + +[ + { + "symbol": "BTCUSD_200925", + "pair": "BTCUSD", + "priceChange": "136.6", + "priceChangePercent": "1.436", + "weightedAvgPrice": "9547.3", + "lastPrice": "9651.6", + "lastQty": "1", + "openPrice": "9515.0", + "highPrice": "9687.0", + "lowPrice": "9499.5", + "volume": "494109", + "baseVolume": "5192.94797687", + "openTime": 1591170300000, + "closeTime": 1591256718418, + "firstId": 600507, // First tradeId + "lastId": 697803, // Last tradeId + "count": 97297 // Trade count + } +] +GET /dapi/v1/ticker/24hr + +24 hour rolling window price change statistics. +Careful when accessing this with no symbol. + +Weight: + +1 for a single symbol; +40 when the symbol parameter is omitted +Parameters: + +Name Type Mandatory Description +symbol STRING NO +pair STRING NO +Symbol and pair cannot be sent together +If a pair is sent,tickers for all symbols of the pair will be returned +If either a pair or symbol is sent, tickers for all symbols of all pairs will be returned +Symbol Price Ticker +Response: + +[ + { + "symbol": "BTCUSD_200626", + "ps": "9647.8", // pair + "price": "9647.8", + "time": 1591257246176 + } +] +GET /dapi/v1/ticker/price + +Latest price for a symbol or symbols. + +Weight: +1 for a single symbol; +2 when the symbol parameter is omitted + +Parameters: + +Name Type Mandatory Description +symbol STRING NO +pair STRING NO +Symbol and pair cannot be sent together +If a pair is sent,tickers for all symbols of the pair will be returned +If either a pair or symbol is sent, tickers for all symbols of all pairs will be returned +Symbol Order Book Ticker +[ + { + "lastUpdateId": 1027024, + "symbol": "BTCUSD_200626", + "pair": "BTCUSD", + "bidPrice": "9650.1", + "bidQty": "16", + "askPrice": "9650.3", + "askQty": "7", + "time": 1591257300345 + } +] +GET /dapi/v1/ticker/bookTicker + +Best price/qty on the order book for a symbol or symbols. + +Weight: +2 for a single symbol; +5 when the symbol parameter is omitted + +Parameters: + +Name Type Mandatory Description +symbol STRING NO +pair STRING NO +Symbol and pair cannot be sent together +If a pair is sent,tickers for all symbols of the pair will be returned +If either a pair or symbol is sent, tickers for all symbols of all pairs will be returned +Query Index Price Constituents +Response: + +{ + "symbol": "BTCUSD", + "time": 1697422647853, + "constituents": [ + { + "exchange": "bitstamp", + "symbol": "btcusd" + }, + { + "exchange": "coinbase", + "symbol": "BTC-USD" + }, + { + "exchange": "kraken", + "symbol": "XBT/USD" + }, + { + "exchange": "binance_cross", + "symbol": "BTCUSDC*index(USDCUSD)" + } + ] +} +GET /dapi/v1/constituents + +Query index price constituents + +Weight: 2 + +Parameters: + +Name Type Mandatory Description +symbol STRING YES symbol underlying e.g BTCUSD +Open Interest +Response: + +{ + "symbol": "BTCUSD_200626", + "pair": "BTCUSD", + "openInterest": "15004", + "contractType": "CURRENT_QUARTER", + "time": 1591261042378 +} + +Get present open interest of a specific symbol. + +GET /dapi/v1/openInterest + +Weight: 1 + +Parameters: + +Name Type Mandatory Description +symbol STRING YES +Quarterly Contract Settlement Price +Response: + +[ +{ + "deliveryPrice": 27101.10000000, + "deliveryTime": 1695945600000 + }, + { + "deliveryPrice": 30729.40000000, + "deliveryTime": 1688083200000 + }, + { + "deliveryPrice": 27823.70000000, + "deliveryTime": 1680220800000 + }, + { + "deliveryPrice": 44094.70000000, + "deliveryTime": 1648166400000 + } +] +GET /futures/data/delivery-price + +Parameters: + +Name Type Mandatory Description +pair STRING YES e.g BTCUSD +Open Interest Statistics +Response: + +[ + { + "pair": "BTCUSD", + "contractType": "CURRENT_QUARTER", + "sumOpenInterest": "20403", //unit: cont + "sumOpenInterestValue": "176196512.23400000", //unit: base asset + "timestamp": 1591261042378 + }, + { + "pair": "BTCUSD", + "contractType": "CURRENT_QUARTER", + "sumOpenInterest": "20401", + "sumOpenInterestValue": "176178704.98700000", + "timestamp": 1583128200000 + } +] +GET /futures/data/openInterestHist + +Weight: 1 + +Parameters: + +Name Type Mandatory Description +pair STRING YES BTCUSD +contractType ENUM YES ALL, CURRENT_QUARTER, NEXT_QUARTER, PERPETUAL +period ENUM YES "5m","15m","30m","1h","2h","4h","6h","12h","1d" +limit LONG NO Default 30,Max 500 +startTime LONG NO +endTime LONG NO +If startTime and endTime are not sent, the most recent data is returned. +Only the data of the latest 30 days is available. +IP rate limit 1000 requests/5min +Top Trader Long/Short Ratio (Accounts) +Response: + +[ + { + "pair": "BTCUSD", + "longShortRatio": "1.8105", + "longAccount": "0.6442", //64.42% + "shortAccount": "0.3558", //35.58% + "timestamp": 1591261042378 + }, + { + "pair": "BTCUSD", + "longShortRatio": "1.1110", + "longAccount": "0.5263", + "shortAccount": "0.4737", + "timestamp": 1592870400000 + } +] +GET /futures/data/topLongShortAccountRatio + +Weight: 1 + +Parameters: + +Name Type Mandatory Description +pair STRING YES BTCUSD +period ENUM YES "5m","15m","30m","1h","2h","4h","6h","12h","1d" +limit LONG NO Default 30,Max 500 +startTime LONG NO +endTime LONG NO +If startTime and endTime are not sent, the most recent data is returned. +Only the data of the latest 30 days is available. +IP rate limit 1000 requests/5min +Top Trader Long/Short Ratio (Positions) +Response: + +[ + { + "pair": "BTCUSD", + "longShortRatio": "0.7869", + "longPosition": "0.6442", //64.42% + "shortPosition": "0.4404", //44.04% + "timestamp": 1592870400000 + }, + { + "pair": "BTCUSD", + "longShortRatio": "1.1231", + "longPosition": "0.2363", + "shortPosition": "0.4537", + "timestamp": 1592956800000 + } +] +GET /futures/data/topLongShortPositionRatio + +Weight: 1 + +Parameters: + +Name Type Mandatory Description +pair STRING YES BTCUSD +period ENUM YES "5m","15m","30m","1h","2h","4h","6h","12h","1d" +limit LONG NO Default 30,Max 500 +startTime LONG NO +endTime LONG NO +If startTime and endTime are not sent, the most recent data is returned. +Only the data of the latest 30 days is available. +IP rate limit 1000 requests/5min +Long/Short Ratio +Response: + +[ + { + "pair": "BTCUSD", + "longShortRatio": "0.1960", + "longAccount": "0.6622", //66.22% + "shortAccount": "0.3378", //33.78% + "timestamp": 1583139600000 + }, + { + "pair": "BTCUSD", + "longShortRatio": "1.9559", + "longAccount": "0.6617", + "shortAccount": "0.3382", + "timestamp": 1583139900000 + } +] +GET /futures/data/globalLongShortAccountRatio + +Weight: 1 + +Parameters: + +Name Type Mandatory Description +pair STRING YES BTCUSD +period ENUM YES "5m","15m","30m","1h","2h","4h","6h","12h","1d" +limit LONG NO Default 30,Max 500 +startTime LONG NO +endTime LONG NO +If startTime and endTime are not sent, the most recent data is returned. +Only the data of the latest 30 days is available. +IP rate limit 1000 requests/5min +Taker Buy/Sell Volume +Response: + +[ + { + "pair": "BTCUSD", + "contractType": CURRENT_QUARTER, + "takerBuyVol": "387", //unit: cont + "takerSellVol": "248", //unit: cont + "takerBuyVolValue": "2342.1220", //unit: base asset + "takerSellVolValue": "4213.9800", //unit: base asset + "timestamp": 1591261042378 + }, + { + "pair": "BTCUSD", + "contractType": CURRENT_QUARTER, + "takerBuyVol": "234", //unit: cont + "takerSellVol": "121", //unit: cont + "takerBuyVolValue": "4563.1320", //unit: base asset + "takerSellVolValue": "3313.3940", //unit: base asset + "timestamp": 1585615200000 + } +] +GET /futures/data/takerBuySellVol + +Weight: 1 + +Parameters: + +Name Type Mandatory Description +pair STRING YES BTCUSD +contractType ENUM YES ALL, CURRENT_QUARTER, NEXT_QUARTER, PERPETUAL +period ENUM YES "5m","15m","30m","1h","2h","4h","6h","12h","1d" +limit LONG NO Default 30,Max 500 +startTime LONG NO +endTime LONG NO +If startTime and endTime are not sent, the most recent data is returned. +Only the data of the latest 30 days is available. +IP rate limit 1000 requests/5min +Basis +Response: + +[ + { + "indexPrice": "29269.93972727", + "contractType": "CURRENT_QUARTER", + "basisRate": "0.0024", + "futuresPrice": "29341.3", + "annualizedBasisRate": "0.0283", + "basis": "71.36027273", + "pair": "BTCUSD", + "timestamp": 1653381600000 + } +] +GET /futures/data/basis + +Parameters: + +Name Type Mandatory Description +pair STRING YES BTCUSD +contractType ENUM YES CURRENT_QUARTER, NEXT_QUARTER, PERPETUAL +period ENUM YES "5m","15m","30m","1h","2h","4h","6h","12h","1d" +limit LONG NO Default 30,Max 500 +startTime LONG NO +endTime LONG NO +If startTime and endTime are not sent, the most recent data is returned. +Only the data of the latest 30 days is available. +Websocket Market Streams +The base endpoint is: wss://dstream.binance.com +Streams can be access either in a single raw stream or a combined stream +Raw streams are accessed at /ws/ +Combined streams are accessed at /stream?streams=// +Combined stream events are wrapped as follows: {"stream":"","data":} +All symbols, pairs, and contract types for streams are lowercase +A single connection is only valid for 24 hours; expect to be disconnected at the 24 hour mark +The websocket server will send a ping frame every 3 minutes. If the websocket server does not receive a pong frame back from the connection within a 10 minute period, the connection will be disconnected. Unsolicited pong frames are allowed. +WebSocket connections have a limit of 10 incoming messages per second. +A connection that goes beyond the limit will be disconnected; IPs that are repeatedly disconnected may be banned. +A single connection is not recommended to listen to more than 200 streams. +Considering the possible data latency from RESTful endpoints during an extremely volatile market, it is highly recommended to get the order status, position, etc from the Websocket user data stream. +Live Subscribing/Unsubscribing to streams +The following data can be sent through the websocket instance in order to subscribe/unsubscribe from streams. Examples can be seen below. +The id used in the JSON payloads is an unsigned INT used as an identifier to uniquely identify the messages going back and forth. +Subscribe to a stream +Response + + { + "result": null, + "id": 1 + } +Request + +{ +"method": "SUBSCRIBE", +"params": +[ +"btcusd_200925@aggTrade", +"btcusd_200925@depth" +], +"id": 1 +} + +Unsubscribe to a stream +Response + + { + "result": null, + "id": 312 + } +Request +{ +"method": "UNSUBSCRIBE", +"params": +[ +"btcusd_200925@depth" +], +"id": 312 +} + +Listing Subscriptions +Response + + { + "result": [ + "btcusd_200925@aggTrade" + ], + "id": 3 + } +Request +{ +"method": "LIST_SUBSCRIPTIONS", +"id": 3 +} + +Setting Properties +Currently, the only property can be set is to set whether combined stream payloads are enabled are not. The combined property is set to false when connecting using /ws/ ("raw streams") and true when connecting using /stream/. + +Response + + { + "result": null, + "id": 5 + } +Request +{ +"method": "SET_PROPERTY", +"params": +[ +"combined", +true +], +"id": 5 +} + +Retrieving Properties +Response + + { + "result": true, // Indicates that combined is set to true. + "id": 2 + } +Request +{ +"method": "GET_PROPERTY", +"params": +[ +"combined" +], +"id": 2 +} + +Aggregate Trade Streams +Payload: + +{ + "e":"aggTrade", // Event type + "E":1591261134288, // Event time + "a":424951, // Aggregate trade ID + "s":"BTCUSD_200626", // Symbol + "p":"9643.5", // Price + "q":"2", // Quantity + "f":606073, // First trade ID + "l":606073, // Last trade ID + "T":1591261134199, // Trade time + "m":false // Is the buyer the market maker? +} +The Aggregate Trade Streams push market trade information that is aggregated for fills with same price and taking side every 100 milliseconds. + +Stream Name: +@aggTrade + +Update Speed: 100ms + +Index Price Stream +Payload: + + { + "e": "indexPriceUpdate", // Event type + "E": 1591261236000, // Event time + "i": "BTCUSD", // Pair + "p": "9636.57860000", // Index Price + } +Stream Name: +@indexPrice OR @indexPrice@1s + +Update Speed: 3000ms OR 1000ms + +Mark Price Stream +Payload: + +{ + "e":"markPriceUpdate", // Event type + "E":1596095725000, // Event time + "s":"BTCUSD_201225", // Symbol + "p":"10934.62615417", // Mark Price + "P":"10962.17178236", // Estimated Settle Price, only useful in the last hour before the settlement starts. + "i":"10933.62615417", // Index Price + "r":"", // funding rate for perpetual symbol, "" will be shown for delivery symbol + "T":0 // next funding time for perpetual symbol, 0 will be shown for delivery symbol +} +Stream Name: +@markPrice OR @markPrice@1s + +Update Speed: 3000ms OR 1000ms + +Mark Price of All Symbols of a Pair +Payload: + +[ + { + "e":"markPriceUpdate", // Event type + "E":1596095725000, // Event time + "s":"BTCUSD_201225", // Symbol + "p":"10934.62615417", // Mark Price + "P":"10962.17178236", // Estimated Settle Price, only useful in the last hour before the settlement starts. + "i":"10933.62615417", // Index Price + "r":"", // funding rate for perpetual symbol, "" will be shown for delivery symbol + "T":0 // next funding time for perpetual symbol, 0 will be shown for delivery symbol + }, + { + "e":"markPriceUpdate", + "E":1596095725000, + "s":"BTCUSD_PERP", + "p":"11012.31359011", + "P":"10962.17178236", + "i":"10933.62615417", // Index Price + "r":"0.00000000", + "T":1596096000000 + } +] +Stream Name: +@markPrice OR @markPrice@1s + +Update Speed: 3000ms OR 1000ms + +Kline/Candlestick Streams +Payload: + +{ + "e":"kline", // Event type + "E":1591261542539, // Event time + "s":"BTCUSD_200626", // Symbol + "k":{ + "t":1591261500000, // Kline start time + "T":1591261559999, // Kline close time + "s":"BTCUSD_200626", // Symbol + "i":"1m", // Interval + "f":606400, // First trade ID + "L":606430, // Last trade ID + "o":"9638.9", // Open price + "c":"9639.8", // Close price + "h":"9639.8", // High price + "l":"9638.6", // Low price + "v":"156", // volume + "n":31, // Number of trades + "x":false, // Is this kline closed? + "q":"1.61836886", // Base asset volume + "V":"73", // Taker buy volume + "Q":"0.75731156", // Taker buy base asset volume + "B":"0" // Ignore + } +} +The Kline/Candlestick Stream push updates to the current klines/candlestick every 250 milliseconds (if existing). + +Kline/Candlestick chart intervals: + +m -> minutes; h -> hours; d -> days; w -> weeks; M -> months + +1m +3m +5m +15m +30m +1h +2h +4h +6h +8h +12h +1d +3d +1w +1M +Stream Name: +@kline_ + +e.g. "btcusd_200626@kline_1m" + +Update Speed: 250ms + +Continuous Contract Kline/Candlestick Streams +Payload: + +{ + "e":"continuous_kline", // Event type + "E":1591261542539, // Event time + "ps":"BTCUSD", // Pair + "ct":"NEXT_QUARTER" // Contract type + "k":{ + "t":1591261500000, // Kline start time + "T":1591261559999, // Kline close time + "i":"1m", // Interval + "f":606400, // First update ID + "L":606430, // Last update ID + "o":"9638.9", // Open price + "c":"9639.8", // Close price + "h":"9639.8", // High price + "l":"9638.6", // Low price + "v":"156", // volume + "n":31, // Number of trades + "x":false, // Is this kline closed? + "q":"1.61836886", // Base asset volume + "V":"73", // Taker buy volume + "Q":"0.75731156", // Taker buy base asset volume + "B":"0" // Ignore + } +} +Contract type: + +perpetual +current_quarter +next_quarter +Kline/Candlestick chart intervals: + +m -> minutes; h -> hours; d -> days; w -> weeks; M -> months + +1m +3m +5m +15m +30m +1h +2h +4h +6h +8h +12h +1d +3d +1w +1M +Stream Name: +_@continuousKline_ + +e.g. "btcusd_next_quarter@continuousKline_1m" + +Update Speed: 250ms + +Index Kline/Candlestick Streams +Payload: + + +{ + "e":"indexPrice_kline", // Event Name + "E":1591267070033, // Event Time + "ps":"BTCUSD", // Pair + "k":{ + "t":1591267020000, // Kline start time + "T":1591267079999, // Kline close time + "s":"0", // ignore + "i":"1m", // Interval + "f":1591267020000, // ignore + "L":1591267070000, // ignore + "o":"9542.21900000", // Open price + "c":"9542.50440000", // Close price + "h":"9542.71640000", // High price + "l":"9542.21040000", // Low price + "v":"0", // ignore + "n":51, // Number of basic data + "x":false, // Is this kline closed? + "q":"0", // ignore + "V":"0", // ignore + "Q":"0", // ignore + "B":"0" // ignore + } +} +Kline/Candlestick chart intervals: + +m -> minutes; h -> hours; d -> days; w -> weeks; M -> months + +1m +3m +5m +15m +30m +1h +2h +4h +6h +8h +12h +1d +3d +1w +1M +Stream Name: +@indexPriceKline_ + +e.g. "btcusd@indexPriceKline_1m" + +Update Speed: 250ms + +Mark Price Kline/Candlestick Streams +Payload: + +{ + "e":"markPrice_kline", // Event Name + "E":1591267398004, // Event Time + "ps":"BTCUSD", // Pair + "k":{ + "t":1591267380000, // Kline start time + "T":1591267439999, // Kline close time + "s":"BTCUSD_200626", // Symbol + "i":"1m", // Interval + "f":1591267380000, // ignore + "L":1591267398000, // ignore + "o":"9539.67161333", // Open price + "c":"9540.82761333", // Close price + "h":"9540.82761333", // High price + "l":"9539.66961333", // Low price + "v":"0", // ignore + "n":19, // Number of basic data + "x":false, // Is this kline closed? + "q":"0", // ignore + "V":"0", // ignore + "Q":"0", // ignore + "B":"0" // ignore + } +} +Kline/Candlestick chart intervals: + +m -> minutes; h -> hours; d -> days; w -> weeks; M -> months + +1m +3m +5m +15m +30m +1h +2h +4h +6h +8h +12h +1d +3d +1w +1M +Stream Name: +@markPriceKline_ + +e.g. "btcusd_200626@markPriceKline_1m" + +Update Speed: 250ms + +Individual Symbol Mini Ticker Stream +Payload: + +{ + "e":"24hrMiniTicker", // Event type + "E":1591267704450, // Event time + "s":"BTCUSD_200626", // Symbol + "ps":"BTCUSD", // Pair + "c":"9561.7", // Close price + "o":"9580.9", // Open price + "h":"10000.0", // High price + "l":"7000.0", // Low price + "v":"487476", // Total traded volume + "q":"33264343847.22378500" // Total traded base asset volume +} +24hr rolling window mini-ticker statistics for a single symbol. These are NOT the statistics of the UTC day, but a 24hr rolling window from requestTime to 24hrs before. + +Stream Name: +@miniTicker + +Update Speed: 500ms + +All Market Mini Tickers Stream +Payload: + +[ + { + "e":"24hrMiniTicker", // Event type + "E":1591267704450, // Event time + "s":"BTCUSD_200626", // Symbol + "ps":"BTCUSD", // Pair + "c":"9561.7", // Close price + "o":"9580.9", // Open price + "h":"10000.0", // High price + "l":"7000.0", // Low price + "v":"487476", // Total traded volume + "q":"33264343847.22378500" // Total traded base asset volume + } +] +24hr rolling window mini-ticker statistics for all symbols. These are NOT the statistics of the UTC day, but a 24hr rolling window from requestTime to 24hrs before. Note that only tickers that have changed will be present in the array. + +Stream Name: +!miniTicker@arr + +Update Speed: 1000ms + +Individual Symbol Ticker Streams +Payload: + +{ + "e":"24hrTicker", // Event type + "E":1591268262453, // Event time + "s":"BTCUSD_200626", // Symbol + "ps":"BTCUSD", // Pair + "p":"-43.4", // Price change + "P":"-0.452", // Price change percent + "w":"0.00147974", // Weighted average price + "c":"9548.5", // Last price + "Q":"2", // Last quantity + "o":"9591.9", // Open price + "h":"10000.0", // High price + "l":"7000.0", // Low price + "v":"487850", // Total traded volume + "q":"32968676323.46222700", // Total traded base asset volume + "O":1591181820000, // Statistics open time + "C":1591268262442, // Statistics close time + "F":512014, // First trade ID + "L":615289, // Last trade Id + "n":103272 // Total number of trades +} +24hr rolling window ticker statistics for a single symbol. These are NOT the statistics of the UTC day, but a 24hr rolling window from requestTime to 24hrs before. + +Stream Name: +@ticker + +Update Speed: 2000ms + +All Market Tickers Streams +Payload: + +[ + { + "e":"24hrTicker", // Event type + "E":1591268262453, // Event time + "s":"BTCUSD_200626", // Symbol + "ps":"BTCUSD", // Pair + "p":"-43.4", // Price change + "P":"-0.452", // Price change percent + "w":"0.00147974", // Weighted average price + "c":"9548.5", // Last price + "Q":"2", // Last quantity + "o":"9591.9", // Open price + "h":"10000.0", // High price + "l":"7000.0", // Low price + "v":"487850", // Total traded volume + "q":"32968676323.46222700", // Total traded base asset volume + "O":1591181820000, // Statistics open time + "C":1591268262442, // Statistics close time + "F":512014, // First trade ID + "L":615289, // Last trade Id + "n":103272 // Total number of trades + } +] +24hr rolling window ticker statistics for all symbols. These are NOT the statistics of the UTC day, but a 24hr rolling window from requestTime to 24hrs before. Note that only tickers that have changed will be present in the array. + +Stream Name: +!ticker@arr + +Update Speed: 1000ms + +Individual Symbol Book Ticker Streams +Payload: + +{ + "e":"bookTicker", // Event type + "u":17242169, // Order book update Id + "s":"BTCUSD_200626", // Symbol + "ps":"BTCUSD", // Pair + "b":"9548.1", // Best bid price + "B":"52", // Best bid qty + "a":"9548.5", // Best ask price + "A":"11", // Best ask qty + "T":1591268628155, // Transaction time + "E":1591268628166 // Event time +} +Pushes any update to the best bid or ask's price or quantity in real-time for a specified symbol. + +Stream Name: @bookTicker + +Update Speed: Real-time + +All Book Tickers Stream +Payload: + +{ + // Same as @bookTicker payload +} +Pushes any update to the best bid or ask's price or quantity in real-time for all symbols. + +Stream Name: !bookTicker + +Update Speed: Real-time + +Liquidation Order Streams +Payload: + +{ + + "e":"forceOrder", // Event Type + "E": 1591154240950, // Event Time + "o":{ + + "s":"BTCUSD_200925", // Symbol + "ps": "BTCUSD", // Pair + "S":"SELL", // Side + "o":"LIMIT", // Order Type + "f":"IOC", // Time in Force + "q":"1", // Original Quantity + "p":"9425.5", // Price + "ap":"9496.5", // Average Price + "X":"FILLED", // Order Status + "l":"1", // Order Last Filled Quantity + "z":"1", // Order Filled Accumulated Quantity + "T": 1591154240949, // Order Trade Time + + } +} +The Liquidation Order Snapshot Streams push force liquidation order information for specific symbol. + +For each symbol,only the latest one liquidation order within 1000ms will be pushed as the snapshot. If no liquidation happens in the interval of 1000ms, no stream will be pushed. + +Stream Name: @forceOrder + +Update Speed: 1000ms + +All Market Liquidation Order Streams +Payload: + +{ + + "e":"forceOrder", // Event Type + "E": 1591154240950, // Event Time + "o":{ + + "s":"BTCUSD_200925", // Symbol + "ps": "BTCUSD", // Pair + "S":"SELL", // Side + "o":"LIMIT", // Order Type + "f":"IOC", // Time in Force + "q":"1", // Original Quantity + "p":"9425.5", // Price + "ap":"9496.5", // Average Price + "X":"FILLED", // Order Status + "l":"1", // Order Last Filled Quantity + "z":"1", // Order Filled Accumulated Quantity + "T": 1591154240949, // Order Trade Time + + } +} +The All Liquidation Order Snapshot Streams push force liquidation order information for all symbols in the market. + +For each symbol,only the latest one liquidation order within 1000ms will be pushed as the snapshot. If no liquidation happens in the interval of 1000ms, no stream will be pushed. + +Stream Name: !forceOrder@arr + +Update Speed: 1000ms + +Contract Info Stream +Payload: + +{ + "e":"contractInfo", // Event Type + "E":1669647330375, // Event Time + "s":"APTUSD_PERP", // Symbol + "ps":"APTUSD", // Pair + "ct":"PERPETUAL", // Contract type + "dt":4133404800000, // Delivery date time + "ot":1666594800000, // onboard date time + "cs":"TRADING", // Contract status + "bks":[ + { + "bs":1, // Notional bracket + "bnf":0, // Floor notional of this bracket + "bnc":5000, // Cap notional of this bracket + "mmr":0.01, // Maintenance ratio for this bracket + "cf":0, // Auxiliary number for quick calculation + "mi":21, // Min leverage for this bracket + "ma":50 // Max leverage for this bracket + }, + { + "bs":2, + "bnf":5000, + "bnc":25000, + "mmr":0.025, + "cf":75, + "mi":11, + "ma":20 + } + ] +} +ContractInfo stream pushes when contract info updates(listing/settlement/contract bracket update). bks field only shows up when bracket gets updated. + +Stream Name: !contractInfo + +Update Speed: Real-time + +Partial Book Depth Streams +Payload: + +{ + "e":"depthUpdate", // Event type + "E":1591269996801, // Event time + "T":1591269996646, // Transaction time + "s":"BTCUSD_200626", // Symbol + "ps":"BTCUSD", // Pair + "U":17276694, + "u":17276701, + "pu":17276678, + "b":[ // Bids to be updated + [ + "9523.0", // Price Level + "5" // Quantity + ], + [ + "9522.8", + "8" + ], + [ + "9522.6", + "2" + ], + [ + "9522.4", + "1" + ], + [ + "9522.0", + "5" + ] + ], + "a":[ // Asks to be updated + [ + "9524.6", // Price level to be updated + "2" // Quantity + ], + [ + "9524.7", + "3" + ], + [ + "9524.9", + "16" + ], + [ + "9525.1", + "10" + ], + [ + "9525.3", + "6" + ] + ] +} +Top bids and asks, Valid are 5, 10, or 20. + +Stream Names: @depth OR @depth@500ms OR @depth@100ms. + +Update Speed: 250ms, 500ms or 100ms + +Diff. Book Depth Streams +Payload: + +{ + "e": "depthUpdate", // Event type + "E": 1591270260907, // Event time + "T": 1591270260891, // Transction time + "s": "BTCUSD_200626", // Symbol + "ps": "BTCUSD", // Pair + "U": 17285681, // First update ID in event + "u": 17285702, // Final update ID in event + "pu": 17285675, // Final update Id in last stream(ie `u` in last stream) + "b": [ // Bids to be updated + [ + "9517.6", // Price level to be updated + "10" // Quantity + ] + ], + "a": [ // Asks to be updated + [ + "9518.5", // Price level to be updated + "45" // Quantity + ] + ] +} +Bids and asks, pushed every 250 milliseconds, 500 milliseconds, or 100 milliseconds + +Stream Name: +@depth OR @depth@500ms OR @depth@100ms + +Update Speed: 250ms, 500ms, 100ms + +How to manage a local order book correctly +Open a stream to wss://dstream.binance.com/stream?streams=btcusd_200925@depth. +Buffer the events you receive from the stream. For same price, latest received update covers the previous one. +Get a depth snapshot from https://dapi.binance.com/dapi/v1/depth?symbol=BTCUSD_200925&limit=1000 . +Drop any event where u is < lastUpdateId in the snapshot +The first processed event should have U <= lastUpdateId AND u >= lastUpdateId +While listening to the stream, each new event's pu should be equal to the previous event's u, otherwise initialize the process from step 3. +The data in each event is the absolute quantity for a price level +If the quantity is 0, remove the price level +Receiving an event that removes a price level that is not in your local order book can happen and is normal. +Account/Trades Endpoints + Considering the possible data latency from RESTful endpoints during an extremely volatile market, it is highly recommended to get the order status, position, etc from the Websocket user data stream. +New Future Account Transfer +Please find details from here. + +Get Future Account Transaction History List +Please find details from here. + +Change Position Mode(TRADE) +Response: + +{ + "code": 200, + "msg": "success" +} +POST /dapi/v1/positionSide/dual (HMAC SHA256) + +Change user's position mode (Hedge Mode or One-way Mode ) on EVERY symbol + +Weight: 1 + +Parameters: + +Name Type Mandatory Description +dualSidePosition STRING YES "true": Hedge Mode; "false": One-way Mode +recvWindow LONG NO +timestamp LONG YES +Get Current Position Mode(USER_DATA) +Response: + +{ + "dualSidePosition": true // "true": Hedge Mode; "false": One-way Mode +} +GET /dapi/v1/positionSide/dual (HMAC SHA256) + +Get user's position mode (Hedge Mode or One-way Mode ) on EVERY symbol + +Weight: 30 + +Parameters: + +Name Type Mandatory Description +recvWindow LONG NO +timestamp LONG YES +New Order (TRADE) +Response: + +{ + "clientOrderId": "testOrder", + "cumQty": "0", + "cumBase": "0", + "executedQty": "0", + "orderId": 22542179, + "avgPrice": "0.0", + "origQty": "10", + "price": "0", + "reduceOnly": false, + "side": "BUY", + "positionSide": "SHORT", + "status": "NEW", + "stopPrice": "9300", // please ignore when order type is TRAILING_STOP_MARKET + "closePosition": false, // if Close-All + "symbol": "BTCUSD_200925", + "pair": "BTCUSD", + "timeInForce": "GTC", + "type": "TRAILING_STOP_MARKET", + "origType": "TRAILING_STOP_MARKET", + "activatePrice": "9020", // activation price, only return with TRAILING_STOP_MARKET order + "priceRate": "0.3", // callback rate, only return with TRAILING_STOP_MARKET order + "updateTime": 1566818724722, + "workingType": "CONTRACT_PRICE", + "priceProtect": false // if conditional order trigger is protected +} +POST /dapi/v1/order + +Send in a new order. + +Weight: 0 + +Parameters: + +Name Type Mandatory Description +symbol STRING YES +side ENUM YES +positionSide ENUM NO Default BOTH for One-way Mode ; LONG or SHORT for Hedge Mode. It must be sent in Hedge Mode. +type ENUM YES +timeInForce ENUM NO +quantity DECIMAL NO quantity measured by contract number, Cannot be sent with closePosition=true +reduceOnly STRING NO "true" or "false". default "false". Cannot be sent in Hedge Mode; cannot be sent with closePosition=true(Close-All) +price DECIMAL NO +newClientOrderId STRING NO A unique id among open orders. Automatically generated if not sent. Can only be string following the rule: ^[\.A-Z\:/a-z0-9_-]{1,36}$ +stopPrice DECIMAL NO Used with STOP/STOP_MARKET or TAKE_PROFIT/TAKE_PROFIT_MARKET orders. +closePosition STRING NO true, false;Close-All,used with STOP_MARKET or TAKE_PROFIT_MARKET. +activationPrice DECIMAL NO Used with TRAILING_STOP_MARKET orders, default as the latest price(supporting different workingType) +callbackRate DECIMAL NO Used with TRAILING_STOP_MARKET orders, min 0.1, max 10 where 1 for 1% +workingType ENUM NO stopPrice triggered by: "MARK_PRICE", "CONTRACT_PRICE". Default "CONTRACT_PRICE" +priceProtect STRING NO "TRUE" or "FALSE", default "FALSE". Used with STOP/STOP_MARKET or TAKE_PROFIT/TAKE_PROFIT_MARKET orders. +newOrderRespType ENUM NO "ACK", "RESULT", default "ACK" +recvWindow LONG NO +timestamp LONG YES +Additional mandatory parameters based on type: + +Type Additional mandatory parameters +LIMIT timeInForce, quantity, price +MARKET quantity +STOP/TAKE_PROFIT price, stopPrice +STOP_MARKET/TAKE_PROFIT_MARKET stopPrice +TRAILING_STOP_MARKET callbackRate,quantity +Order with type STOP, parameter timeInForce can be sent ( default GTC). +Order with type TAKE_PROFIT, parameter timeInForce can be sent ( default GTC). +Condition orders will be triggered when: + +If parameterpriceProtectis sent as true: +when price reaches the stopPrice ,the difference rate between "MARK_PRICE" and "CONTRACT_PRICE" cannot be larger than the "triggerProtect" of the symbol +"triggerProtect" of a symbol can be got from GET /dapi/v1/exchangeInfo +STOP, STOP_MARKET: +BUY: latest price ("MARK_PRICE" or "CONTRACT_PRICE") >= stopPrice +SELL: latest price ("MARK_PRICE" or "CONTRACT_PRICE") <= stopPrice +TAKE_PROFIT, TAKE_PROFIT_MARKET: +BUY: latest price ("MARK_PRICE" or "CONTRACT_PRICE") <= stopPrice +SELL: latest price ("MARK_PRICE" or "CONTRACT_PRICE") >= stopPrice +TRAILING_STOP_MARKET: +BUY: the lowest price after order placed <= activationPrice, and the latest price >= the lowest price * (1 + callbackRate) +SELL: the highest price after order placed >= activationPrice, and the latest price <= the highest price * (1 - callbackRate) +For TRAILING_STOP_MARKET, if you got such error code. +{"code": -2021, "msg": "Order would immediately trigger."} +means that the parameters you send do not meet the following requirements: + +BUY: activationPrice should be smaller than latest price. +SELL: activationPrice should be larger than latest price. +If newOrderRespType is sent as RESULT : + +MARKET order: the final FILLED result of the order will be return directly. +LIMIT order with special timeInForce: the final status result of the order(FILLED or EXPIRED) will be returned directly. +STOP_MARKET, TAKE_PROFIT_MARKET with closePosition=true: + +Follow the same rules for condition orders. +If triggered,close all current long position( if SELL) or current short position( if BUY). +Cannot be used with quantity parameter +Cannot be used with reduceOnly parameter +In Hedge Mode,cannot be used with BUY orders in LONG position side. and cannot be used with SELL orders in SHORT position side +Modify Order (TRADE) +Response: + +{ + "orderId": 20072994037, + "symbol": "BTCUSD_PERP", + "pair": "BTCUSD", + "status": "NEW", + "clientOrderId": "LJ9R4QZDihCaS8UAOOLpgW", + "price": "30005", + "avgPrice": "0.0", + "origQty": "1", + "executedQty": "0", + "cumQty": "0", + "cumBase": "0", + "timeInForce": "GTC", + "type": "LIMIT", + "reduceOnly": false, + "closePosition": false, + "side": "BUY", + "positionSide": "LONG", + "stopPrice": "0", + "workingType": "CONTRACT_PRICE", + "priceProtect": false, + "origType": "LIMIT", + "updateTime": 1629182711600 +} +PUT /dapi/v1/order (HMAC SHA256) + +Order modify function, currently only LIMIT order modification is supported, modified orders will be reordered in the match queue + +Weight: 1 + +Parameters: + +Name Type Mandatory Description +orderId LONG NO +origClientOrderId STRING NO +symbol STRING YES +side ENUM YES SELL, BUY +quantity DECIMAL NO Order quantity, cannot be sent with closePosition=true +price DECIMAL NO +recvWindow LONG NO +timestamp LONG YES +Either orderId or origClientOrderId must be sent, and the orderId will prevail if both are sent. +Either quantity or price must be sent. +When the new quantity or price doesn't satisfy PRICE_FILTER / PERCENT_FILTER / LOT_SIZE, amendment will be rejected and the order will stay as it is. +However the order will be cancelled by the amendment in the following situations: +when the order is in partially filled status and the new quantity <= executedQty +When the order is GTX and the new price will cause it to be executed immediately +One order can only be modfied for less than 10000 times +Place Multiple Orders (TRADE) +Response: + +[ + { + "clientOrderId": "testOrder", + "cumQty": "0", + "cumBase": "0", + "executedQty": "0", + "orderId": 22542179, + "avgPrice": "0.0", + "origQty": "10", + "price": "0", + "reduceOnly": false, + "side": "BUY", + "positionSide": "SHORT", + "status": "NEW", + "stopPrice": "9300", // please ignore when order type is TRAILING_STOP_MARKET + "symbol": "BTCUSD_200925", + "pair": "BTCUSD", + "timeInForce": "GTC", + "type": "TRAILING_STOP_MARKET", + "origType": "TRAILING_STOP_MARKET", + "activatePrice": "9020", // activation price, only return with TRAILING_STOP_MARKET order + "priceRate": "0.3", // callback rate, only return with TRAILING_STOP_MARKET order + "updateTime": 1566818724722, + "workingType": "CONTRACT_PRICE", + "priceProtect": false // if conditional order trigger is protected + }, + { + "code": -2022, + "msg": "ReduceOnly Order is rejected." + } +] +POST /dapi/v1/batchOrders (HMAC SHA256) + +Weight: 5 + +Parameters: + +Name Type Mandatory Description +batchOrders LIST YES order list. Max 5 orders +recvWindow LONG NO +timestamp LONG YES +Where batchOrders is the list of order parameters in JSON + +Example: /dapi/v1/batchOrders?batchOrders=[{"type":"LIMIT","timeInForce":"GTC", +"symbol":"BTCUSD_PERP","side":"BUY","price":"10001","quantity":"1"}] +Name Type Mandatory Description +symbol STRING YES +side ENUM YES +positionSide ENUM NO Default BOTH for One-way Mode ; LONG or SHORT for Hedge Mode. It must be sent with Hedge Mode. +type ENUM YES +timeInForce ENUM NO +quantity DECIMAL YES +reduceOnly STRING NO "true" or "false". default "false". +price DECIMAL NO +newClientOrderId STRING NO A unique id among open orders. Automatically generated if not sent. Can only be string following the rule: ^[\.A-Z\:/a-z0-9_-]{1,36}$ +stopPrice DECIMAL NO Used with STOP/STOP_MARKET or TAKE_PROFIT/TAKE_PROFIT_MARKET orders. +activationPrice DECIMAL NO Used with TRAILING_STOP_MARKET orders, default as the latest price(supporting different workingType) +callbackRate DECIMAL NO Used with TRAILING_STOP_MARKET orders, min 0.1, max 4 where 1 for 1% +workingType ENUM NO stopPrice triggered by: "MARK_PRICE", "CONTRACT_PRICE". Default "CONTRACT_PRICE" +priceProtect STRING NO "TRUE" or "FALSE", default "FALSE". Used with STOP/STOP_MARKET or TAKE_PROFIT/TAKE_PROFIT_MARKET orders. +newOrderRespType ENUM NO "ACK", "RESULT", default "ACK" +Parameter rules are same with New Order +Batch orders are processed concurrently, and the order of matching is not guaranteed. +The order of returned contents for batch orders is the same as the order of the order list. +Modify Multiple Orders (TRADE) +Response: + +[ + { + "orderId": 20072994037, + "symbol": "BTCUSD_PERP", + "pair": "BTCUSD", + "status": "NEW", + "clientOrderId": "LJ9R4QZDihCaS8UAOOLpgW", + "price": "30005", + "avgPrice": "0.0", + "origQty": "1", + "executedQty": "0", + "cumQty": "0", + "cumBase": "0", + "timeInForce": "GTC", + "type": "LIMIT", + "reduceOnly": false, + "closePosition": false, + "side": "BUY", + "positionSide": "LONG", + "stopPrice": "0", + "workingType": "CONTRACT_PRICE", + "priceProtect": false, + "origType": "LIMIT", + "updateTime": 1629182711600 + }, + { + "code": -2022, + "msg": "ReduceOnly Order is rejected." + } +] +PUT /dapi/v1/batchOrders (HMAC SHA256) + +Weight: 5 + +Parameters: + +Name Type Mandatory Description +batchOrders list YES order list. Max 5 orders +recvWindow LONG NO +timestamp LONG YES +Where batchOrders is the list of order parameters in JSON + +Name Type Mandatory Description +orderId LONG NO +origClientOrderId STRING NO +symbol STRING YES +side ENUM YES SELL, BUY +quantity DECIMAL NO Order quantity, cannot be sent with closePosition=true +price DECIMAL NO +recvWindow LONG NO +timestamp LONG YES +Parameter rules are same with Modify Order +Batch modify orders are processed concurrently, and the order of matching is not guaranteed. +The order of returned contents for batch modify orders is the same as the order of the order list. +One order can only be modfied for less than 10000 times +Get Order Modify History (USER_DATA) +Response: + +[ + { + "amendmentId": 5363, // Order modification ID + "symbol": "BTCUSD_PERP", + "pair": "BTCUSD", + "orderId": 20072994037, + "clientOrderId": "LJ9R4QZDihCaS8UAOOLpgW", + "time": 1629184560899, // Order modification time + "amendment": { + "price": { + "before": "30004", + "after": "30003.2" + }, + "origQty": { + "before": "1", + "after": "1" + }, + "count": 3 // Order modification count, representing the number of times the order has been modified + } + }, + { + "amendmentId": 5361, + "symbol": "BTCUSD_PERP", + "pair": "BTCUSD", + "orderId": 20072994037, + "clientOrderId": "LJ9R4QZDihCaS8UAOOLpgW", + "time": 1629184533946, + "amendment": { + "price": { + "before": "30005", + "after": "30004" + }, + "origQty": { + "before": "1", + "after": "1" + }, + "count": 2 + } + }, + { + "amendmentId": 5325, + "symbol": "BTCUSD_PERP", + "pair": "BTCUSD", + "orderId": 20072994037, + "clientOrderId": "LJ9R4QZDihCaS8UAOOLpgW", + "time": 1629182711787, + "amendment": { + "price": { + "before": "30002", + "after": "30005" + }, + "origQty": { + "before": "1", + "after": "1" + }, + "count": 1 + } + } +] +GET /dapi/v1/orderAmendment (HMAC SHA256) + +Get order modification history + +Weight: 1 + +Parameters: + +Name Type Mandatory Description +symbol STRING YES +orderId LONG NO +origClientOrderId STRING NO +startTime LONG NO Timestamp in ms to get modification history from INCLUSIVE +endTime LONG NO Timestamp in ms to get modification history until INCLUSIVE +limit INT NO Default 50; max 100 +recvWindow LONG NO +timestamp LONG YES +Notes: + +Either orderId or origClientOrderId must be sent, and the orderId will prevail if both are sent. +Query Order (USER_DATA) +Response: + +{ + "avgPrice": "0.0", + "clientOrderId": "abc", + "cumBase": "0", + "executedQty": "0", + "orderId": 1917641, + "origQty": "0.40", + "origType": "TRAILING_STOP_MARKET", + "price": "0", + "reduceOnly": false, + "side": "BUY", + "status": "NEW", + "stopPrice": "9300", // please ignore when order type is TRAILING_STOP_MARKET + "closePosition": false, // if Close-All + "symbol": "BTCUSD_200925", + "pair": "BTCUSD", + "time": 1579276756075, // order time + "timeInForce": "GTC", + "type": "TRAILING_STOP_MARKET", + "activatePrice": "9020", // activation price, only return with TRAILING_STOP_MARKET order + "priceRate": "0.3", // callback rate, only return with TRAILING_STOP_MARKET order + "updateTime": 1579276756075, // update time + "workingType": "CONTRACT_PRICE", + "priceProtect": false // if conditional order trigger is protected +} +GET /dapi/v1/order (HMAC SHA256) + +Check an order's status. + +Weight: 1 + +These orders will not be found: +order status is CANCELED or EXPIRED, AND +order has NO filled trade, AND +created time + 3 days < current time +Parameters: + +Name Type Mandatory Description +symbol STRING YES +orderId LONG NO +origClientOrderId STRING NO +recvWindow LONG NO +timestamp LONG YES +Notes: + +Either orderId or origClientOrderId must be sent. +Cancel Order (TRADE) +Response: + +{ + "avgPrice": "0.0", + "clientOrderId": "myOrder1", + "cumQty": "0", + "cumBase": "0", + "executedQty": "0", + "orderId": 283194212, + "origQty": "11", + "origType": "TRAILING_STOP_MARKET", + "price": "0", + "reduceOnly": false, + "side": "BUY", + "positionSide": "SHORT", + "status": "CANCELED", + "stopPrice": "9300", // please ignore when order type is TRAILING_STOP_MARKET + "closePosition": false, // if Close-All + "symbol": "BTCUSD_200925", + "pair": "BTCUSD", + "timeInForce": "GTC", + "type": "TRAILING_STOP_MARKET", + "activatePrice": "9020", // activation price, only return with TRAILING_STOP_MARKET order + "priceRate": "0.3", // callback rate, only return with TRAILING_STOP_MARKET order + "updateTime": 1571110484038, + "workingType": "CONTRACT_PRICE", + "priceProtect": false // if conditional order trigger is protected +} +DELETE /dapi/v1/order (HMAC SHA256) + +Cancel an active order. + +Weight: 1 + +Parameters: + +Name Type Mandatory Description +symbol STRING YES +orderId LONG NO +origClientOrderId STRING NO +recvWindow LONG NO +timestamp LONG YES +Either orderId or origClientOrderId must be sent. + +Cancel All Open Orders (TRADE) +Response: + +{ + "code": 200, + "msg": "The operation of cancel all open order is done." +} +DELETE /dapi/v1/allOpenOrders (HMAC SHA256) + +Weight: 1 + +Parameters: + +Name Type Mandatory Description +symbol STRING YES +recvWindow LONG NO +timestamp LONG YES +Cancel Multiple Orders (TRADE) +Response: + +[ + { + "avgPrice": "0.0", + "clientOrderId": "myOrder1", + "cumQty": "0", + "cumBase": "0", + "executedQty": "0", + "orderId": 283194212, + "origQty": "11", + "origType": "TRAILING_STOP_MARKET", + "price": "0", + "reduceOnly": false, + "side": "BUY", + "positionSide": "SHORT", + "status": "CANCELED", + "stopPrice": "9300", // please ignore when order type is TRAILING_STOP_MARKET + "closePosition": false, // if Close-All + "symbol": "BTCUSD_200925", + "timeInForce": "GTC", + "type": "TRAILING_STOP_MARKET", + "activatePrice": "9020", // activation price, only return with TRAILING_STOP_MARKET order + "priceRate": "0.3", // callback rate, only return with TRAILING_STOP_MARKET order + "workingType": "CONTRACT_PRICE", + "priceProtect": false, // if conditional order trigger is protected + "updateTime": 1571110484038 + }, + { + "code": -2011, + "msg": "Unknown order sent." + } +] +DELETE /dapi/v1/batchOrders (HMAC SHA256) + +Weight: 1 + +Parameters: + +Name Type Mandatory Description +symbol STRING YES +orderIdList LIST NO max length 10 +e.g. [1234567,2345678] +origClientOrderIdList LIST NO max length 10 +e.g. ["my_id_1","my_id_2"], encode the double quotes. No space after comma. +recvWindow LONG NO +timestamp LONG YES +Either orderIdList or origClientOrderIdList must be sent. + +Auto-Cancel All Open Orders (TRADE) +Response: + +{ + "symbol": "BTCUSD_200925", + "countdownTime": "100000" +} +Cancel all open orders of the specified symbol at the end of the specified countdown. + +POST /dapi/v1/countdownCancelAll (HMAC SHA256) + +Weight: 10 + +Parameters: + +Name Type Mandatory Description +symbol STRING YES +countdownTime LONG YES countdown time, 1000 for 1 second. 0 to cancel the timer +recvWindow LONG NO +timestamp LONG YES +This rest endpoint means to ensure your open orders are canceled in case of an outage. The endpoint should be called repeatedly as heartbeats so that the existing countdown time can be canceled and repalced by a new one. + +Example usage: +Call this endpoint at 30s intervals with an countdownTime of 120000 (120s). +If this endpoint is not called within 120 seconds, all your orders of the specified symbol will be automatically canceled. +If this endpoint is called with an countdownTime of 0, the countdown timer will be stopped. + +The system will check all countdowns approximately every 10 milliseconds, so please note that sufficient redundancy should be considered when using this function. We do not recommend setting the countdown time to be too precise or too small. + +Query Current Open Order (USER_DATA) +Response: + + +{ + "avgPrice": "0.0", + "clientOrderId": "abc", + "cumBase": "0", + "executedQty": "0", + "orderId": 1917641, + "origQty": "0.40", + "origType": "TRAILING_STOP_MARKET", + "price": "0", + "reduceOnly": false, + "side": "BUY", + "positionSide": "SHORT", + "status": "NEW", + "stopPrice": "9300", // please ignore when order type is TRAILING_STOP_MARKET + "closePosition": false, // if Close-All + "symbol": "BTCUSD_200925", + "pair": "BTCUSD" + "time": 1579276756075, // order time + "timeInForce": "GTC", + "type": "TRAILING_STOP_MARKET", + "activatePrice": "9020", // activation price, only return with TRAILING_STOP_MARKET order + "priceRate": "0.3", // callback rate, only return with TRAILING_STOP_MARKET order + "updateTime": 1579276756075, + "workingType": "CONTRACT_PRICE", + "priceProtect": false // if conditional order trigger is protected +} +GET /dapi/v1/openOrder (HMAC SHA256) + +Weight: 1 + +Parameters: + +Name Type Mandatory Description +symbol STRING YES +orderId LONG NO +origClientOrderId STRING NO +recvWindow LONG NO +timestamp LONG YES +EitherorderId or origClientOrderId must be sent +If the queried order has been filled or cancelled, the error message "Order does not exist" will be returned. +Current All Open Orders (USER_DATA) +Response: + +[ + { + "avgPrice": "0.0", + "clientOrderId": "abc", + "cumBase": "0", + "executedQty": "0", + "orderId": 1917641, + "origQty": "0.40", + "origType": "TRAILING_STOP_MARKET", + "price": "0", + "reduceOnly": false, + "side": "BUY", + "positionSide": "SHORT", + "status": "NEW", + "stopPrice": "9300", // please ignore when order type is TRAILING_STOP_MARKET + "closePosition": false, // if Close-All + "symbol": "BTCUSD_200925", + "time": 1579276756075, // order time + "timeInForce": "GTC", + "type": "TRAILING_STOP_MARKET", + "activatePrice": "9020", // activation price, only return with TRAILING_STOP_MARKET order + "priceRate": "0.3", // callback rate, only return with TRAILING_STOP_MARKET order + "updateTime": 1579276756075, // update time + "workingType": "CONTRACT_PRICE", + "priceProtect": false // if conditional order trigger is protected + } +] +GET /dapi/v1/openOrders (HMAC SHA256) + +Get all open orders on a symbol. Careful when accessing this with no symbol. + +Weight: + +1 for a single symbol; +40 for mutltiple symbols + +Parameters: + +Name Type Mandatory Description +symbol STRING NO +pair STRING NO +recvWindow LONG NO +timestamp LONG YES +All Orders (USER_DATA) +Response: + +[ + { + "avgPrice": "0.0", + "clientOrderId": "abc", + "cumBase": "0", + "executedQty": "0", + "orderId": 1917641, + "origQty": "0.40", + "origType": "TRAILING_STOP_MARKET", + "price": "0", + "reduceOnly": false, + "side": "BUY", + "positionSide": "SHORT", + "status": "NEW", + "stopPrice": "9300", // please ignore when order type is TRAILING_STOP_MARKET + "closePosition": false, // if Close-All + "symbol": "BTCUSD_200925", + "pair": "BTCUSD", + "time": 1579276756075, // order time + "timeInForce": "GTC", + "type": "TRAILING_STOP_MARKET", + "activatePrice": "9020", // activation price, only return with TRAILING_STOP_MARKET order + "priceRate": "0.3", // callback rate, only return with TRAILING_STOP_MARKET order + "updateTime": 1579276756075, // update time + "workingType": "CONTRACT_PRICE", + "priceProtect": false // if conditional order trigger is protected + } +] +GET /dapi/v1/allOrders (HMAC SHA256) + +Get all account orders; active, canceled, or filled. + +These orders will not be found: +order status is CANCELED or EXPIRED, AND +order has NO filled trade, AND +created time + 3 days < current time +Weight: + +20 with symbol 40 with pair + +Parameters: + +Name Type Mandatory Description +symbol STRING NO +pair STRING NO +orderId LONG NO +startTime LONG NO +endTime LONG NO +limit INT NO Default 50; max 100. +recvWindow LONG NO +timestamp LONG YES +Notes: + +Either symbol or pair must be sent. +If orderId is set, it will get orders >= that orderId. Otherwise most recent orders are returned. +Futures Account Balance (USER_DATA) +Response: + +[ + { + "accountAlias": "SgsR", // unique account code + "asset": "BTC", + "balance": "0.00250000", + "withdrawAvailable": "0.00250000", + "crossWalletBalance": "0.00241969", + "crossUnPnl": "0.00000000", + "availableBalance": "0.00241969", + "updateTime": 1592468353979 + } +] +GET /dapi/v1/balance (HMAC SHA256) + +Weight: 1 + +Parameters: + +Name Type Mandatory Description +recvWindow LONG NO +timestamp LONG YES +Account Information (USER_DATA) +Response: + + +{ + "assets": [ + { + "asset": "BTC", // asset name + "walletBalance": "0.00241969", // total wallet balance + "unrealizedProfit": "0.00000000", // unrealized profit or loss + "marginBalance": "0.00241969", // margin balance + "maintMargin": "0.00000000", // maintenance margin + "initialMargin": "0.00000000", // total intial margin required with the latest mark price + "positionInitialMargin": "0.00000000", // positions" margin required with the latest mark price + "openOrderInitialMargin": "0.00000000", // open orders" intial margin required with the latest mark price + "maxWithdrawAmount": "0.00241969", // available amount for transfer out + "crossWalletBalance": "0.00241969", // wallet balance for crossed margin + "crossUnPnl": "0.00000000", // total unrealized profit or loss of crossed positions + "availableBalance": "0.00241969", // available margin balance + "updateTime": 1625474304765 //update time + } + ], + "positions": [ + { + "symbol": "BTCUSD_201225", + "positionAmt":"0", // position amount + "initialMargin": "0", + "maintMargin": "0", + "unrealizedProfit": "0.00000000", + "positionInitialMargin": "0", + "openOrderInitialMargin": "0", + "leverage": "125", + "isolated": false, + "positionSide": "BOTH", // BOTH means that it is the position of One-way Mode + "entryPrice": "0.0", + "breakEvenPrice": "0.0", // break-even price + "maxQty": "50", // maximum quantity of base asset + "updateTime": 0 + }, + { + "symbol": "BTCUSD_201225", + "positionAmt":"0", + "initialMargin": "0", + "maintMargin": "0", + "unrealizedProfit": "0.00000000", + "positionInitialMargin": "0", + "openOrderInitialMargin": "0", + "leverage": "125", + "isolated": false, + "positionSide": "LONG", // LONG or SHORT means that it is the position of Hedge Mode + "entryPrice": "0.0", + "breakEvenPrice": "0.0", // break-even price + "maxQty": "50", + "updateTime": 0 + }, + { + "symbol": "BTCUSD_201225", + "positionAmt":"0", + "initialMargin": "0", + "maintMargin": "0", + "unrealizedProfit": "0.00000000", + "positionInitialMargin": "0", + "openOrderInitialMargin": "0", + "leverage": "125", + "isolated": false, + "positionSide": "SHORT", // LONG or SHORT means that it is the position of Hedge Mode + "entryPrice": "0.0", + "breakEvenPrice": "0.0", // break-even price + "maxQty": "50" + "updateTime":1627026881327 + } + ], + "canDeposit": true, + "canTrade": true, + "canWithdraw": true, + "feeTier": 2, + "updateTime": 0 + } + +GET /dapi/v1/account (HMAC SHA256) + +Get current account information. + +Weight: 5 + +Parameters: + +Name Type Mandatory Description +recvWindow LONG NO +timestamp LONG YES +for One-way Mode user, the "positions" will only show the "BOTH" positions +for Hedge Mode user, the "positions" will show "BOTH", "LONG", and "SHORT" positions. +Change Initial Leverage (TRADE) +Response: + +{ + "leverage": 21, + "maxQty": "1000", // maximum quantity of base asset + "symbol": "BTCUSD_200925" +} +POST /dapi/v1/leverage (HMAC SHA256) + +Change user's initial leverage in the specific symbol market. +For Hedge Mode, LONG and SHORT positions of one symbol use the same initial leverage and share a total notional value. + +Weight: 1 + +Parameters: + +Name Type Mandatory Description +symbol STRING YES +leverage INT YES target initial leverage: int from 1 to 125 +recvWindow LONG NO +timestamp LONG YES +Change Margin Type (TRADE) +Response: + +{ + "code": 200, + "msg": "success" +} +Change user's margin type in the specific symbol market.For Hedge Mode, LONG and SHORT positions of one symbol use the same margin type. +With ISOLATED margin type, margins of the LONG and SHORT positions are isolated from each other. + +POST /dapi/v1/marginType (HMAC SHA256) + +Weight: 1 + +Parameters: + +Name Type Mandatory Description +symbol STRING YES +marginType ENUM YES ISOLATED, CROSSED +recvWindow LONG NO +timestamp LONG YES +Modify Isolated Position Margin (TRADE) +Response: + +{ + "amount": 100.0, + "code": 200, + "msg": "Successfully modify position margin.", + "type": 1 +} +POST /dapi/v1/positionMargin (HMAC SHA256) + +Weight: 1 + +Parameters: + +Name Type Mandatory Description +symbol STRING YES +positionSide ENUM NO Default BOTH for One-way Mode ; LONG or SHORT for Hedge Mode. It must be sent with Hedge Mode. +amount DECIMAL YES +type INT YES 1: Add position margin,2: Reduce position margin +recvWindow LONG NO +timestamp LONG YES +Only for isolated symbol +Get Position Margin Change History (TRADE) +Response: + +[ + { + "amount": "23.36332311", + "asset": "BTC", + "symbol": "BTCUSD_200925", + "time": 1578047897183, + "type": 1, + "positionSide": "BOTH" + }, + { + "amount": "100", + "asset": "BTC", + "symbol": "BTCUSD_200925", + "time": 1578047900425, + "type": 1, + "positionSide": "LONG" + } +] +GET /dapi/v1/positionMargin/history (HMAC SHA256) + +Weight: 1 + +Parameters: + +Name Type Mandatory Description +symbol STRING YES +type INT NO 1: Add position margin,2: Reduce position margin +startTime LONG NO +endTime LONG NO +limit INT NO Default: 50 +recvWindow LONG NO +timestamp LONG YES +Position Information (USER_DATA) +Response: + +[ + { + "symbol": "BTCUSD_201225", + "positionAmt": "0", + "entryPrice": "0.0", + "breakEvenPrice": "0.0", // break-even price + "markPrice": "0.00000000", + "unRealizedProfit": "0.00000000", + "liquidationPrice": "0", + "leverage": "125", + "maxQty": "50", // maximum quantity of base asset + "marginType": "cross", + "isolatedMargin": "0.00000000", + "isAutoAddMargin": "false", + "positionSide": "BOTH", + "notionalValue":"0", + "updateTime": 0 + }, + { + "symbol": "BTCUSD_201225", + "positionAmt": "1", + "entryPrice": "11707.70000003", + "breakEvenPrice": "11707.80000005", // break-even price + "markPrice": "11788.66626667", + "unRealizedProfit": "0.00005866", + "liquidationPrice": "11667.63509587", + "leverage": "125", + "maxQty": "50", + "marginType": "cross", + "isolatedMargin": "0.00000000", + "isAutoAddMargin": "false", + "positionSide": "LONG", + "notionalValue":"11788.66626667", + "updateTime": 1627026881327 + }, + { + "symbol": "BTCUSD_201225", + "positionAmt": "0", + "entryPrice": "0.0", + "breakEvenPrice": "0.0", // break-even price + "markPrice": "0.00000000", + "unRealizedProfit": "0.00000000", + "liquidationPrice": "0", + "leverage": "125", + "maxQty": "50", + "marginType": "cross", + "isolatedMargin": "0.00000000", + "isAutoAddMargin": "false", + "positionSide": "SHORT", + "notionalValue":"0", + "updateTime":1627026881327 + } +] +GET /dapi/v1/positionRisk (HMAC SHA256) Get current account information. + +Weight: 1 + +Parameters: + +Name Type Mandatory Description +marginAsset STRING NO +pair STRING NO +recvWindow LONG NO +timestamp LONG YES +If neither marginAsset nor pair is sent, positions of all symbols with TRADING status will be returned. + +for One-way Mode user, the response will only show the "BOTH" positions + +for Hedge Mode user, the response will show "BOTH", "LONG", and "SHORT" positions. + +Note +Please use with user data stream ACCOUNT_UPDATE to meet your timeliness and accuracy needs. + +Account Trade List (USER_DATA) +Response: + +[ + { + 'symbol': 'BTCUSD_200626', + 'id': 6, + 'orderId': 28, + 'pair': 'BTCUSD', + 'side': 'SELL', + 'price': '8800', + 'qty': '1', + 'realizedPnl': '0', + 'marginAsset': 'BTC', + 'baseQty': '0.01136364', + 'commission': '0.00000454', + 'commissionAsset': 'BTC', + 'time': 1590743483586, + 'positionSide': 'BOTH', + 'buyer': false, + 'maker': false + } +] +GET /dapi/v1/userTrades (HMAC SHA256) + +Get trades for a specific account and symbol. + +Weight: + +20 with symbol 40 with pair + +Parameters: + +Name Type Mandatory Description +symbol STRING NO +pair STRING NO +orderId STRING NO +startTime LONG NO +endTime LONG NO +fromId LONG NO Trade id to fetch from. Default gets most recent trades. +limit INT NO Default 50; max 1000 +recvWindow LONG NO +timestamp LONG YES +Either symbol or pair must be sent +Symbol and pair cannot be sent together +Pair and fromId cannot be sent together +Pair and orderId cannot be sent together +If a pair is sent,tickers for all symbols of the pair will be returned +The parameter fromId cannot be sent with startTime or endTime +Get Income History(USER_DATA) +Response: + +[ + { + "symbol": "", // trade symbol, if existing + "incomeType": "TRANSFER", // income type + "income": "-0.37500000", // income amount + "asset": "BTC", // income asset + "info":"WITHDRAW", // extra information + "time": 1570608000000, + "tranId":"9689322392", // transaction id + "tradeId":"" // trade id, if existing + }, + { + "symbol": "BTCUSD_200925", + "incomeType": "COMMISSION", + "income": "-0.01000000", + "asset": "BTC", + "info":"", + "time": 1570636800000, + "tranId":"9689322392", + "tradeId":"2059192" + } +] +GET /dapi/v1/income (HMAC SHA256) + +Weight: 20 + +Parameters: + +Name Type Mandatory Description +symbol STRING NO +incomeType STRING NO "TRANSFER","WELCOME_BONUS", "FUNDING_FEE", "REALIZED_PNL", "COMMISSION", "INSURANCE_CLEAR", "API_REBATE" and "DELIVERED_SETTELMENT" +startTime LONG NO Timestamp in ms to get funding from INCLUSIVE. +endTime LONG NO Timestamp in ms to get funding until INCLUSIVE. +page INT NO +limit INT NO Default 100; max 1000 +recvWindow LONG NO +timestamp LONG YES +If incomeType is not sent, all kinds of flow will be returned +"trandId" is unique in the same "incomeType" for a user +The interval between startTime and endTime can not exceed 200 days: +If startTime and endTime are not sent, the last 200 days will be returned +Notional Bracket for Pair(USER_DATA) +Response: + +[ + { + "pair": "BTCUSD", + "brackets": [ + { + "bracket": 1, // bracket level + "initialLeverage": 125, // the maximum leverage + "qtyCap": 50, // upper edge of base asset quantity + "qtylFloor": 0, // lower edge of base asset quantity + "maintMarginRatio": 0.004 // maintenance margin rate + "cum": 0.0 // Auxiliary number for quick calculation + }, + ] + } +] +Not recommended to continue using this v1 endpoint + +Get the pair's default notional bracket list, may return ambiguous values when there have been multiple different symbol brackets under the pair, suggest using the following GET /dapi/v2/leverageBracket query instead to get the specific symbol notional bracket list. + +GET /dapi/v1/leverageBracket + +Weight: 1 + +Parameters: + +Name Type Mandatory Description +pair STRING NO +recvWindow LONG NO +timestamp LONG YES +Notional Bracket for Symbol(USER_DATA) +Response: + +[ + { + "symbol": "BTCUSD_PERP", + "notionalCoef": 1.50, //user symbol bracket multiplier, only appears when user's symbol bracket is adjusted + "brackets": [ + { + "bracket": 1, // bracket level + "initialLeverage": 125, // the maximum leverage + "qtyCap": 50, // upper edge of base asset quantity + "qtylFloor": 0, // lower edge of base asset quantity + "maintMarginRatio": 0.004 // maintenance margin rate + "cum": 0.0 // Auxiliary number for quick calculation + }, + ] + } +] +Get the symbol's notional bracket list. + +GET /dapi/v2/leverageBracket + +Weight: 1 + +Parameters: + +Name Type Mandatory Description +symbol STRING NO +recvWindow LONG NO +timestamp LONG YES +User's Force Orders (USER_DATA) +Response: + +[ + { + "orderId": 165123080, + "symbol": "BTCUSD_200925", + "pair": "BTCUSD", + "status": "FILLED", + "clientOrderId": "autoclose-1596542005017000006", + "price": "11326.9", + "avgPrice": "11326.9", + "origQty": "1", + "executedQty": "1", + "cumBase": "0.00882854", + "timeInForce": "IOC", + "type": "LIMIT", + "reduceOnly": false, + "closePosition": false, + "side": "SELL", + "positionSide": "BOTH", + "stopPrice": "0", + "workingType": "CONTRACT_PRICE", + "priceProtect": false, + "origType": "LIMIT", + "time": 1596542005019, + "updateTime": 1596542005050 + }, + { + "orderId": 207251986, + "symbol": "BTCUSD_200925", + "pair": "BTCUSD", + "status": "FILLED", + "clientOrderId": "autoclose-1597307316020000006", + "price": "11619.4", + "avgPrice": "11661.2", + "origQty": "1", + "executedQty": "1", + "cumBase": "0.00857544", + "timeInForce": "IOC", + "type": "LIMIT", + "reduceOnly": false, + "closePosition": false, + "side": "SELL", + "positionSide": "LONG", + "stopPrice": "0", + "workingType": "CONTRACT_PRICE", + "priceProtect": false, + "origType": "LIMIT", + "time": 1597307316022, + "updateTime": 1597307316035 + } +] +GET /dapi/v1/forceOrders + +Weight: 20 with symbol, 50 without symbol + +Parameters: + +Name Type Mandatory Description +symbol STRING NO +autoCloseType ENUM NO "LIQUIDATION" for liquidation orders, "ADL" for ADL orders. +startTime LONG NO +endTime LONG NO +limit INT NO Default 50; max 100. +recvWindow LONG NO +timestamp LONG YES +If "autoCloseType" is not sent, orders with both of the types will be returned +If "startTime" is not sent, data within 200 days before "endTime" can be queried +Position ADL Quantile Estimation (USER_DATA) +Response: + +[ + { + "symbol": "BTCUSD_200925", + "adlQuantile": + { + // if the positions of the symbol are crossed margined in Hedge Mode, "LONG" and "SHORT" will be returned a same quantile value, and "HEDGE" will be returned instead of "BOTH". + "LONG": 3, + "SHORT": 3, + "HEDGE": 0 // only a sign, ignore the value + } + }, + { + "symbol": "BTCUSD_201225", + "adlQuantile": + { + // for positions of the symbol are in One-way Mode or isolated margined in Hedge Mode + "LONG": 1, // adl quantile for "LONG" position in hedge mode + "SHORT": 2, // adl qauntile for "SHORT" position in hedge mode + "BOTH": 0 // adl qunatile for position in one-way mode + } + } + ] +GET /dapi/v1/adlQuantile + +Weight: 5 + +Parameters: + +Name Type Mandatory Description +symbol STRING NO +recvWindow LONG NO +timestamp LONG YES +Values update every 30s. + +Values 0, 1, 2, 3, 4 shows the queue position and possibility of ADL from low to high. + +For positions of the symbol are in One-way Mode or isolated margined in Hedge Mode, "LONG", "SHORT", and "BOTH" will be returned to show the positions' adl quantiles of different position sides. + +If the positions of the symbol are crossed margined in Hedge Mode: + +"HEDGE" as a sign will be returned instead of "BOTH"; +A same value caculated on unrealized pnls on long and short sides' positions will be shown for "LONG" and "SHORT" when there are positions in both of long and short sides. +User Commission Rate (USER_DATA) +Response: + +{ + "symbol": "BTCUSD_PERP", + "makerCommissionRate": "0.00015", // 0.015% + "takerCommissionRate": "0.00040" // 0.040% +} +GET /dapi/v1/commissionRate (HMAC SHA256) + +Weight: 20 + +Parameters: + +Name Type Mandatory Description +symbol STRING YES +recvWindow LONG NO +timestamp LONG YES +Get Download Id For Futures Transaction History (USER_DATA) +Response: + +{ + "avgCostTimestampOfLast30d":7241837, // Average time taken for data download in the past 30 days + "downloadId":"546975389218332672", +} +GET /dapi/v1/income/asyn (HMAC SHA256) + +Weight: 5 + +Parameters: + +Name Type Mandatory Description +startTime LONG YES Timestamp in ms +endTime LONG YES Timestamp in ms +recvWindow LONG NO +timestamp LONG YES +Request Limitation is 5 times per month, shared by front end download page and rest api +The time between startTime and endTime can not be longer than 1 year +Get Futures Transaction History Download Link by Id (USER_DATA) +Response: + +{ + "downloadId":"545923594199212032", + "status":"completed", // Enum:completed,processing + "url":"www.binance.com", // The link is mapped to download id + "notified":true, // ignore + "expirationTimestamp":1645009771000, // The link would expire after this timestamp + "isExpired":null, +} +OR (Response when server is processing) + +{ + "downloadId":"545923594199212032", + "status":"processing", + "url":"", + "notified":false, + "expirationTimestamp":-1 + "isExpired":null, + +} +GET /dapi/v1/income/asyn/id (HMAC SHA256) + +Weight: 5 + +Parameters: + +Name Type Mandatory Description +downloadId STRING YES get by download id api +recvWindow LONG NO +timestamp LONG YES +Download link expiration: 24h +User Data Streams +The base API endpoint is: https://dapi.binance.com +A User Data Stream listenKey is valid for 60 minutes after creation. +Doing a PUT on a listenKey will extend its validity for 60 minutes, if response -1125 error "This listenKey does not exist." Please use POST /fapi/v1/listenKey to recreate listenKey. +Doing a DELETE on a listenKey will close the stream and invalidate the listenKey. +Doing a POST on an account with an active listenKey will return the currently active listenKey and extend its validity for 60 minutes. +The base websocket endpoint is: wss://dstream.binance.com +User Data Streams are accessed at /ws/ +For one stream (one user data), the user data stream payloads can be guaranteed to be in order during heavy periods. Strongly recommend you order your updates using E. +A single connection to dstream.binance.com is only valid for 24 hours; expect to be disconnected at the 24 hour mark +Start User Data Stream (USER_STREAM) +Response: + +{ + "listenKey": "pqia91ma19a5s61cv6a81va65sdf19v8a65a1a5s61cv6a81va65sdf19v8a65a1" +} +POST /dapi/v1/listenKey + +Start a new user data stream. The stream will close after 60 minutes unless a keepalive is sent. If the account has an active listenKey, that listenKey will be returned and its validity will be extended for 60 minutes. + +Weight: 1 + +Parameters: + +None + +Keepalive User Data Stream (USER_STREAM) +Response: + +{} +PUT /dapi/v1/listenKey + +Keepalive a user data stream to prevent a time out. User data streams will close after 60 minutes. + +Weight: 1 + +Parameters: + +None + +Close User Data Stream (USER_STREAM) +Response: + +{} +DELETE /dapi/v1/listenKey + +Close out a user data stream. + +Weight: 1 + +Parameters: + +None + +Event: User Data Stream Expired +Payload: + +{ + "stream": "OfYGbUzi3PraNagEkdKuFwUHn48brFsItTdsuiIXrucEvD0rhRXZ7I6URWfE8YE8", + "data": { + "e": "listenKeyExpired", // event type + "E": "1699596037418", // event time + "listenKey": "OfYGbUzi3PraNagEkdKuFwUHn48brFsItTdsuiIXrucEvD0rhRXZ7I6URWfE8YE8" + } +} +When the listenKey used for the user data stream turns expired, this event will be pushed. + +Notice: + +This event is not related to the websocket disconnection. +This event will be received only when a valid listenKey in connection got expired. +No more user data event will be updated after this event received until a new valid listenKey used. +Event: Margin Call +Payload: + +{ + "e":"MARGIN_CALL", // Event Type + "E":1587727187525, // Event Time + "i": "SfsR", // Account Alias + "cw":"3.16812045", // Cross Wallet Balance. Only pushed with crossed position margin call + "p":[ // Position(s) of Margin Call + { + "s":"BTCUSD_200925", // Symbol + "ps":"LONG", // Position Side + "pa":"132", // Position Amount + "mt":"CROSSED", // Margin Type + "iw":"0", // Isolated Wallet (if isolated position) + "mp":"9187.17127000", // Mark Price + "up":"-1.166074", // Unrealized PnL + "mm":"1.614445" // Maintenance Margin Required + } + ] +} + +When the user's position risk ratio is too high, this stream will be pushed. +This message is only used as risk guidance information and is not recommended for investment strategies. +In the case of a highly volatile market, there may be the possibility that the user's position has been liquidated at the same time when this stream is pushed out. +Under cross margin mode, this stream will be pushed 1 time every 1 hour if margin call triggered; Under isolated margin mode, this stream will be pushed 1 time every 1 hour for each symbol if margin call triggered +Event: Balance and Position Update +Payload: + +{ + "e": "ACCOUNT_UPDATE", // Event Type + "E": 1564745798939, // Event Time + "T": 1564745798938 , // Transaction + "i": "SfsR", // Account Alias + "a": // Update Data + { + "m":"ORDER", // Event reason type + "B":[ // Balances + { + "a":"BTC", // Asset + "wb":"122624.12345678", // Wallet Balance + "cw":"100.12345678", // Cross Wallet Balance + "bc":"50.12345678" // Balance Change except PnL and Commission + }, + { + "a":"ETH", + "wb":"1.00000000", + "cw":"0.00000000", + "bc":"-49.12345678" + } + ], + "P":[ + { + "s":"BTCUSD_200925", // Symbol + "pa":"0", // Position Amount + "ep":"0.0", // Entry Price + "bep":"0.0", // Break-Even Price + "cr":"200", // (Pre-fee) Accumulated Realized + "up":"0", // Unrealized PnL + "mt":"isolated", // Margin Type + "iw":"0.00000000", // Isolated Wallet (if isolated position) + "ps":"BOTH" // Position Side + }, + { + "s":"BTCUSD_200925", + "pa":"20", + "ep":"6563.6", + "bep":"6563.7", + "cr":"0", + "up":"2850.21200000", + "mt":"isolated", + "iw":"13200.70726908", + "ps":"LONG" + }, + { + "s":"BTCUSD_200925", + "pa":"-10", + "ep":"6563.8" + "bep":"6563.6",, + "cr":"-45.04000000", + "up":"-1423.15600000", + "mt":"isolated", + "iw":"6570.42511771", + "ps":"SHORT" + } + ] + } +} +Event type is ACCOUNT_UPDATE. + +When balance or position get updated, this event will be pushed. + +ACCOUNT_UPDATE will be pushed only when update happens on user's account, including changes on balances, positions, or margin type. +Unfilled orders or cancelled orders will not make the event ACCOUNT_UPDATE pushed, since there's no change on positions. +"position" in ACCOUNT_UPDATE: All symbols will be pushed. +The field "m" represents the reason type for the event and may shows the following possible types: + +DEPOSIT +WITHDRAW +ORDER +FUNDING_FEE +ADJUSTMENT +INSURANCE_CLEAR +ADMIN_DEPOSIT +ADMIN_WITHDRAW +MARGIN_TRANSFER +MARGIN_TYPE_CHANGE +ASSET_TRANSFER +COIN_SWAP_DEPOSIT +COIN_SWAP_WITHDRAW +The field "bc" represents the balance change except for PnL and commission. + +Event: Order Update +Payload: + +{ + + "e":"ORDER_TRADE_UPDATE", // Event Type + "E":1591274595442, // Event Time + "T":1591274595442, // Transaction Time + "i":"SfsR", // Account Alias + "o":{ + "s":"BTCUSD_200925", // Symbol + "c":"TEST", // Client Order Id + // special client order id: + // starts with "autoclose-": liquidation order + // "adl_autoclose": ADL auto close order + // "delivery_autoclose-": settlement order for delisting or delivery + "S":"SELL", // Side + "o":"TRAILING_STOP_MARKET", // Order Type + "f":"GTC", // Time in Force + "q":"2", // Original Quantity + "p":"0", // Original Price + "ap":"0", // Average Price + "sp":"9103.1", // Stop Price. Please ignore with TRAILING_STOP_MARKET order + "x":"NEW", // Execution Type + "X":"NEW", // Order Status + "i":8888888, // Order Id + "l":"0", // Order Last Filled Quantity + "z":"0", // Order Filled Accumulated Quantity + "L":"0", // Last Filled Price + "ma": "BTC", // Margin Asset + "N":"BTC", // Commission Asset of the trade, will not push if no commission + "n":"0", // Commission of the trade, will not push if no commission + "T":1591274595442, // Order Trade Time + "t":0, // Trade Id + "rp": "0", // Realized Profit of the trade + "b":"0", // Bid quantity of base asset + "a":"0", // Ask quantity of base asset + "m":false, // Is this trade the maker side? + "R":false, // Is this reduce only + "wt":"CONTRACT_PRICE", // Stop Price Working Type + "ot":"TRAILING_STOP_MARKET",// Original Order Type + "ps":"LONG", // Position Side + "cp":false, // If Close-All, pushed with conditional order + "AP":"9476.8", // Activation Price, only puhed with TRAILING_STOP_MARKET order + "cr":"5.0", // Callback Rate, only puhed with TRAILING_STOP_MARKET order + "pP": false // If price protection is turned on + } + +} +When new order created, modified, order status changed will push such event. event type is ORDER_TRADE_UPDATE. + +Side + +BUY +SELL +Position side: + +BOTH +LONG +SHORT +Order Type + +MARKET +LIMIT +STOP +TAKE_PROFIT +LIQUIDATION +Execution Type + +NEW +CANCELED +CALCULATED - Liquidation Execution +EXPIRED +TRADE +AMENDMENT - Order Modified +Order Status + +NEW +PARTIALLY_FILLED +FILLED +CANCELED +EXPIRED +NEW_INSURANCE insurance fund liquidation +NEW_ADL ADL liquiation +Time in force + +GTC +IOC +FOK +GTX +Liquidation and ADL: + +If user gets liquidated due to insufficient margin balance: + +If liquidation Counterparty is market:c shows as "autoclose-XXX",X shows as "NEW" +If liquidation Counterparty is insurance fund: c shows as "autoclose-XXX",X shows as "NEW_INSURANCE" +If liquidation Counterparty is ADL counterparty:c shows as "autoclose-XXX",X shows as "NEW_ADL" +If user has enough margin balance but gets ADL: + +c shows as “adl_autoclose”,X shows as “NEW” +Websocket User Data Request +User data request need a successful connection with the user data stream with a listenKey. +The following data can be sent through the websocket instance in order to request for user data. Examples can be seen below. +The id used in the JSON payloads is an unsigned INT used as an identifier to uniquely identify the messages going back and forth. +Request Form +Response + +{ + "result"[ + { + "req":"@account", // request name 1 + "res": // response to the request name 1 + ... + }, + { + "req":"@balance", // request name 2, if existing + "res": // response to the request name 2, if existing + ... + } + ] + "id": 12 // request ID +} +Request + +{ +"method": "REQUEST", +"params": +[ +"@account", // request name 1 +"@balance" // request name 2, if existing +], +"id": 12 // request ID. +} + +Request: User's Account Information +Response + +{ + "id":1, // request ID + "result":[ + { + "req":"gN0SiRrevtS4O0ufdCpzd4N0MzHu2lVmwbHh6hj4g9eTT9Yfe55eUc4klmsEhnwC@account", // request name + "res":{ + "feeTier":0, // account fee tier + "canTrade":true, // if can trade + "canDeposit":true, // if can transfer in asset + "canWithdraw":true, // if can transfer out asset + "accountAlias":"fsR" // the unique account alias + } + } + ] +} +Request Name @account + +Request: User's Account Balance +Response + +{ + "id":2, // request ID + "result":[ + { + "req":"gN0SiRrevtS4O0ufdCpzd4N0MzHu2lVmwbHh6hj4g9eTT9Yfe55eUc4klmsEhnwC@balance", // request name + "res":{ + "accountAlias":"fsR", // unique account alias + "balances":[ // account balance + { + "asset":"BTC", // asset name + "balance":"0.00241628", // asset wallet balance + "crossWalletBalance":"0.00235137", // wallet balance for cross margin + "crossUnPnl":"0.00000000", // unrealized profit of cross margin positions + "availableBalance":"0.00235137", // available margin balance for order + "maxWithdrawAmount":"0.00235137" // available balance for transfer out + } + ] + } + } + ] +} +Request Name @balance + +Request: User's Position +Response + +{ + "id":3, + "result":[ + { + "req":"gN0SiRrevtS4O0ufdCpzd4N0MzHu2lVmwbHh6hj4g9eTT9Yfe55eUc4klmsEhnwC@position", + "res":{ + "positions":[ + { + "entryPrice":"12044.90000003", + "marginType":"ISOLATED", // margin type, "CROSSED" or "ISOLATED" + "isAutoAddMargin":false, + "isolatedMargin":"0.00006388", // isolated margin balance + "leverage":125, // current leverage + "liquidationPrice":"12002.39091452", // estimated liquidation price + "markPrice":"12046.06021667", // current mark price + "maxQty":"50", // maximum quantity of base asset + "positionAmt":"1", // position amount + "symbol":"BTCUSD_200925", // symbol + "unRealizedProfit":"0.00000079", // unrealized PnL + "positionSide":"LONG" // position side + }, + { + "entryPrice":"0.0", + "marginType":"ISOLATED", + "isAutoAddMargin":false, + "isolatedMargin":"0", + "leverage":125, + "liquidationPrice":"0", + "markPrice":"12046.06021667", + "maxQty":"50", + "positionAmt":"0", + "symbol":"BTCUSD_200925", + "unRealizedProfit":"0.00000000", + "positionSide":"SHORT" + } + ] + } + } + ] +} +Request Name @position + +for One-way Mode user, the response will only show the "BOTH" positions + +for Hedge Mode user, the response will show "LONG" and "SHORT" positions. + +Event: Account Configuration Update (Leverage Update) +Payload: + +{ + "e":"ACCOUNT_CONFIG_UPDATE", // Event Type + "E":1611646737479, // Event Time + "T":1611646737476, // Transaction Time + "ac":{ + "s":"BTCUSD_PERP", // symbol + "l":25 // leverage + + } +} + +When the account configuration is changed, the event type will be pushed as ACCOUNT_CONFIG_UPDATE + +When the leverage of a trade pair changes, the payload will contain the object ac to represent the account configuration of the trade pair, where s represents the specific trade pair and l represents the leverage + +Event: STRATEGY_UPDATE +Payload: + +{ + "e": "STRATEGY_UPDATE", // Event Type + "T": 1669261797627, // Transaction Time + "E": 1669261797628, // Event Time + "su": { + "si": 176054594, // Strategy ID + "st": "GRID", // Strategy Type + "ss": "NEW", // Strategy Status + "s": "BTCUSDT", // Symbol + "ut": 1669261797627, // Update Time + "c": 8007 // opCode + } +} +STRATEGY_UPDATE update when a strategy is created/cancelled/expired, ...etc. + +Strategy Status + +NEW +WORKING +CANCELLED +EXPIRED +opCode + +8001: The strategy params have been updated +8002: User cancelled the strategy +8003: User manually placed or cancelled an order +8004: The stop limit of this order reached +8005: User position liquidated +8006: Max open order limit reached +8007: New grid order +8008: Margin not enough +8009: Price out of bounds +8010: Market is closed or paused +8011: Close position failed, unable to fill +8012: Exceeded the maximum allowable notional value at current leverage +8013: Grid expired due to incomplete KYC verification or access from a restricted jurisdiction +8014: User can only place reduce only order +8015: User position empty or liquidated +Event: GRID_UPDATE +Payload: + +{ + "e": "GRID_UPDATE", // Event Type + "T": 1669262908216, // Transaction Time + "E": 1669262908218, // Event Time + "gu": { + "si": 176057039, // Strategy ID + "st": "GRID", // Strategy Type + "ss": "WORKING", // Strategy Status + "s": "BTCUSDT", // Symbol + "r": "-0.00300716", // Realized PNL + "up": "16720", // Unmatched Average Price + "uq": "-0.001", // Unmatched Qty + "uf": "-0.00300716", // Unmatched Fee + "mp": "0.0", // Matched PNL + "ut": 1669262908197 // Update Time + } +} +GRID_UPDATE update when a sub order of a grid is filled or partially filled. + +Strategy Status + +NEW +WORKING +CANCELLED +EXPIRED +Classic Portfolio Margin Endpoints +The Binance Classic Portfolio Margin Program is a cross-asset margin program supporting consolidated margin balance across trading products with over 200+ effective crypto collaterals. It is designed for professional traders, market makers, and institutional users looking to actively trade & hedge cross-asset and optimize risk-management in a consolidated setup. + +FAQ: Classic Portfolio Margin Program + +Only Classic Portfolio Margin Account is accessible to these endpoints. To enroll, kindly refer to: How to Enroll into the Binance Classic Portfolio Margin Program + +Query Classic Portfolio Margin Notional Limit (USER_DATA) +Response: + +{ + "notionalLimits": [ // Classic Portfolio Margin notional limit + { + "symbol": "BTCUSD_PERP", // Symbol + "pair": "BTCUSD", // Pair + "notionalLimit": "500" // Classic Portfolio Margin Notional Limit in coin + }, + { + "symbol": "BTCUSD_220624", + "pair": "BTCUSD", + " notionalLimit": "200" + } + ] +} +GET /dapi/v1/pmExchangeInfo + +Get Classic Portfolio Margin notional limit. + +Weight(IP): 5 + +Parameters: + +Name Type Mandatory Description +symbol STRING NO +pair STRING NO +Classic Portfolio Margin Account Information (USER_DATA) +Response: + +{ + "maxWithdrawAmountUSD": "25347.92083245", // Classic Portfolio margin maximum virtual amount for transfer out in USD + "asset": "BTC", // asset name + "maxWithdrawAmount": "1.33663654", // maximum amount for transfer out +} +GET /dapi/v1/pmAccountInfo + +Get Classic Portfolio Margin current account information. + +Weight(IP): 5 + +Parameters: + +Name Type Mandatory Description +asset STRING YES +recvWindow LONG NO +maxWithdrawAmount is for asset transfer out to the spot wallet. +Error Codes +Here is the error JSON payload: + +{ + "code":-1121, + "msg":"Invalid symbol." +} +Errors consist of two parts: an error code and a message. +Codes are universal,but messages can vary. + +10xx - General Server or Network issues +-1000 UNKNOWN +An unknown error occured while processing the request. +-1001 DISCONNECTED +Internal error; unable to process your request. Please try again. +-1002 UNAUTHORIZED +You are not authorized to execute this request. +-1003 TOO_MANY_REQUESTS +Too many requests queued. +Too many requests; please use the websocket for live updates. +Too many requests; current limit is %s requests per minute. Please use the websocket for live updates to avoid polling the API. +Way too many requests; IP banned until %s. Please use the websocket for live updates to avoid bans. +-1004 DUPLICATE_IP +This IP is already on the white list +-1005 NO_SUCH_IP +No such IP has been white listed +-1006 UNEXPECTED_RESP +An unexpected response was received from the message bus. Execution status unknown. +-1007 TIMEOUT +Timeout waiting for response from backend server. Send status unknown; execution status unknown. +-1010 ERROR_MSG_RECEIVED +ERROR_MSG_RECEIVED. +-1011 NON_WHITE_LIST +This IP cannot access this route. +-1013 INVALID_MESSAGE +INVALID_MESSAGE. +-1014 UNKNOWN_ORDER_COMPOSITION +Unsupported order combination. +-1015 TOO_MANY_ORDERS +Too many new orders. +Too many new orders; current limit is %s orders per %s. +-1016 SERVICE_SHUTTING_DOWN +This service is no longer available. +-1020 UNSUPPORTED_OPERATION +This operation is not supported. +-1021 INVALID_TIMESTAMP +Timestamp for this request is outside of the recvWindow. +Timestamp for this request was 1000ms ahead of the server's time. +-1022 INVALID_SIGNATURE +Signature for this request is not valid. +-1023 START_TIME_GREATER_THAN_END_TIME +Start time is greater than end time. +11xx - Request issues +-1100 ILLEGAL_CHARS +Illegal characters found in a parameter. +Illegal characters found in parameter '%s'; legal range is '%s'. +-1101 TOO_MANY_PARAMETERS +Too many parameters sent for this endpoint. +Too many parameters; expected '%s' and received '%s'. +Duplicate values for a parameter detected. +-1102 MANDATORY_PARAM_EMPTY_OR_MALFORMED +A mandatory parameter was not sent, was empty/null, or malformed. +Mandatory parameter '%s' was not sent, was empty/null, or malformed. +Param '%s' or '%s' must be sent, but both were empty/null! +-1103 UNKNOWN_PARAM +An unknown parameter was sent. +-1104 UNREAD_PARAMETERS +Not all sent parameters were read. +Not all sent parameters were read; read '%s' parameter(s) but was sent '%s'. +-1105 PARAM_EMPTY +A parameter was empty. +Parameter '%s' was empty. +-1106 PARAM_NOT_REQUIRED +A parameter was sent when not required. +Parameter '%s' sent when not required. +-1108 BAD_ASSET +Invalid asset. +-1109 BAD_ACCOUNT +Invalid account. +-1110 BAD_INSTRUMENT_TYPE +Invalid symbolType. +-1111 BAD_PRECISION +Precision is over the maximum defined for this asset. +-1112 NO_DEPTH +No orders on book for symbol. +-1113 WITHDRAW_NOT_NEGATIVE +Withdrawal amount must be negative. +-1114 TIF_NOT_REQUIRED +TimeInForce parameter sent when not required. +-1115 INVALID_TIF +Invalid timeInForce. +-1116 INVALID_ORDER_TYPE +Invalid orderType. +-1117 INVALID_SIDE +Invalid side. +-1118 EMPTY_NEW_CL_ORD_ID +New client order ID was empty. +-1119 EMPTY_ORG_CL_ORD_ID +Original client order ID was empty. +-1120 BAD_INTERVAL +Invalid interval. +-1121 BAD_SYMBOL +Invalid symbol. +-1125 INVALID_LISTEN_KEY +This listenKey does not exist. Please use POST /fapi/v1/listenKey to recreate listenKey +-1127 MORE_THAN_XX_HOURS +Lookup interval is too big. +More than %s hours between startTime and endTime. +-1128 OPTIONAL_PARAMS_BAD_COMBO +Combination of optional parameters invalid. +-1130 INVALID_PARAMETER +Invalid data sent for a parameter. +Data sent for parameter '%s' is not valid. +-1136 INVALID_NEW_ORDER_RESP_TYPE +Invalid newOrderRespType. +20xx - Processing Issues +-2010 NEW_ORDER_REJECTED +NEW_ORDER_REJECTED +-2011 CANCEL_REJECTED +CANCEL_REJECTED +-2013 NO_SUCH_ORDER +Order does not exist. +-2014 BAD_API_KEY_FMT +API-key format invalid. +-2015 REJECTED_MBX_KEY +Invalid API-key, IP, or permissions for action. +-2016 NO_TRADING_WINDOW +No trading window could be found for the symbol. Try ticker/24hrs instead. +-2018 BALANCE_NOT_SUFFICIENT +Balance is insufficient. +-2019 MARGIN_NOT_SUFFICIEN +Margin is insufficient. +-2020 UNABLE_TO_FILL +Unable to fill. +-2021 ORDER_WOULD_IMMEDIATELY_TRIGGER +Order would immediately trigger. +-2022 REDUCE_ONLY_REJECT +ReduceOnly Order is rejected. +-2023 USER_IN_LIQUIDATION +User in liquidation mode now. +-2024 POSITION_NOT_SUFFICIENT +Position is not sufficient. +-2025 MAX_OPEN_ORDER_EXCEEDED +Reach max open order limit. +-2026 REDUCE_ONLY_ORDER_TYPE_NOT_SUPPORTED +This OrderType is not supported when reduceOnly. +-2027 MAX_LEVERAGE_RATIO +Exceeded the maximum allowable position at current leverage. +-2028 MIN_LEVERAGE_RATIO +Leverage is smaller than permitted: insufficient margin balance. +40xx - Filters and other Issues +-4000 INVALID_ORDER_STATUS +Invalid order status. +-4001 PRICE_LESS_THAN_ZERO +Price less than 0. +-4002 PRICE_GREATER_THAN_MAX_PRICE +Price greater than max price. +-4003 QTY_LESS_THAN_ZERO +Quantity less than zero. +-4004 QTY_LESS_THAN_MIN_QTY +Quantity less than min quantity. +-4005 QTY_GREATER_THAN_MAX_QTY +Quantity greater than max quantity. +-4006 STOP_PRICE_LESS_THAN_ZERO +Stop price less than zero. +-4007 STOP_PRICE_GREATER_THAN_MAX_PRICE +Stop price greater than max price. +-4008 TICK_SIZE_LESS_THAN_ZERO +Tick size less than zero. +-4009 MAX_PRICE_LESS_THAN_MIN_PRICE +Max price less than min price. +-4010 MAX_QTY_LESS_THAN_MIN_QTY +Max qty less than min qty. +-4011 STEP_SIZE_LESS_THAN_ZERO +Step size less than zero. +-4012 MAX_NUM_ORDERS_LESS_THAN_ZERO +Max mum orders less than zero. +-4013 PRICE_LESS_THAN_MIN_PRICE +Price less than min price. +-4014 PRICE_NOT_INCREASED_BY_TICK_SIZE +Price not increased by tick size. +-4015 INVALID_CL_ORD_ID_LEN +Client order id is not valid. +Client order id length should not be more than 36 chars +-4016 PRICE_HIGHTER_THAN_MULTIPLIER_UP +Price is higher than mark price multiplier cap. +-4017 MULTIPLIER_UP_LESS_THAN_ZERO +Multiplier up less than zero. +-4018 MULTIPLIER_DOWN_LESS_THAN_ZERO +Multiplier down less than zero. +-4019 COMPOSITE_SCALE_OVERFLOW +Composite scale too large. +-4020 TARGET_STRATEGY_INVALID +Target strategy invalid for orderType '%s',reduceOnly '%b'. +-4021 INVALID_DEPTH_LIMIT +Invalid depth limit. +'%s' is not valid depth limit. +-4022 WRONG_MARKET_STATUS +market status sent is not valid. +-4023 QTY_NOT_INCREASED_BY_STEP_SIZE +Qty not increased by step size. +-4024 PRICE_LOWER_THAN_MULTIPLIER_DOWN +Price is lower than mark price multiplier floor. +-4025 MULTIPLIER_DECIMAL_LESS_THAN_ZERO +Multiplier decimal less than zero. +-4026 COMMISSION_INVALID +Commission invalid. +%s less than zero. +%s absolute value greater than %s +-4027 INVALID_ACCOUNT_TYPE +Invalid account type. +-4028 INVALID_LEVERAGE +Invalid leverage +Leverage %s is not valid +Leverage %s already exist with %s +-4029 INVALID_TICK_SIZE_PRECISION +Tick size precision is invalid. +-4030 INVALID_STEP_SIZE_PRECISION +Step size precision is invalid. +-4031 INVALID_WORKING_TYPE +Invalid parameter working type +Invalid parameter working type: %s +-4032 EXCEED_MAX_CANCEL_ORDER_SIZE +Exceed maximum cancel order size. +Invalid parameter working type: %s +-4033 INSURANCE_ACCOUNT_NOT_FOUND +Insurance account not found. +-4044 INVALID_BALANCE_TYPE +Balance Type is invalid. +-4045 MAX_STOP_ORDER_EXCEEDED +Reach max stop order limit. +-4046 NO_NEED_TO_CHANGE_MARGIN_TYPE +No need to change margin type. +-4047 THERE_EXISTS_OPEN_ORDERS +Margin type cannot be changed if there exists open orders. +-4048 THERE_EXISTS_QUANTITY +Margin type cannot be changed if there exists position. +-4049 ADD_ISOLATED_MARGIN_REJECT +Add margin only support for isolated position. +-4050 CROSS_BALANCE_INSUFFICIENT +Cross balance insufficient. +-4051 ISOLATED_BALANCE_INSUFFICIENT +Isolated balance insufficient. +-4052 NO_NEED_TO_CHANGE_AUTO_ADD_MARGIN +No need to change auto add margin. +-4053 AUTO_ADD_CROSSED_MARGIN_REJECT +Auto add margin only support for isolated position. +-4054 ADD_ISOLATED_MARGIN_NO_POSITION_REJECT +Cannot add position margin: position is 0. +-4055 AMOUNT_MUST_BE_POSITIVE +Amount must be positive. +-4056 INVALID_API_KEY_TYPE +Invalid api key type. +-4057 INVALID_RSA_PUBLIC_KEY +Invalid api public key +-4058 MAX_PRICE_TOO_LARGE +maxPrice and priceDecimal too large,please check. +-4059 NO_NEED_TO_CHANGE_POSITION_SIDE +No need to change position side. +-4060 INVALID_POSITION_SIDE +Invalid position side. +-4061 POSITION_SIDE_NOT_MATCH +Order's position side does not match user's setting. +-4062 REDUCE_ONLY_CONFLICT +Invalid or improper reduceOnly value. +-4067 POSITION_SIDE_CHANGE_EXISTS_OPEN_ORDERS +Position side cannot be changed if there exists open orders. +-4068 POSITION_SIDE_CHANGE_EXISTS_QUANTITY +Position side cannot be changed if there exists position. +-4082 INVALID_BATCH_PLACE_ORDER_SIZE +Invalid number of batch place orders. +Invalid number of batch place orders: %s +-4083 PLACE_BATCH_ORDERS_FAIL +Fail to place batch orders. +-4084 UPCOMING_METHOD +Method is not allowed currently. Upcoming soon. +-4086 INVALID_PRICE_SPREAD_THRESHOLD +Invalid price spread threshold. +-4087 INVALID_PAIR +Invalid pair. +-4088 INVALID_TIME_INTERVAL +Invalid time interval. +Maximum time interval is %s days. +-4089 REDUCE_ONLY_ORDER_PERMISSION +User can only place reduce only order. +-4090 NO_PLACE_ORDER_PERMISSION +User can not place order currently. +-4104 INVALID_CONTRACT_TYPE +Invalid contract type. +-4110 INVALID_CLIENT_TRAN_ID_LEN +clientTranId is not valid. +Client tran id length should be less than 64 chars. +-4111 DUPLICATED_CLIENT_TRAN_ID +clientTranId is duplicated. +Client tran id should be unique within 7 days. +-4112 REDUCE_ONLY_MARGIN_CHECK_FAILED +ReduceOnly Order Failed. Please check your existing position and open orders. +-4113 MARKET_ORDER_REJECT +The counterparty's best price does not meet the PERCENT_PRICE filter limit. +-4135 INVALID_ACTIVATION_PRICE +Invalid activation price. +-4137 QUANTITY_EXISTS_WITH_CLOSE_POSITION +Quantity must be zero with closePosition equals true. +-4138 REDUCE_ONLY_MUST_BE_TRUE +Reduce only must be true with closePosition equals true. +-4139 ORDER_TYPE_CANNOT_BE_MKT +Order type can not be market if it's unable to cancel. +-4142 STRATEGY_INVALID_TRIGGER_PRICE +REJECT: take profit or stop order will be triggered immediately. +-4150 ISOLATED_LEVERAGE_REJECT_WITH_POSITION +Leverage reduction is not supported in Isolated Margin Mode with open positions. +-4151 PRICE_HIGHTER_THAN_STOP_MULTIPLIER_UP +Price is higher than stop price multiplier cap. +Limit price can't be higher than %s. +-4152 PRICE_LOWER_THAN_STOP_MULTIPLIER_DOWN +Price is lower than stop price multiplier floor. +Limit price can't be lower than %s. +-4154 STOP_PRICE_HIGHER_THAN_PRICE_MULTIPLIER_LIMIT +Stop price is higher than price multiplier cap. +Stop price can't be higher than %s +-4155 STOP_PRICE_LOWER_THAN_PRICE_MULTIPLIER_LIMIT +PStop price is lower than price multiplier floor. +Stop price can't be lower than %s +-4178 MIN_NOTIONAL +Order's notional must be no smaller than one (unless you choose reduce only) +Order's notional must be no smaller than %s (unless you choose reduce only) +-4192 COOLING_OFF_PERIOD +Trade forbidden due to Cooling-off Period. +-4194 ADJUST_LEVERAGE_KYC_FAILED +Intermediate Personal Verification is required for adjusting leverage over 20x. +-4195 ADJUST_LEVERAGE_ONE_MONTH_FAILED +More than 20x leverage is available one month after account registration. +-4196 LIMIT_ORDER_ONLY +Only limit order is supported. +-4197 SAME_ORDER +No need to modify the order. +-4198 EXCEED_MAX_MODIFY_ORDER_LIMIT +Exceed maximum modify order limit. +-4199 MOVE_ORDER_NOT_ALLOWED_SYMBOL_REASON +Symbol is not in trading status. Order amendment is not permitted. +-4200 ADJUST_LEVERAGE_X_DAYS_FAILED +More than 20x leverage is available 30 days after Futures account registration. +More than 20x leverage is available %s days after Futures account registration. +-4201 ADJUST_LEVERAGE_KYC_LIMIT +Users in this country has limited adjust leverage. +Users in your location/country can only access a maximum leverage of %s +-4202 ADJUST_LEVERAGE_ACCOUNT_SYMBOL_FAILED +Current symbol leverage cannot exceed 20 when using position limit adjustment service. +-4188 ME_INVALID_TIMESTAMP +Timestamp for this request is outside of the ME recvWindow. diff --git a/utils/coin_endpoints_list.txt b/utils/coin_endpoints_list.txt new file mode 100644 index 000000000..f377413a0 --- /dev/null +++ b/utils/coin_endpoints_list.txt @@ -0,0 +1,68 @@ +GET /futures/data/delivery-price +GET /futures/data/openInterestHist +GET /futures/data/topLongShortAccountRatio +GET /futures/data/topLongShortPositionRatio +GET /futures/data/globalLongShortAccountRatio +GET /futures/data/takerlongshortRatio +GET /dapi/v1/constituents +GET /dapi/v1/fundingInfo +GET /dapi/v1/ticker/bookTicker +GET /dapi/v1/account +GET /dapi/v1/income/asynto +GET /dapi/v1/income/asyn/idto +GET /dapi/v1/income +GET /dapi/v2/leverageBracket +GET /dapi/v1/positionRisk +POST /dapi/v1/order +PUT /dapi/v1/order +POST /dapi/v1/batchOrders +PUT /dapi/v1/batchOrders +GET /dapi/v1/pmAccountInfo +GET /dapi/v1/trades +GET /dapi/v1/pmExchangeInfo +GET /dapi/v1/orderAmendment +GET /dapi/v1/userTrades +GET /dapi/v1/exchangeInfo +GET /dapi/v1/allForceOrders +GET /dapi/v1/forceOrders +GET /dapi/v1/klines +GET /dapi/v1/continuousKlines +GET /dapi/v1/indexPriceKlines +GET /dapi/v1/markPriceKlines +GET /dapi/v1/historicalTrades +GET /dapi/v1/aggTrades +GET /dapi/v1/commissionRate +GET /dapi/v1/adlQuantile +GET /dapi/v1/premiumIndex +GET /dapi/v1/fundingRate +GET /futures/data/takerBuySellVol +GET /futures/data/basis +GET /dapi/v1/ping +GET /dapi/v1/time +GET /dapi/v1/depth +GET /dapi/v1/premiumIndexKlines +GET /dapi/v1/ticker/24hr +GET /dapi/v1/ticker/price +GET /dapi/v1/openInterest +POST /dapi/v1/positionSide/dual +GET /dapi/v1/positionSide/dual +GET /dapi/v1/order +DELETE /dapi/v1/order +DELETE /dapi/v1/allOpenOrders +DELETE /dapi/v1/batchOrders +POST /dapi/v1/countdownCancelAll +GET /dapi/v1/openOrder +GET /dapi/v1/openOrders +GET /dapi/v1/allOrders +GET /dapi/v1/balance +POST /dapi/v1/leverage +POST /dapi/v1/marginType +POST /dapi/v1/positionMargin +GET /dapi/v1/positionMargin/history +GET /dapi/v1/leverageBracket +GET /dapi/v1/income/asyn +GET /dapi/v1/income/asyn/id +POST /fapi/v1/listenKey +POST /dapi/v1/listenKey +PUT /dapi/v1/listenKey +DELETE /dapi/v1/listenKey \ No newline at end of file diff --git a/utils/futures_docs.txt b/utils/futures_docs.txt new file mode 100644 index 000000000..7ce5d25db --- /dev/null +++ b/utils/futures_docs.txt @@ -0,0 +1,8097 @@ +Logo +Spot/Margin/Savings/Mining +USDⓈ-M Futures +COIN-M Futures +European Options +WebSocket API +Portfolio Margin +简体中文 +Search +Change Log +General Info +Market Data Endpoints +Websocket Market Streams +Account/Trades Endpoints +User Data Streams +Portfolio Margin Pro Endpoints +WebSocket API +Error Codes +Binance Futures +Change Log +Important Documentation Notice + +Binance has launched its new API Documentation Portal. The existing GitHub API documentation is now deprecated(2024-06-17) and set to go offline in the upcoming few months following user migration; the exact date will be determined and communicated in due course. + +During this transition phase, both sites will be maintained. However, any new services will only be published in the new portal moving forward. + +Here's a reference table of the links for the current and new API documentation: + +Functionality Current Documentation New Documentation +Spot Trading Current Documentation New Documentation +Spot Websocket API Current Documentation New Documentation +Margin Trading Current Documentation New Documentation +Derivative UM Futures Current Documentation New Documentation +Derivative CM Futures Current Documentation New Documentation +Derivative Options Current Documentation New Documentation +Derivative Portfolio Margin Current Documentation New Documentation +Wallet Current Documentation New Documentation +Sub Account Current Documentation New Documentation +Simple Earn Current Documentation New Documentation +Dual Investment Current Documentation New Documentation +Auto Invest Current Documentation New Documentation +Staking Current Documentation New Documentation +Mining Current Documentation New Documentation +Algo Trading Current Documentation New Documentation +Copy Trading Current Documentation New Documentation +Porfolio Margin Pro Current Documentation New Documentation +Fiat Current Documentation New Documentation +C2C Current Documentation New Documentation +VIP Loan Current Documentation New Documentation +Crypto Loan Current Documentation New Documentation +Pay Current Documentation New Documentation +Convert Current Documentation New Documentation +Rebate Current Documentation New Documentation +NFT Current Documentation New Documentation +Gift Card Current Documentation New Documentation +2024-07-24 + +REST API + +New Endpoints to Query Account Information: + +GET /fapi/v1/symbolConfig: Query user symbol configuration. +GET /fapi/v1/accountConfig: Query user account configuration. +GET /fapi/v3/account: Compared to GET /fapi/v2/account, this endpoint only returns symbols that the user has positions or open orders in. Configuration-related fields have been removed and can now be queried from GET /fapi/v1/symbolConfig and GET /fapi/v1/accountConfig. The V3 endpoint also offers better performance. +GET /fapi/v3/balance: Query user account balance. +New Endpoints to Query Trade Information: + +GET /fapi/v3/positionRisk: Compared to GET /fapi/v2/positionRisk, this endpoint only returns symbols that the user has positions or open orders in. Configuration-related fields have been removed and can now be queried from GET /fapi/v1/symbolConfig. The V3 endpoint also offers better performance. +WebSocket API + +New Endpoints to Query Account Information: +v2/account.status: Compared to account.status, this endpoint only returns symbols that the user has positions or open orders in. Configuration-related fields have been removed and can now be queried from GET /fapi/v1/symbolConfig and GET /fapi/v1/accountConfig. The V2 endpoint also offers better performance. +v2/account.balance: Query user account balance. +v2/account.position: Compared to account.position, this endpoint only returns symbols that the user has positions or open orders in. Configuration-related fields have been removed and can now be queried from GET /fapi/v1/symbolConfig. The V2 endpoint also offers better performance. +Deprecation Notice: - The following endpoints will be deprecated in the coming months (exact date to be announced later). Please switch to the new endpoints listed above: - REST API: - GET /fapi/v2/balance - GET /fapi/v2/account - GET /fapi/v2/positionRisk - Websocket API: - account.status - account.balance - account.position + +2024-06-19 + +The response field marginAsset in GET /fapi/v1/userTrades will be removed on 2024-06-25. +2024-05-28 + +"The autoAssetExchange field in GET /fapi/v1/exchangeInfo is exclusively applicable for users with VIP levels 2-9. For thresholds pertaining to VIP level 0-1 users, please refer to the relevant Binance announcement. +2024-05-24 + +New endpoint to toggle BNB Burn: +POST /fapi/v1/feeBurn to toggle BNB Burn on Futures Trade. +GET /fapi/v1/feeBurn to get BNB Burn status. +2024-04-19 + +{ + "listenKey": "3HBntNTepshgEdjIwSUIBgB9keLyOCg5qv3n6bYAtktG8ejcaW5HXz9Vx1JgIieg" +} +The new field listenKey will be integrated into the response received from the PUT /fapi/v1/listenKey endpoint or Websocket Api userDataStream.ping. This enhancement will allow users to view the key that has been kept alive. This update is scheduled to take effect on 2024-04-25. +2024-04-09 + +Good-Till-Cancel (GTC) timeInForce will have a one-year validity period after order placement. GTC orders longer than one-year will be automatically canceled. This applies to all order types including reduceOnly but does not affect part-filled orders or strategy trading or copy-trading orders. +2024-04-01 + +WEBSOCKET API + +Websocket API is now available and can be accessed through this URL: wss://ws-fapi.binance.com/ws-fapi/v1 +WebSocket API allows placing orders, canceling orders, etc. through a WebSocket connection. +WebSocket API is a separate service from WebSocket Market Data streams. I.e., placing orders and listening to market data requires two separate WebSocket connections. +WebSocket API is subject to the same Filter and Rate Limit rules as REST API. +WebSocket API and REST API are functionally equivalent: they provide the same features, accept the same parameters, return the same status and error codes. +2024-03-11 + +REST + +Add new Account Endpoints: +GET /fapi/v1/rateLimit/order: query user order rate limits +2024-02-09 + +Binance Future is doing Websocket Service upgrade and the upgrade impacts the following: + +Before upgrade: + +The websocket server will send a ping frame every 3 minutes. If the websocket server does not receive a pong frame back from the connection within a 10 minute period, the connection will be disconnected. Unsolicited pong frames are allowed. +After upgrade: + +Websocket server will send a ping frame every 3 minutes. +If the websocket server does not receive a pong frame back from the connection within a 10 minute period, the connection will be disconnected. +When you receive a ping, you must send a pong with a copy of ping's payload as soon as possible. +Unsolicited pong frames are allowed, but will not prevent disconnection. It is recommended that the payload for these pong frames are empty. +2024-01-24 + +Testnet WEBSOCKET + +The Websocket baseurl for testnet is updated to "wss://fstream.binancefuture.com" +2024-01-08 + +REST + +Update endpoint for Account/Trade(Release date 2023-01-11): +PUT /fapi/v1/order: add parameter priceMatch to support priceMatch for order modification +PUT /fapi/v1/batchOrders: add parameter priceMatch to support priceMatch for order modification +Order modification will preserve the original selfTradePreventionMode of the order +2023-12-12 + +WEBSOCKET + +Update speed for stream !bookTicker will be modified from real-time to every 5 seconds on starting December 20, 2023. Individual Symbol Book Ticker Streams @bookticker will remain unaffected by this update +2023-11-15 + +REST + +Add new Market Data Endpoints: +GET /fapi/v2/ticker/price: this is v2 endpoint for querying latest price. It has same parameters and response as the GET /fapi/v1/ticker/price, and it offers lower latency and consume less of the IP rate limit. Please note that the GET /fapi/v1/ticker/price will be deprecated in the future, with the exact timing to be determined. +WEBSOCKET + +Binance Futures will retire the wss://fstream-auth.binance.com domain at 2023-12-15 06:00. API users are advised to establish a new WebSocket connection to wss://fstream.binance.com. Please note that the connection method for wss://fstream.binance.com is different from that of wss://fstream-auth.binance.com. For instance: +wss://fstream-auth.binance.com/ws/?listenKey= should change to wss://fstream.binance.com/ws/ +2023-11-01 + +REST + +Add new Market Data Endpoints: + +GET /futures/data/basis: query basis data +Update on GET /fapi/v1/fundingRate: + +add response field markPrice to display mark price associated with a particular funding fee charge +2023-10-19 + +REST + +New Market Data Endpoints +GET /futures/data/delivery-price: query quarterly contract settlement price +Update Rate Limit to 1000/5min/IP on Market Data Endpoints below: +GET /futures/data/openInterestHist +GET /futures/data/topLongShortAccountRatio +GET /futures/data/topLongShortPositionRatio +GET /futures/data/globalLongShortAccountRatio +GET /futures/data/takerlongshortRatio +Update Rate Limit to 500/5min/IP on Market Data Endpoints below: +GET /fapi/v1/fundingRate and GET /fapi/v1/fundingInfo share 500/5min/IP rate limit +2023-10-16 + +REST + +New Market Data Endpoints +GET /fapi/v1/constituents: query index constituents +2023-10-11 + +REST + +Account Endpoints IP Weight Update: +GET /fapi/v1/income/asyn: 5->1000 +GET /fapi/v1/order/asyn: 5->1000 +GET /fapi/v1/trade/asyn: 5->1000 +GET /fapi/v1/income/asyn/id: 5->10 +GET /fapi/v1/order/asyn/id: 5->10 +GET /fapi/v1/trade/asyn/id: 5->10 +2023-09-25 + +REST + +New Market Data Endpoints Update +GET /fapi/v1/fundingInfo: query adjusted funding info +2023-09-20 + +REST + +Update on GET /fapi/v1/ticker/bookTicker: +add response field lastUpdateId +2023-09-19 + +{ + "code": -1008, + "msg": "Server is currently overloaded with other requests. Please try again in a few minutes." +} +New error code message for http 503 return code, endpoints below might have this response during high traffic: +POST /fapi/v1/order +PUT /fapi/v1/order +DELETE /fapi/v1/order +POST /fapi/v1/batchOrder +PUT /fapi/v1/batchOrder +DELETE /fapi/v1/batchOrder +POST /fapi/v1/order/test +DELETE /fapi/v1/allOpenOrders +This is a failure API operation and you can resend your request if you need. +2023-09-05 + +As per the announcement, Self Trade Prevention is enabled at 2023-09-05. +Price Match/ Good Till Date TIF/ Breakeven Price(detail in 2023-08-29 changelog) are released at 2023-09-05 +2023-08-31 + +Binance Future is doing Websocket Service upgrade and the upgrade impacts the following: + +Before upgrade: + +The websocket server will send a ping frame every 5 minutes. If the websocket server does not receive a pong frame back from the connection within a 15 minute period, the connection will be disconnected. Unsolicited pong frames are allowed. +After upgrade: + +The websocket server will send a ping frame every 3 minutes. If the websocket server does not receive a pong frame back from the connection within a 10 minute period, the connection will be disconnected. Unsolicited pong frames are allowed. +2023-08-29 + +Self-Trade Prevention(Release Date TBD): + +Self-Trade Prevention (aka STP) will be added to the system. This will prevent orders from matching with orders from the same account, or accounts under the same tradeGroupId. For more detail, please check FAQ + +User can set selfTradePreventionMode when placing new orders. All symbols support the following STP mode: + +NONE: No Self-Trade Prevention +EXPIRE_TAKER: expire taker order when STP trigger +EXPIRE_BOTH: expire taker and maker order when STP trigger +EXPIRE_MAKER: expire maker order when STP trigger +REST Update: + +New order status EXPIRED_IN_MATCH - This means that the order expired due to STP being triggered. +GET /fapi/v2/account: Add new field tradeGroupId in response to show user's tradeGroupId +Add optional parameter selfTradePreventionMode in the endpoints below to set order's STP mode: +POST /fapi/v1/order +POST /fapi/v1/batchOrders +Add new field selfTradePreventionMode in response of the endpoints below to show order's STP mode: +POST /fapi/v1/order +POST /fapi/v1/batchOrders +POST /fapi/v1/order +POST /fapi/v1/order +GET /fapi/v1/order +GET /fapi/v1/openOrders +GET /fapi/v1/allOrders +PUT /fapi/v1/order +PUT /fapi/v1/batchOrders +DELETE /fapi/v1/order +DELETE /fapi/v1/batchOrders +WEBSOCKET User Data Stream: + +Add new field V in ORDER_TRADE_UPDATE to order STP mode. +Price Match(Release Date TBD) + +USDⓈ margin future will support order price match function. This feature will allow users' LIMIT/STOP/TAKE_PROFIT orders to be placed without entering a price. The price match function will automatically determine the order price in real-time based on the price match mode and the order book. + +The following priceMatch modes are supported on order level: + +NONE: no price match +OPPONENT: counterparty best price +OPPONENT_5: counterparty 5th best price +OPPONENT_10: counterparty 10th best price +OPPONENT_20: counterparty 20th best price +QUEUE: the best price on the same side of the order book +QUEUE_5: the 5th best price on the same side of the order book +QUEUE_10: the 10th best price on the same side of the order book +QUEUE_20: the 20th best price on the same side of the order book +Example: + +User places buy order and set priceMatch as QUEUE_5, the order price will be 5th best bid price of the orderbook +User places buy order and set priceMatch as OPPONENT, the order price will be best ask price of the orderbook +REST Update: + +Add optional parameter priceMatch in the endpoints below to set order's priceMatch mode: +POST /fapi/v1/order +POST /fapi/v1/batchOrders +Add new field priceMatch in response of the endpoints below to show order's priceMatch mode: +POST /fapi/v1/order +POST /fapi/v1/batchOrders +POST /fapi/v1/order +POST /fapi/v1/order +GET /fapi/v1/order +GET /fapi/v1/openOrders +GET /fapi/v1/allOrders +PUT /fapi/v1/order +PUT /fapi/v1/batchOrders +DELETE /fapi/v1/order +DELETE /fapi/v1/batchOrders +WEBSOCKET User Data Stream: + +Add new field pm in ORDER_TRADE_UPDATE to order's priceMatch mode. +Good Till Date TIF(Release Date TBD) + +USDⓈ margin future will support Good To Date TIF. Orders with the TIF set to GTD will be automatically canceled. by the goodTillDate time + +REST Update: + +Add optional parameter goodTillDate in the endpoints below to set order's goodTillDate : +POST /fapi/v1/order +POST /fapi/v1/batchOrders +Add new field goodTillDate in response of the endpoints below to show order's goodTillDate: +POST /fapi/v1/order +POST /fapi/v1/batchOrders +POST /fapi/v1/order +POST /fapi/v1/order +GET /fapi/v1/order +GET /fapi/v1/openOrders +GET /fapi/v1/allOrders +PUT /fapi/v1/order +PUT /fapi/v1/batchOrders +DELETE /fapi/v1/order +DELETE /fapi/v1/batchOrders +WEBSOCKET User Data Stream: + +Add new field gtd in ORDER_TRADE_UPDATE to order good till date. +Breakeven Price(Release Date TBD) + +REST Update +Add new field breakEvenPrice in The following endpoint +GET /fapi/v2/account +GET /fapi/v2/positionRisk +WEBSOCKET +New field bep represents Break-Even Price in position P of payload to event: Balance and Position Update – "e": "ACCOUNT_UPDATE" +2023-08-19 + +Binance Future is doing Websocket Service upgrade and the upgrade impacts the following: +Connect websocket server without subscription: +Before upgrade, user can connect by using: +wss://fstream.binance.com/ws +wss://fstream.binance.com/stream +wss://fstream.binance.com/ws/ +wss://fstream.binance.com/stream/ +After upgrade, user can connect by using: +wss://fstream.binance.com/ws +wss://fstream.binance.com/stream +/ at the end is no longer supported +Connect websocket server with subscription: +Raw stream like wss://fstream.binance.com/illegal_parameter/stream?steams= or wss://fstream.binance.com/illegal_parameter/ws/is not supported, please use remove illegal_parameter/ before /ws and /stream. +2023-08-14 + +Update endpoint for Account/Trade: +GET /fapi/v1/income: Add parameter page for pagination +2023-07-18 + +REST + +Add field notionalCoef in GET /fapi/v1/leverageBracket to show the bracket multiplier comparing to default leverage bracket +2023-07-04 + +REST + +The following endpoints will be adjust to keep only recent three month data: +GET /fapi/v1/order(effective 2023-07-27) +GET /fapi/v1/allOrders(effective 2023-07-27) +GET /fapi/v1/userTrades(exact time TBD) +Please maintain and record old order/trade infomation or switch querying historical order/trade using new endpoint below: +New endpointGET /fapi/v1/order/asynto get Download Id For Futures Order History +New endpointGET /fapi/v1/order/asyn/idto get Futures Order History Download Link by Id +New endpointGET /fapi/v1/trade/asynto get Download Id For Futures Trade History +New endpointGET /fapi/v1/trade/asyn/idto get Futures Trade History Download Link by Id +2023-06-28 + +Notice: + +REST + +The following endpoints will no longer be supported from 2023-07-15: +GET /fapi/v1/account +GET /fapi/v1/balance +GET /fapi/v1/positionRisk +Please switch to corresponding v2 endpoints: +GET /fapi/v2/account +GET /fapi/v2/balance +GET /fapi/v2/positionRisk +2023-06-22 + +Notice: + +WEBSOCKET + +Raw stream like /ws? is not supported, for example wss://fstream.binance.com/ws?btcusdt@depth is invalid. +Sending websocket message with invalid JSON format will cause disconnection now, returning this error {"error":{"code":3,"msg":"Invalid JSON: expected value at line 1 column 1"}} +2023-06-16 + +Notice: + +It is recommended to use standard HTTP request formats, non-standard request formats will not be supported in fapi, below are some examples for correct code practice: + +Escaping (") with '\x22' is no longer supported, please use the standard '%22' instead. It is necessary to URL encode the square brackets [] and the double quotes(")inside the square brackets. + +DELETE /fapi/v1/batchOrders?origClientOrderIdList= + +Unsupported: + +[\x229151944646313025900\x22] + +Suggest: + +["9151944646313025900"] + +--After URL encode-- + +DELETE /fapi/v1/batchOrders?origClientOrderIdList=%5B%229151944646313025900%22%5D + +Non-standard nested JSON formats are not supported, + +POST /fapi/v1/batchOrders?batchOrders= + +Unsupported: + +["{\"type\":\"LIMIT\",\"timeInForce\":\"GTC\"}"] + +Suggest: + +[{"type":"LIMIT","timeInForce":"GTC"}] + +--After URL encode-- + +POST /fapi/v1/batchOrders?batchOrders=%5B%7B%22type%22%3A%22LIMIT%22%2C%22timeInForce%22%3A%22GTC%22%7D%5D + +Using incorrect data type is not supported + +DELETE /fapi/v1/batchOrders?orderIdList= + +As the data type of the 'orderIdList' parameter is LIST Unsupported: + +["159856286502","159856313662"] + +Suggest: + +[159856286502,159856313662] + +--After URL encode-- + +DELETE /fapi/v1/batchOrders?orderIdList=%5B159856286502%2C159856313662%5D + +Invalid whitespace characters from the request parameters are not supported + +Unsupported: + +POST symbol=BTCUSDT& price= 40000.0 & signature=2d24a314 + +Suggest: + +POST symbol=BTCUSDT&&price=40000.0&signature=2d24a314 + +Passing empty values in request parameters is not supported + +Unsupported: + +GET symbol=BTCUSDT&orderId=&signature=2d24a314 + +Suggest: + +GET symbol=BTCUSDT&signature=2d24a314 + +2023-06-14 + +WEBSOCKET + +New WebSocket stream !assetIndex@arrOR@assetIndex for multi-assets mode asset index update +2023-05-31 + +WEBSOCKET + +Add user data stream: +new event CONDITIONAL_ORDER_TRIGGER_REJECT to the order reject reason for triggered TP/SL order +2023-05-24 + +REST + +GET /fapi/v1/pmExchangeInfo will be deprecated on 5/29 due to removing notionalLimit restriction. +2023-05-05 + +REST + +New endpoints PUT /fapi/v1/order and PUT /fapi/v1/batchOrders to support limit order modify +New endpoint GET /fapi/v1/orderAmendment to get order modify history +WEBSOCKET + +New type "AMENDMENT" as order modify in Execution Type x of Order Update event ORDER_TRADE_UPDATE +2023-04-17 + +RELEASE DATE 2023-04-18 + +The recvWindow check will also be performed when orders reach matching engine. The recvWindow will be checked more precisely on order placing endpoints. + +{ + "code": -5028, + "msg": "Timestamp for this request is outside of the ME recvWindow" +} +recvWindow Logic Before Release: + +The order placing requests are valid if recvWindow + timestamp => REST API service server timestamp +recvWindow Logic After Release: + +Add new recwWindow check: the order placing requests are valid if recvWindow + timestamp => matching engine timestamp + +Impacted Endpoints: + +POST /fapi/v1/order +PUT /fapi/v1/order +POST /fapi/v1/batchOrders +PUT /fapi/v1/batchOrders +2023-03-28 + +Referal Rebate Logic Before Release + +For every trade,the referal rebate balance change will be reflected in ACCOUNT_UPDATE event of USER-DATA-STREAM in real time: +{ + "e": "ACCOUNT_UPDATE", + "T": 1679974782150, + "E": 1679974782155, + "a": { + "B": [ + { + "a": "USDT", + "wb": "685.31478079", + "cw": "677.17212454", + "bc": "0.00258637" + } + ], + "P": [], + "m": "ADMIN_DEPOSIT" + } +} +Referal Rebate Logic After Release + +Referral rebates are aggregated every 20 minutes and reflected as a single push in the ACCOUNT_UPDATE event of the USER-DATA-STREAM, showing the total sum of rebates earned from multiple referrals. +2023-03-08 + +RELEASE DATE 2023-03-22 + +Order Logic Before Release: + +When placing order with timeInForce FOK or GTX(Post-only), user will get order response with status = “NEW“ and corresponding order_trade_update with x = “NEW”, X = “NEW”. If the orders can't meet execution criteria, user will receive another websocket order_trade_update message x = “EXPIRED”, X = “EXPIRED”. The order can be found in GET /fapi/v1/order or GET /fapi/v1/allOrders. +{ + "code": -5021, + "msg": "Due to the order could not be filled immediately, the FOK order has been rejected. The order will not be recorded in the order history" +} +Order Logic After Release: + +When placing order with timeInForce FOK or GTX(Post-only), if the order can't meet execution criteria, order will get rejected directly and receive error response, no order_trade_update message in websocket. The order can't be found in GET /fapi/v1/order or GET /fapi/v1/allOrders. +{ + "code": -5022, + "msg": "Due to the order could not be executed as maker, the Post Only order will be rejected. The order will not be recorded in the order history" +} +Impacted Endpoints: +POST /fapi/v1/order +POST /fapi/v1/batchOrders +GET /fapi/v1/order +GET /fapi/v1/allOrders +2023-01-04 + +WEBSOCKET + +Delete Order Status NEW_INSURANCE and NEW_ADL in Order Update Event +2022-12-16 + +WEBSOCKET + +New WebSocket stream !contractInfo for symbol information update +2022-11-29 + +WEB SOCKET USER DATA STREAM + +New WebSocket stream STRATEGY_UPDATE in USER-DATA-STREAM: update when a strategy is created/cancelled/expired, ...etc. +New WebSocket stream GRID_UPDATE in USER-DATA-STREAM: update when a sub order of a grid is filled or partially filled. +2022-10-13 + +Note: This change will be effictive on 2022-10-17 + +REST RATE LIMIT WEIGHT + +Endpoint GET /fapi/v1/ticker/bookTicker + +Weight Update: + +2 for a single symbol; +5 when the symbol parameter is omitted + +2022-09-22 + +Update endpoint for Account/Trade: +GET /fapi/v1/income: Support more incomeType +Add new endpoint for Portfolio Margin: +GET /fapi/v1/pmAccountInfo: Get Portfolio Margin current account information. +2022-07-27 + +REST RATE LIMIT WEIGHT + +The weight of endpoint GET /fapi/v1/trades is updated to 5 +2022-06-28 + +REST + +New endpoint GET /fapi/v1/pmExchangeInfo to get current Portfolio Margin exchange trading rules. +2022-03-01 + +REST + +New endpointGET /fapi/v1/income/asynto get Download Id For Futures Transaction History +New endpointGET /fapi/v1/income/asyn/idto get Futures Transaction History Download Link by Id +2022-02-10 + +REST + +Update GET /fapi/v2/account endpoints: +If user is in multiAssetsMargin mode, all assets will be included in calculation for fields totalInitialMargintotalMaintMargintotalWalletBalancetotalUnrealizedProfittotalMarginBalancetotalPositionInitialMargintotalOpenOrderInitialMargintotalCrossWalletBalancetotalCrossUnPnlavailableBalancemaxWithdrawAmount and the results will be show as value in USD +If user is in singleAssetsMargin mode, only USDT assets are included in the calculation(same as before) +2021-12-30 + +WEBSOCKET + +New connection method for WEBSOCKET. +Base Url is wss://fstream-auth.binance.com +Streams can be access either in a single raw stream or a combined stream +Raw streams are accessed at /ws/?listenKey= +Combined streams are accessed at /stream?streams=//&listenKey= + must be a valid listenKey when you establish a connection. +More details: Websocket Market Streams and User Data Streams +2021-11-02 + +REST + +New endpointGET /fapi/v1/assetIndexto get asset index for Multi-Assets mode margin asset +2021-07-06 + +REST + +New field updateTime as last update time of asset and position in response of GET /fapi/v2/account and GET /fapi/v2/positionRisk +New fields in the response of GET /fapi/v1/exchangeInfo: +"liquidationFee" for liquidation fee rate +"marketTakeBound" for he max price difference rate( from mark price) a market order can make +2021-06-15 + +WEBSOCKET + +New fields "q" and "i" for quote asset and index price added in stream @compositeIndex +REST + +Update endpoints: +New fields component and quoteAsset as component asset and quote asset added in response of GET /fapi/v1/indexInfo +2021-05-06 + +WEBSOCKET + +Update streams: +Previous Leverage Update event ACCOUNT_CONFIG_UPDATE expanded as account configuration update event, including leverage update and Multi-Assets margin status update. +Balance and Position Update event ACCOUNT_UPDATE add new event reason type m as AUTO_EXCHANGEto represent Multi-Assets margin auto-exchange event +REST + +New endpoints: + +POST /fapi/v1/multiAssetsMargin to change Multi-Assets margin mode +GET /fapi/v1/multiAssetsMargin to check Multi-Assets margin mode +Update endpoints: + +New object assets as asset information in response of GET /fapi/v1/exchangeInfo. +New field marginAvailable in response of GET /fapi/v2/balance and GET /fapi/v2/account to indicate whether the asset can be used as margin in Multi-Assets mode. +2021-04-27 + +WEBSOCKET + +The following liquidation orders streams do not push realtime order data anymore. Instead, they push snapshot order data at a maximum frequency of 1 order push per second.: +@forceOrder +!forceOrder@arr +REST + +The endpoint GET /fapi/v1/allForceOrders stop being maintained and no longer accepts request. +2021-04-22 + +WEBSOCKET + +New field "bc" for balance change in event "ACCOUNT_UPDATE" +2021-03-02 + +New endpoint GET /fapi/v1/indexPriceKlines to get index price kline/candlestick data. + +New endpoint GET /fapi/v1/markPriceKlines to get mark price kline/candlestick data. + +2021-02-24 + +REST RATE LIMIT WEIGHT + +The weight of endpoint GET /fapi/v2/balance is updated to 5 +The weight of endpoint GET /fapi/v2/positionRisk is updated to 5 +2021-02-22 + +REST RATE LIMIT WEIGHT + +The weight of endpoint GET /fapi/v1/income is updated to 30 +REST + +The query time period for endpoint GET /fapi/v1/allOrders must be less than 7 days. +The query time period for endpoint GET /fapi/v1/allForceOrders must be within the recent 7 days. +2021-01-26 + +WEB SOCKET USER DATA STREAM + +New WebSocket stream ACCOUNT_CONFIG_UPDATE in USER-DATA-STREAM for leverage changed update +REST RATE LIMIT WEIGHT + +Following endpoints' weights will be updated to 20 with symbol and 50 without symbol: +GET /fapi/v1/allForceOrders +GET /fapi/v1/forceOrders +REST + +New filter "MIN_NOTIONAL" whicht defines the minimum notional value allowed for an order on a symbol, and shown in the /fapi/v1/exchangeInfo +2021-01-21 + +The regular expression rule for newClientOrderId updated as ^[\.A-Z\:/a-z0-9_-]{1,36}$ + +2021-01-04 + +REST RATE LIMIT WEIGHT + +Following endpoints will use new weight rule based on the paremeter "LIMIT" in the request: + +GET /fapi/v1/klines +GET /fapi/v1/continuousKlines +Following endpoints' weights will be updated to 20: + +GET /fapi/v1/historicalTrades +GET /fapi/v1/allForceOrders +GET /fapi/v1/forceOrders +GET /fapi/v1/aggTrades +2020-12-08 + +WEBSOCKET + +New field e for event type in payload of streams @bookTicker and !bookTicker +New field P for estimated settle price in payload of streams @markPrice, @markPrice@1s, !markPrice@arr, and !markPrice@arr@1s. +New stream _@continuousKline_ for continuous contract kline +REST API + +New field "estimatedSettlePrice" in response to GET /fapi/v1/premiumIndex +New fields in response to GET /fapi/v1/exchangeInfo: + +"pair" +"contractType" +"deliveryDate" +"onboardDate" +New endpoint GET /fapi/v1/continuousKlines to get continuous contract kline data + +ENUM + +Contract types: +PERPETUAL +CURRENT_MONTH +NEXT_MONTH +CURRENT_QUARTER +NEXT_QUARTER +2020-11-27 + +New endpoint GET /fapi/v1/commissionRate to get user commission rate. +2020-11-13 + +WEB SOCKET STREAM + +In order to provide users with more secure and stable services, the update time of depth@0ms and @depth@0ms is dynamically adjusted according to the total amount of data traffic and other objective conditions. +2020-11-10 + +New field "marginAsset" for margin asset in the response to GET /fapi/v1/exchangeInfo. +New field "positionAmt" for position amount in the response to GET /fapi/v2/account. +2020-11-09 + +WEB SOCKET USER DATA STREAM + +Please notice: new streamlined and optimized push rules on event ACCOUNT_UPDATE in USER-DATA-STREAM + +When an asset of a user is changed: + +Only this asset and its balance information will be pushed +Other assets and information will no longer be pushed even the balances may not be 0 +If none of the open positions change, the position "P" will only return an empty [] +When a position or the margin type of a symbol is changed: + +"P" will push the details in the "BOTH" position of this symbol +If the change happens in "LONG" or "SHORT" position, the changed "LONG" or "SHORT" position of this symbol will be pushed +Initialized "LONG" or "SHORT" isolated position of this symbol will also be pushed +Position information of other symbols will no longer be pushed, even their positions may not be 0 +In short, the full information of assets and positions should be obtained via the related RESTful endpoints(GET /fapi/v2/account and GET /fapi/v2/positionRisk), and the locally cached asset or position data can be updated via the event ACCOUNT_UPDATE in Websocket USER-DATA-STREAM with the information of changed asset or position. + +Please visit here to get examples for helping to understand the upgrade. + +2020-10-27 + +WEB SOCKET STREAM + +The maximum stream number that a single connection can listen to changes as 200. +2020-10-10 + +WEBSOCKET + +New WebSocket streams @compositeIndex for composite index symbol information. +2020-10-09 + +New endpoint GET /fapi/v1/indexInfo to get information of composite index. +2020-09-18 + +New endpoint GET /fapi/v1/apiTradingStatus to get futures API trading quantitative rules indicators +2020-09-09 + +Some orders that were cancelled/expired will be removed gradually from API endpoints. +Orders that meet criteria +order status is CANCELED or EXPIRED, AND +order has NO filled trade, AND +created time + 7 days < current time +These endpoints are affected: +GET /fapi/v1/order +GET /fapi/v1/allOrders +2020-08-14 + +New field "indexPrice" in response to endpoint GET /fapi/v1/premiumIndex. +New field "i" for indexPrice in payload of ws streams: +@markPrice, +@markPrice@1s, +!markPrice@arr, +!markPrice@arr@1s +2020-08-12 + +New endpoint GET /fapi/v1/forceOrders to get the user's force orderes. +2020-07-30 + +New endpoint GET /fapi/v1/adlQuantile to get the positions' ADL quantile estimation values +2020-07-17 + +Weights of endpoint GET /fapi/v1/income has been changed as 20 +2020-07-02 + +WEBSOCKET + +New field "m" for event reason type in event "ACCOUNT_UPDATE" +New field "rp" for the realized profit of the trade in event "ORDER_TRADE_UPDATE" +2020-06-15 + +New fields in responses to GET /fapi/v2/account and GET /fapi/v2/balance: +availableBalance +maxWithdrawAmount +2020-06-04 + +New endpoints of version 2 of fapi, having better performance than the v1 endpoints: +GET /fapi/v2/account +GET /fapi/v2/balance +2020-06-02 + +New endpoint GET /fapi/v2/positionRisk in version 2 of fapi: +User can choose to send specific "symbol". +All symbols in the market can be returned. +Different responses for "One-way" or "Hedge" position mode. +Better performance than the v1 endpoint. +2020-05-18 + +New parameter closePosition for endpoint POST /fapi/v1/order: +If a STOP_MARKET or TAKE_PROFIT_MARKET order with closePosition=true is triggered,all of the current long position( if SELL order) or current short position( if BUY order) will be closed. + +New field closePosition in response to endpoints: + +POST /fapi/v1/order +POST /fapi/v1/batchOrders +GET /fapi/v1/order +DELETE /fapi/v1/order +DELETE /fapi/v1/batchOrders +GET /fapi/v1/openOrder +GET /fapi/v1/openOrders +GET /fapi/v1/allOrders +2020-05-18 + +Some orders that were cancelled/expired will be removed gradually from API endpoints, but they are still available from Web UI. +Orders that meet criteria +order status is CANCELED or EXPIRED, AND +order has NO filled trade, AND +created time + 30 days < current time +These endpoints are affected: +GET /fapi/v1/order +GET /fapi/v1/allOrders +2020-05-15 + +New fields in payloads of @bookTicker and !bookTicker: +E for event time +T for transaction time +2020-05-14 + +New field time for transaction time in response to endpoints: +GET /fapi/v1/ticker/price +GET /fapi/v1/ticker/bookTicker +GET /fapi/v1/openInterest +2020-05-11 + +New endpoint POST /fapi/v1/countdownCancelAll to cancel all open orders of the specified symbol at the end of the specified countdown. +This rest endpoint means to ensure your open orders are canceled in case of an outage. The endpoint should be called repeatedly as heartbeats so that the existing countdown time can be canceled and repalced by a new one. +2020-05-06 + +REST + +Endpoint GET /fapi/v1/leverageBracket is changed as "USER-DATA". It need to be signed, and timestamp is needed. +WEB SOCKET USER DATA STREAM + +Please notice: event ACCOUNT_UPDATE in USER-DATA-STREAM will be pushed with only account balance or relative position when "FUNDING FEE" occurs. +When "FUNDING FEE" occurs in a crossed position, ACCOUNT_UPDATE will be pushed with only the balance B(including the "FUNDING FEE" asset only), without any position P message. +When "FUNDING FEE" occurs in an isolated position, ACCOUNT_UPDATE will be pushed with only the balance B(including the "FUNDING FEE" asset only) and the relative position message P( including the isolated position on which the "FUNDING FEE" occurs only, without any other position message). +2020-04-25 + +New fields in USER DATA STREAM event ORDER_TRADE_UPDATE: + +cp stands for Close-All conditional order +AP for Activation Price with TRAILING_STOP_MARKET order +cr for Callback Rate with TRAILING_STOP_MARKET order +New USER DATA STREAM event MARGIN_CALL. + +2020-04-17 + +New parameter newOrderRespType for response type in endpoint POST /fapi/v1/order. +ACK and RESULT are supported. And for newOrderRespType= RESULT: +MARKET order: the final FILLED result of the order will be return directly. +LIMIT order with special timeInForce: the final status result of the order(FILLED or EXPIRED) will be returned directly. +2020-04-14 + +WEB SOCKET STREAM + +WebSocket connections have a limit of 10 incoming messages per second. A message is considered: +A PING frame +A PONG frame +A JSON control message (e.g. subscribe, unsubscribe) +A connection that goes beyond the limit will be disconnected; IPs that are repeatedly disconnected may be banned. +A single connection can listen to a maximum of 200 streams. +2020-04-09 + +New endpoint of futures trading data: GET /futures/data/takerlongshortRatio +2020-04-08 + +New endpoint GET /fapi/v1/positionSide/dual to get current position mode. +New endpoint POST /fapi/v1/batchOrders to place multiple orders. +2020-04-06 + +Please notice: event ACCOUNT_UPDATE in USER-DATA-STREAM will not be pushed without update of account balances or positions. + +ACCOUNT_UPDATE will be pushed only when update happens on user's account, including changes on balances, positions, or margin type. +Unfilled orders or cancelled orders will not make the event ACCOUNT_UPDATE pushed, since there's no change on positions. +Only positions of symbols with non-zero isolatd wallet or non-zero position amount will be pushed in the "position" part of the event ACCOUNT_UPDATE. +New endpoint POST /fapi/v1/positionSide/dual to change position mode: Hedge Mode or One-way Mode. + +New parameter positionSide in the following endpoints: + +POST /fapi/v1/order +POST /fapi/v1/positionMargin +New field positionSide in the responses to the following endpoints: + +POST /fapi/v1/order +GET /fapi/v1/order +DELETE /fapi/v1/order +DELETE /fapi/v1/batchOrders +GET /fapi/v1/openOrder +GET /fapi/v1/openOrders +GET /fapi/v1/allOrders +GET /fapi/v1/account +GET /fapi/v1/positionMargin/history +GET /fapi/v1/positionRisk +GET /fapi/v1/userTrades +New field ps for "position side"in USER_DATA_STREAM events ACCOUNT_UPDATE and ORDER_TRADE_UPDATE. + +2020-03-30 + +New endpoints of futures trading data: +GET /futures/data/openInterestHist +GET /futures/data/topLongShortAccountRatio +GET /futures/data/topLongShortPositionRatio +GET /futures/data/globalLongShortAccountRatio +2020-02-26 + +New order type: TRAILING_STOP_MARKET +2020-02-20 + +New endpoint to query specific current open order: GET /fapi/v1/openOrder +2020-02-17 + +Update time changed as 1000ms for streams @ticker and !ticker@arr +New diff depth data with 500ms updates: @depth@500ms +New partial depth data with 500ms updates: @depth@500ms +2020-02-12 + +New SDK and Code Demonstration on Java + +Faster mark price websocket data with 1s updates: @markPrice@1s and !markPrice@arr@1s + +2020-02-05 + +New market data endpointGET /fapi/v1/leverageBracket to check notional and leverage brackets. +2020-01-19 + +"cumQty" is going to be removed from the responses to DELETE /fapi/v1/order, DELETE /fapi/v1/batchOrders and other order relatived endpoints in the coming weeks. +Please use "executedQty" instead. +2020-01-17 + +New SDK and Code Demonstration on Python +2020-01-06 + +Faster diff data with real time updates: @depth@0ms +2020-01-03 + +New endpoints related to isolated position: + +POST /fapi/v1/marginType +POST /fapi/v1/positionMargin +GET /fapi/v1/positionMargin/history +New field in response to GET /fapi/v1/positionRisk related to isolated position: + +marginType +isolatedMargin +New field in response to GET /fapi/v1/accountrelated to isolated position: isolated + +New field in event ACCOUNT_UPDATE: + +"cw" for cross wallet +"mt" for margin type +"iw" for isolated wallet (if isolated) +2019-12-19 + +New endpoint GET /fapi/v1/openInterest to get present open interest of a specific symbol. +2019-12-18 + +New event type in user data stream:listenKeyExpired. +2019-12-12 + +New endpoint DELETE /fapi/v1/allOpenOrders to cancel all open orders of a specific symbol. +New endpointDELETE /fapi/v1/batchOrders to cancel a list of open orders. +reduceOnly has been supported in orders with type: +TAKE_PROFIT +TAKE_PROFIT_MARKET +STOP +STOP_MARKET +2019-11-29 + +New endpoint GET /fapi/v1/allForceOrders to get all liquidation orders. +New websocket streams: +@forceOrderfor liquidation order streams +!forceOrder@arr for all market liquidation order streams +2019-11-25 + +GET /fapi/v1/account has new field: positions +Added new field time for order creation time in: +GET /fapi/v1/openOrders +GET /fapi/v1/order +GET /fapi/v1/allOrders +2019-11-15 + +New websocket streams: +!miniTicker@arr: All market 24hr mini-tickers stream. +!ticker@arr: : All market 24hr tickers stream. +2019-11-12 + +WSS now supports live subscribing/unsubscribing to streams. +2019-11-05 + +New order type: +STOP_MARKET, +TAKE_PROFIT_MARKET. +New parameter workingType in POST /fapi/v1/order: +order with stop price can be triggered by "CONTRACT_PRICE" or "MARK_PRICE" +New keys in USER-DATA-STREAMS: +in ORDER_TRADE_UPDATE: +"T" as transaction time +"wt" as workingType +in ACCOUNT_UPDATE: +"T" as transaction time +2019-10-28 + +New rest endpoint for income flow history GET /fapi/v1/income +2019-10-25 + +Added "up" in event ACCOUNT_UPDATE in user data stream: the unrealized PnL of the position. +Added "R" in event ORDER_TRADE_UPDATE in user data stream, showing if the trade is reduce only. +2019-10-24 + +New WebSocket streams for booktickers added: @bookTicker and !bookTicker. +New WebSocket streams for partial orderbook added: @depth and @depth@100ms +Faster diff data with 100ms updates: @depth@100ms +Added Update Speed: to Websocket Market Streams +2019-10-18 + +New endpoint POST /fapi/v1/leverage for changing user's initial leverage in specific symbol market. +Added "leverage" for current initial leverage and "maxNotionalValue" for notional value limit of current initial leverage in response to GET /fapi/v1/positionRisk. +reduceOnly now is supported in the MARKET orders. +2019-10-14 + +Added GET /fapi/v1/fundingRate for getting funding fee rate history. +2019-10-11 + +Added "m" in event ORDER_TRADE_UPDATE in user data stream, showing if the trade is the maker side. +2019-10-08 + +New order parameter reduceOnly for LIMIT orders. +New order type TAKE_PROFIT. +2019-09-20 + +New retured values in response to GET /fapi/v1/account: +maxWithdrawAmount, openOrderInitialMargin, positionInitialMargin + +New retured values in response to GET /fapi/v1/positionRisk: +liquidationPrice + +General Info +testnet +Most of the endpoints can be used in the testnet platform. +The REST baseurl for testnet is "https://testnet.binancefuture.com" +The Websocket baseurl for testnet is "wss://fstream.binancefuture.com" +SDK and Code Demonstration +Disclaimer: + +The following SDKs are provided by partners and users, and are not officially produced. They are only used to help users become familiar with the API endpoint. Please use it with caution and expand R&D according to your own situation. +Binance does not make any commitment to the safety and performance of the SDKs, nor will be liable for the risks or even losses caused by using the SDKs. +Python3 +SDK: To get the provided SDK for Binance Futures Connector, +please visit https://github.com/binance/binance-futures-connector-python, +or use the command below: +pip install binance-futures-connector + +Java +To get the provided SDK for Binance Futures, +please visit https://github.com/binance/binance-futures-connector-java, +or use the command below: +git clone https://github.com/binance/binance-futures-connector-java.git + +General API Information +Some endpoints will require an API Key. Please refer to this page +The base endpoint is: https://fapi.binance.com +All endpoints return either a JSON object or array. +Data is returned in ascending order. Oldest first, newest last. +All time and timestamp related fields are in milliseconds. +All data types adopt definition in JAVA. +HTTP Return Codes +HTTP 4XX return codes are used for for malformed requests; the issue is on the sender's side. +HTTP 403 return code is used when the WAF Limit (Web Application Firewall) has been violated. +HTTP 408 return code is used when a timeout has occurred while waiting for a response from the backend server. +HTTP 429 return code is used when breaking a request rate limit. +HTTP 418 return code is used when an IP has been auto-banned for continuing to send requests after receiving 429 codes. +HTTP 5XX return codes are used for internal errors; the issue is on Binance's side. +If there is an error message "Request occur unknown error.", please retry later. +HTTP 503 return code is used when: +If there is an error message "Unknown error, please check your request or try again later." returned in the response, the API successfully sent the request but not get a response within the timeout period. +It is important to NOT treat this as a failure operation; the execution status is UNKNOWN and could have been a success; +If there is an error message "Service Unavailable." returned in the response, it means this is a failure API operation and the service might be unavailable at the moment, you need to retry later. +If there is an error message "Internal error; unable to process your request. Please try again." returned in the response, it means this is a failure API operation and you can resend your request if you need. +If there is an error message "Server is currently overloaded with other requests. Please try again in a few minutes." returned in the response, it means this is a failure API operation and you can resend your request if you need. +Error Codes and Messages +Any endpoint can return an ERROR +The error payload is as follows: + +{ + "code": -1121, + "msg": "Invalid symbol." +} +Specific error codes and messages defined in Error Codes. +General Information on Endpoints +For GET endpoints, parameters must be sent as a query string. +For POST, PUT, and DELETE endpoints, the parameters may be sent as a query string or in the request body with content type application/x-www-form-urlencoded. You may mix parameters between both the query string and request body if you wish to do so. +Parameters may be sent in any order. +If a parameter sent in both the query string and request body, the query string parameter will be used. +LIMITS +The /fapi/v1/exchangeInfo rateLimits array contains objects related to the exchange's RAW_REQUEST, REQUEST_WEIGHT, and ORDER rate limits. These are further defined in the ENUM definitions section under Rate limiters (rateLimitType). +A 429 will be returned when either rate limit is violated. + Binance has the right to further tighten the rate limits on users with intent to attack. +IP Limits +Every request will contain X-MBX-USED-WEIGHT-(intervalNum)(intervalLetter) in the response headers which has the current used weight for the IP for all request rate limiters defined. +Each route has a weight which determines for the number of requests each endpoint counts for. Heavier endpoints and endpoints that do operations on multiple symbols will have a heavier weight. +When a 429 is received, it's your obligation as an API to back off and not spam the API. +Repeatedly violating rate limits and/or failing to back off after receiving 429s will result in an automated IP ban (HTTP status 418). +IP bans are tracked and scale in duration for repeat offenders, from 2 minutes to 3 days. +The limits on the API are based on the IPs, not the API keys. + It is strongly recommended to use websocket stream for getting data as much as possible, which can not only ensure the timeliness of the message, but also reduce the access restriction pressure caused by the request. +Order Rate Limits +Every order response will contain a X-MBX-ORDER-COUNT-(intervalNum)(intervalLetter) header which has the current order count for the account for all order rate limiters defined. +Rejected/unsuccessful orders are not guaranteed to have X-MBX-ORDER-COUNT-** headers in the response. +The order rate limit is counted against each account. +Endpoint Security Type +Each endpoint has a security type that determines the how you will interact with it. +API-keys are passed into the Rest API via the X-MBX-APIKEY header. +API-keys and secret-keys are case sensitive. +API-keys can be configured to only access certain types of secure endpoints. For example, one API-key could be used for TRADE only, while another API-key can access everything except for TRADE routes. +By default, API-keys can access all secure routes. +Security Type Description +NONE Endpoint can be accessed freely. +TRADE Endpoint requires sending a valid API-Key and signature. +USER_DATA Endpoint requires sending a valid API-Key and signature. +USER_STREAM Endpoint requires sending a valid API-Key. +MARKET_DATA Endpoint requires sending a valid API-Key. +TRADE and USER_DATA endpoints are SIGNED endpoints. +SIGNED (TRADE and USER_DATA) Endpoint Security +SIGNED endpoints require an additional parameter, signature, to be sent in the query string or request body. +Endpoints use HMAC SHA256 signatures. The HMAC SHA256 signature is a keyed HMAC SHA256 operation. Use your secretKey as the key and totalParams as the value for the HMAC operation. +The signature is not case sensitive. +Please make sure the signature is the end part of your query string or request body. +totalParams is defined as the query string concatenated with the request body. +Timing Security +A SIGNED endpoint also requires a parameter, timestamp, to be sent which should be the millisecond timestamp of when the request was created and sent. +An additional parameter, recvWindow, may be sent to specify the number of milliseconds after timestamp the request is valid for. If recvWindow is not sent, it defaults to 5000. +The logic is as follows: + + if (timestamp < (serverTime + 1000) && (serverTime - timestamp) <= recvWindow){ + // process request + } + else { + // reject request + } +Serious trading is about timing. Networks can be unstable and unreliable, which can lead to requests taking varying amounts of time to reach the servers. With recvWindow, you can specify that the request must be processed within a certain number of milliseconds or be rejected by the server. + + It is recommended to use a small recvWindow of 5000 or less! +SIGNED Endpoint Examples for POST /fapi/v1/order - HMAC Keys +Here is a step-by-step example of how to send a vaild signed payload from the Linux command line using echo, openssl, and curl. + +Key Value +apiKey dbefbc809e3e83c283a984c3a1459732ea7db1360ca80c5c2c8867408d28cc83 +secretKey 2b5eb11e18796d12d88f13dc27dbbd02c2cc51ff7059765ed9821957d82bb4d9 +Parameter Value +symbol BTCUSDT +side BUY +type LIMIT +timeInForce GTC +quantity 1 +price 9000 +recvWindow 5000 +timestamp 1591702613943 +Example 1: As a query string +Example 1 + +HMAC SHA256 signature: + + $ echo -n "symbol=BTCUSDT&side=BUY&type=LIMIT&quantity=1&price=9000&timeInForce=GTC&recvWindow=5000×tamp=1591702613943" | openssl dgst -sha256 -hmac "2b5eb11e18796d12d88f13dc27dbbd02c2cc51ff7059765ed9821957d82bb4d9" + (stdin)= 3c661234138461fcc7a7d8746c6558c9842d4e10870d2ecbedf7777cad694af9 +curl command: + + + $ curl -H "X-MBX-APIKEY: dbefbc809e3e83c283a984c3a1459732ea7db1360ca80c5c2c8867408d28cc83" -X POST 'https://fapi/binance.com/fapi/v1/order?symbol=BTCUSDT&side=BUY&type=LIMIT&quantity=1&price=9000&timeInForce=GTC&recvWindow=5000×tamp=1591702613943&signature= 3c661234138461fcc7a7d8746c6558c9842d4e10870d2ecbedf7777cad694af9' +queryString: + +symbol=BTCUSDT +&side=BUY +&type=LIMIT +&timeInForce=GTC +&quantity=1 +&price=9000 +&recvWindow=5000 +×tamp=1591702613943 + +Example 2: As a request body +Example 2 + +HMAC SHA256 signature: + + $ echo -n "symbol=BTCUSDT&side=BUY&type=LIMIT&quantity=1&price=9000&timeInForce=GTC&recvWindow=5000×tamp=1591702613943" | openssl dgst -sha256 -hmac "2b5eb11e18796d12d88f13dc27dbbd02c2cc51ff7059765ed9821957d82bb4d9" + (stdin)= 3c661234138461fcc7a7d8746c6558c9842d4e10870d2ecbedf7777cad694af9 +curl command: + + + $ curl -H "X-MBX-APIKEY: dbefbc809e3e83c283a984c3a1459732ea7db1360ca80c5c2c8867408d28cc83" -X POST 'https://fapi/binance.com/fapi/v1/order' -d 'symbol=BTCUSDT&side=BUY&type=LIMIT&quantity=1&price=9000&timeInForce=GTC&recvWindow=5000×tamp=1591702613943&signature= 3c661234138461fcc7a7d8746c6558c9842d4e10870d2ecbedf7777cad694af9' +requestBody: + +symbol=BTCUSDT +&side=BUY +&type=LIMIT +&timeInForce=GTC +&quantity=1 +&price=9000 +&recvWindow=5000 +×tamp=1591702613943 + +Example 3: Mixed query string and request body +Example 3 + +HMAC SHA256 signature: + + $ echo -n "symbol=BTCUSDT&side=BUY&type=LIMIT&timeInForce=GTCquantity=1&price=9000&recvWindow=5000×tamp= 1591702613943" | openssl dgst -sha256 -hmac "2b5eb11e18796d12d88f13dc27dbbd02c2cc51ff7059765ed9821957d82bb4d9" + (stdin)= f9d0ae5e813ef6ccf15c2b5a434047a0181cb5a342b903b367ca6d27a66e36f2 +curl command: + + + $ curl -H "X-MBX-APIKEY: dbefbc809e3e83c283a984c3a1459732ea7db1360ca80c5c2c8867408d28cc83" -X POST 'https://fapi.binance.com/fapi/v1/order?symbol=BTCUSDT&side=BUY&type=LIMIT&timeInForce=GTC' -d 'quantity=1&price=9000&recvWindow=5000×tamp=1591702613943&signature=f9d0ae5e813ef6ccf15c2b5a434047a0181cb5a342b903b367ca6d27a66e36f2' +queryString: symbol=BTCUSDT&side=BUY&type=LIMIT&timeInForce=GTC +requestBody: quantity=1&price=9000&recvWindow=5000×tamp= 1591702613943 +Note that the signature is different in example 3. +There is no & between "GTC" and "quantity=1". + +SIGNED Endpoint Examples for POST /fapi/v1/order - RSA Keys +This will be a step by step process how to create the signature payload to send a valid signed payload. +We support PKCS#8 currently. +To get your API key, you need to upload your RSA Public Key to your account and a corresponding API key will be provided for you. +For this example, the private key will be referenced as test-prv-key.pem + +Key Value +apiKey vE3BDAL1gP1UaexugRLtteaAHg3UO8Nza20uexEuW1Kh3tVwQfFHdAiyjjY428o2 +Parameter Value +symbol BTCUSDT +side SELL +type MARKET +quantity 1.23 +recvWindow 9999999 +timestamp 1671090801999 +Signature payload (with the listed parameters): + +timestamp=1671090801999&recvWindow=9999999&symbol=BTCUSDT&side=SELL&type=MARKET&quantity=1.23 +Step 1: Construct the payload + +Arrange the list of parameters into a string. Separate each parameter with a &. + +Step 2: Compute the signature: + +2.1 - Encode signature payload as ASCII data. + +Step 2.2 + + $ echo -n 'timestamp=1671090801999&recvWindow=9999999&symbol=BTCUSDT&side=SELL&type=MARKET&quantity=1.23' | openssl dgst -keyform PEM -sha256 -sign ./test-prv-key.pem +2.2 - Sign payload using RSASSA-PKCS1-v1_5 algorithm with SHA-256 hash function. + +Step 2.3 + +$ echo -n 'timestamp=1671090801999&recvWindow=9999999&symbol=BTCUSDT&side=SELL&type=MARKET&quantity=1.23' | openssl dgst -keyform PEM -sha256 -sign ./test-prv-key.pem | openssl enc -base64 +aap36wD5loVXizxvvPI3wz9Cjqwmb3KVbxoym0XeWG1jZq8umqrnSk8H8dkLQeySjgVY91Ufs%2BBGCW%2B4sZjQEpgAfjM76riNxjlD3coGGEsPsT2lG39R%2F1q72zpDs8pYcQ4A692NgHO1zXcgScTGgdkjp%2Brp2bcddKjyz5XBrBM%3D +2.3 - Encode output as base64 string. + +Step 2.4 + +$ echo -n 'timestamp=1671090801999&recvWindow=9999999&symbol=BTCUSDT&side=SELL&type=MARKET&quantity=1.23' | openssl dgst -keyform PEM -sha256 -sign ./test-prv-key.pem | openssl enc -base64 | tr -d '\n' +aap36wD5loVXizxvvPI3wz9Cjqwmb3KVbxoym0XeWG1jZq8umqrnSk8H8dkLQeySjgVY91Ufs%2BBGCW%2B4sZjQEpgAfjM76riNxjlD3coGGEsPsT2lG39R%2F1q72zpDs8pYcQ4A692NgHO1zXcgScTGgdkjp%2Brp2bcddKjyz5XBrBM%3D +2.4 - Delete any newlines in the signature. + +Step 2.5 + +aap36wD5loVXizxvvPI3wz9Cjqwmb3KVbxoym0XeWG1jZq8umqrnSk8H8dkLQeySjgVY91Ufs%2BBGCW%2B4sZjQEpgAfjM76riNxjlD3coGGEsPsT2lG39R%2F1q72zpDs8pYcQ4A692NgHO1zXcgScTGgdkjp%2Brp2bcddKjyz5XBrBM%3D +2.5 - Since the signature may contain / and =, this could cause issues with sending the request. So the signature has to be URL encoded. + +Step 2.6 + + curl -H "X-MBX-APIKEY: vE3BDAL1gP1UaexugRLtteaAHg3UO8Nza20uexEuW1Kh3tVwQfFHdAiyjjY428o2" -X POST 'https://fapi.binance.com/fapi/v1/order?timestamp=1671090801999&recvWindow=9999999&symbol=BTCUSDT&side=SELL&type=MARKET&quantity=1.23&signature=aap36wD5loVXizxvvPI3wz9Cjqwmb3KVbxoym0XeWG1jZq8umqrnSk8H8dkLQeySjgVY91Ufs%2BBGCW%2B4sZjQEpgAfjM76riNxjlD3coGGEsPsT2lG39R%2F1q72zpDs8pYcQ4A692NgHO1zXcgScTGgdkjp%2Brp2bcddKjyz5XBrBM%3D' +2.6 - curl command + +Bash script + +#!/usr/bin/env bash + +# Set up authentication: +apiKey="vE3BDAL1gP1UaexugRLtteaAHg3UO8Nza20uexEuW1Kh3tVwQfFHdAiyjjY428o2" ### REPLACE THIS WITH YOUR API KEY + +# Set up the request: +apiMethod="POST" +apiCall="v1/order" +apiParams="timestamp=1671090801999&recvWindow=9999999&symbol=BTCUSDT&side=SELL&type=MARKET&quantity=1.23" +function rawurlencode { + local value="$1" + local len=${#value} + local encoded="" + local pos c o + for (( pos=0 ; pos minutes; h -> hours; d -> days; w -> weeks; M -> months + +1m +3m +5m +15m +30m +1h +2h +4h +6h +8h +12h +1d +3d +1w +1M +STP MODE: + +NONE +EXPIRE_TAKER +EXPIRE_BOTH +EXPIRE_MAKER +Price Match: + +NONE (No price match) +OPPONENT (counterparty best price) +OPPONENT_5 (the 5th best price from the counterparty) +OPPONENT_10 (the 10th best price from the counterparty) +OPPONENT_20 (the 20th best price from the counterparty) +QUEUE (the best price on the same side of the order book) +QUEUE_5 (the 5th best price on the same side of the order book) +QUEUE_10 (the 10th best price on the same side of the order book) +QUEUE_20 (the 20th best price on the same side of the order book) +Rate limiters (rateLimitType) + +REQUEST_WEIGHT + + { + "rateLimitType": "REQUEST_WEIGHT", + "interval": "MINUTE", + "intervalNum": 1, + "limit": 2400 + } +ORDERS + + { + "rateLimitType": "ORDERS", + "interval": "MINUTE", + "intervalNum": 1, + "limit": 1200 + } +REQUEST_WEIGHT + +ORDERS + +Rate limit intervals (interval) + +MINUTE +Filters +Filters define trading rules on a symbol or an exchange. + +Symbol filters +PRICE_FILTER +/exchangeInfo format: + + { + "filterType": "PRICE_FILTER", + "minPrice": "0.00000100", + "maxPrice": "100000.00000000", + "tickSize": "0.00000100" + } +The PRICE_FILTER defines the price rules for a symbol. There are 3 parts: + +minPrice defines the minimum price/stopPrice allowed; disabled on minPrice == 0. +maxPrice defines the maximum price/stopPrice allowed; disabled on maxPrice == 0. +tickSize defines the intervals that a price/stopPrice can be increased/decreased by; disabled on tickSize == 0. +Any of the above variables can be set to 0, which disables that rule in the price filter. In order to pass the price filter, the following must be true for price/stopPrice of the enabled rules: + +price >= minPrice +price <= maxPrice +(price-minPrice) % tickSize == 0 +LOT_SIZE +/exchangeInfo format: + + { + "filterType": "LOT_SIZE", + "minQty": "0.00100000", + "maxQty": "100000.00000000", + "stepSize": "0.00100000" + } +The LOT_SIZE filter defines the quantity (aka "lots" in auction terms) rules for a symbol. There are 3 parts: + +minQty defines the minimum quantity allowed. +maxQty defines the maximum quantity allowed. +stepSize defines the intervals that a quantity can be increased/decreased by. +In order to pass the lot size, the following must be true for quantity: + +quantity >= minQty +quantity <= maxQty +(quantity-minQty) % stepSize == 0 +MARKET_LOT_SIZE +/exchangeInfo format: + + { + "filterType": "MARKET_LOT_SIZE", + "minQty": "0.00100000", + "maxQty": "100000.00000000", + "stepSize": "0.00100000" + } +The MARKET_LOT_SIZE filter defines the quantity (aka "lots" in auction terms) rules for MARKET orders on a symbol. There are 3 parts: + +minQty defines the minimum quantity allowed. +maxQty defines the maximum quantity allowed. +stepSize defines the intervals that a quantity can be increased/decreased by. +In order to pass the market lot size, the following must be true for quantity: + +quantity >= minQty +quantity <= maxQty +(quantity-minQty) % stepSize == 0 +MAX_NUM_ORDERS +/exchangeInfo format: + + { + "filterType": "MAX_NUM_ORDERS", + "limit": 200 + } +The MAX_NUM_ORDERS filter defines the maximum number of orders an account is allowed to have open on a symbol. + +Note that both "algo" orders and normal orders are counted for this filter. + +MAX_NUM_ALGO_ORDERS +/exchangeInfo format: + + { + "filterType": "MAX_NUM_ALGO_ORDERS", + "limit": 100 + } +The MAX_NUM_ALGO_ORDERS filter defines the maximum number of all kinds of algo orders an account is allowed to have open on a symbol. + +The algo orders include STOP, STOP_MARKET, TAKE_PROFIT, TAKE_PROFIT_MARKET, and TRAILING_STOP_MARKET orders. + +PERCENT_PRICE +/exchangeInfo format: + + { + "filterType": "PERCENT_PRICE", + "multiplierUp": "1.1500", + "multiplierDown": "0.8500", + "multiplierDecimal": 4 + } +The PERCENT_PRICE filter defines valid range for a price based on the mark price. + +In order to pass the percent price, the following must be true for price: + +BUY: price <= markPrice * multiplierUp +SELL: price >= markPrice * multiplierDown +MIN_NOTIONAL +/exchangeInfo format: + + { + "filterType": "MIN_NOTIONAL", + "notional": "5.0" + } +The MIN_NOTIONAL filter defines the minimum notional value allowed for an order on a symbol. An order's notional value is the price * quantity. Since MARKET orders have no price, the mark price is used. + +Postman Collections +There is now a Postman collection containing the API endpoints for quick and easy use. + +For more information please refer to this page: Binance API Postman + +WebSocket API General Info +The base endpoint is: wss://ws-fapi.binance.com/ws-fapi/v1 +The base endpoint for testnet is: wss://testnet.binancefuture.com/ws-fapi/v1 +A single connection to the API is only valid for 24 hours; expect to be disconnected after the 24-hour mark. +Websocket server will send a ping frame every 3 minutes. +If the websocket server does not receive a pong frame back from the connection within a 10 minute period, the connection will be disconnected. +When you receive a ping, you must send a pong with a copy of ping's payload as soon as possible. +Unsolicited pong frames are allowed, but will not prevent disconnection. It is recommended that the payload for these pong frames are empty. +Signature payload must be generated by taking all request params except for the signature and sorting them by name in alphabetical order. +Lists are returned in chronological order, unless noted otherwise. +All timestamps are in milliseconds in UTC, unless noted otherwise. +All field names and values are case-sensitive, unless noted otherwise. +INT parameters such as timestamp are expected as JSON integers, not strings. +DECIMAL parameters such as price are expected as JSON strings, not floats. +User Data Stream requests - you will need to establish a separate WebSocket connection to listen to user data streams +WebSocket API Request format +Requests must be sent as JSON in text frames, one request per frame. + +Example of request: + +{ + "id": "9ca10e58-7452-467e-9454-f669bb9c764e", + "method": "order.place", + "params": { + "apiKey": "yeqKcXjtA9Eu4Tr3nJk61UJAGzXsEmFqqfVterxpMpR4peNfqE7Zl7oans8Qj089", + "price": "42088.0", + "quantity": "0.1", + "recvWindow": 5000, + "side": "BUY", + "signature": "996962a19802b5a09d7bc6ab1524227894533322a2f8a1f8934991689cabf8fe", + "symbol": "BTCUSDT", + "timeInForce": "GTC", + "timestamp": 1705311512994, + "type": "LIMIT" + } +} +Request fields: + +Name Type Mandatory Description +id INT/STRING/null YES Arbitrary ID used to match responses to requests +method STRING YES Request method name +params OBJECT NO Request parameters. May be omitted if there are no parameters + * Request id is truly arbitrary. You can use UUIDs, sequential IDs, current timestamp, etc. The server does not interpret id in any way, simply echoing it back in the response. + +You can freely reuse IDs within a session. However, be careful to not send more than one request at a time with the same ID, since otherwise it might be impossible to tell the responses apart. * Request method names may be prefixed with explicit version: e.g., "v3/order.place". * The order of params is not significant. + +Response format +Responses are returned as JSON in text frames, one response per frame. + +Example of successful response: + +{ + "id": "43a3843a-2321-4e45-8f79-351e5c354563", + "status": 200, + "result": { + "orderId": 336829446, + "symbol": "BTCUSDT", + "status": "NEW", + "clientOrderId": "FqEw6cn0vDhrkmfiwLYPeo", + "price": "42088.00", + "avgPrice": "0.00", + "origQty": "0.100", + "executedQty": "0.000", + "cumQty": "0.000", + "cumQuote": "0.00000", + "timeInForce": "GTC", + "type": "LIMIT", + "reduceOnly": false, + "closePosition": false, + "side": "BUY", + "positionSide": "BOTH", + "stopPrice": "0.00", + "workingType": "CONTRACT_PRICE", + "priceProtect": false, + "origType": "LIMIT", + "priceMatch": "NONE", + "selfTradePreventionMode": "NONE", + "goodTillDate": 0, + "updateTime": 1705385954229 + }, + "rateLimits": [ + { + "rateLimitType": "REQUEST_WEIGHT", + "interval": "MINUTE", + "intervalNum": 1, + "limit": 2400, + "count": 1 + }, + { + "rateLimitType": "ORDERS", + "interval": "SECOND", + "intervalNum": 10, + "limit": 300, + "count": 1 + }, + { + "rateLimitType": "ORDERS", + "interval": "MINUTE", + "intervalNum": 1, + "limit": 1200, + "count": 0 + } + ] +} +Example of failed response: + +{ + "id": "5761b939-27b1-4948-ab87-4a372a3f6b72", + "status": 400, + "error": { + "code": -1102, + "msg": "Mandatory parameter 'quantity' was not sent, was empty/null, or malformed." + }, + "rateLimits": [ + { + "rateLimitType": "REQUEST_WEIGHT", + "interval": "MINUTE", + "intervalNum": 1, + "limit": 2400, + "count": 1 + }, + { + "rateLimitType": "ORDERS", + "interval": "SECOND", + "intervalNum": 10, + "limit": 300, + "count": 1 + }, + { + "rateLimitType": "ORDERS", + "interval": "MINUTE", + "intervalNum": 1, + "limit": 1200, + "count": 1 + } + ] +} +Response fields: + +Name Type Mandatory Description +id INT/STRING/null YES Same as in the original request +status INT YES Response status. See status codes +result OBJECT/ARRAY YES Response content. Present if request succeeded +error OBJECT YES Error description. Present if request failed +rateLimits ARRAY NO Rate limiting status. See Rate limits +WebSocket API Rate limits +Rate limits are the same as on REST API and are shared with REST API. +WebSocket handshake attempt costs 5 weight. +Rate limit for ping/pong frames: maximum 5 per second. +Rate limit information is included in responses by default, see the rateLimits field. +rateLimits field visibility can be controlled with returnRateLimits boolean parameter in connection string or individual requests. +E.g., use wss://ws-fapi.binance.com/ws-fapi/v1?returnRateLimits=false to hide rateLimits in responses by default. With that, you can pass extra "returnRateLimits": true parameter in requests to show rate limit in response when it is otherwise hidden by default. +WebSocket API Authenticate after connection +You can authenticate an already established connection using session authentication requests: * session.logon - authenticate, or change the API key associated with the connection * session.status - check connection status and the current API key * session.logout - forget the API key associated with the connection + +WebSocket API API key revocation +If during an active session the API key becomes invalid for any reason (e.g. IP address is not whitelisted, API key was deleted, API key doesn't have correct permissions, etc), after the next request the session will be revoked with the following error message: + +{ + "id": null, + "status": 401, + "error": { + "code": -2015, + "msg": "Invalid API-key, IP, or permissions for action." + } +} +WebSocket API Authorize ad hoc requests +Only one API key can be authenticated with the WebSocket connection. The authenticated API key is used by default for requests that require an apiKey parameter. However, you can always specify the apiKey and signature explicitly for individual requests, overriding the authenticated API key and using a different one to authorize a specific request. + +For example, you might want to authenticate your USER_DATA key to be used by default, but specify the TRADE key with an explicit signature when placing orders. + +WebSocket API Authentication request +Note: Only Ed25519 keys are supported for this feature. + +Log in with API key (SIGNED) +Request + +{ + "id": "c174a2b1-3f51-4580-b200-8528bd237cb7", + "method": "session.logon", + "params": { + "apiKey": "vmPUZE6mv9SD5VNHk4HlWFsOr6aKE2zvsw0MuIgwCIPy6utIco14y7Ju91duEh8A", + "signature": "1cf54395b336b0a9727ef27d5d98987962bc47aca6e13fe978612d0adee066ed", + "timestamp": 1649729878532 + } +} +Response + +{ + "id": "c174a2b1-3f51-4580-b200-8528bd237cb7", + "status": 200, + "result": { + "apiKey": "vmPUZE6mv9SD5VNHk4HlWFsOr6aKE2zvsw0MuIgwCIPy6utIco14y7Ju91duEh8A", + "authorizedSince": 1649729878532, + "connectedSince": 1649729873021, + "returnRateLimits": false, + "serverTime": 1649729878630 + } +} +Authenticate WebSocket connection using the provided API key. + +After calling session.logon, you can omit apiKey and signature parameters for future requests that require them. + +Note that only one API key can be authenticated. Calling session.logon multiple times changes the current authenticated API key. + +Weight: 2 + +Method: "session.logon" + +Parameters + +Name Type Mandatory Description +apiKey STRING YES +recvWindow INT NO +signature STRING YES +timestamp INT YES +Query session status +Request + +{ + "id": "b50c16cd-62c9-4e29-89e4-37f10111f5bf", + "method": "session.status" +} +Response + +{ + "id": "b50c16cd-62c9-4e29-89e4-37f10111f5bf", + "status": 200, + "result": { + // if the connection is not authenticated, "apiKey" and "authorizedSince" will be shown as null + "apiKey": "vmPUZE6mv9SD5VNHk4HlWFsOr6aKE2zvsw0MuIgwCIPy6utIco14y7Ju91duEh8A", + "authorizedSince": 1649729878532, + "connectedSince": 1649729873021, + "returnRateLimits": false, + "serverTime": 1649730611671 + } +} +Query the status of the WebSocket connection, inspecting which API key (if any) is used to authorize requests. + +Weight: 2 + +Method: "session.status" + +Parameters: None + +Log out of the session +Request + +{ + "id": "c174a2b1-3f51-4580-b200-8528bd237cb7", + "method": "session.logout" +} +Response + +{ + "id": "c174a2b1-3f51-4580-b200-8528bd237cb7", + "status": 200, + "result": { + "apiKey": null, + "authorizedSince": null, + "connectedSince": 1649729873021, + "returnRateLimits": false, + "serverTime": 1649730611671 + } +} +Forget the API key previously authenticated. If the connection is not authenticated, this request does nothing. + +Note that the WebSocket connection stays open after session.logout request. You can continue using the connection, but now you will have to explicitly provide the apiKey and signature parameters where needed. + +Weight: 2 + +Method: "session.logout" + +Parameters: None + +SIGNED (TRADE and USER_DATA) Endpoint Security +SIGNED request example (Ed25519) +Parameter Value +symbol BTCUSDT +side SELL +type LIMIT +timeInForce GTC +quantity 1 +price 0.2 +timestamp 1668481559918 +#!/usr/bin/env python3 + +import base64 +import time +import json +from cryptography.hazmat.primitives.serialization import load_pem_private_key +from websocket import create_connection + +# Set up authentication +API_KEY='put your own API Key here' +PRIVATE_KEY_PATH='test-prv-key.pem' + +# Load the private key. +# In this example the key is expected to be stored without encryption, +# but we recommend using a strong password for improved security. +with open(PRIVATE_KEY_PATH, 'rb') as f: + private_key = load_pem_private_key(data=f.read(), + password=None) + +# Set up the request parameters +params = { + 'apiKey': API_KEY, + 'symbol': 'BTCUSDT', + 'side': 'SELL', + 'type': 'LIMIT', + 'timeInForce': 'GTC', + 'quantity': '1.0000000', + 'price': '0.20' +} + +# Timestamp the request +timestamp = int(time.time() * 1000) # UNIX timestamp in milliseconds +params['timestamp'] = timestamp + +# Sign the request +payload = '&'.join([f'{param}={value}' for param, value in sorted(params.items())]) + +signature = base64.b64encode(private_key.sign(payload.encode('ASCII'))) +params['signature'] = signature.decode('ASCII') + +# Send the request +request = { + 'id': 'my_new_order', + 'method': 'order.place', + 'params': params +} + +ws = create_connection("wss://ws-fapi.binance.com/ws-fapi/v1") +ws.send(json.dumps(request)) +result = ws.recv() +ws.close() + +print(result) + +A sample code in Python to show how to sign the payload with an Ed25519 key is available on the right side. + +Market Data Endpoints +Test Connectivity +Response: + +{} +GET /fapi/v1/ping + +Test connectivity to the Rest API. + +Weight: 1 + +Parameters: NONE + +Check Server Time +Response: + +{ + "serverTime": 1499827319559 +} +GET /fapi/v1/time + +Test connectivity to the Rest API and get the current server time. + +Weight: 1 + +Parameters: NONE + +Exchange Information +Response: + +{ + "exchangeFilters": [], + "rateLimits": [ + { + "interval": "MINUTE", + "intervalNum": 1, + "limit": 2400, + "rateLimitType": "REQUEST_WEIGHT" + }, + { + "interval": "MINUTE", + "intervalNum": 1, + "limit": 1200, + "rateLimitType": "ORDERS" + } + ], + "serverTime": 1565613908500, // Ignore please. If you want to check current server time, please check via "GET /fapi/v1/time" + "assets": [ // assets information + { + "asset": "BUSD", + "marginAvailable": true, // whether the asset can be used as margin in Multi-Assets mode + "autoAssetExchange": 0 // only valid for vip2-9 users + }, + { + "asset": "USDT", + "marginAvailable": true, + "autoAssetExchange": 0 //only valid for vip2-9 users + }, + { + "asset": "BNB", + "marginAvailable": false, + "autoAssetExchange": null + } + ], + "symbols": [ + { + "symbol": "BLZUSDT", + "pair": "BLZUSDT", + "contractType": "PERPETUAL", + "deliveryDate": 4133404800000, + "onboardDate": 1598252400000, + "status": "TRADING", + "maintMarginPercent": "2.5000", // ignore + "requiredMarginPercent": "5.0000", // ignore + "baseAsset": "BLZ", + "quoteAsset": "USDT", + "marginAsset": "USDT", + "pricePrecision": 5, // please do not use it as tickSize + "quantityPrecision": 0, // please do not use it as stepSize + "baseAssetPrecision": 8, + "quotePrecision": 8, + "underlyingType": "COIN", + "underlyingSubType": ["STORAGE"], + "settlePlan": 0, + "triggerProtect": "0.15", // threshold for algo order with "priceProtect" + "filters": [ + { + "filterType": "PRICE_FILTER", + "maxPrice": "300", + "minPrice": "0.0001", + "tickSize": "0.0001" + }, + { + "filterType": "LOT_SIZE", + "maxQty": "10000000", + "minQty": "1", + "stepSize": "1" + }, + { + "filterType": "MARKET_LOT_SIZE", + "maxQty": "590119", + "minQty": "1", + "stepSize": "1" + }, + { + "filterType": "MAX_NUM_ORDERS", + "limit": 200 + }, + { + "filterType": "MAX_NUM_ALGO_ORDERS", + "limit": 100 + }, + { + "filterType": "MIN_NOTIONAL", + "notional": "5.0", + }, + { + "filterType": "PERCENT_PRICE", + "multiplierUp": "1.1500", + "multiplierDown": "0.8500", + "multiplierDecimal": 4 + } + ], + "OrderType": [ + "LIMIT", + "MARKET", + "STOP", + "STOP_MARKET", + "TAKE_PROFIT", + "TAKE_PROFIT_MARKET", + "TRAILING_STOP_MARKET" + ], + "timeInForce": [ + "GTC", + "IOC", + "FOK", + "GTX" + ], + "liquidationFee": "0.010000", // liquidation fee rate + "marketTakeBound": "0.30", // the max price difference rate( from mark price) a market order can make + } + ], + "timezone": "UTC" +} + +GET /fapi/v1/exchangeInfo + +Current exchange trading rules and symbol information + +Weight: 1 + +Parameters: NONE + +Order Book +Response: + +{ + "lastUpdateId": 1027024, + "E": 1589436922972, // Message output time + "T": 1589436922959, // Transaction time + "bids": [ + [ + "4.00000000", // PRICE + "431.00000000" // QTY + ] + ], + "asks": [ + [ + "4.00000200", + "12.00000000" + ] + ] +} +GET /fapi/v1/depth + +Weight: + +Adjusted based on the limit: + +Limit Weight +5, 10, 20, 50 2 +100 5 +500 10 +1000 20 +Update Speed: 15ms + +Parameters: + +Name Type Mandatory Description +symbol STRING YES +limit INT NO Default 500; Valid limits:[5, 10, 20, 50, 100, 500, 1000] +Recent Trades List +Response: + +[ + { + "id": 28457, + "price": "4.00000100", + "qty": "12.00000000", + "quoteQty": "48.00", + "time": 1499865549590, + "isBuyerMaker": true, + } +] +GET /fapi/v1/trades + +Get recent market trades + +Weight: 5 + +Parameters: + +Name Type Mandatory Description +symbol STRING YES +limit INT NO Default 500; max 1000. +Market trades means trades filled in the order book. Only market trades will be returned, which means the insurance fund trades and ADL trades won't be returned. +Old Trades Lookup (MARKET_DATA) +Response: + +[ + { + "id": 28457, + "price": "4.00000100", + "qty": "12.00000000", + "quoteQty": "8000.00", + "time": 1499865549590, + "isBuyerMaker": true, + } +] +GET /fapi/v1/historicalTrades + +Get older market historical trades. + +Weight: 20 + +Parameters: + +Name Type Mandatory Description +symbol STRING YES +limit INT NO Default 500; max 1000. +fromId LONG NO TradeId to fetch from. Default gets most recent trades. +Market trades means trades filled in the order book. Only market trades will be returned, which means the insurance fund trades and ADL trades won't be returned. +Only supports returning data from the last three months (the earliest available time is currently 2023-11-21 00:00:00). +Compressed/Aggregate Trades List +Response: + +[ + { + "a": 26129, // Aggregate tradeId + "p": "0.01633102", // Price + "q": "4.70443515", // Quantity + "f": 27781, // First tradeId + "l": 27781, // Last tradeId + "T": 1498793709153, // Timestamp + "m": true, // Was the buyer the maker? + } +] +GET /fapi/v1/aggTrades + +Get compressed, aggregate market trades. Market trades that fill in 100ms with the same price and the same taking side will have the quantity aggregated. + +Weight: 20 + +Parameters: + +Name Type Mandatory Description +symbol STRING YES +fromId LONG NO ID to get aggregate trades from INCLUSIVE. +startTime LONG NO Timestamp in ms to get aggregate trades from INCLUSIVE. +endTime LONG NO Timestamp in ms to get aggregate trades until INCLUSIVE. +limit INT NO Default 500; max 1000. +If both startTime and endTime are sent, time between startTime and endTime must be less than 1 hour. +If fromId, startTime, and endTime are not sent, the most recent aggregate trades will be returned. +Only market trades will be aggregated and returned, which means the insurance fund trades and ADL trades won't be aggregated. +Sending both startTime/endTime and fromId might cause response timeout, please send either fromId or startTime/endTime +Kline/Candlestick Data +Response: + +[ + [ + 1499040000000, // Open time + "0.01634790", // Open + "0.80000000", // High + "0.01575800", // Low + "0.01577100", // Close + "148976.11427815", // Volume + 1499644799999, // Close time + "2434.19055334", // Quote asset volume + 308, // Number of trades + "1756.87402397", // Taker buy base asset volume + "28.46694368", // Taker buy quote asset volume + "17928899.62484339" // Ignore. + ] +] +GET /fapi/v1/klines + +Kline/candlestick bars for a symbol. Klines are uniquely identified by their open time. + +Weight: based on parameter LIMIT + +LIMIT weight +[1,100) 1 +[100, 500) 2 +[500, 1000] 5 +> 1000 10 +Parameters: + +Name Type Mandatory Description +symbol STRING YES +interval ENUM YES +startTime LONG NO +endTime LONG NO +limit INT NO Default 500; max 1500. +If startTime and endTime are not sent, the most recent klines are returned. +Continuous Contract Kline/Candlestick Data +Response: + +[ + [ + 1607444700000, // Open time + "18879.99", // Open + "18900.00", // High + "18878.98", // Low + "18896.13", // Close (or latest price) + "492.363", // Volume + 1607444759999, // Close time + "9302145.66080", // Quote asset volume + 1874, // Number of trades + "385.983", // Taker buy volume + "7292402.33267", // Taker buy quote asset volume + "0" // Ignore. + ] +] +GET /fapi/v1/continuousKlines + +Kline/candlestick bars for a specific contract type. + +Klines are uniquely identified by their open time. + +Weight: based on parameter LIMIT + +LIMIT weight +[1,100) 1 +[100, 500) 2 +[500, 1000] 5 +> 1000 10 +Parameters: + +Name Type Mandatory Description +pair STRING YES +contractType ENUM YES +interval ENUM YES +startTime LONG NO +endTime LONG NO +limit INT NO Default 500; max 1500. +If startTime and endTime are not sent, the most recent klines are returned. + +Contract type: + +PERPETUAL +CURRENT_QUARTER +NEXT_QUARTER +Index Price Kline/Candlestick Data +Response: + +[ + [ + 1591256400000, // Open time + "9653.69440000", // Open + "9653.69640000", // High + "9651.38600000", // Low + "9651.55200000", // Close (or latest price) + "0 ", // Ignore + 1591256459999, // Close time + "0", // Ignore + 60, // Ignore + "0", // Ignore + "0", // Ignore + "0" // Ignore + ] +] +GET /fapi/v1/indexPriceKlines + +Kline/candlestick bars for the index price of a pair. + +Klines are uniquely identified by their open time. + +Weight: based on parameter LIMIT + +LIMIT weight +[1,100) 1 +[100, 500) 2 +[500, 1000] 5 +> 1000 10 +Parameters: + +Name Type Mandatory Description +pair STRING YES +interval ENUM YES +startTime LONG NO +endTime LONG NO +limit INT NO Default 500; max 1500. +If startTime and endTime are not sent, the most recent klines are returned. +Mark Price Kline/Candlestick Data +Response: + +[ + [ + 1591256460000, // Open time + "9653.29201333", // Open + "9654.56401333", // High + "9653.07367333", // Low + "9653.07367333", // Close (or latest price) + "0 ", // Ignore + 1591256519999, // Close time + "0", // Ignore + 60, // Ignore + "0", // Ignore + "0", // Ignore + "0" // Ignore + ] +] +GET /fapi/v1/markPriceKlines + +Kline/candlestick bars for the mark price of a symbol. + +Klines are uniquely identified by their open time. + +Weight: based on parameter LIMIT + +LIMIT weight +[1,100) 1 +[100, 500) 2 +[500, 1000] 5 +> 1000 10 +Parameters: + +Name Type Mandatory Description +symbol STRING YES +interval ENUM YES +startTime LONG NO +endTime LONG NO +limit INT NO Default 500; max 1500. +If startTime and endTime are not sent, the most recent klines are returned. +Premium index Kline Data +Response: + +[ + [ + 1691603820000, // Open time + "-0.00042931", // Open + "-0.00023641", // High + "-0.00059406", // Low + "-0.00043659", // Close + "0", // Ignore + 1691603879999, // Close time + "0", // Ignore + 12, // Ignore + "0", // Ignore + "0", // Ignore + "0" // Ignore + ] +] +GET /fapi/v1/premiumIndexKlines + +Premium index kline bars of a symbol. + +Klines are uniquely identified by their open time. + +Weight: based on parameter LIMIT + +LIMIT weight +[1,100) 1 +[100, 500) 2 +[500, 1000] 5 +> 1000 10 +Parameters: + +Name Type Mandatory Description +symbol STRING YES +interval ENUM YES +startTime LONG NO +endTime LONG NO +limit INT NO Default 500; max 1500. +If startTime and endTime are not sent, the most recent klines are returned. +Mark Price +Response: + +{ + "symbol": "BTCUSDT", + "markPrice": "11793.63104562", // mark price + "indexPrice": "11781.80495970", // index price + "estimatedSettlePrice": "11781.16138815", // Estimated Settle Price, only useful in the last hour before the settlement starts. + "lastFundingRate": "0.00038246", // This is the Latest funding rate + "nextFundingTime": 1597392000000, + "interestRate": "0.00010000", + "time": 1597370495002 +} +OR (when symbol not sent) + +[ + { + "symbol": "BTCUSDT", + "markPrice": "11793.63104562", // mark price + "indexPrice": "11781.80495970", // index price + "estimatedSettlePrice": "11781.16138815", // Estimated Settle Price, only useful in the last hour before the settlement starts. + "lastFundingRate": "0.00038246", // This is the lastest estimated funding rate + "nextFundingTime": 1597392000000, + "interestRate": "0.00010000", + "time": 1597370495002 + } +] +GET /fapi/v1/premiumIndex + +Mark Price and Funding Rate + +Weight: 1 with symbol; 10 without symbol + +Parameters: + +Name Type Mandatory Description +symbol STRING NO +Get Funding Rate History +Response: + +[ + { + "symbol": "BTCUSDT", + "fundingTime": 1698768000000, + "fundingRate": "0.00010000", + "markPrice": "34287.54619963" // mark price associated with a particular funding fee charge + }, + { + "symbol": "BTCUSDT", + "fundingTime": 1698796800000, + "fundingRate": "0.00010000", + "markPrice": "34651.40000000" + } +] +GET /fapi/v1/fundingRate + +Rate Limit share 500/5min/IP rate limit with GET /fapi/v1/fundingInfo + +Parameters: + +Name Type Mandatory Description +symbol STRING NO +startTime LONG NO Timestamp in ms to get funding rate from INCLUSIVE. +endTime LONG NO Timestamp in ms to get funding rate until INCLUSIVE. +limit INT NO Default 100; max 1000 +rate limit on +If startTime and endTime are not sent, the most recent limit datas are returned. +If the number of data between startTime and endTime is larger than limit, return as startTime + limit. +In ascending order. +Get Funding Rate Info +Response: + +[ + { + "symbol": "BLZUSDT", + "adjustedFundingRateCap": "0.02500000", + "adjustedFundingRateFloor": "-0.02500000", + "fundingIntervalHours": 8, + "disclaimer": false // ingore + } +] +GET /fapi/v1/fundingInfo + +rate limit share 500/5min/IP rate limit with GET /fapi/v1/fundingInfo + +Query funding rate info for symbols that had FundingRateCap/ FundingRateFloor / fundingIntervalHours adjustment + +24hr Ticker Price Change Statistics +Response: + +{ + "symbol": "BTCUSDT", + "priceChange": "-94.99999800", + "priceChangePercent": "-95.960", + "weightedAvgPrice": "0.29628482", + "lastPrice": "4.00000200", + "lastQty": "200.00000000", + "openPrice": "99.00000000", + "highPrice": "100.00000000", + "lowPrice": "0.10000000", + "volume": "8913.30000000", + "quoteVolume": "15.30000000", + "openTime": 1499783499040, + "closeTime": 1499869899040, + "firstId": 28385, // First tradeId + "lastId": 28460, // Last tradeId + "count": 76 // Trade count +} +OR + +[ + { + "symbol": "BTCUSDT", + "priceChange": "-94.99999800", + "priceChangePercent": "-95.960", + "weightedAvgPrice": "0.29628482", + "lastPrice": "4.00000200", + "lastQty": "200.00000000", + "openPrice": "99.00000000", + "highPrice": "100.00000000", + "lowPrice": "0.10000000", + "volume": "8913.30000000", + "quoteVolume": "15.30000000", + "openTime": 1499783499040, + "closeTime": 1499869899040, + "firstId": 28385, // First tradeId + "lastId": 28460, // Last tradeId + "count": 76 // Trade count + } +] +GET /fapi/v1/ticker/24hr + +24 hour rolling window price change statistics. +Careful when accessing this with no symbol. + +Weight: + +1 for a single symbol; +40 when the symbol parameter is omitted + +Update Speed: 5s + +Parameters: + +Name Type Mandatory Description +symbol STRING NO +If the symbol is not sent, tickers for all symbols will be returned in an array. +Symbol Price Ticker +Response: + +{ + "symbol": "BTCUSDT", + "price": "6000.01", + "time": 1589437530011 // Transaction time +} +OR + +[ + { + "symbol": "BTCUSDT", + "price": "6000.01", + "time": 1589437530011 + } +] +GET /fapi/v1/ticker/price + +Latest price for a symbol or symbols. + +Weight: + +1 for a single symbol; +2 when the symbol parameter is omitted + +Update Speed: 5s + +Parameters: + +Name Type Mandatory Description +symbol STRING NO +If the symbol is not sent, prices for all symbols will be returned in an array. +Symbol Price Ticker V2 +Response: + +{ + "symbol": "BTCUSDT", + "price": "6000.01", + "time": 1589437530011 // Transaction time +} +OR + +[ + { + "symbol": "BTCUSDT", + "price": "6000.01", + "time": 1589437530011 + } +] +GET /fapi/v2/ticker/price + +Latest price for a symbol or symbols. + +Weight: + +with symbol 1 +no symbol 2 +Update Speed: real time + +Parameters: + +Name Type Mandatory Description +symbol STRING NO +If the symbol is not sent, prices for all symbols will be returned in an array. +Symbol Order Book Ticker +Response: + +{ + "lastUpdateId": 1027024, + "symbol": "BTCUSDT", + "bidPrice": "4.00000000", + "bidQty": "431.00000000", + "askPrice": "4.00000200", + "askQty": "9.00000000", + "time": 1589437530011 // Transaction time +} +OR + +[ + { + "lastUpdateId": 1027024, + "symbol": "BTCUSDT", + "bidPrice": "4.00000000", + "bidQty": "431.00000000", + "askPrice": "4.00000200", + "askQty": "9.00000000", + "time": 1589437530011 + } +] +GET /fapi/v1/ticker/bookTicker + +Best price/qty on the order book for a symbol or symbols. + +Weight: + +2 for a single symbol; +5 when the symbol parameter is omitted + +Update Speed: real time + +Parameters: + +Name Type Mandatory Description +symbol STRING NO +If the symbol is not sent, bookTickers for all symbols will be returned in an array. +The field X-MBX-USED-WEIGHT-1M in response header is not accurate from this endpoint, please ignore. +Open Interest +Response: + +{ + "openInterest": "10659.509", + "symbol": "BTCUSDT", + "time": 1589437530011 // Transaction time +} + +GET /fapi/v1/openInterest + +Get present open interest of a specific symbol. + +Weight: +1 + +Update Speed: 3s + +Parameters: + +Name Type Mandatory Description +symbol STRING YES +Quarterly Contract Settlement Price +Response: + +[ + { + "deliveryTime": 1695945600000, + "deliveryPrice": 27103.00000000 + }, + { + "deliveryTime": 1688083200000, + "deliveryPrice": 30733.60000000 + }, + { + "deliveryTime": 1680220800000, + "deliveryPrice": 27814.20000000 + }, + { + "deliveryTime": 1648166400000, + "deliveryPrice": 44066.30000000 + } +] +GET /futures/data/delivery-price + +Parameters: + +Name Type Mandatory Description +pair STRING YES e.g BTCUSDT +Open Interest Statistics +Response: + +[ + { + "symbol":"BTCUSDT", + "sumOpenInterest":"20403.63700000", // total open interest + "sumOpenInterestValue": "150570784.07809979", // total open interest value + "timestamp":"1583127900000" + }, + { + "symbol":"BTCUSDT", + "sumOpenInterest":"20401.36700000", + "sumOpenInterestValue":"149940752.14464448", + "timestamp":"1583128200000" + }, +] +GET /futures/data/openInterestHist + +Parameters: + +Name Type Mandatory Description +symbol STRING YES +period ENUM YES "5m","15m","30m","1h","2h","4h","6h","12h","1d" +limit LONG NO default 30, max 500 +startTime LONG NO +endTime LONG NO +If startTime and endTime are not sent, the most recent data is returned. +Only the data of the latest 30 days is available. +IP rate limit 1000 requests/5min +Top Trader Long/Short Ratio (Accounts) +Response: + +[ + { + "symbol":"BTCUSDT", + "longShortRatio":"1.8105", // long/short account num ratio of top traders + "longAccount": "0.6442", // long account num ratio of top traders + "shortAccount":"0.3558", // long account num ratio of top traders + "timestamp":"1583139600000" + }, + { + "symbol":"BTCUSDT", + "longShortRatio":"0.5576", + "longAccount": "0.3580", + "shortAccount":"0.6420", + "timestamp":"1583139900000" + }, +] +GET /futures/data/topLongShortAccountRatio + +Parameters: + +Name Type Mandatory Description +symbol STRING YES +period ENUM YES "5m","15m","30m","1h","2h","4h","6h","12h","1d" +limit LONG NO default 30, max 500 +startTime LONG NO +endTime LONG NO +If startTime and endTime are not sent, the most recent data is returned. +Only the data of the latest 30 days is available. +IP rate limit 1000 requests/5min +Top Trader Long/Short Ratio (Positions) +Response: + +[ + { + "symbol":"BTCUSDT", + "longShortRatio":"1.4342",// long/short position ratio of top traders + "longAccount": "0.5891", // long positions ratio of top traders + "shortAccount":"0.4656", // short positions ratio of top traders + "timestamp":"1583139600000" + }, + { + "symbol":"BTCUSDT", + "longShortRatio":"1.4337", + "longAccount": "0.3583", + "shortAccount":"0.6417", + "timestamp":"1583139900000" + }, +] +GET /futures/data/topLongShortPositionRatio + +Parameters: + +Name Type Mandatory Description +symbol STRING YES +period ENUM YES "5m","15m","30m","1h","2h","4h","6h","12h","1d" +limit LONG NO default 30, max 500 +startTime LONG NO +endTime LONG NO +If startTime and endTime are not sent, the most recent data is returned. +Only the data of the latest 30 days is available. +IP rate limit 1000 requests/5min +Long/Short Ratio +Response: + +[ + { + "symbol":"BTCUSDT", // long/short account num ratio of all traders + "longShortRatio":"0.1960", //long account num ratio of all traders + "longAccount": "0.6622", // short account num ratio of all traders + "shortAccount":"0.3378", + "timestamp":"1583139600000" + }, + { + "symbol":"BTCUSDT", + "longShortRatio":"1.9559", + "longAccount": "0.6617", + "shortAccount":"0.3382", + "timestamp":"1583139900000" + }, +] +GET /futures/data/globalLongShortAccountRatio + +Parameters: + +Name Type Mandatory Description +symbol STRING YES +period ENUM YES "5m","15m","30m","1h","2h","4h","6h","12h","1d" +limit LONG NO default 30, max 500 +startTime LONG NO +endTime LONG NO +If startTime and endTime are not sent, the most recent data is returned. +Only the data of the latest 30 days is available. +IP rate limit 1000 requests/5min +Taker Buy/Sell Volume +Response: + +[ + { + "buySellRatio":"1.5586", + "buyVol": "387.3300", + "sellVol":"248.5030", + "timestamp":"1585614900000" + }, + { + "buySellRatio":"1.3104", + "buyVol": "343.9290", + "sellVol":"248.5030", + "timestamp":"1583139900000" + }, +] +GET /futures/data/takerlongshortRatio + +Parameters: + +Name Type Mandatory Description +symbol STRING YES +period ENUM YES "5m","15m","30m","1h","2h","4h","6h","12h","1d" +limit LONG NO default 30, max 500 +startTime LONG NO +endTime LONG NO +If startTime and endTime are not sent, the most recent data is returned. +Only the data of the latest 30 days is available. +IP rate limit 1000 requests/5min +Basis +Response: + +[ + { + "indexPrice": "34400.15945055", + "contractType": "PERPETUAL", + "basisRate": "0.0004", + "futuresPrice": "34414.10", + "annualizedBasisRate": "", + "basis": "13.94054945", + "pair": "BTCUSDT", + "timestamp": 1698742800000 + } +] +GET /futures/data/basis + +Parameters: + +Name Type Mandatory Description +pair STRING YES BTCUSDT +contractType ENUM YES CURRENT_QUARTER, NEXT_QUARTER, PERPETUAL +period ENUM YES "5m","15m","30m","1h","2h","4h","6h","12h","1d" +limit LONG YES Default 30,Max 500 +startTime LONG NO +endTime LONG NO +If startTime and endTime are not sent, the most recent data is returned. +Only the data of the latest 30 days is available. +Composite Index Symbol Information +Response: + +[ + { + "symbol": "DEFIUSDT", + "time": 1589437530011, // Current time + "component": "baseAsset", //Component asset + "baseAssetList":[ + { + "baseAsset":"BAL", + "quoteAsset": "USDT", + "weightInQuantity":"1.04406228", + "weightInPercentage":"0.02783900" + }, + { + "baseAsset":"BAND", + "quoteAsset": "USDT", + "weightInQuantity":"3.53782729", + "weightInPercentage":"0.03935200" + } + ] + } +] + +GET /fapi/v1/indexInfo + +Weight: with symbol 1; without symbol 10 + +Parameters: + +Name Type Mandatory Description +symbol STRING NO +Only for composite index symbols +Multi-Assets Mode Asset Index +Response: + +{ + "symbol": "ADAUSD", + "time": 1635740268004, + "index": "1.92957370", + "bidBuffer": "0.10000000", + "askBuffer": "0.10000000", + "bidRate": "1.73661633", + "askRate": "2.12253107", + "autoExchangeBidBuffer": "0.05000000", + "autoExchangeAskBuffer": "0.05000000", + "autoExchangeBidRate": "1.83309501", + "autoExchangeAskRate": "2.02605238" +} +Or(without symbol) + +[ + { + "symbol": "ADAUSD", + "time": 1635740268004, + "index": "1.92957370", + "bidBuffer": "0.10000000", + "askBuffer": "0.10000000", + "bidRate": "1.73661633", + "askRate": "2.12253107", + "autoExchangeBidBuffer": "0.05000000", + "autoExchangeAskBuffer": "0.05000000", + "autoExchangeBidRate": "1.83309501", + "autoExchangeAskRate": "2.02605238" + } +] +GET /fapi/v1/assetIndex + +asset index for Multi-Assets mode + +Weight: 1 for a single symbol; 10 when the symbol parameter is omitted + +Parameters: + +Name Type Mandatory Description +symbol STRING NO Asset pair +Query Index Price Constituents +Response: + +{ + "symbol": "BTCUSDT", + "time": 1697421272043, + "constituents": [ + { + "exchange": "binance", + "symbol": "BTCUSDT" + }, + { + "exchange": "okex", + "symbol": "BTC-USDT" + }, + { + "exchange": "huobi", + "symbol": "btcusdt" + }, + { + "exchange": "coinbase", + "symbol": "BTC-USDT" + } + ] +} +GET /fapi/v1/constituents + +Query index price constituents + +Weight: 2 + +Parameters: + +Name Type Mandatory Description +symbol STRING YES symbol +Websocket Market Streams +The connection method for Websocket is: + +Base Url: wss://fstream.binance.com +Streams can be access either in a single raw stream or a combined stream +Raw streams are accessed at /ws/ +Combined streams are accessed at /stream?streams=// +Example: +wss://fstream.binance.com/ws/bnbusdt@aggTrade +wss://fstream.binance.com/stream?streams=bnbusdt@aggTrade/btcusdt@markPrice +Combined stream events are wrapped as follows: {"stream":"","data":} + +All symbols for streams are lowercase + +A single connection is only valid for 24 hours; expect to be disconnected at the 24 hour mark + +Websocket server will send a ping frame every 3 minutes. + +If the websocket server does not receive a pong frame back from the connection within a 10 minute period, the connection will be disconnected. +When you receive a ping, you must send a pong with a copy of ping's payload as soon as possible. +Unsolicited pong frames are allowed, but will not prevent disconnection. It is recommended that the payload for these pong frames are empty. +WebSocket connections have a limit of 10 incoming messages per second. + +A connection that goes beyond the limit will be disconnected; IPs that are repeatedly disconnected may be banned. + +A single connection is not recommended to listen to more than 200 streams. + +Considering the possible data latency from RESTful endpoints during an extremely volatile market, it is highly recommended to get the order status, position, etc from the Websocket user data stream. + +Live Subscribing/Unsubscribing to streams +The following data can be sent through the websocket instance in order to subscribe/unsubscribe from streams. Examples can be seen below. +The id used in the JSON payloads is an unsigned INT used as an identifier to uniquely identify the messages going back and forth. +Subscribe to a stream +Response + + { + "result": null, + "id": 1 + } +Request + +{ +"method": "SUBSCRIBE", +"params": +[ +"btcusdt@aggTrade", +"btcusdt@depth" +], +"id": 1 +} + +Unsubscribe to a stream +Response + + { + "result": null, + "id": 312 + } +Request +{ +"method": "UNSUBSCRIBE", +"params": +[ +"btcusdt@depth" +], +"id": 312 +} + +Listing Subscriptions +Response + + { + "result": [ + "btcusdt@aggTrade" + ], + "id": 3 + } +Request +{ +"method": "LIST_SUBSCRIPTIONS", +"id": 3 +} + +Setting Properties +Currently, the only property can be set is to set whether combined stream payloads are enabled are not. The combined property is set to false when connecting using /ws/ ("raw streams") and true when connecting using /stream/. + +Response + + { + "result": null, + "id": 5 + } +Request +{ +"method": "SET_PROPERTY", +"params": +[ +"combined", +true +], +"id": 5 +} + +Retrieving Properties +Response + + { + "result": true, // Indicates that combined is set to true. + "id": 2 + } +Request +{ +"method": "GET_PROPERTY", +"params": +[ +"combined" +], +"id": 2 +} + +Error Messages +Error Message Description +{"code": 0, "msg": "Unknown property"} Parameter used in the SET_PROPERTY or GET_PROPERTY was invalid +{"code": 1, "msg": "Invalid value type: expected Boolean"} Value should only be true or false +{"code": 2, "msg": "Invalid request: property name must be a string"} Property name provided was invalid +{"code": 2, "msg": "Invalid request: request ID must be an unsigned integer"} Parameter id had to be provided or the value provided in the id parameter is an unsupported type +{"code": 2, "msg": "Invalid request: unknown variant %s, expected one of SUBSCRIBE, UNSUBSCRIBE, LIST_SUBSCRIPTIONS, SET_PROPERTY, GET_PROPERTY at line 1 column 28"} Possible typo in the provided method or provided method was neither of the expected values +{"code": 2, "msg": "Invalid request: too many parameters"} Unnecessary parameters provided in the data +{"code": 2, "msg": "Invalid request: property name must be a string"} Property name was not provided +{"code": 2, "msg": "Invalid request: missing field method at line 1 column 73"} method was not provided in the data +{"code":3,"msg":"Invalid JSON: expected value at line %s column %s"} JSON data sent has incorrect syntax. +Aggregate Trade Streams +Payload: + +{ + "e": "aggTrade", // Event type + "E": 123456789, // Event time + "s": "BTCUSDT", // Symbol + "a": 5933014, // Aggregate trade ID + "p": "0.001", // Price + "q": "100", // Quantity + "f": 100, // First trade ID + "l": 105, // Last trade ID + "T": 123456785, // Trade time + "m": true, // Is the buyer the market maker? +} +The Aggregate Trade Streams push market trade information that is aggregated for fills with same price and taking side every 100 milliseconds. + +Stream Name: +@aggTrade + +Update Speed: 100ms + +Only market trades will be aggregated, which means the insurance fund trades and ADL trades won't be aggregated. +Mark Price Stream +Payload: + + { + "e": "markPriceUpdate", // Event type + "E": 1562305380000, // Event time + "s": "BTCUSDT", // Symbol + "p": "11794.15000000", // Mark price + "i": "11784.62659091", // Index price + "P": "11784.25641265", // Estimated Settle Price, only useful in the last hour before the settlement starts + "r": "0.00038167", // Funding rate + "T": 1562306400000 // Next funding time + } +Mark price and funding rate for a single symbol pushed every 3 seconds or every second. + +Stream Name: +@markPrice or @markPrice@1s + +Update Speed: 3000ms or 1000ms + +Mark Price Stream for All market +Payload: + +[ + { + "e": "markPriceUpdate", // Event type + "E": 1562305380000, // Event time + "s": "BTCUSDT", // Symbol + "p": "11185.87786614", // Mark price + "i": "11784.62659091" // Index price + "P": "11784.25641265", // Estimated Settle Price, only useful in the last hour before the settlement starts + "r": "0.00030000", // Funding rate + "T": 1562306400000 // Next funding time + } +] +Mark price and funding rate for all symbols pushed every 3 seconds or every second. + +Stream Name: +!markPrice@arr or !markPrice@arr@1s + +Update Speed: 3000ms or 1000ms + +Kline/Candlestick Streams +Payload: + +{ + "e": "kline", // Event type + "E": 1638747660000, // Event time + "s": "BTCUSDT", // Symbol + "k": { + "t": 1638747660000, // Kline start time + "T": 1638747719999, // Kline close time + "s": "BTCUSDT", // Symbol + "i": "1m", // Interval + "f": 100, // First trade ID + "L": 200, // Last trade ID + "o": "0.0010", // Open price + "c": "0.0020", // Close price + "h": "0.0025", // High price + "l": "0.0015", // Low price + "v": "1000", // Base asset volume + "n": 100, // Number of trades + "x": false, // Is this kline closed? + "q": "1.0000", // Quote asset volume + "V": "500", // Taker buy base asset volume + "Q": "0.500", // Taker buy quote asset volume + "B": "123456" // Ignore + } +} +The Kline/Candlestick Stream push updates to the current klines/candlestick every 250 milliseconds (if existing). + +Kline/Candlestick chart intervals: + +m -> minutes; h -> hours; d -> days; w -> weeks; M -> months + +1m +3m +5m +15m +30m +1h +2h +4h +6h +8h +12h +1d +3d +1w +1M +Stream Name: +@kline_ + +Update Speed: 250ms + +Continuous Contract Kline/Candlestick Streams +Payload: + +{ + "e":"continuous_kline", // Event type + "E":1607443058651, // Event time + "ps":"BTCUSDT", // Pair + "ct":"PERPETUAL" // Contract type + "k":{ + "t":1607443020000, // Kline start time + "T":1607443079999, // Kline close time + "i":"1m", // Interval + "f":116467658886, // First updateId + "L":116468012423, // Last updateId + "o":"18787.00", // Open price + "c":"18804.04", // Close price + "h":"18804.04", // High price + "l":"18786.54", // Low price + "v":"197.664", // volume + "n": 543, // Number of trades + "x":false, // Is this kline closed? + "q":"3715253.19494", // Quote asset volume + "V":"184.769", // Taker buy volume + "Q":"3472925.84746", //Taker buy quote asset volume + "B":"0" // Ignore + } +} +Contract type: + +perpetual +current_quarter +next_quarter +Kline/Candlestick chart intervals: + +m -> minutes; h -> hours; d -> days; w -> weeks; M -> months + +1m +3m +5m +15m +30m +1h +2h +4h +6h +8h +12h +1d +3d +1w +1M +Stream Name: +_@continuousKline_ + +Update Speed: 250ms + +Individual Symbol Mini Ticker Stream +Payload: + + { + "e": "24hrMiniTicker", // Event type + "E": 123456789, // Event time + "s": "BTCUSDT", // Symbol + "c": "0.0025", // Close price + "o": "0.0010", // Open price + "h": "0.0025", // High price + "l": "0.0010", // Low price + "v": "10000", // Total traded base asset volume + "q": "18" // Total traded quote asset volume + } +24hr rolling window mini-ticker statistics for a single symbol. These are NOT the statistics of the UTC day, but a 24hr rolling window from requestTime to 24hrs before. + +Stream Name: +@miniTicker + +Update Speed: 500ms + +All Market Mini Tickers Stream +Payload: + +[ + { + "e": "24hrMiniTicker", // Event type + "E": 123456789, // Event time + "s": "BTCUSDT", // Symbol + "c": "0.0025", // Close price + "o": "0.0010", // Open price + "h": "0.0025", // High price + "l": "0.0010", // Low price + "v": "10000", // Total traded base asset volume + "q": "18" // Total traded quote asset volume + } +] +24hr rolling window mini-ticker statistics for all symbols. These are NOT the statistics of the UTC day, but a 24hr rolling window from requestTime to 24hrs before. Note that only tickers that have changed will be present in the array. + +Stream Name: +!miniTicker@arr + +Update Speed: 1000ms + +Individual Symbol Ticker Streams +Payload: + +{ + "e": "24hrTicker", // Event type + "E": 123456789, // Event time + "s": "BTCUSDT", // Symbol + "p": "0.0015", // Price change + "P": "250.00", // Price change percent + "w": "0.0018", // Weighted average price + "c": "0.0025", // Last price + "Q": "10", // Last quantity + "o": "0.0010", // Open price + "h": "0.0025", // High price + "l": "0.0010", // Low price + "v": "10000", // Total traded base asset volume + "q": "18", // Total traded quote asset volume + "O": 0, // Statistics open time + "C": 86400000, // Statistics close time + "F": 0, // First trade ID + "L": 18150, // Last trade Id + "n": 18151 // Total number of trades +} +24hr rolling window ticker statistics for a single symbol. These are NOT the statistics of the UTC day, but a 24hr rolling window from requestTime to 24hrs before. + +Stream Name: +@ticker + +Update Speed: 2000ms + +All Market Tickers Streams +Payload: + +[ + { + "e": "24hrTicker", // Event type + "E": 123456789, // Event time + "s": "BTCUSDT", // Symbol + "p": "0.0015", // Price change + "P": "250.00", // Price change percent + "w": "0.0018", // Weighted average price + "c": "0.0025", // Last price + "Q": "10", // Last quantity + "o": "0.0010", // Open price + "h": "0.0025", // High price + "l": "0.0010", // Low price + "v": "10000", // Total traded base asset volume + "q": "18", // Total traded quote asset volume + "O": 0, // Statistics open time + "C": 86400000, // Statistics close time + "F": 0, // First trade ID + "L": 18150, // Last trade Id + "n": 18151 // Total number of trades + } +] +24hr rolling window ticker statistics for all symbols. These are NOT the statistics of the UTC day, but a 24hr rolling window from requestTime to 24hrs before. Note that only tickers that have changed will be present in the array. + +Stream Name: +!ticker@arr + +Update Speed: 1000ms + +Individual Symbol Book Ticker Streams +Payload: + +{ + "e":"bookTicker", // event type + "u":400900217, // order book updateId + "E": 1568014460893, // event time + "T": 1568014460891, // transaction time + "s":"BNBUSDT", // symbol + "b":"25.35190000", // best bid price + "B":"31.21000000", // best bid qty + "a":"25.36520000", // best ask price + "A":"40.66000000" // best ask qty +} +Pushes any update to the best bid or ask's price or quantity in real-time for a specified symbol. + +Stream Name: @bookTicker + +Update Speed: Real-time + +All Book Tickers Stream +Payload: + +{ + // Same as @bookTicker payload +} +Pushes any update to the best bid or ask's price or quantity in real-time for all symbols. + +Stream Name: !bookTicker + +Update Speed: Real-time, Starting from December 20th, 2023, it will be updated every 5 seconds. + +Liquidation Order Streams +Payload: + +{ + + "e":"forceOrder", // Event Type + "E":1568014460893, // Event Time + "o":{ + + "s":"BTCUSDT", // Symbol + "S":"SELL", // Side + "o":"LIMIT", // Order Type + "f":"IOC", // Time in Force + "q":"0.014", // Original Quantity + "p":"9910", // Price + "ap":"9910", // Average Price + "X":"FILLED", // Order Status + "l":"0.014", // Order Last Filled Quantity + "z":"0.014", // Order Filled Accumulated Quantity + "T":1568014460893, // Order Trade Time + + } + +} +The Liquidation Order Snapshot Streams push force liquidation order information for specific symbol. + +For each symbol,only the latest one liquidation order within 1000ms will be pushed as the snapshot. If no liquidation happens in the interval of 1000ms, no stream will be pushed. + +Stream Name: @forceOrder + +Update Speed: 1000ms + +All Market Liquidation Order Streams +Payload: + +{ + + "e":"forceOrder", // Event Type + "E":1568014460893, // Event Time + "o":{ + + "s":"BTCUSDT", // Symbol + "S":"SELL", // Side + "o":"LIMIT", // Order Type + "f":"IOC", // Time in Force + "q":"0.014", // Original Quantity + "p":"9910", // Price + "ap":"9910", // Average Price + "X":"FILLED", // Order Status + "l":"0.014", // Order Last Filled Quantity + "z":"0.014", // Order Filled Accumulated Quantity + "T":1568014460893, // Order Trade Time + + } + +} +The All Liquidation Order Snapshot Streams push force liquidation order information for all symbols in the market. + +For each symbol,only the latest one liquidation order within 1000ms will be pushed as the snapshot. If no liquidation happens in the interval of 1000ms, no stream will be pushed. + +Stream Name: !forceOrder@arr + +Update Speed: 1000ms + +Partial Book Depth Streams +Payload: + +{ + "e": "depthUpdate", // Event type + "E": 1571889248277, // Event time + "T": 1571889248276, // Transaction time + "s": "BTCUSDT", + "U": 390497796, + "u": 390497878, + "pu": 390497794, + "b": [ // Bids to be updated + [ + "7403.89", // Price Level to be + "0.002" // Quantity + ], + [ + "7403.90", + "3.906" + ], + [ + "7404.00", + "1.428" + ], + [ + "7404.85", + "5.239" + ], + [ + "7405.43", + "2.562" + ] + ], + "a": [ // Asks to be updated + [ + "7405.96", // Price level to be + "3.340" // Quantity + ], + [ + "7406.63", + "4.525" + ], + [ + "7407.08", + "2.475" + ], + [ + "7407.15", + "4.800" + ], + [ + "7407.20", + "0.175" + ] + ] +} +Top bids and asks, Valid are 5, 10, or 20. + +Stream Names: @depth OR @depth@500ms OR @depth@100ms. + +Update Speed: 250ms, 500ms or 100ms + +Diff. Book Depth Streams +Payload: + +{ + "e": "depthUpdate", // Event type + "E": 123456789, // Event time + "T": 123456788, // Transaction time + "s": "BTCUSDT", // Symbol + "U": 157, // First update ID in event + "u": 160, // Final update ID in event + "pu": 149, // Final update Id in last stream(ie `u` in last stream) + "b": [ // Bids to be updated + [ + "0.0024", // Price level to be updated + "10" // Quantity + ] + ], + "a": [ // Asks to be updated + [ + "0.0026", // Price level to be updated + "100" // Quantity + ] + ] +} +Bids and asks, pushed every 250 milliseconds, 500 milliseconds, 100 milliseconds (if existing) + +Stream Name: +@depth OR @depth@500ms OR @depth@100ms + +Update Speed: 250ms, 500ms, 100ms + +How to manage a local order book correctly +Open a stream to wss://fstream.binance.com/stream?streams=btcusdt@depth. +Buffer the events you receive from the stream. For same price, latest received update covers the previous one. +Get a depth snapshot from https://fapi.binance.com/fapi/v1/depth?symbol=BTCUSDT&limit=1000 . +Drop any event where u is < lastUpdateId in the snapshot. +The first processed event should have U <= lastUpdateId AND u >= lastUpdateId +While listening to the stream, each new event's pu should be equal to the previous event's u, otherwise initialize the process from step 3. +The data in each event is the absolute quantity for a price level. +If the quantity is 0, remove the price level. +Receiving an event that removes a price level that is not in your local order book can happen and is normal. +Composite Index Symbol Information Streams +Payload: + +{ + "e":"compositeIndex", // Event type + "E":1602310596000, // Event time + "s":"DEFIUSDT", // Symbol + "p":"554.41604065", // Price + "C":"baseAsset", + "c":[ // Composition + { + "b":"BAL", // Base asset + "q":"USDT", // Quote asset + "w":"1.04884844", // Weight in quantity + "W":"0.01457800", // Weight in percentage + "i":"24.33521021" // Index price + }, + { + "b":"BAND", + "q":"USDT" , + "w":"3.53782729", + "W":"0.03935200", + "i":"7.26420084" + } + ] +} +Composite index information for index symbols pushed every second. + +Stream Name: @compositeIndex + +Update Speed: 1000ms + +Contract Info Stream +Payload: + +{ + "e":"contractInfo", // Event Type + "E":1669356423908, // Event Time + "s":"IOTAUSDT", // Symbol + "ps":"IOTAUSDT", // Pair + "ct":"PERPETUAL", // Contract type + "dt":4133404800000, // Delivery date time + "ot":1569398400000, // onboard date time + "cs":"TRADING", // Contract status + "bks":[ + { + "bs":1, // Notional bracket + "bnf":0, // Floor notional of this bracket + "bnc":5000, // Cap notional of this bracket + "mmr":0.01, // Maintenance ratio for this bracket + "cf":0, // Auxiliary number for quick calculation + "mi":21, // Min leverage for this bracket + "ma":50 // Max leverage for this bracket + }, + { + "bs":2, + "bnf":5000, + "bnc":25000, + "mmr":0.025, + "cf":75, + "mi":11, + "ma":20 + } + ] +} +ContractInfo stream pushes when contract info updates(listing/settlement/contract bracket update). bks field only shows up when bracket gets updated. + +Stream Name: !contractInfo + +Update Speed: Real-time + +Multi-Assets Mode Asset Index +Payload: + +[ + { + "e":"assetIndexUpdate", + "E":1686749230000, + "s":"ADAUSD", // asset index symbol + "i":"0.27462452", // index price + "b":"0.10000000", // bid buffer + "a":"0.10000000", // ask buffer + "B":"0.24716207", // bid rate + "A":"0.30208698", // ask rate + "q":"0.05000000", // auto exchange bid buffer + "g":"0.05000000", // auto exchange ask buffer + "Q":"0.26089330", // auto exchange bid rate + "G":"0.28835575" // auto exchange ask rate + }, + { + "e":"assetIndexUpdate", + "E":1686749230000, + "s":"USDTUSD", + "i":"0.99987691", + "b":"0.00010000", + "a":"0.00010000", + "B":"0.99977692", + "A":"0.99997689", + "q":"0.00010000", + "g":"0.00010000", + "Q":"0.99977692", + "G":"0.99997689" + } +] +Asset index for multi-assets mode user + +Stream Name: !assetIndex@arrOR @assetIndex + +Update Speed: 1s + +Account/Trades Endpoints + Considering the possible data latency from RESTful endpoints during an extremely volatile market, it is highly recommended to get the order status, position, etc from the Websocket user data stream. +New Future Account Transfer +Please find details from here. + +Get Future Account Transaction History List (USER_DATA) +Please find details from here. + +Change Position Mode(TRADE) +Response: + +{ + "code": 200, + "msg": "success" +} +POST /fapi/v1/positionSide/dual + +Change user's position mode (Hedge Mode or One-way Mode ) on EVERY symbol + +Weight: 1 + +Parameters: + +Name Type Mandatory Description +dualSidePosition STRING YES "true": Hedge Mode; "false": One-way Mode +recvWindow LONG NO +timestamp LONG YES +Get Current Position Mode(USER_DATA) +Response: + +{ + "dualSidePosition": true // "true": Hedge Mode; "false": One-way Mode +} +GET /fapi/v1/positionSide/dual + +Get user's position mode (Hedge Mode or One-way Mode ) on EVERY symbol + +Weight: 30 + +Parameters: + +Name Type Mandatory Description +recvWindow LONG NO +timestamp LONG YES +Change Multi-Assets Mode (TRADE) +Response: + +{ + "code": 200, + "msg": "success" +} +POST /fapi/v1/multiAssetsMargin + +Change user's Multi-Assets mode (Multi-Assets Mode or Single-Asset Mode) on Every symbol + +Weight: 1 + +Parameters: + +Name Type Mandatory Description +multiAssetsMargin STRING YES "true": Multi-Assets Mode; "false": Single-Asset Mode +recvWindow LONG NO +timestamp LONG YES +Get Current Multi-Assets Mode (USER_DATA) +Response: + +{ + "multiAssetsMargin": true // "true": Multi-Assets Mode; "false": Single-Asset Mode +} +GET /fapi/v1/multiAssetsMargin + +Get user's Multi-Assets mode (Multi-Assets Mode or Single-Asset Mode) on Every symbol + +Weight: 30 + +Parameters: + +Name Type Mandatory Description +recvWindow LONG NO +timestamp LONG YES +Toggle BNB Burn On Futures Trade (TRADE) +Response: + +{ + "code": 200, + "msg": "success" +} +POST /fapi/v1/feeBurn (HMAC SHA256) + +Change user's BNB Fee Discount (Fee Discount On or Fee Discount Off ) on EVERY symbol + +Weight: 1 + +Parameters: + +Name Type Mandatory Description +feeBurn STRING YES "true": Fee Discount On; "false": Fee Discount Off +recvWindow LONG NO +timestamp LONG YES +Get BNB Burn Status (USER_DATA) +Response: + +{ + "feeBurn": true // "true": Fee Discount On; "false": Fee Discount Off +} +GET /fapi/v1/feeBurn (HMAC SHA256) + +Get user's BNB Fee Discount (Fee Discount On or Fee Discount Off ) on EVERY symbol + +Weight: 30 + +Parameters: + +Name Type Mandatory Description +recvWindow LONG NO +timestamp LONG YES +New Order (TRADE) +Response: + +{ + "clientOrderId": "testOrder", + "cumQty": "0", + "cumQuote": "0", + "executedQty": "0", + "orderId": 22542179, + "avgPrice": "0.00000", + "origQty": "10", + "price": "0", + "reduceOnly": false, + "side": "BUY", + "positionSide": "SHORT", + "status": "NEW", + "stopPrice": "9300", // please ignore when order type is TRAILING_STOP_MARKET + "closePosition": false, // if Close-All + "symbol": "BTCUSDT", + "timeInForce": "GTD", + "type": "TRAILING_STOP_MARKET", + "origType": "TRAILING_STOP_MARKET", + "activatePrice": "9020", // activation price, only return with TRAILING_STOP_MARKET order + "priceRate": "0.3", // callback rate, only return with TRAILING_STOP_MARKET order + "updateTime": 1566818724722, + "workingType": "CONTRACT_PRICE", + "priceProtect": false, // if conditional order trigger is protected + "priceMatch": "NONE", //price match mode + "selfTradePreventionMode": "NONE", //self trading preventation mode + "goodTillDate": 1693207680000 //order pre-set auot cancel time for TIF GTD order +} +POST /fapi/v1/order + +Send in a new order. + +Weight: 0 + +Parameters: + +Name Type Mandatory Description +symbol STRING YES +side ENUM YES +positionSide ENUM NO Default BOTH for One-way Mode ; LONG or SHORT for Hedge Mode. It must be sent in Hedge Mode. +type ENUM YES +timeInForce ENUM NO +quantity DECIMAL NO Cannot be sent with closePosition=true(Close-All) +reduceOnly STRING NO "true" or "false". default "false". Cannot be sent in Hedge Mode; cannot be sent with closePosition=true +price DECIMAL NO +newClientOrderId STRING NO A unique id among open orders. Automatically generated if not sent. Can only be string following the rule: ^[\.A-Z\:/a-z0-9_-]{1,36}$ +stopPrice DECIMAL NO Used with STOP/STOP_MARKET or TAKE_PROFIT/TAKE_PROFIT_MARKET orders. +closePosition STRING NO true, false;Close-All,used with STOP_MARKET or TAKE_PROFIT_MARKET. +activationPrice DECIMAL NO Used with TRAILING_STOP_MARKET orders, default as the latest price(supporting different workingType) +callbackRate DECIMAL NO Used with TRAILING_STOP_MARKET orders, min 0.1, max 10, where 1 for 1% +workingType ENUM NO stopPrice triggered by: "MARK_PRICE", "CONTRACT_PRICE". Default "CONTRACT_PRICE" +priceProtect STRING NO "TRUE" or "FALSE", default "FALSE". Used with STOP/STOP_MARKET or TAKE_PROFIT/TAKE_PROFIT_MARKET orders. +newOrderRespType ENUM NO "ACK", "RESULT", default "ACK" +priceMatch ENUM NO only avaliable for LIMIT/STOP/TAKE_PROFIT order; can be set to OPPONENT/ OPPONENT_5/ OPPONENT_10/ OPPONENT_20: /QUEUE/ QUEUE_5/ QUEUE_10/ QUEUE_20; Can't be passed together with price +selfTradePreventionMode ENUM NO NONE:No STP / EXPIRE_TAKER:expire taker order when STP triggers/ EXPIRE_MAKER:expire maker order when STP triggers/ EXPIRE_BOTH:expire both orders when STP triggers; default NONE +goodTillDate LONG NO order cancel time for timeInForce GTD, mandatory when timeInforce set to GTD; order the timestamp only retains second-level precision, ms part will be ignored; The goodTillDate timestamp must be greater than the current time plus 600 seconds and smaller than 253402300799000 +recvWindow LONG NO +timestamp LONG YES +Additional mandatory parameters based on type: + +Type Additional mandatory parameters +LIMIT timeInForce, quantity, price +MARKET quantity +STOP/TAKE_PROFIT quantity, price, stopPrice +STOP_MARKET/TAKE_PROFIT_MARKET stopPrice +TRAILING_STOP_MARKET quantity,callbackRate +Order with type STOP, parameter timeInForce can be sent ( default GTC). +Order with type TAKE_PROFIT, parameter timeInForce can be sent ( default GTC). +Condition orders will be triggered when: + +If parameterpriceProtectis sent as true: +when price reaches the stopPrice ,the difference rate between "MARK_PRICE" and "CONTRACT_PRICE" cannot be larger than the "triggerProtect" of the symbol +"triggerProtect" of a symbol can be got from GET /fapi/v1/exchangeInfo +STOP, STOP_MARKET: +BUY: latest price ("MARK_PRICE" or "CONTRACT_PRICE") >= stopPrice +SELL: latest price ("MARK_PRICE" or "CONTRACT_PRICE") <= stopPrice +TAKE_PROFIT, TAKE_PROFIT_MARKET: +BUY: latest price ("MARK_PRICE" or "CONTRACT_PRICE") <= stopPrice +SELL: latest price ("MARK_PRICE" or "CONTRACT_PRICE") >= stopPrice +TRAILING_STOP_MARKET: +BUY: the lowest price after order placed <= activationPrice, and the latest price >= the lowest price * (1 + callbackRate) +SELL: the highest price after order placed >= activationPrice, and the latest price <= the highest price * (1 - callbackRate) +For TRAILING_STOP_MARKET, if you got such error code. +{"code": -2021, "msg": "Order would immediately trigger."} +means that the parameters you send do not meet the following requirements: + +BUY: activationPrice should be smaller than latest price. +SELL: activationPrice should be larger than latest price. +If newOrderRespType is sent as RESULT : + +MARKET order: the final FILLED result of the order will be return directly. +LIMIT order with special timeInForce: the final status result of the order(FILLED or EXPIRED) will be returned directly. +STOP_MARKET, TAKE_PROFIT_MARKET with closePosition=true: + +Follow the same rules for condition orders. +If triggered,close all current long position( if SELL) or current short position( if BUY). +Cannot be used with quantity paremeter +Cannot be used with reduceOnly parameter +In Hedge Mode,cannot be used with BUY orders in LONG position side. and cannot be used with SELL orders in SHORT position side +selfTradePreventionMode is only effective when timeInForce set to IOC or GTC or GTD. + +In extreme market conditions, timeInForce GTD order auto cancel time might be delayed comparing to goodTillDate + +Test Order(TRADE) +Response: + +response result matches request +POST /fapi/v1/order/test + +Testing order request, this order will not be submitted to matching engine + +Parameters: + +Please refer to POST /fapi/v1/order + +Modify Order (TRADE) +Response: + +{ + "orderId": 20072994037, + "symbol": "BTCUSDT", + "pair": "BTCUSDT", + "status": "NEW", + "clientOrderId": "LJ9R4QZDihCaS8UAOOLpgW", + "price": "30005", + "avgPrice": "0.0", + "origQty": "1", + "executedQty": "0", + "cumQty": "0", + "cumBase": "0", + "timeInForce": "GTC", + "type": "LIMIT", + "reduceOnly": false, + "closePosition": false, + "side": "BUY", + "positionSide": "LONG", + "stopPrice": "0", + "workingType": "CONTRACT_PRICE", + "priceProtect": false, + "origType": "LIMIT", + "priceMatch": "NONE", //price match mode + "selfTradePreventionMode": "NONE", //self trading preventation mode + "goodTillDate": 0 //order pre-set auot cancel time for TIF GTD order + "updateTime": 1629182711600 +} +PUT /fapi/v1/order + +Order modify function, currently only LIMIT order modification is supported, modified orders will be reordered in the match queue + +Weight: 1 on 10s order rate limit(X-MBX-ORDER-COUNT-10S); 1 on 1min order rate limit(X-MBX-ORDER-COUNT-1M); 1 on IP rate limit(x-mbx-used-weight-1m); + +Parameters: + +Name Type Mandatory Description +orderId LONG NO +origClientOrderId STRING NO +symbol STRING YES +side ENUM YES SELL, BUY; side needs to be same as origin order +quantity DECIMAL YES Order quantity, cannot be sent with closePosition=true +price DECIMAL YES +priceMatch ENUM NO only avaliable for LIMIT/STOP/TAKE_PROFIT order; can be set to OPPONENT/ OPPONENT_5/ OPPONENT_10/ OPPONENT_20: /QUEUE/ QUEUE_5/ QUEUE_10/ QUEUE_20; Can't be passed together with price +recvWindow LONG NO +timestamp LONG YES +Either orderId or origClientOrderId must be sent, and the orderId will prevail if both are sent. +Both quantity and price must be sent, which is different from dapi modify order endpoint. +When the new quantity or price doesn't satisfy PRICE_FILTER / PERCENT_FILTER / LOT_SIZE, amendment will be rejected and the order will stay as it is. +However the order will be cancelled by the amendment in the following situations: +when the order is in partially filled status and the new quantity <= executedQty +When the order is GTX and the new price will cause it to be executed immediately +One order can only be modfied for less than 10000 times +Order modification will preserve the original selfTradePreventionMode of the order +Place Multiple Orders (TRADE) +Response: + +[ + { + "clientOrderId": "testOrder", + "cumQty": "0", + "cumQuote": "0", + "executedQty": "0", + "orderId": 22542179, + "avgPrice": "0.00000", + "origQty": "10", + "price": "0", + "reduceOnly": false, + "side": "BUY", + "positionSide": "SHORT", + "status": "NEW", + "stopPrice": "9300", // please ignore when order type is TRAILING_STOP_MARKET + "symbol": "BTCUSDT", + "timeInForce": "GTC", + "type": "TRAILING_STOP_MARKET", + "origType": "TRAILING_STOP_MARKET", + "activatePrice": "9020", // activation price, only return with TRAILING_STOP_MARKET order + "priceRate": "0.3", // callback rate, only return with TRAILING_STOP_MARKET order + "updateTime": 1566818724722, + "workingType": "CONTRACT_PRICE", + "priceProtect": false, // if conditional order trigger is protected + "priceMatch": "NONE", //price match mode + "selfTradePreventionMode": "NONE", //self trading preventation mode + "goodTillDate": 0 //order pre-set auot cancel time for TIF GTD order + }, + { + "code": -2022, + "msg": "ReduceOnly Order is rejected." + } +] +POST /fapi/v1/batchOrders + +Weight: 5 on 10s order rate limit(X-MBX-ORDER-COUNT-10S); 1 on 1min order rate limit(X-MBX-ORDER-COUNT-1M); 5 on IP rate limit(x-mbx-used-weight-1m); + +Parameters: + +Name Type Mandatory Description +batchOrders LIST YES order list. Max 5 orders +recvWindow LONG NO +timestamp LONG YES +Where batchOrders is the list of order parameters in JSON + +Example: /fapi/v1/batchOrders?batchOrders=[{"type":"LIMIT","timeInForce":"GTC", +"symbol":"BTCUSDT","side":"BUY","price":"10001","quantity":"0.001"}] +Name Type Mandatory Description +symbol STRING YES +side ENUM YES +positionSide ENUM NO Default BOTH for One-way Mode ; LONG or SHORT for Hedge Mode. It must be sent with Hedge Mode. +type ENUM YES +timeInForce ENUM NO +quantity DECIMAL YES +reduceOnly STRING NO "true" or "false". default "false". +price DECIMAL NO +newClientOrderId STRING NO A unique id among open orders. Automatically generated if not sent. Can only be string following the rule: ^[\.A-Z\:/a-z0-9_-]{1,36}$ +stopPrice DECIMAL NO Used with STOP/STOP_MARKET or TAKE_PROFIT/TAKE_PROFIT_MARKET orders. +activationPrice DECIMAL NO Used with TRAILING_STOP_MARKET orders, default as the latest price(supporting different workingType) +callbackRate DECIMAL NO Used with TRAILING_STOP_MARKET orders, min 0.1, max 4 where 1 for 1% +workingType ENUM NO stopPrice triggered by: "MARK_PRICE", "CONTRACT_PRICE". Default "CONTRACT_PRICE" +priceProtect STRING NO "TRUE" or "FALSE", default "FALSE". Used with STOP/STOP_MARKET or TAKE_PROFIT/TAKE_PROFIT_MARKET orders. +newOrderRespType ENUM NO "ACK", "RESULT", default "ACK" +priceMatch ENUM NO only avaliable for LIMIT/STOP/TAKE_PROFIT order; can be set to OPPONENT/ OPPONENT_5/ OPPONENT_10/ OPPONENT_20: /QUEUE/ QUEUE_5/ QUEUE_10/ QUEUE_20; Can't be passed together with price +selfTradePreventionMode ENUM NO NONE:No STP / EXPIRE_TAKER:expire taker order when STP triggers/ EXPIRE_MAKER:expire maker order when STP triggers/ EXPIRE_BOTH:expire both orders when STP triggers +goodTillDate LONG NO order cancel time for timeInForce GTD, mandatory when timeInforce set to GTD; order the timestamp only retains second-level precision, ms part will be ignored; The goodTillDate timestamp must be greater than the current time plus 600 seconds and smaller than 253402300799000 +Paremeter rules are same with New Order +Batch orders are processed concurrently, and the order of matching is not guaranteed. +The order of returned contents for batch orders is the same as the order of the order list. +Modify Multiple Orders (TRADE) +Response: + +[ + { + "orderId": 20072994037, + "symbol": "BTCUSDT", + "pair": "BTCUSDT", + "status": "NEW", + "clientOrderId": "LJ9R4QZDihCaS8UAOOLpgW", + "price": "30005", + "avgPrice": "0.0", + "origQty": "1", + "executedQty": "0", + "cumQty": "0", + "cumBase": "0", + "timeInForce": "GTC", + "type": "LIMIT", + "reduceOnly": false, + "closePosition": false, + "side": "BUY", + "positionSide": "LONG", + "stopPrice": "0", + "workingType": "CONTRACT_PRICE", + "priceProtect": false, + "origType": "LIMIT", + "priceMatch": "NONE", //price match mode + "selfTradePreventionMode": "NONE", //self trading preventation mode + "goodTillDate": 0 //order pre-set auot cancel time for TIF GTD order + "updateTime": 1629182711600 + }, + { + "code": -2022, + "msg": "ReduceOnly Order is rejected." + } +] +PUT /fapi/v1/batchOrders + +Weight: 5 + +Parameters: + +Name Type Mandatory Description +batchOrders list YES order list. Max 5 orders +recvWindow LONG NO +timestamp LONG YES +Where batchOrders is the list of order parameters in JSON + +Name Type Mandatory Description +orderId LONG NO +origClientOrderId STRING NO +symbol STRING YES +side ENUM YES SELL, BUY +quantity DECIMAL YES Order quantity, cannot be sent with closePosition=true +price DECIMAL YES +priceMatch ENUM NO only avaliable for LIMIT/STOP/TAKE_PROFIT order; can be set to OPPONENT/ OPPONENT_5/ OPPONENT_10/ OPPONENT_20: /QUEUE/ QUEUE_5/ QUEUE_10/ QUEUE_20; Can't be passed together with price +recvWindow LONG NO +timestamp LONG YES +Parameter rules are same with Modify Order +Batch modify orders are processed concurrently, and the order of matching is not guaranteed. +The order of returned contents for batch modify orders is the same as the order of the order list. +One order can only be modfied for less than 10000 times +Order modification will preserve the original selfTradePreventionMode of the order +Get Order Modify History (USER_DATA) +Response: + +[ + { + "amendmentId": 5363, // Order modification ID + "symbol": "BTCUSDT", + "pair": "BTCUSDT", + "orderId": 20072994037, + "clientOrderId": "LJ9R4QZDihCaS8UAOOLpgW", + "time": 1629184560899, // Order modification time + "amendment": { + "price": { + "before": "30004", + "after": "30003.2" + }, + "origQty": { + "before": "1", + "after": "1" + }, + "count": 3 // Order modification count, representing the number of times the order has been modified + }, + "priceMatch":"QUEUE_20" + }, + { + "amendmentId": 5361, + "symbol": "BTCUSDT", + "pair": "BTCUSDT", + "orderId": 20072994037, + "clientOrderId": "LJ9R4QZDihCaS8UAOOLpgW", + "time": 1629184533946, + "amendment": { + "price": { + "before": "30005", + "after": "30004" + }, + "origQty": { + "before": "1", + "after": "1" + }, + "count": 2 + }, + "priceMatch":"QUEUE_20" + }, + { + "amendmentId": 5325, + "symbol": "BTCUSDT", + "pair": "BTCUSDT", + "orderId": 20072994037, + "clientOrderId": "LJ9R4QZDihCaS8UAOOLpgW", + "time": 1629182711787, + "amendment": { + "price": { + "before": "30002", + "after": "30005" + }, + "origQty": { + "before": "1", + "after": "1" + }, + "count": 1 + }, + "priceMatch":"QUEUE_20" + } +] +GET /fapi/v1/orderAmendment + +Get order modification history + +Weight: 1 + +Parameters: + +Name Type Mandatory Description +symbol STRING YES +orderId LONG NO +origClientOrderId STRING NO +startTime LONG NO Timestamp in ms to get modification history from INCLUSIVE +endTime LONG NO Timestamp in ms to get modification history until INCLUSIVE +limit INT NO Default 1000; max 1000 +recvWindow LONG NO +timestamp LONG YES +Notes: + +Either orderId or origClientOrderId must be sent, and the orderId will prevail if both are sent. +Query Order (USER_DATA) +Response: + +{ + "avgPrice": "0.00000", + "clientOrderId": "abc", + "cumQuote": "0", + "executedQty": "0", + "orderId": 1917641, + "origQty": "0.40", + "origType": "TRAILING_STOP_MARKET", + "price": "0", + "reduceOnly": false, + "side": "BUY", + "positionSide": "SHORT", + "status": "NEW", + "stopPrice": "9300", // please ignore when order type is TRAILING_STOP_MARKET + "closePosition": false, // if Close-All + "symbol": "BTCUSDT", + "time": 1579276756075, // order time + "timeInForce": "GTC", + "type": "TRAILING_STOP_MARKET", + "activatePrice": "9020", // activation price, only return with TRAILING_STOP_MARKET order + "priceRate": "0.3", // callback rate, only return with TRAILING_STOP_MARKET order + "updateTime": 1579276756075, // update time + "workingType": "CONTRACT_PRICE", + "priceProtect": false, // if conditional order trigger is protected + "priceMatch": "NONE", //price match mode + "selfTradePreventionMode": "NONE", //self trading preventation mode + "goodTillDate": 0 //order pre-set auot cancel time for TIF GTD order +} +GET /fapi/v1/order + +Check an order's status. + +Weight: 1 + +These orders will not be found: +order status is CANCELED or EXPIRED AND order has NO filled trade AND created time + 3 days < current time +order create time + 90 days < current time +Parameters: + +Name Type Mandatory Description +symbol STRING YES +orderId LONG NO +origClientOrderId STRING NO +recvWindow LONG NO +timestamp LONG YES +Notes: + +Either orderId or origClientOrderId must be sent. +orderId is self-increment for each specific symbol +Cancel Order (TRADE) +Response: + +{ + "clientOrderId": "myOrder1", + "cumQty": "0", + "cumQuote": "0", + "executedQty": "0", + "orderId": 283194212, + "origQty": "11", + "origType": "TRAILING_STOP_MARKET", + "price": "0", + "reduceOnly": false, + "side": "BUY", + "positionSide": "SHORT", + "status": "CANCELED", + "stopPrice": "9300", // please ignore when order type is TRAILING_STOP_MARKET + "closePosition": false, // if Close-All + "symbol": "BTCUSDT", + "timeInForce": "GTC", + "type": "TRAILING_STOP_MARKET", + "activatePrice": "9020", // activation price, only return with TRAILING_STOP_MARKET order + "priceRate": "0.3", // callback rate, only return with TRAILING_STOP_MARKET order + "updateTime": 1571110484038, + "workingType": "CONTRACT_PRICE", + "priceProtect": false, // if conditional order trigger is protected + "priceMatch": "NONE", //price match mode + "selfTradePreventionMode": "NONE", //self trading preventation mode + "goodTillDate": 0 //order pre-set auot cancel time for TIF GTD order +} +DELETE /fapi/v1/order + +Cancel an active order. + +Weight: 1 + +Parameters: + +Name Type Mandatory Description +symbol STRING YES +orderId LONG NO +origClientOrderId STRING NO +recvWindow LONG NO +timestamp LONG YES +Either orderId or origClientOrderId must be sent. + +Cancel All Open Orders (TRADE) +Response: + +{ + "code": 200, + "msg": "The operation of cancel all open order is done." +} +DELETE /fapi/v1/allOpenOrders + +Weight: 1 + +Parameters: + +Name Type Mandatory Description +symbol STRING YES +recvWindow LONG NO +timestamp LONG YES +Cancel Multiple Orders (TRADE) +Response: + +[ + { + "clientOrderId": "myOrder1", + "cumQty": "0", + "cumQuote": "0", + "executedQty": "0", + "orderId": 283194212, + "origQty": "11", + "origType": "TRAILING_STOP_MARKET", + "price": "0", + "reduceOnly": false, + "side": "BUY", + "positionSide": "SHORT", + "status": "CANCELED", + "stopPrice": "9300", // please ignore when order type is TRAILING_STOP_MARKET + "closePosition": false, // if Close-All + "symbol": "BTCUSDT", + "timeInForce": "GTC", + "type": "TRAILING_STOP_MARKET", + "activatePrice": "9020", // activation price, only return with TRAILING_STOP_MARKET order + "priceRate": "0.3", // callback rate, only return with TRAILING_STOP_MARKET order + "updateTime": 1571110484038, + "workingType": "CONTRACT_PRICE", + "priceProtect": false, // if conditional order trigger is protected + "priceMatch": "NONE", //price match mode + "selfTradePreventionMode": "NONE", //self trading preventation mode + "goodTillDate": 0 //order pre-set auot cancel time for TIF GTD order + }, + { + "code": -2011, + "msg": "Unknown order sent." + } +] +DELETE /fapi/v1/batchOrders + +Weight: 1 + +Parameters: + +Name Type Mandatory Description +symbol STRING YES +orderIdList LIST NO max length 10 +e.g. [1234567,2345678] +origClientOrderIdList LIST NO max length 10 +e.g. ["my_id_1","my_id_2"], encode the double quotes. No space after comma. +recvWindow LONG NO +timestamp LONG YES +Either orderIdList or origClientOrderIdList must be sent. + +Auto-Cancel All Open Orders (TRADE) +Response: + +{ + "symbol": "BTCUSDT", + "countdownTime": "100000" +} +Cancel all open orders of the specified symbol at the end of the specified countdown. + +POST /fapi/v1/countdownCancelAll + +Weight: 10 + +Parameters: + +Name Type Mandatory Description +symbol STRING YES +countdownTime LONG YES countdown time, 1000 for 1 second. 0 to cancel the timer +recvWindow LONG NO +timestamp LONG YES +The endpoint should be called repeatedly as heartbeats so that the existing countdown time can be canceled and replaced by a new one. + +Example usage: +Call this endpoint at 30s intervals with an countdownTime of 120000 (120s). +If this endpoint is not called within 120 seconds, all your orders of the specified symbol will be automatically canceled. +If this endpoint is called with an countdownTime of 0, the countdown timer will be stopped. + +The system will check all countdowns approximately every 10 milliseconds, so please note that sufficient redundancy should be considered when using this function. We do not recommend setting the countdown time to be too precise or too small. + +Query Current Open Order (USER_DATA) +Response: + + +{ + "avgPrice": "0.00000", + "clientOrderId": "abc", + "cumQuote": "0", + "executedQty": "0", + "orderId": 1917641, + "origQty": "0.40", + "origType": "TRAILING_STOP_MARKET", + "price": "0", + "reduceOnly": false, + "side": "BUY", + "positionSide": "SHORT", + "status": "NEW", + "stopPrice": "9300", // please ignore when order type is TRAILING_STOP_MARKET + "closePosition": false, // if Close-All + "symbol": "BTCUSDT", + "time": 1579276756075, // order time + "timeInForce": "GTC", + "type": "TRAILING_STOP_MARKET", + "activatePrice": "9020", // activation price, only return with TRAILING_STOP_MARKET order + "priceRate": "0.3", // callback rate, only return with TRAILING_STOP_MARKET order + "updateTime": 1579276756075, + "workingType": "CONTRACT_PRICE", + "priceProtect": false, // if conditional order trigger is protected + "priceMatch": "NONE", //price match mode + "selfTradePreventionMode": "NONE", //self trading preventation mode + "goodTillDate": 0 //order pre-set auot cancel time for TIF GTD order +} +GET /fapi/v1/openOrder + +Weight: 1 + +Parameters: + +Name Type Mandatory Description +symbol STRING YES +orderId LONG NO +origClientOrderId STRING NO +recvWindow LONG NO +timestamp LONG YES +EitherorderId or origClientOrderId must be sent +If the queried order has been filled or cancelled, the error message "Order does not exist" will be returned. +Current All Open Orders (USER_DATA) +Response: + +[ + { + "avgPrice": "0.00000", + "clientOrderId": "abc", + "cumQuote": "0", + "executedQty": "0", + "orderId": 1917641, + "origQty": "0.40", + "origType": "TRAILING_STOP_MARKET", + "price": "0", + "reduceOnly": false, + "side": "BUY", + "positionSide": "SHORT", + "status": "NEW", + "stopPrice": "9300", // please ignore when order type is TRAILING_STOP_MARKET + "closePosition": false, // if Close-All + "symbol": "BTCUSDT", + "time": 1579276756075, // order time + "timeInForce": "GTC", + "type": "TRAILING_STOP_MARKET", + "activatePrice": "9020", // activation price, only return with TRAILING_STOP_MARKET order + "priceRate": "0.3", // callback rate, only return with TRAILING_STOP_MARKET order + "updateTime": 1579276756075, // update time + "workingType": "CONTRACT_PRICE", + "priceProtect": false, // if conditional order trigger is protected + "priceMatch": "NONE", //price match mode + "selfTradePreventionMode": "NONE", //self trading preventation mode + "goodTillDate": 0 //order pre-set auot cancel time for TIF GTD order + } +] +GET /fapi/v1/openOrders + +Get all open orders on a symbol. Careful when accessing this with no symbol. + +Weight: 1 for a single symbol; 40 when the symbol parameter is omitted + +Parameters: + +Name Type Mandatory Description +symbol STRING NO +recvWindow LONG NO +timestamp LONG YES +If the symbol is not sent, orders for all symbols will be returned in an array. +All Orders (USER_DATA) +Response: + +[ + { + "avgPrice": "0.00000", + "clientOrderId": "abc", + "cumQuote": "0", + "executedQty": "0", + "orderId": 1917641, + "origQty": "0.40", + "origType": "TRAILING_STOP_MARKET", + "price": "0", + "reduceOnly": false, + "side": "BUY", + "positionSide": "SHORT", + "status": "NEW", + "stopPrice": "9300", // please ignore when order type is TRAILING_STOP_MARKET + "closePosition": false, // if Close-All + "symbol": "BTCUSDT", + "time": 1579276756075, // order time + "timeInForce": "GTC", + "type": "TRAILING_STOP_MARKET", + "activatePrice": "9020", // activation price, only return with TRAILING_STOP_MARKET order + "priceRate": "0.3", // callback rate, only return with TRAILING_STOP_MARKET order + "updateTime": 1579276756075, // update time + "workingType": "CONTRACT_PRICE", + "priceProtect": false, // if conditional order trigger is protected + "priceMatch": "NONE", //price match mode + "selfTradePreventionMode": "NONE", //self trading preventation mode + "goodTillDate": 0 //order pre-set auot cancel time for TIF GTD order + } +] +GET /fapi/v1/allOrders + +Get all account orders; active, canceled, or filled. + +These orders will not be found: +order status is CANCELED or EXPIRED AND order has NO filled trade AND created time + 3 days < current time +order create time + 90 days < current time +Weight: 5 + +Parameters: + +Name Type Mandatory Description +symbol STRING YES +orderId LONG NO +startTime LONG NO +endTime LONG NO +limit INT NO Default 500; max 1000. +recvWindow LONG NO +timestamp LONG YES +Notes: + +If orderId is set, it will get orders >= that orderId. Otherwise most recent orders are returned. +The query time period must be less then 7 days( default as the recent 7 days). +Futures Account Balance V3 (USER_DATA) +Response: + +[ + { + "accountAlias": "SgsR", // unique account code + "asset": "USDT", // asset name + "balance": "122607.35137903", // wallet balance + "crossWalletBalance": "23.72469206", // crossed wallet balance + "crossUnPnl": "0.00000000" // unrealized profit of crossed positions + "availableBalance": "23.72469206", // available balance + "maxWithdrawAmount": "23.72469206", // maximum amount for transfer out + "marginAvailable": true, // whether the asset can be used as margin in Multi-Assets mode + "updateTime": 1617939110373 + } +] +GET /fapi/v3/balance + +Weight: 5 + +Parameters: + +Name Type Mandatory Description +recvWindow LONG NO +timestamp LONG YES +Futures Account Balance V2 (USER_DATA) +Response: + +[ + { + "accountAlias": "SgsR", // unique account code + "asset": "USDT", // asset name + "balance": "122607.35137903", // wallet balance + "crossWalletBalance": "23.72469206", // crossed wallet balance + "crossUnPnl": "0.00000000" // unrealized profit of crossed positions + "availableBalance": "23.72469206", // available balance + "maxWithdrawAmount": "23.72469206", // maximum amount for transfer out + "marginAvailable": true, // whether the asset can be used as margin in Multi-Assets mode + "updateTime": 1617939110373 + } +] +GET /fapi/v2/balance + +Weight: 5 + +Parameters: + +Name Type Mandatory Description +recvWindow LONG NO +timestamp LONG YES +Account Information V3 (USER_DATA) +Response: + +single-asset mode + +{ + "totalInitialMargin": "0.00000000", // total initial margin required with current mark price (useless with isolated positions), only for USDT asset + "totalMaintMargin": "0.00000000", // total maintenance margin required, only for USDT asset + "totalWalletBalance": "103.12345678", // total wallet balance, only for USDT asset + "totalUnrealizedProfit": "0.00000000", // total unrealized profit, only for USDT asset + "totalMarginBalance": "103.12345678", // total margin balance, only for USDT asset + "totalPositionInitialMargin": "0.00000000", // initial margin required for positions with current mark price, only for USDT asset + "totalOpenOrderInitialMargin": "0.00000000", // initial margin required for open orders with current mark price, only for USDT asset + "totalCrossWalletBalance": "103.12345678", // crossed wallet balance, only for USDT asset + "totalCrossUnPnl": "0.00000000", // unrealized profit of crossed positions, only for USDT asset + "availableBalance": "103.12345678", // available balance, only for USDT asset + "maxWithdrawAmount": "103.12345678" // maximum amount for transfer out, only for USDT asset + "assets": [ // For assets that are quote assets, USDT/USDC/BTC + { + "asset": "USDT", // asset name + "walletBalance": "23.72469206", // wallet balance + "unrealizedProfit": "0.00000000", // unrealized profit + "marginBalance": "23.72469206", // margin balance + "maintMargin": "0.00000000", // maintenance margin required + "initialMargin": "0.00000000", // total initial margin required with current mark price + "positionInitialMargin": "0.00000000", // initial margin required for positions with current mark price + "openOrderInitialMargin": "0.00000000", // initial margin required for open orders with current mark price + "crossWalletBalance": "23.72469206", // crossed wallet balance + "crossUnPnl": "0.00000000" // unrealized profit of crossed positions + "availableBalance": "23.72469206", // available balance + "maxWithdrawAmount": "23.72469206", // maximum amount for transfer out + "updateTime": 1625474304765 // last update time + }, + { + "asset": "USDC", // asset name + "walletBalance": "103.12345678", // wallet balance + "unrealizedProfit": "0.00000000", // unrealized profit + "marginBalance": "103.12345678", // margin balance + "maintMargin": "0.00000000", // maintenance margin required + "initialMargin": "0.00000000", // total initial margin required with current mark price + "positionInitialMargin": "0.00000000", // initial margin required for positions with current mark price + "openOrderInitialMargin": "0.00000000", // initial margin required for open orders with current mark price + "crossWalletBalance": "103.12345678", // crossed wallet balance + "crossUnPnl": "0.00000000" // unrealized profit of crossed positions + "availableBalance": "126.72469206", // available balance + "maxWithdrawAmount": "103.12345678", // maximum amount for transfer out + "updateTime": 1625474304765 // last update time + }, + ], + "positions": [ // positions of all symbols user had position/ open orders are returned + // only "BOTH" positions will be returned with One-way mode + // only "LONG" and "SHORT" positions will be returned with Hedge mode + { + "symbol": "BTCUSDT", + "positionSide": "BOTH", // position side + "positionAmt": "1.000", + "unrealizedProfit": "0.00000000", // unrealized profit + "isolatedMargin": "0.00000000", + "notional": "0", + "isolatedWallet": "0", + "initialMargin": "0", // initial margin required with current mark price + "maintMargin": "0", // maintenance margin required + "updateTime": 0 + } + ] +} +OR multi-assets mode + +{ + "totalInitialMargin": "0.00000000", // the sum of USD value of all cross positions/open order initial margin + "totalMaintMargin": "0.00000000", // the sum of USD value of all cross positions maintenance margin + "totalWalletBalance": "126.72469206", // total wallet balance in USD + "totalUnrealizedProfit": "0.00000000", // total unrealized profit in USD + "totalMarginBalance": "126.72469206", // total margin balance in USD + "totalPositionInitialMargin": "0.00000000", // the sum of USD value of all cross positions initial margin + "totalOpenOrderInitialMargin": "0.00000000", // initial margin required for open orders with current mark price in USD + "totalCrossWalletBalance": "126.72469206", // crossed wallet balance in USD + "totalCrossUnPnl": "0.00000000", // unrealized profit of crossed positions in USD + "availableBalance": "126.72469206", // available balance in USD + "maxWithdrawAmount": "126.72469206" // maximum virtual amount for transfer out in USD + "assets": [ + { + "asset": "USDT", // asset name + "walletBalance": "23.72469206", // wallet balance + "unrealizedProfit": "0.00000000", // unrealized profit + "marginBalance": "23.72469206", // margin balance + "maintMargin": "0.00000000", // maintenance margin required + "initialMargin": "0.00000000", // total initial margin required with current mark price + "positionInitialMargin": "0.00000000", //initial margin required for positions with current mark price + "openOrderInitialMargin": "0.00000000", // initial margin required for open orders with current mark price + "crossWalletBalance": "23.72469206", // crossed wallet balance + "crossUnPnl": "0.00000000" // unrealized profit of crossed positions + "availableBalance": "126.72469206", // available balance + "maxWithdrawAmount": "23.72469206", // maximum amount for transfer out + "marginAvailable": true, // whether the asset can be used as margin in Multi-Assets mode + "updateTime": 1625474304765 // last update time + }, + { + "asset": "BUSD", // asset name + "walletBalance": "103.12345678", // wallet balance + "unrealizedProfit": "0.00000000", // unrealized profit + "marginBalance": "103.12345678", // margin balance + "maintMargin": "0.00000000", // maintenance margin required + "initialMargin": "0.00000000", // total initial margin required with current mark price + "positionInitialMargin": "0.00000000", //initial margin required for positions with current mark price + "openOrderInitialMargin": "0.00000000", // initial margin required for open orders with current mark price + "crossWalletBalance": "103.12345678", // crossed wallet balance + "crossUnPnl": "0.00000000" // unrealized profit of crossed positions + "availableBalance": "126.72469206", // available balance + "maxWithdrawAmount": "103.12345678", // maximum amount for transfer out + "marginAvailable": true, // whether the asset can be used as margin in Multi-Assets mode + "updateTime": 1625474304765 // last update time + } + ], + "positions": [ // positions of all symbols user had position are returned + // only "BOTH" positions will be returned with One-way mode + // only "LONG" and "SHORT" positions will be returned with Hedge mode + { + "symbol": "BTCUSDT", + "positionSide": "BOTH", // position side + "positionAmt": "1.000", + "unrealizedProfit": "0.00000000", // unrealized profit + "isolatedMargin": "0.00000000", + "notional": "0", + "isolatedWallet": "0", + "initialMargin": "0", // initial margin required with current mark price + "maintMargin": "0", // maintenance margin required + "updateTime": 0 + } + ] +} +GET /fapi/v3/account + +Get current account information. User in single-asset/ multi-assets mode will see different value, see comments in response section for detail. Weight: 5 + +Parameters: + +Name Type Mandatory Description +recvWindow LONG NO +timestamp LONG YES +Account Information V2 (USER_DATA) +Response: + +single-asset mode + +{ + "feeTier": 0, // account commission tier + "feeBurn": true, // "true": Fee Discount On; "false": Fee Discount Off + "canTrade": true, // if can trade + "canDeposit": true, // if can transfer in asset + "canWithdraw": true, // if can transfer out asset + "updateTime": 0, // reserved property, please ignore + "multiAssetsMargin": false, + "tradeGroupId": -1, + "totalInitialMargin": "0.00000000", // total initial margin required with current mark price (useless with isolated positions), only for USDT asset + "totalMaintMargin": "0.00000000", // total maintenance margin required, only for USDT asset + "totalWalletBalance": "23.72469206", // total wallet balance, only for USDT asset + "totalUnrealizedProfit": "0.00000000", // total unrealized profit, only for USDT asset + "totalMarginBalance": "23.72469206", // total margin balance, only for USDT asset + "totalPositionInitialMargin": "0.00000000", // initial margin required for positions with current mark price, only for USDT asset + "totalOpenOrderInitialMargin": "0.00000000", // initial margin required for open orders with current mark price, only for USDT asset + "totalCrossWalletBalance": "23.72469206", // crossed wallet balance, only for USDT asset + "totalCrossUnPnl": "0.00000000", // unrealized profit of crossed positions, only for USDT asset + "availableBalance": "23.72469206", // available balance, only for USDT asset + "maxWithdrawAmount": "23.72469206" // maximum amount for transfer out, only for USDT asset + "assets": [ + { + "asset": "USDT", // asset name + "walletBalance": "23.72469206", // wallet balance + "unrealizedProfit": "0.00000000", // unrealized profit + "marginBalance": "23.72469206", // margin balance + "maintMargin": "0.00000000", // maintenance margin required + "initialMargin": "0.00000000", // total initial margin required with current mark price + "positionInitialMargin": "0.00000000", //initial margin required for positions with current mark price + "openOrderInitialMargin": "0.00000000", // initial margin required for open orders with current mark price + "crossWalletBalance": "23.72469206", // crossed wallet balance + "crossUnPnl": "0.00000000" // unrealized profit of crossed positions + "availableBalance": "23.72469206", // available balance + "maxWithdrawAmount": "23.72469206", // maximum amount for transfer out + "marginAvailable": true, // whether the asset can be used as margin in Multi-Assets mode + "updateTime": 1625474304765 // last update time + }, + { + "asset": "BUSD", // asset name + "walletBalance": "103.12345678", // wallet balance + "unrealizedProfit": "0.00000000", // unrealized profit + "marginBalance": "103.12345678", // margin balance + "maintMargin": "0.00000000", // maintenance margin required + "initialMargin": "0.00000000", // total initial margin required with current mark price + "positionInitialMargin": "0.00000000", //initial margin required for positions with current mark price + "openOrderInitialMargin": "0.00000000", // initial margin required for open orders with current mark price + "crossWalletBalance": "103.12345678", // crossed wallet balance + "crossUnPnl": "0.00000000" // unrealized profit of crossed positions + "availableBalance": "103.12345678", // available balance + "maxWithdrawAmount": "103.12345678", // maximum amount for transfer out + "marginAvailable": true, // whether the asset can be used as margin in Multi-Assets mode + "updateTime": 1625474304765 // last update time + } + ], + "positions": [ // positions of all symbols in the market are returned + // only "BOTH" positions will be returned with One-way mode + // only "LONG" and "SHORT" positions will be returned with Hedge mode + { + "symbol": "BTCUSDT", // symbol name + "initialMargin": "0", // initial margin required with current mark price + "maintMargin": "0", // maintenance margin required + "unrealizedProfit": "0.00000000", // unrealized profit + "positionInitialMargin": "0", // initial margin required for positions with current mark price + "openOrderInitialMargin": "0", // initial margin required for open orders with current mark price + "leverage": "100", // current initial leverage + "isolated": true, // if the position is isolated + "entryPrice": "0.00000", // average entry price + "maxNotional": "250000", // maximum available notional with current leverage + "bidNotional": "0", // bids notional, ignore + "askNotional": "0", // ask notional, ignore + "positionSide": "BOTH", // position side + "positionAmt": "0", // position amount + "updateTime": 0 // last update time + } + ] +} +OR multi-assets mode + +{ + "feeTier": 0, // account commission tier + "feeBurn": true, // "true": Fee Discount On; "false": Fee Discount Off + "canTrade": true, // if can trade + "canDeposit": true, // if can transfer in asset + "canWithdraw": true, // if can transfer out asset + "updateTime": 0, // reserved property, please ignore + "multiAssetsMargin": true, + "tradeGroupId": -1, + "totalInitialMargin": "0.00000000", // the sum of USD value of all cross positions/open order initial margin + "totalMaintMargin": "0.00000000", // the sum of USD value of all cross positions maintenance margin + "totalWalletBalance": "126.72469206", // total wallet balance in USD + "totalUnrealizedProfit": "0.00000000", // total unrealized profit in USD + "totalMarginBalance": "126.72469206", // total margin balance in USD + "totalPositionInitialMargin": "0.00000000", // the sum of USD value of all cross positions initial margin + "totalOpenOrderInitialMargin": "0.00000000", // initial margin required for open orders with current mark price in USD + "totalCrossWalletBalance": "126.72469206", // crossed wallet balance in USD + "totalCrossUnPnl": "0.00000000", // unrealized profit of crossed positions in USD + "availableBalance": "126.72469206", // available balance in USD + "maxWithdrawAmount": "126.72469206" // maximum virtual amount for transfer out in USD + "assets": [ + { + "asset": "USDT", // asset name + "walletBalance": "23.72469206", // wallet balance + "unrealizedProfit": "0.00000000", // unrealized profit + "marginBalance": "23.72469206", // margin balance + "maintMargin": "0.00000000", // maintenance margin required + "initialMargin": "0.00000000", // total initial margin required with current mark price + "positionInitialMargin": "0.00000000", //initial margin required for positions with current mark price + "openOrderInitialMargin": "0.00000000", // initial margin required for open orders with current mark price + "crossWalletBalance": "23.72469206", // crossed wallet balance + "crossUnPnl": "0.00000000" // unrealized profit of crossed positions + "availableBalance": "126.72469206", // available balance + "maxWithdrawAmount": "23.72469206", // maximum amount for transfer out + "marginAvailable": true, // whether the asset can be used as margin in Multi-Assets mode + "updateTime": 1625474304765 // last update time + }, + { + "asset": "BUSD", // asset name + "walletBalance": "103.12345678", // wallet balance + "unrealizedProfit": "0.00000000", // unrealized profit + "marginBalance": "103.12345678", // margin balance + "maintMargin": "0.00000000", // maintenance margin required + "initialMargin": "0.00000000", // total initial margin required with current mark price + "positionInitialMargin": "0.00000000", //initial margin required for positions with current mark price + "openOrderInitialMargin": "0.00000000", // initial margin required for open orders with current mark price + "crossWalletBalance": "103.12345678", // crossed wallet balance + "crossUnPnl": "0.00000000" // unrealized profit of crossed positions + "availableBalance": "126.72469206", // available balance + "maxWithdrawAmount": "103.12345678", // maximum amount for transfer out + "marginAvailable": true, // whether the asset can be used as margin in Multi-Assets mode + "updateTime": 1625474304765 // last update time + } + ], + "positions": [ // positions of all symbols in the market are returned + // only "BOTH" positions will be returned with One-way mode + // only "LONG" and "SHORT" positions will be returned with Hedge mode + { + "symbol": "BTCUSDT", // symbol name + "initialMargin": "0", // initial margin required with current mark price + "maintMargin": "0", // maintenance margin required + "unrealizedProfit": "0.00000000", // unrealized profit + "positionInitialMargin": "0", // initial margin required for positions with current mark price + "openOrderInitialMargin": "0", // initial margin required for open orders with current mark price + "leverage": "100", // current initial leverage + "isolated": true, // if the position is isolated + "entryPrice": "0.00000", // average entry price + "breakEvenPrice": "0.0", // average entry price + "maxNotional": "250000", // maximum available notional with current leverage + "bidNotional": "0", // bids notional, ignore + "askNotional": "0", // ask notional, ignore + "positionSide": "BOTH", // position side + "positionAmt": "0", // position amount + "updateTime": 0 // last update time + } + ] +} +GET /fapi/v2/account + +Get current account information. User in single-asset/ multi-assets mode will see different value, see comments in response section for detail. Weight: 5 + +Parameters: + +Name Type Mandatory Description +recvWindow LONG NO +timestamp LONG YES +Change Initial Leverage (TRADE) +Response: + +{ + "leverage": 21, + "maxNotionalValue": "1000000", + "symbol": "BTCUSDT" +} +POST /fapi/v1/leverage + +Change user's initial leverage of specific symbol market. + +Weight: 1 + +Parameters: + +Name Type Mandatory Description +symbol STRING YES +leverage INT YES target initial leverage: int from 1 to 125 +recvWindow LONG NO +timestamp LONG YES +Change Margin Type (TRADE) +Response: + +{ + "code": 200, + "msg": "success" +} +POST /fapi/v1/marginType + +Weight: 1 + +Parameters: + +Name Type Mandatory Description +symbol STRING YES +marginType ENUM YES ISOLATED, CROSSED +recvWindow LONG NO +timestamp LONG YES +Modify Isolated Position Margin (TRADE) +Response: + +{ + "amount": 100.0, + "code": 200, + "msg": "Successfully modify position margin.", + "type": 1 +} +POST /fapi/v1/positionMargin + +Weight: 1 + +Parameters: + +Name Type Mandatory Description +symbol STRING YES +positionSide ENUM NO Default BOTH for One-way Mode ; LONG or SHORT for Hedge Mode. It must be sent with Hedge Mode. +amount DECIMAL YES +type INT YES 1: Add position margin,2: Reduce position margin +recvWindow LONG NO +timestamp LONG YES +Only for isolated symbol +Get Position Margin Change History (TRADE) +Response: + +[ + { + "symbol": "BTCUSDT", + "type": 1, + "deltaType": "USER_ADJUST", + "amount": "23.36332311", + "asset": "USDT", + "time": 1578047897183, + "positionSide": "BOTH" + }, + { + "symbol": "BTCUSDT", + "type": 1, + "deltaType": "USER_ADJUST", + "amount": "100", + "asset": "USDT", + "time": 1578047900425, + "positionSide": "LONG" + } +] +GET /fapi/v1/positionMargin/history + +Weight: 1 + +Parameters: + +Name Type Mandatory Description +symbol STRING YES +type INT NO 1: Add position margin,2: Reduce position margin +startTime LONG NO +endTime LONG NO Default current time if not pass +limit INT NO Default: 500 +recvWindow LONG NO +timestamp LONG YES +The time between startTime and endTimecan't be more than 30 days +Position Information V3 (USER_DATA) +Response: + +For One-way position mode: + +[ + { + "symbol": "ADAUSDT", + "positionSide": "BOTH", // position side + "positionAmt": "30", + "entryPrice": "0.385", + "breakEvenPrice": "0.385077", + "markPrice": "0.41047590", + "unRealizedProfit": "0.76427700", // unrealized profit + "liquidationPrice": "0", + "isolatedMargin": "0", + "notional": "12.31427700", + "marginAsset": "USDT", + "isolatedWallet": "0", + "initialMargin": "0.61571385", // initial margin required with current mark price + "maintMargin": "0.08004280", // maintenance margin required + "positionInitialMargin": "0.61571385",// initial margin required for positions with current mark price + "openOrderInitialMargin": "0", // initial margin required for open orders with current mark price + "adl": 2, + "bidNotional": "0", // bids notional, ignore + "askNotional": "0", // ask notional, ignore + "updateTime": 1720736417660 + } +] +For Hedge position mode: + +[ + { + "symbol": "BTCUSDT", + "positionAmt": "0.001", + "entryPrice": "22185.2", + "breakEvenPrice": "0.0", + "markPrice": "21123.05052574", + "unRealizedProfit": "-1.06214947", + "liquidationPrice": "19731.45529116", + "leverage": "4", + "maxNotionalValue": "100000000", + "marginType": "cross", + "isolatedMargin": "0.00000000", + "isAutoAddMargin": "false", + "positionSide": "LONG", + "notional": "21.12305052", + "isolatedWallet": "0", + "updateTime": 1655217461579 + }, + { + "symbol": "BTCUSDT", + "positionAmt": "0.000", + "entryPrice": "0.0", + "breakEvenPrice": "0.0", + "markPrice": "21123.05052574", + "unRealizedProfit": "0.00000000", + "liquidationPrice": "0", + "leverage": "4", + "maxNotionalValue": "100000000", + "marginType": "cross", + "isolatedMargin": "0.00000000", + "isAutoAddMargin": "false", + "positionSide": "SHORT", + "notional": "0", + "isolatedWallet": "0", + "updateTime": 0 + } +] +GET /fapi/v3/positionRisk + +Get current position information(only symbol that has position or open orders will be returned). + +Weight: 5 + +Parameters: + +Name Type Mandatory Description +symbol STRING NO +recvWindow LONG NO +timestamp LONG YES +Note +Please use with user data stream ACCOUNT_UPDATE to meet your timeliness and accuracy needs. + +Position Information V2 (USER_DATA) +Response: + +For One-way position mode: + +[ + { + "entryPrice": "0.00000", + "breakEvenPrice": "0.0", + "marginType": "isolated", + "isAutoAddMargin": "false", + "isolatedMargin": "0.00000000", + "leverage": "10", + "liquidationPrice": "0", + "markPrice": "6679.50671178", + "maxNotionalValue": "20000000", + "positionAmt": "0.000", + "notional": "0",, + "isolatedWallet": "0", + "symbol": "BTCUSDT", + "unRealizedProfit": "0.00000000", + "positionSide": "BOTH", + "updateTime": 0 + } +] +For Hedge position mode: + +[ + { + "symbol": "BTCUSDT", + "positionAmt": "0.001", + "entryPrice": "22185.2", + "breakEvenPrice": "0.0", + "markPrice": "21123.05052574", + "unRealizedProfit": "-1.06214947", + "liquidationPrice": "19731.45529116", + "leverage": "4", + "maxNotionalValue": "100000000", + "marginType": "cross", + "isolatedMargin": "0.00000000", + "isAutoAddMargin": "false", + "positionSide": "LONG", + "notional": "21.12305052", + "isolatedWallet": "0", + "updateTime": 1655217461579 + }, + { + "symbol": "BTCUSDT", + "positionAmt": "0.000", + "entryPrice": "0.0", + "breakEvenPrice": "0.0", + "markPrice": "21123.05052574", + "unRealizedProfit": "0.00000000", + "liquidationPrice": "0", + "leverage": "4", + "maxNotionalValue": "100000000", + "marginType": "cross", + "isolatedMargin": "0.00000000", + "isAutoAddMargin": "false", + "positionSide": "SHORT", + "notional": "0", + "isolatedWallet": "0", + "updateTime": 0 + } +] +GET /fapi/v2/positionRisk + +Get current position information. + +Weight: 5 + +Parameters: + +Name Type Mandatory Description +symbol STRING NO +recvWindow LONG NO +timestamp LONG YES +Note +Please use with user data stream ACCOUNT_UPDATE to meet your timeliness and accuracy needs. + +Account Trade List (USER_DATA) +Response: + +[ + { + "buyer": false, + "commission": "-0.07819010", + "commissionAsset": "USDT", + "id": 698759, + "maker": false, + "orderId": 25851813, + "price": "7819.01", + "qty": "0.002", + "quoteQty": "15.63802", + "realizedPnl": "-0.91539999", + "side": "SELL", + "positionSide": "SHORT", + "symbol": "BTCUSDT", + "time": 1569514978020 + } +] +GET /fapi/v1/userTrades + +Get trades for a specific account and symbol. + +Weight: 5 + +Parameters: + +Name Type Mandatory Description +symbol STRING YES +orderId LONG NO This can only be used in combination with symbol +startTime LONG NO +endTime LONG NO +fromId LONG NO Trade id to fetch from. Default gets most recent trades. +limit INT NO Default 500; max 1000. +recvWindow LONG NO +timestamp LONG YES +If startTime and endTime are both not sent, then the last 7 days' data will be returned. +The time between startTime and endTime cannot be longer than 7 days. +The parameter fromId cannot be sent with startTime or endTime. +Get Income History (USER_DATA) +Response: + +[ + { + "symbol": "", // trade symbol, if existing + "incomeType": "TRANSFER", // income type + "income": "-0.37500000", // income amount + "asset": "USDT", // income asset + "info":"TRANSFER", // extra information + "time": 1570608000000, + "tranId":"9689322392", // transaction id + "tradeId":"" // trade id, if existing + }, + { + "symbol": "BTCUSDT", + "incomeType": "COMMISSION", + "income": "-0.01000000", + "asset": "USDT", + "info":"COMMISSION", + "time": 1570636800000, + "tranId":"9689322392", + "tradeId": 2059192 + } +] +GET /fapi/v1/income + +Weight: 30 + +Parameters: + +Name Type Mandatory Description +symbol STRING NO +incomeType STRING NO TRANSFER, WELCOME_BONUS, REALIZED_PNL, FUNDING_FEE, COMMISSION, INSURANCE_CLEAR, REFERRAL_KICKBACK, COMMISSION_REBATE, API_REBATE, CONTEST_REWARD, CROSS_COLLATERAL_TRANSFER, OPTIONS_PREMIUM_FEE, OPTIONS_SETTLE_PROFIT, INTERNAL_TRANSFER, AUTO_EXCHANGE, DELIVERED_SETTELMENT, COIN_SWAP_DEPOSIT, COIN_SWAP_WITHDRAW, POSITION_LIMIT_INCREASE_FEE +startTime LONG NO Timestamp in ms to get funding from INCLUSIVE. +endTime LONG NO Timestamp in ms to get funding until INCLUSIVE. +page INT NO +limit INT NO Default 100; max 1000 +recvWindow LONG NO +timestamp LONG YES +If neither startTime nor endTime is sent, the recent 7-day data will be returned. +If incomeType is not sent, all kinds of flow will be returned +"trandId" is unique in the same incomeType for a user +Income history only contains data for the last three months +Notional and Leverage Brackets (USER_DATA) +Response: + +[ + { + "symbol": "ETHUSDT", + "notionalCoef": 1.50, //user symbol bracket multiplier, only appears when user's symbol bracket is adjusted + "brackets": [ + { + "bracket": 1, // Notional bracket + "initialLeverage": 75, // Max initial leverage for this bracket + "notionalCap": 10000, // Cap notional of this bracket + "notionalFloor": 0, // Notional threshold of this bracket + "maintMarginRatio": 0.0065, // Maintenance ratio for this bracket + "cum":0 // Auxiliary number for quick calculation + + }, + ] + } +] +OR (if symbol sent) + + +{ + "symbol": "ETHUSDT", + "notionalCoef": 1.50, + "brackets": [ + { + "bracket": 1, + "initialLeverage": 75, + "notionalCap": 10000, + "notionalFloor": 0, + "maintMarginRatio": 0.0065, + "cum":0 + }, + ] +} +GET /fapi/v1/leverageBracket + +Weight: 1 + +Parameters: + +Name Type Mandatory Description +symbol STRING NO +recvWindow LONG NO +timestamp LONG YES +Position ADL Quantile Estimation (USER_DATA) +Response: + +[ + { + "symbol": "ETHUSDT", + "adlQuantile": + { + // if the positions of the symbol are crossed margined in Hedge Mode, "LONG" and "SHORT" will be returned a same quantile value, and "HEDGE" will be returned instead of "BOTH". + "LONG": 3, + "SHORT": 3, + "HEDGE": 0 // only a sign, ignore the value + } + }, + { + "symbol": "BTCUSDT", + "adlQuantile": + { + // for positions of the symbol are in One-way Mode or isolated margined in Hedge Mode + "LONG": 1, // adl quantile for "LONG" position in hedge mode + "SHORT": 2, // adl qauntile for "SHORT" position in hedge mode + "BOTH": 0 // adl qunatile for position in one-way mode + } + } + ] +GET /fapi/v1/adlQuantile + +Weight: 5 + +Parameters: + +Name Type Mandatory Description +symbol STRING NO +recvWindow LONG NO +timestamp LONG YES +Values update every 30s. + +Values 0, 1, 2, 3, 4 shows the queue position and possibility of ADL from low to high. + +For positions of the symbol are in One-way Mode or isolated margined in Hedge Mode, "LONG", "SHORT", and "BOTH" will be returned to show the positions' adl quantiles of different position sides. + +If the positions of the symbol are crossed margined in Hedge Mode: + +"HEDGE" as a sign will be returned instead of "BOTH"; +A same value caculated on unrealized pnls on long and short sides' positions will be shown for "LONG" and "SHORT" when there are positions in both of long and short sides. +User's Force Orders (USER_DATA) +Response: + +[ + { + "orderId": 6071832819, + "symbol": "BTCUSDT", + "status": "FILLED", + "clientOrderId": "autoclose-1596107620040000020", + "price": "10871.09", + "avgPrice": "10913.21000", + "origQty": "0.001", + "executedQty": "0.001", + "cumQuote": "10.91321", + "timeInForce": "IOC", + "type": "LIMIT", + "reduceOnly": false, + "closePosition": false, + "side": "SELL", + "positionSide": "BOTH", + "stopPrice": "0", + "workingType": "CONTRACT_PRICE", + "origType": "LIMIT", + "time": 1596107620044, + "updateTime": 1596107620087 + } + { + "orderId": 6072734303, + "symbol": "BTCUSDT", + "status": "FILLED", + "clientOrderId": "adl_autoclose", + "price": "11023.14", + "avgPrice": "10979.82000", + "origQty": "0.001", + "executedQty": "0.001", + "cumQuote": "10.97982", + "timeInForce": "GTC", + "type": "LIMIT", + "reduceOnly": false, + "closePosition": false, + "side": "BUY", + "positionSide": "SHORT", + "stopPrice": "0", + "workingType": "CONTRACT_PRICE", + "origType": "LIMIT", + "time": 1596110725059, + "updateTime": 1596110725071 + } +] +GET /fapi/v1/forceOrders + +Weight: 20 with symbol, 50 without symbol + +Parameters: + +Name Type Mandatory Description +symbol STRING NO +autoCloseType ENUM NO "LIQUIDATION" for liquidation orders, "ADL" for ADL orders. +startTime LONG NO +endTime LONG NO +limit INT NO Default 50; max 100. +recvWindow LONG NO +timestamp LONG YES +If "autoCloseType" is not sent, orders with both of the types will be returned +If "startTime" is not sent, data within 7 days before "endTime" can be queried +Futures Trading Quantitative Rules Indicators (USER_DATA) +For more information on this, please refer to the Futures Trading Quantitative Rules +Response: + +{ + "indicators": { // indicator: quantitative rules indicators, value: user's indicators value, triggerValue: trigger indicator value threshold of quantitative rules. + "BTCUSDT": [ + { + "isLocked": true, + "plannedRecoverTime": 1545741270000, + "indicator": "UFR", // Unfilled Ratio (UFR) + "value": 0.05, // Current value + "triggerValue": 0.995 // Trigger value + }, + { + "isLocked": true, + "plannedRecoverTime": 1545741270000, + "indicator": "IFER", // IOC/FOK Expiration Ratio (IFER) + "value": 0.99, // Current value + "triggerValue": 0.99 // Trigger value + }, + { + "isLocked": true, + "plannedRecoverTime": 1545741270000, + "indicator": "GCR", // GTC Cancellation Ratio (GCR) + "value": 0.99, // Current value + "triggerValue": 0.99 // Trigger value + }, + { + "isLocked": true, + "plannedRecoverTime": 1545741270000, + "indicator": "DR", // Dust Ratio (DR) + "value": 0.99, // Current value + "triggerValue": 0.99 // Trigger value + } + ], + "ETHUSDT": [ + { + "isLocked": true, + "plannedRecoverTime": 1545741270000, + "indicator": "UFR", + "value": 0.05, + "triggerValue": 0.995 + }, + { + "isLocked": true, + "plannedRecoverTime": 1545741270000, + "indicator": "IFER", + "value": 0.99, + "triggerValue": 0.99 + }, + { + "isLocked": true, + "plannedRecoverTime": 1545741270000, + "indicator": "GCR", + "value": 0.99, + "triggerValue": 0.99 + } + { + "isLocked": true, + "plannedRecoverTime": 1545741270000, + "indicator": "DR", + "value": 0.99, + "triggerValue": 0.99 + } + ] + }, + "updateTime": 1545741270000 +} +Or (account violation triggered) + +{ + "indicators":{ + "ACCOUNT":[ + { + "indicator":"TMV", // Too many violations under multiple symbols trigger account violation + "value":10, + "triggerValue":1, + "plannedRecoverTime":1644919865000, + "isLocked":true + } + ] + }, + "updateTime":1644913304748 +} +GET /fapi/v1/apiTradingStatus + +Weight: + +1 for a single symbol +10 when the symbol parameter is omitted +Parameters: + +Name Type Mandatory Description +symbol STRING NO +recvWindow LONG NO +timestamp LONG YES +Futures Account Configuration(USER_DATA) +Response: + +{ + "feeTier": 0, // account commission tier + "canTrade": true, // if can trade + "canDeposit": true, // if can transfer in asset + "canWithdraw": true, // if can transfer out asset + "dualSidePosition": true, + "updateTime": 0, // reserved property, please ignore + "multiAssetsMargin": false, + "tradeGroupId": -1 +} +GET /fapi/v1/accountConfig + +Query account configuration + +Weight: 5 + +Parameters: + +Name Type Mandatory Description +recvWindow LONG NO +timestamp LONG YES +Symbol Configuration(USER_DATA) +Response: + +{ + "feeTier": 0, // account commission tier + "canTrade": true, // if can trade + "canDeposit": true, // if can transfer in asset + "canWithdraw": true, // if can transfer out asset + "dualSidePosition": true, + "updateTime": 0, // reserved property, please ignore + "multiAssetsMargin": false, + "tradeGroupId": -1 +} +GET /fapi/v1/symbolConfig + +Get current account symbol configuration. + +Weight: 5 + +Parameters: + +Name Type Mandatory Description +symbol STRING NO +recvWindow LONG NO +timestamp LONG YES +User Commission Rate (USER_DATA) +Response: + +{ + "symbol": "BTCUSDT", + "makerCommissionRate": "0.0002", // 0.02% + "takerCommissionRate": "0.0004" // 0.04% +} +GET /fapi/v1/commissionRate + +Weight: 20 + +Parameters: + +Name Type Mandatory Description +symbol STRING YES +recvWindow LONG NO +timestamp LONG YES +Query User Rate Limit (USER_DATA) +Response: + +[ + { + "rateLimitType": "ORDERS", + "interval": "SECOND", + "intervalNum": 10, + "limit": 10000, + }, + { + "rateLimitType": "ORDERS", + "interval": "MINUTE", + "intervalNum": 1, + "limit": 20000, + } +] +GET /fapi/v1/rateLimit/order + +Weight: 1 + +Parameters: + +Name Type Mandatory Description +recvWindow LONG NO +timestamp LONG YES +Get Download Id For Futures Transaction History (USER_DATA) +Response: + +{ + "avgCostTimestampOfLast30d":7241837, // Average time taken for data download in the past 30 days + "downloadId":"546975389218332672", +} +GET /fapi/v1/income/asyn + +Weight: 1500 + +Parameters: + +Name Type Mandatory Description +startTime LONG YES Timestamp in ms +endTime LONG YES Timestamp in ms +recvWindow LONG NO +timestamp LONG YES +Request Limitation is 5 times per month, shared by front end download page and rest api +The time between startTime and endTime can not be longer than 1 year +Get Futures Transaction History Download Link by Id (USER_DATA) +Response: + +{ + "downloadId":"545923594199212032", + "status":"completed", // Enum:completed,processing + "url":"www.binance.com", // The link is mapped to download id + "notified":true, // ignore + "expirationTimestamp":1645009771000, // The link would expire after this timestamp + "isExpired":null, +} +OR (Response when server is processing) + +{ + "downloadId":"545923594199212032", + "status":"processing", + "url":"", + "notified":false, + "expirationTimestamp":-1 + "isExpired":null, + +} +GET /fapi/v1/income/asyn/id + +Weight: 10 + +Parameters: + +Name Type Mandatory Description +downloadId STRING YES get by download id api +recvWindow LONG NO +timestamp LONG YES +Download link expiration: 24h +Get Download Id For Futures Order History (USER_DATA) +Response: + +{ + "avgCostTimestampOfLast30d":7241837, // Average time taken for data download in the past 30 days + "downloadId":"546975389218332672", +} +GET /fapi/v1/order/asyn + +Weight: 1500 + +Parameters: + +Name Type Mandatory Description +startTime LONG YES Timestamp in ms +endTime LONG YES Timestamp in ms +recvWindow LONG NO +timestamp LONG YES +Request Limitation is 10 times per month, shared by front end download page and rest api +The time between startTime and endTime can not be longer than 1 year +Get Futures Order History Download Link by Id (USER_DATA) +Response: + +{ + "downloadId":"545923594199212032", + "status":"completed", // Enum:completed,processing + "url":"www.binance.com", // The link is mapped to download id + "notified":true, // ignore + "expirationTimestamp":1645009771000, // The link would expire after this timestamp + "isExpired":null, +} +OR (Response when server is processing) + +{ + "downloadId":"545923594199212032", + "status":"processing", + "url":"", + "notified":false, + "expirationTimestamp":-1 + "isExpired":null, + +} +GET /fapi/v1/order/asyn/id + +Weight: 10 + +Parameters: + +Name Type Mandatory Description +downloadId STRING YES get by download id api +recvWindow LONG NO +timestamp LONG YES +Download link expiration: 24h +Get Download Id For Futures Trade History (USER_DATA) +Response: + +{ + "avgCostTimestampOfLast30d":7241837, // Average time taken for data download in the past 30 days + "downloadId":"546975389218332672", +} +GET /fapi/v1/trade/asyn + +Weight: 1500 + +Parameters: + +Name Type Mandatory Description +startTime LONG YES Timestamp in ms +endTime LONG YES Timestamp in ms +recvWindow LONG NO +timestamp LONG YES +Request Limitation is 5 times per month, shared by front end download page and rest api +The time between startTime and endTime can not be longer than 1 year +Get Futures Trade Download Link by Id (USER_DATA) +Response: + +{ + "downloadId":"545923594199212032", + "status":"completed", // Enum:completed,processing + "url":"www.binance.com", // The link is mapped to download id + "notified":true, // ignore + "expirationTimestamp":1645009771000, // The link would expire after this timestamp + "isExpired":null, +} +OR (Response when server is processing) + +{ + "downloadId":"545923594199212032", + "status":"processing", + "url":"", + "notified":false, + "expirationTimestamp":-1 + "isExpired":null, + +} +GET /fapi/v1/trade/asyn/id + +Weight: 10 + +Parameters: + +Name Type Mandatory Description +downloadId STRING YES get by download id api +recvWindow LONG NO +timestamp LONG YES +Download link expiration: 24h +User Data Streams +The base API endpoint is: https://fapi.binance.com +A User Data Stream listenKey is valid for 60 minutes after creation. +Doing a PUT on a listenKey will extend its validity for 60 minutes, if response -1125 error "This listenKey does not exist." Please use POST /fapi/v1/listenKey to recreate listenKey and use new listenKey to build connection. +Doing a DELETE on a listenKey will close the stream and invalidate the listenKey. +Doing a POST on an account with an active listenKey will return the currently active listenKey and extend its validity for 60 minutes. +The connection method for Websocket is: + +Base Url: wss://fstream.binance.com +User Data Streams are accessed at /ws/ +Example: wss://fstream.binance.com/ws/XaEAKTsQSRLZAGH9tuIu37plSRsdjmlAVBoNYPUITlTAko1WI22PgmBMpI1rS8Yh +For one connection(one user data), the user data stream payloads can guaranteed to be in order during heavy periods; Strongly recommend you order your updates using E + +A single connection is only valid for 24 hours; expect to be disconnected at the 24 hour mark + +Start User Data Stream (USER_STREAM) +Response: + +{ + "listenKey": "pqia91ma19a5s61cv6a81va65sdf19v8a65a1a5s61cv6a81va65sdf19v8a65a1" +} +POST /fapi/v1/listenKey + +Start a new user data stream. The stream will close after 60 minutes unless a keepalive is sent. If the account has an active listenKey, that listenKey will be returned and its validity will be extended for 60 minutes. In very rare cases, this endpoint will still generate a new listenKey when the account has a valid listenKey. Please use this listenKey to reestablish the connection. We do not recommend extending the listenKey using this endpoint. Instead, we suggest using PUT /fapi/v1/listenKey to extend the listenKey. + +Weight: 1 + +Parameters: + +None + +Keepalive User Data Stream (USER_STREAM) +Response: + +{ + "listenKey": "3HBntNTepshgEdjIwSUIBgB9keLyOCg5qv3n6bYAtktG8ejcaW5HXz9Vx1JgIieg" //the listenkey which got extended +} +PUT /fapi/v1/listenKey + +Keepalive a user data stream to prevent a time out. User data streams will close after 60 minutes. It's recommended to send a ping about every 60 minutes. If response -1125 error "This listenKey does not exist." Please use POST /fapi/v1/listenKey to recreate listenKey and use new listenKey to build connection. + +Weight: 1 + +Parameters: + +None + +Close User Data Stream (USER_STREAM) +Response: + +{} +DELETE /fapi/v1/listenKey + +Close out a user data stream. + +Weight: 1 + +Parameters: + +None + +Event: User Data Stream Expired +Payload: + +{ + "stream": "OfYGbUzi3PraNagEkdKuFwUHn48brFsItTdsuiIXrucEvD0rhRXZ7I6URWfE8YE8", + "data": { + "e": "listenKeyExpired", // event type + "E": "1699596037418", // event time + "listenKey": "OfYGbUzi3PraNagEkdKuFwUHn48brFsItTdsuiIXrucEvD0rhRXZ7I6URWfE8YE8" + } +} +When the listenKey used for the user data stream turns expired, this event will be pushed. + +Notice: + +This event is not related to the websocket disconnection. +This event will be received only when a valid listenKey in connection got expired. +No more user data event will be updated after this event received until a new valid listenKey used. +Websocket User Data Request(To be deprecated) +User data request need a successful connection with the user data stream with a listenKey. +The following data can be sent through the websocket instance in order to request for user data. Examples can be seen below. +The id used in the JSON payloads is an unsigned INT used as an identifier to uniquely identify the messages going back and forth. +Request Form +Response + +{ + "result"[ + { + "req":"@account", // request name 1 + "res": // response to the request name 1 + ... + }, + { + "req":"@balance", // request name 2, if existing + "res": // response to the request name 2, if existing + ... + } + ] + "id": 12 // request ID +} +Request + +{ +"method": "REQUEST", +"params": +[ +"@account", // request name 1 +"@balance" // request name 2, if existing +], +"id": 12 // request ID. +} + +Event: Margin Call +Payload: + +{ + "e":"MARGIN_CALL", // Event Type + "E":1587727187525, // Event Time + "cw":"3.16812045", // Cross Wallet Balance. Only pushed with crossed position margin call + "p":[ // Position(s) of Margin Call + { + "s":"ETHUSDT", // Symbol + "ps":"LONG", // Position Side + "pa":"1.327", // Position Amount + "mt":"CROSSED", // Margin Type + "iw":"0", // Isolated Wallet (if isolated position) + "mp":"187.17127", // Mark Price + "up":"-1.166074", // Unrealized PnL + "mm":"1.614445" // Maintenance Margin Required + } + ] +} +When the user's position risk ratio is too high, this stream will be pushed. +This message is only used as risk guidance information and is not recommended for investment strategies. +In the case of a highly volatile market, there may be the possibility that the user's position has been liquidated at the same time when this stream is pushed out. +Under cross margin mode, this stream will be pushed 1 time every 1 hour if margin call triggered; Under isolated margin mode, this stream will be pushed 1 time every 1 hour for each symbol if margin call triggered +Event: Balance and Position Update +Payload: + +{ + "e": "ACCOUNT_UPDATE", // Event Type + "E": 1564745798939, // Event Time + "T": 1564745798938 , // Transaction + "a": // Update Data + { + "m":"ORDER", // Event reason type + "B":[ // Balances + { + "a":"USDT", // Asset + "wb":"122624.12345678", // Wallet Balance + "cw":"100.12345678", // Cross Wallet Balance + "bc":"50.12345678" // Balance Change except PnL and Commission + }, + { + "a":"BUSD", + "wb":"1.00000000", + "cw":"0.00000000", + "bc":"-49.12345678" + } + ], + "P":[ + { + "s":"BTCUSDT", // Symbol + "pa":"0", // Position Amount + "ep":"0.00000", // Entry Price + "bep":"0", // breakeven price + "cr":"200", // (Pre-fee) Accumulated Realized + "up":"0", // Unrealized PnL + "mt":"isolated", // Margin Type + "iw":"0.00000000", // Isolated Wallet (if isolated position) + "ps":"BOTH" // Position Side + }, + { + "s":"BTCUSDT", + "pa":"20", + "ep":"6563.66500", + "bep":"6563.6", + "cr":"0", + "up":"2850.21200", + "mt":"isolated", + "iw":"13200.70726908", + "ps":"LONG" + }, + { + "s":"BTCUSDT", + "pa":"-10", + "ep":"6563.86000", + "bep":"6563.6", + "cr":"-45.04000000", + "up":"-1423.15600", + "mt":"isolated", + "iw":"6570.42511771", + "ps":"SHORT" + } + ] + } +} +Event type is ACCOUNT_UPDATE. + +When balance or position get updated, this event will be pushed. + +ACCOUNT_UPDATE will be pushed only when update happens on user's account, including changes on balances, positions, or margin type. +Unfilled orders or cancelled orders will not make the event ACCOUNT_UPDATE pushed, since there's no change on positions. +"position" in ACCOUNT_UPDATE: Only symbols of changed positions will be pushed. +When "FUNDING FEE" changes to the user's balance, the event will be pushed with the brief message: + +When "FUNDING FEE" occurs in a crossed position, ACCOUNT_UPDATE will be pushed with only the balance B(including the "FUNDING FEE" asset only), without any position P message. +When "FUNDING FEE" occurs in an isolated position, ACCOUNT_UPDATE will be pushed with only the balance B(including the "FUNDING FEE" asset only) and the relative position message P( including the isolated position on which the "FUNDING FEE" occurs only, without any other position message). +The field "m" represents the reason type for the event and may shows the following possible types: + +DEPOSIT +WITHDRAW +ORDER +FUNDING_FEE +WITHDRAW_REJECT +ADJUSTMENT +INSURANCE_CLEAR +ADMIN_DEPOSIT +ADMIN_WITHDRAW +MARGIN_TRANSFER +MARGIN_TYPE_CHANGE +ASSET_TRANSFER +OPTIONS_PREMIUM_FEE +OPTIONS_SETTLE_PROFIT +AUTO_EXCHANGE +COIN_SWAP_DEPOSIT +COIN_SWAP_WITHDRAW +The field "bc" represents the balance change except for PnL and commission. + +Event: Order Update +Payload: + +{ + "e":"ORDER_TRADE_UPDATE", // Event Type + "E":1568879465651, // Event Time + "T":1568879465650, // Transaction Time + "o":{ + "s":"BTCUSDT", // Symbol + "c":"TEST", // Client Order Id + // special client order id: + // starts with "autoclose-": liquidation order + // "adl_autoclose": ADL auto close order + // "settlement_autoclose-": settlement order for delisting or delivery + "S":"SELL", // Side + "o":"TRAILING_STOP_MARKET", // Order Type + "f":"GTC", // Time in Force + "q":"0.001", // Original Quantity + "p":"0", // Original Price + "ap":"0", // Average Price + "sp":"7103.04", // Stop Price. Please ignore with TRAILING_STOP_MARKET order + "x":"NEW", // Execution Type + "X":"NEW", // Order Status + "i":8886774, // Order Id + "l":"0", // Order Last Filled Quantity + "z":"0", // Order Filled Accumulated Quantity + "L":"0", // Last Filled Price + "N":"USDT", // Commission Asset, will not push if no commission + "n":"0", // Commission, will not push if no commission + "T":1568879465650, // Order Trade Time + "t":0, // Trade Id + "b":"0", // Bids Notional + "a":"9.91", // Ask Notional + "m":false, // Is this trade the maker side? + "R":false, // Is this reduce only + "wt":"CONTRACT_PRICE", // Stop Price Working Type + "ot":"TRAILING_STOP_MARKET",// Original Order Type + "ps":"LONG", // Position Side + "cp":false, // If Close-All, pushed with conditional order + "AP":"7476.89", // Activation Price, only puhed with TRAILING_STOP_MARKET order + "cr":"5.0", // Callback Rate, only puhed with TRAILING_STOP_MARKET order + "pP": false, // If price protection is turned on + "si": 0, // ignore + "ss": 0, // ignore + "rp":"0", // Realized Profit of the trade + "V":"EXPIRE_TAKER", // STP mode + "pm":"OPPONENT", // Price match mode + "gtd":0 // TIF GTD order auto cancel time + } +} +When new order created, order status changed will push such event. event type is ORDER_TRADE_UPDATE. + +Side + +BUY +SELL +Order Type + +MARKET +LIMIT +STOP +TAKE_PROFIT +LIQUIDATION +Execution Type + +NEW +CANCELED +CALCULATED - Liquidation Execution +EXPIRED +TRADE +AMENDMENT - Order Modified +Order Status + +NEW +PARTIALLY_FILLED +FILLED +CANCELED +EXPIRED +EXPIRED_IN_MATCH +Time in force + +GTC +IOC +FOK +GTX +Working Type + +MARK_PRICE +CONTRACT_PRICE +Liquidation and ADL: + +If user gets liquidated due to insufficient margin balance: + +c shows as "autoclose-XXX",X shows as "NEW" +If user has enough margin balance but gets ADL: + +c shows as “adl_autoclose”,X shows as “NEW” +Event: Account Configuration Update previous Leverage Update +Payload: + +{ + "e":"ACCOUNT_CONFIG_UPDATE", // Event Type + "E":1611646737479, // Event Time + "T":1611646737476, // Transaction Time + "ac":{ + "s":"BTCUSDT", // symbol + "l":25 // leverage + + } +} + +Or + +{ + "e":"ACCOUNT_CONFIG_UPDATE", // Event Type + "E":1611646737479, // Event Time + "T":1611646737476, // Transaction Time + "ai":{ // User's Account Configuration + "j":true // Multi-Assets Mode + } +} +When the account configuration is changed, the event type will be pushed as ACCOUNT_CONFIG_UPDATE + +When the leverage of a trade pair changes, the payload will contain the object ac to represent the account configuration of the trade pair, where s represents the specific trade pair and l represents the leverage + +When the user Multi-Assets margin mode changes the payload will contain the object ai representing the user account configuration, where j represents the user Multi-Assets margin mode + +Event: STRATEGY_UPDATE +Payload: + +{ + "e": "STRATEGY_UPDATE", // Event Type + "T": 1669261797627, // Transaction Time + "E": 1669261797628, // Event Time + "su": { + "si": 176054594, // Strategy ID + "st": "GRID", // Strategy Type + "ss": "NEW", // Strategy Status + "s": "BTCUSDT", // Symbol + "ut": 1669261797627, // Update Time + "c": 8007 // opCode + } +} +STRATEGY_UPDATE update when a strategy is created/cancelled/expired, ...etc. + +Strategy Status + +NEW +WORKING +CANCELLED +EXPIRED +opCode + +8001: The strategy params have been updated +8002: User cancelled the strategy +8003: User manually placed or cancelled an order +8004: The stop limit of this order reached +8005: User position liquidated +8006: Max open order limit reached +8007: New grid order +8008: Margin not enough +8009: Price out of bounds +8010: Market is closed or paused +8011: Close position failed, unable to fill +8012: Exceeded the maximum allowable notional value at current leverage +8013: Grid expired due to incomplete KYC verification or access from a restricted jurisdiction +8014: Violated Futures Trading Quantitative Rules. Strategy stopped +8015: User position empty or liquidated +Event: GRID_UPDATE +Payload: + +{ + "e": "GRID_UPDATE", // Event Type + "T": 1669262908216, // Transaction Time + "E": 1669262908218, // Event Time + "gu": { + "si": 176057039, // Strategy ID + "st": "GRID", // Strategy Type + "ss": "WORKING", // Strategy Status + "s": "BTCUSDT", // Symbol + "r": "-0.00300716", // Realized PNL + "up": "16720", // Unmatched Average Price + "uq": "-0.001", // Unmatched Qty + "uf": "-0.00300716", // Unmatched Fee + "mp": "0.0", // Matched PNL + "ut": 1669262908197 // Update Time + } +} +GRID_UPDATE update when a sub order of a grid is filled or partially filled. + +Strategy Status + +NEW +WORKING +CANCELLED +EXPIRED +Event: Conditional_Order_Trigger_Reject +Payload: + +{ + "e":"CONDITIONAL_ORDER_TRIGGER_REJECT", // Event Type + "E":1685517224945, // Event Time + "T":1685517224955, // me message send Time + "or":{ + "s":"ETHUSDT", // Symbol + "i":155618472834, // orderId + "r":"Due to the order could not be filled immediately, the FOK order has been rejected. The order will not be recorded in the order history", // reject reason + } +} +CONDITIONAL_ORDER_TRIGGER_REJECT update when a triggered TP/SL order got rejected. + +Portfolio Margin Pro Endpoints +The Binance Portfolio Margin Pro Program is a cross-asset margin program supporting consolidated margin balance across trading products with over 200+ effective crypto collaterals. It is designed for professional traders, market makers, and institutional users looking to actively trade & hedge cross-asset and optimize risk-management in a consolidated setup. + +FAQ: Portfolio Margin Pro Program + +Only Portfolio Margin Pro Account is accessible to these endpoints. To enroll, kindly refer to: How to Enroll into the Binance Portfolio Margin Pro Program + +Portfolio Margin Pro Account Information (USER_DATA) +Response: + +{ + "maxWithdrawAmountUSD": "1627523.32459208", // Portfolio Margin Pro maximum virtual amount for transfer out in USD + "asset": "BTC", // asset name + "maxWithdrawAmount": "27.43689636", // Please ignore +} +GET /fapi/v1/pmAccountInfo + +Get Portfolio Margin Pro current account information. + +Weight(IP): 5 + +Parameters: + +Name Type Mandatory Description +asset STRING YES +recvWindow LONG NO +timestamp LONG YES +maxWithdrawAmount is for asset transfer out to the spot wallet. +Portfolio Margin Pro User Data Stream +The websocket base url is: wss://fstream.binance.com/pm-classic +User Data Streams are accessed at /ws/ +Example: wss://fstream.binance.com/pm-classic/ws/XaEAKTsQSRLZAGH9tuIu37plSRsdjmlAVBoNYPUITlTAko1WI22PgmBMpI1rS8Yh +Event: riskLevelChange +Payload: + +{ + "e":"riskLevelChange", // Event Type + "E":1587727187525, // Event Time + "u":"1.99999999", // uniMMR level + "s":"MARGIN_CALL", //MARGIN_CALL, SUPPLY_MARGIN, REDUCE_ONLY, FORCE_LIQUIDATION + "eq":"30.23416728", // account equity in USD value + "ae":"30.23416728", // actual equity without collateral rate in USD value + "m":"15.11708371" // total maintenance margin in USD value +} +When the user's position risk ratio changes, this stream will be pushed. This message is only used as risk guidance information and is not recommended for investment strategies. RISK_LEVEL_CHANGE includes following types:MARGIN_CALL, SUPPLY_MARGIN, REDUCE_ONLY, FORCE_LIQUIDATION In the case of a highly volatile market, there may be the possibility that the user's position has been liquidated at the same time when this stream is pushed out. + +WebSocket API +New Order (TRADE) +Request + +{ + "id": "3f7df6e3-2df4-44b9-9919-d2f38f90a99a", + "method": "order.place", + "params": { + "apiKey": "HMOchcfii9ZRZnhjp2XjGXhsOBd6msAhKz9joQaWwZ7arcJTlD2hGPHQj1lGdTjR", + "positionSide": "BOTH", + "price": "43187.00", + "quantity": 0.1, + "side": "BUY", + "symbol": "BTCUSDT", + "timeInForce": "GTC", + "timestamp": 1702555533821, + "type": "LIMIT", + "signature": "0f04368b2d22aafd0ggc8809ea34297eff602272917b5f01267db4efbc1c9422" + } +} +Response + +{ + "id": "3f7df6e3-2df4-44b9-9919-d2f38f90a99a", + "status": 200, + "result": { + "orderId": 325078477, + "symbol": "BTCUSDT", + "status": "NEW", + "clientOrderId": "iCXL1BywlBaf2sesNUrVl3", + "price": "43187.00", + "avgPrice": "0.00", + "origQty": "0.100", + "executedQty": "0.000", + "cumQty": "0.000", + "cumQuote": "0.00000", + "timeInForce": "GTC", + "type": "LIMIT", + "reduceOnly": false, + "closePosition": false, + "side": "BUY", + "positionSide": "BOTH", + "stopPrice": "0.00", + "workingType": "CONTRACT_PRICE", + "priceProtect": false, + "origType": "LIMIT", + "priceMatch": "NONE", + "selfTradePreventionMode": "NONE", + "goodTillDate": 0, + "updateTime": 1702555534435 + }, + "rateLimits": [ + { + "rateLimitType": "ORDERS", + "interval": "SECOND", + "intervalNum": 10, + "limit": 300, + "count": 1 + }, + { + "rateLimitType": "ORDERS", + "interval": "MINUTE", + "intervalNum": 1, + "limit": 1200, + "count": 1 + }, + { + "rateLimitType": "REQUEST_WEIGHT", + "interval": "MINUTE", + "intervalNum": 1, + "limit": 2400, + "count": 1 + } + ] +} +Send in a new order. + +Weight: 0 + +Method: order.place + +Parameters + +Name Type Mandatory Description +symbol STRING YES +side ENUM YES +positionSide ENUM NO Default BOTH for One-way Mode; LONG or SHORT for Hedge Mode. It must be sent in Hedge Mode. +type ENUM YES +timeInForce ENUM NO +quantity DECIMAL NO Cannot be sent with closePosition=true (Close-All) +reduceOnly STRING NO true or false. default false. Cannot be sent in Hedge Mode; cannot be sent with closePosition=true +price DECIMAL NO +newClientOrderId STRING NO A unique id among open orders. Automatically generated if not sent. Can only be string following the rule: ^[\.A-Z\:/a-z0-9_-]{1,36}$ +stopPrice DECIMAL NO Used with STOP/STOP_MARKET or TAKE_PROFIT/TAKE_PROFIT_MARKET orders. +closePosition STRING NO true, false;Close-All,used with STOP_MARKET or TAKE_PROFIT_MARKET. +activationPrice DECIMAL NO Used with TRAILING_STOP_MARKET orders, default as the latest price(supporting different workingType) +callbackRate DECIMAL NO Used with TRAILING_STOP_MARKET orders, min 0.1, max 5 where 1 for 1% +workingType ENUM NO stopPrice triggered by: "MARK_PRICE", "CONTRACT_PRICE". Default "CONTRACT_PRICE" +priceProtect ENUM NO "TRUE" or "FALSE", default "FALSE". Used with STOP/STOP_MARKET or TAKE_PROFIT/TAKE_PROFIT_MARKET orders. +newOrderRespType ENUM NO ACK,RESULT, default ACK +priceMatch ENUM NO only available for LIMIT/STOP/TAKE_PROFIT order; can be set to OPPONENT/ OPPONENT_5/ OPPONENT_10/ OPPONENT_20: /QUEUE/ QUEUE_5/ QUEUE_10/ QUEUE_20; Can't be passed together with price +selfTradePreventionMode ENUM NO NONE/ EXPIRE_TAKER/ EXPIRE_MAKER/ EXPIRE_BOTH; default NONE +goodTillDate INT NO Order cancel time for timeInForce GTD, mandatory when timeInforce set to GTD; order the timestamp only retains second-level precision, ms part will be ignored; The goodTillDate timestamp must be greater than the current time plus 600 seconds and smaller than 253402300799000 +recvWindow INT NO +timestamp INT YES +Additional mandatory parameters based on type: + +Type Additional mandatory parameters +LIMIT timeInForce, quantity, price +MARKET quantity +STOP/TAKE_PROFIT quantity, price, stopPrice +STOP_MARKET/TAKE_PROFIT_MARKET stopPrice +TRAILING_STOP_MARKET callbackRate +Order with type STOP, parameter timeInForce can be sent ( default GTC). +Order with type TAKE_PROFIT, parameter timeInForce can be sent ( default GTC). +Condition orders will be triggered when: +If parameter priceProtect is sent as true: +when price reaches the stopPrice,the difference rate between "MARK_PRICE" and "CONTRACT_PRICE" cannot be larger than the "triggerProtect" of the symbol +"triggerProtect" of a symbol can be got from GET /fapi/v1/exchangeInfo +STOP, STOP_MARKET: +BUY: latest price ("MARK_PRICE" or "CONTRACT_PRICE") >= stopPrice +SELL: latest price ("MARK_PRICE" or "CONTRACT_PRICE") <= stopPrice +TAKE_PROFIT, TAKE_PROFIT_MARKET: +BUY: latest price ("MARK_PRICE" or "CONTRACT_PRICE") <= stopPrice +SELL: latest price ("MARK_PRICE" or "CONTRACT_PRICE") >= stopPrice +TRAILING_STOP_MARKET: +BUY: the lowest price after order placed <= activationPrice, and the latest price >= the lowest price * (1 + callbackRate) +SELL: the highest price after order placed >= activationPrice, and the latest price <= the highest price * (1 - callbackRate) +For TRAILING_STOP_MARKET, if you got such error code. {"code": -2021, "msg": "Order would immediately trigger."} means that the parameters you send do not meet the following requirements: +BUY: activationPrice should be smaller than latest price. +SELL: activationPrice should be larger than latest price. +If newOrderRespType is sent as RESULT: +MARKET order: the final FILLED result of the order will be return directly. +LIMIT order with special timeInForce: the final status result of the order(FILLED or EXPIRED) will be returned directly. +STOP_MARKET, TAKE_PROFIT_MARKET with closePosition=true: +Follow the same rules for condition orders. +If triggered,close all current long position(if SELL) or current short position(if BUY). +Cannot be used with quantity parameter +Cannot be used with reduceOnly parameter +In Hedge Mode, cannot be used with BUY orders in LONG position side. and cannot be used with SELL orders in SHORT position side +selfTradePreventionMode is only effective when timeInForce set to IOC or GTC or GTD. +In extreme market conditions, timeInForce GTD order auto cancel time might be delayed comparing to goodTillDate + + +Cancel order (TRADE) +Request + +{ + "id": "5633b6a2-90a9-4192-83e7-925c90b6a2fd", + "method": "order.cancel", + "params": { + "apiKey": "HsOehcfih8ZRxnhjp2XjGXhsOBd6msAhKz9joQaWwZ7arcJTlD2hGOGQj1lGdTjR", + "orderId": 283194212, + "symbol": "BTCUSDT", + "timestamp": 1703439070722, + "signature": "b09c49815b4e3f1f6098cd9fbe26a933a9af79803deaaaae03c29f719c08a8a8" + } +} +Response + +{ + "id": "5633b6a2-90a9-4192-83e7-925c90b6a2fd", + "status": 200, + "result": { + "clientOrderId": "myOrder1", + "cumQty": "0", + "cumQuote": "0", + "executedQty": "0", + "orderId": 283194212, + "origQty": "11", + "origType": "TRAILING_STOP_MARKET", + "price": "0", + "reduceOnly": false, + "side": "BUY", + "positionSide": "SHORT", + "status": "CANCELED", + "stopPrice": "9300", // please ignore when order type is TRAILING_STOP_MARKET + "closePosition": false, // if Close-All + "symbol": "BTCUSDT", + "timeInForce": "GTC", + "type": "TRAILING_STOP_MARKET", + "activatePrice": "9020", // activation price, only return with TRAILING_STOP_MARKET order + "priceRate": "0.3", // callback rate, only return with TRAILING_STOP_MARKET order + "updateTime": 1571110484038, + "workingType": "CONTRACT_PRICE", + "priceProtect": false, // if conditional order trigger is protected + "priceMatch": "NONE", //price match mode + "selfTradePreventionMode": "NONE", //self trading prevention mode + "goodTillDate": 0 //order pre-set auto cancel time for TIF GTD order + }, + "rateLimits": [ + { + "rateLimitType": "REQUEST_WEIGHT", + "interval": "MINUTE", + "intervalNum": 1, + "limit": 2400, + "count": 1 + } + ] +} +Cancel an active order. + +Weight: 1 + +Method: order.cancel + +Parameters + +Name Type Mandatory Description +symbol STRING YES +orderId INT NO +origClientOrderId STRING NO +recvWindow INT NO +timestamp INT YES +Either orderId or origClientOrderId must be sent. +Modify Order (TRADE) +Request + +{ + "id": "c8c271ba-de70-479e-870c-e64951c753d9", + "method": "order.modify", + "params": { + "apiKey": "HMOchcfiT9ZRZnhjp2XjGXhsOBd6msAhKz9joQaWwZ7arcJTlD2hGPHQj1lGdTjR", + "orderId": 328971409, + "origType": "LIMIT", + "positionSide": "SHORT", + "price": "43769.1", + "priceMatch": "NONE", + "quantity": "0.11", + "side": "SELL", + "symbol": "BTCUSDT", + "timestamp": 1703426755754, + "signature": "d30c9f0736a307f5a9988d4a40b688662d18324b17367d51421da5484e835923" + } +} +Response + +{ + "id": "c8c271ba-de70-479e-870c-e64951c753d9", + "status": 200, + "result": { + "orderId": 328971409, + "symbol": "BTCUSDT", + "status": "NEW", + "clientOrderId": "xGHfltUMExx0TbQstQQfRX", + "price": "43769.10", + "avgPrice": "0.00", + "origQty": "0.110", + "executedQty": "0.000", + "cumQty": "0.000", + "cumQuote": "0.00000", + "timeInForce": "GTC", + "type": "LIMIT", + "reduceOnly": false, + "closePosition": false, + "side": "SELL", + "positionSide": "SHORT", + "stopPrice": "0.00", + "workingType": "CONTRACT_PRICE", + "priceProtect": false, + "origType": "LIMIT", + "priceMatch": "NONE", + "selfTradePreventionMode": "NONE", + "goodTillDate": 0, + "updateTime": 1703426756190 + }, + "rateLimits": [ + { + "rateLimitType": "ORDERS", + "interval": "SECOND", + "intervalNum": 10, + "limit": 300, + "count": 1 + }, + { + "rateLimitType": "ORDERS", + "interval": "MINUTE", + "intervalNum": 1, + "limit": 1200, + "count": 1 + }, + { + "rateLimitType": "REQUEST_WEIGHT", + "interval": "MINUTE", + "intervalNum": 1, + "limit": 2400, + "count": 1 + } + ] +} +Order modify function, currently only LIMIT order modification is supported, modified orders will be reordered in the match queue + +Weight: 1 on 10s order rate limit(X-MBX-ORDER-COUNT-10S); 1 on 1min order rate limit(X-MBX-ORDER-COUNT-1M); 1 on IP rate limit(x-mbx-used-weight-1m) + +Method: order.modify + +Parameters + +Name Type Mandatory Description +orderId INT NO +origClientOrderId STRING NO +symbol STRING YES +side ENUM YES SELL, BUY; side needs to be same as origin order` +quantity DECIMAL YES Order quantity, cannot be sent with closePosition=true +price DECIMAL YES +priceMatch ENUM NO only available for LIMIT,STOP,TAKE_PROFIT order; Can be set to OPPONENT/ OPPONENT_5/ OPPONENT_10/ OPPONENT_20/QUEUE/ QUEUE_5/ QUEUE_10/ QUEUE_20;can't be passed price together with price +recvWindow INT NO +timestamp INT YES +Either orderId or origClientOrderId must be sent, and the orderId will prevail if both are sent. +Both quantity and price must be sent, which is different from dapi modify order endpoint. +When the new quantity or price doesn't satisfy PRICE_FILTER / PERCENT_FILTER / LOT_SIZE, amendment will be rejected and the order will stay as it is. +However the order will be cancelled by the amendment in the following situations: +When the order is in partially filled status and the new quantity <= executedQty +When the order is GTX and the new price will cause it to be executed immediately +One order can only be modified for less than 10000 times +Modify order will set selfTradePreventionMode to NONE +Query Order (USER_DATA) +Request + +{ + "id": "0ce5d070-a5e5-4ff2-b57f-1556741a4204", + "method": "order.status", + "params": { + "apiKey": "HMOchcfii9ZRZnhjp2XjGXhsOBd6msAhKz9joQaWwZ7arcJTlD2hGPHQj1lGdTjR", + "orderId": 328999071, + "symbol": "BTCUSDT", + "timestamp": 1703441060152, + "signature": "ba48184fc38a71d03d2b5435bd67c1206e3191e989fe99bda1bc643a880dfdbf" + } +} +Response + +{ + "id": "0ce5d070-a5e5-4ff2-b57f-1556741a4204", + "status": 200, + "result": { + "orderId": 328999071, + "symbol": "BTCUSDT", + "status": "NEW", + "clientOrderId": "bK2CASGXToGAKVsePruSCs", + "price": "43634.50", + "avgPrice": "0.00", + "origQty": "0.010", + "executedQty": "0.000", + "cumQuote": "0.00000", + "timeInForce": "GTC", + "type": "LIMIT", + "reduceOnly": false, + "closePosition": false, + "side": "BUY", + "positionSide": "BOTH", + "stopPrice": "0.00", + "workingType": "CONTRACT_PRICE", + "priceProtect": false, + "origType": "LIMIT", + "priceMatch": "NONE", + "selfTradePreventionMode": "NONE", + "goodTillDate": 0, + "time": 1703441059890, + "updateTime": 1703441059890 + }, + "rateLimits": [ + { + "rateLimitType": "REQUEST_WEIGHT", + "interval": "MINUTE", + "intervalNum": 1, + "limit": 2400, + "count": 6 + } + ] +} +Check an order's status. + +Weight: 1 + +Method: order.status + +These orders will not be found: +order status is CANCELED or EXPIRED AND order has NO filled trade AND created time + 3 days < current time +order create time + 90 days < current time +Parameters + +Name Type Mandatory Description +symbol STRING YES +orderId INT NO +origClientOrderId STRING NO +recvWindow INT NO +timestamp INT YES + Notes: + +Either orderId or origClientOrderId must be sent. +orderId is self-increment for each specific symbol +Account information V2(USER_DATA) +Request + +{ + "id": "605a6d20-6588-4cb9-afa0-b0ab087507ba", + "method": "v2/account.status", + "params": { + "apiKey": "xTaDyrmvA9XT2oBHHjy39zyPzKCvMdtH3b9q4xadkAg2dNSJXQGCxzui26L823W2", + "timestamp": 1702620814781, + "signature": "6bb98ef84170c70ba3d01f44261bfdf50fef374e551e590de22b5c3b729b1d8c" + } +} +Response + +Single Asset Mode + +{ + "id": "605a6d20-6588-4cb9-afa0-b0ab087507ba", + "status": 200, + "result": { + "totalInitialMargin": "0.00000000", // total initial margin required with current mark price (useless with isolated positions), only for USDT asset + "totalMaintMargin": "0.00000000", // total maintenance margin required, only for USDT asset + "totalWalletBalance": "103.12345678", // total wallet balance, only for USDT asset + "totalUnrealizedProfit": "0.00000000", // total unrealized profit, only for USDT asset + "totalMarginBalance": "103.12345678", // total margin balance, only for USDT asset + "totalPositionInitialMargin": "0.00000000", // initial margin required for positions with current mark price, only for USDT asset + "totalOpenOrderInitialMargin": "0.00000000", // initial margin required for open orders with current mark price, only for USDT asset + "totalCrossWalletBalance": "103.12345678", // crossed wallet balance, only for USDT asset + "totalCrossUnPnl": "0.00000000", // unrealized profit of crossed positions, only for USDT asset + "availableBalance": "103.12345678", // available balance, only for USDT asset + "maxWithdrawAmount": "103.12345678" // maximum amount for transfer out, only for USDT asset + "assets": [ // For assets that are quote assets, USDT/USDC/BTC + { + "asset": "USDT", // asset name + "walletBalance": "23.72469206", // wallet balance + "unrealizedProfit": "0.00000000", // unrealized profit + "marginBalance": "23.72469206", // margin balance + "maintMargin": "0.00000000", // maintenance margin required + "initialMargin": "0.00000000", // total initial margin required with current mark price + "positionInitialMargin": "0.00000000", // initial margin required for positions with current mark price + "openOrderInitialMargin": "0.00000000", // initial margin required for open orders with current mark price + "crossWalletBalance": "23.72469206", // crossed wallet balance + "crossUnPnl": "0.00000000" // unrealized profit of crossed positions + "availableBalance": "23.72469206", // available balance + "maxWithdrawAmount": "23.72469206", // maximum amount for transfer out + "updateTime": 1625474304765 // last update time + }, + { + "asset": "USDC", // asset name + "walletBalance": "103.12345678", // wallet balance + "unrealizedProfit": "0.00000000", // unrealized profit + "marginBalance": "103.12345678", // margin balance + "maintMargin": "0.00000000", // maintenance margin required + "initialMargin": "0.00000000", // total initial margin required with current mark price + "positionInitialMargin": "0.00000000", // initial margin required for positions with current mark price + "openOrderInitialMargin": "0.00000000", // initial margin required for open orders with current mark price + "crossWalletBalance": "103.12345678", // crossed wallet balance + "crossUnPnl": "0.00000000" // unrealized profit of crossed positions + "availableBalance": "126.72469206", // available balance + "maxWithdrawAmount": "103.12345678", // maximum amount for transfer out + "updateTime": 1625474304765 // last update time + }, + ], + "positions": [ // positions of all symbols user had position/ open orders are returned + // only "BOTH" positions will be returned with One-way mode + // only "LONG" and "SHORT" positions will be returned with Hedge mode + { + "symbol": "BTCUSDT", + "positionSide": "BOTH", // position side + "positionAmt": "1.000", + "unrealizedProfit": "0.00000000", // unrealized profit + "isolatedMargin": "0.00000000", + "notional": "0", + "isolatedWallet": "0", + "initialMargin": "0", // initial margin required with current mark price + "maintMargin": "0", // maintenance margin required + "updateTime": 0 + } + ] + }, + "rateLimits": [ + { + "rateLimitType": "REQUEST_WEIGHT", + "interval": "MINUTE", + "intervalNum": 1, + "limit": 2400, + "count": 20 + } + ] +} +Multi-Asset Mode javascript { "id": "605a6d20-6588-4cb9-afa0-b0ab087507ba", "status": 200, "result": { "totalInitialMargin": "0.00000000", // the sum of USD value of all cross positions/open order initial margin "totalMaintMargin": "0.00000000", // the sum of USD value of all cross positions maintenance margin "totalWalletBalance": "126.72469206", // total wallet balance in USD "totalUnrealizedProfit": "0.00000000", // total unrealized profit in USD "totalMarginBalance": "126.72469206", // total margin balance in USD "totalPositionInitialMargin": "0.00000000", // the sum of USD value of all cross positions initial margin "totalOpenOrderInitialMargin": "0.00000000", // initial margin required for open orders with current mark price in USD "totalCrossWalletBalance": "126.72469206", // crossed wallet balance in USD "totalCrossUnPnl": "0.00000000", // unrealized profit of crossed positions in USD "availableBalance": "126.72469206", // available balance in USD "maxWithdrawAmount": "126.72469206" // maximum virtual amount for transfer out in USD "assets": [ { "asset": "USDT", // asset name "walletBalance": "23.72469206", // wallet balance "unrealizedProfit": "0.00000000", // unrealized profit "marginBalance": "23.72469206", // margin balance "maintMargin": "0.00000000", // maintenance margin required "initialMargin": "0.00000000", // total initial margin required with current mark price "positionInitialMargin": "0.00000000", //initial margin required for positions with current mark price "openOrderInitialMargin": "0.00000000", // initial margin required for open orders with current mark price "crossWalletBalance": "23.72469206", // crossed wallet balance "crossUnPnl": "0.00000000" // unrealized profit of crossed positions "availableBalance": "126.72469206", // available balance "maxWithdrawAmount": "23.72469206", // maximum amount for transfer out "marginAvailable": true, // whether the asset can be used as margin in Multi-Assets mode "updateTime": 1625474304765 // last update time }, { "asset": "BUSD", // asset name "walletBalance": "103.12345678", // wallet balance "unrealizedProfit": "0.00000000", // unrealized profit "marginBalance": "103.12345678", // margin balance "maintMargin": "0.00000000", // maintenance margin required "initialMargin": "0.00000000", // total initial margin required with current mark price "positionInitialMargin": "0.00000000", //initial margin required for positions with current mark price "openOrderInitialMargin": "0.00000000", // initial margin required for open orders with current mark price "crossWalletBalance": "103.12345678", // crossed wallet balance "crossUnPnl": "0.00000000" // unrealized profit of crossed positions "availableBalance": "126.72469206", // available balance "maxWithdrawAmount": "103.12345678", // maximum amount for transfer out "marginAvailable": true, // whether the asset can be used as margin in Multi-Assets mode "updateTime": 1625474304765 // last update time } ], "positions": [ // positions of all symbols user had position are returned // only "BOTH" positions will be returned with One-way mode // only "LONG" and "SHORT" positions will be returned with Hedge mode { "symbol": "BTCUSDT", "positionSide": "BOTH", // position side "positionAmt": "1.000", "unrealizedProfit": "0.00000000", // unrealized profit "isolatedMargin": "0.00000000", "notional": "0", "isolatedWallet": "0", "initialMargin": "0", // initial margin required with current mark price "maintMargin": "0", // maintenance margin required "updateTime": 0 } ] }, "rateLimits": [ { "rateLimitType": "REQUEST_WEIGHT", "interval": "MINUTE", "intervalNum": 1, "limit": 2400, "count": 20 } ] } + +Get current account information. User in single-asset/ multi-assets mode will see different value, see comments in response section for detail. + +Weight: 5 + +Method: v2/account.status + +Parameters + +Name Type Mandatory Description +recvWindow INT NO +timestamp INT YES +Account information (USER_DATA) +Request + +{ + "id": "605a6d20-6588-4cb9-afa0-b0ab087507ba", + "method": "account.status", + "params": { + "apiKey": "xTaDyrmvA9XT2oBHHjy39zyPzKCvMdtH3b9q4xadkAg2dNSJXQGCxzui26L823W2", + "timestamp": 1702620814781, + "signature": "6bb98ef84170c70ba3d01f44261bfdf50fef374e551e590de22b5c3b729b1d8c" + } +} +Response + +Single Asset Mode + +{ + "id": "605a6d20-6588-4cb9-afa0-b0ab087507ba", + "status": 200, + "result": { + "feeTier": 0, // account commission tier + "canTrade": true, // if can trade + "canDeposit": true, // if can transfer in asset + "canWithdraw": true, // if can transfer out asset + "updateTime": 0, // reserved property, please ignore + "multiAssetsMargin": false, + "tradeGroupId": -1, + "totalInitialMargin": "0.00000000", // total initial margin required with current mark price (useless with isolated positions), only for USDT asset + "totalMaintMargin": "0.00000000", // total maintenance margin required, only for USDT asset + "totalWalletBalance": "23.72469206", // total wallet balance, only for USDT asset + "totalUnrealizedProfit": "0.00000000", // total unrealized profit, only for USDT asset + "totalMarginBalance": "23.72469206", // total margin balance, only for USDT asset + "totalPositionInitialMargin": "0.00000000", // initial margin required for positions with current mark price, only for USDT asset + "totalOpenOrderInitialMargin": "0.00000000", // initial margin required for open orders with current mark price, only for USDT asset + "totalCrossWalletBalance": "23.72469206", // crossed wallet balance, only for USDT asset + "totalCrossUnPnl": "0.00000000", // unrealized profit of crossed positions, only for USDT asset + "availableBalance": "23.72469206", // available balance, only for USDT asset + "maxWithdrawAmount": "23.72469206" // maximum amount for transfer out, only for USDT asset + "assets": [ + { + "asset": "USDT", // asset name + "walletBalance": "23.72469206", // wallet balance + "unrealizedProfit": "0.00000000", // unrealized profit + "marginBalance": "23.72469206", // margin balance + "maintMargin": "0.00000000", // maintenance margin required + "initialMargin": "0.00000000", // total initial margin required with current mark price + "positionInitialMargin": "0.00000000", //initial margin required for positions with current mark price + "openOrderInitialMargin": "0.00000000", // initial margin required for open orders with current mark price + "crossWalletBalance": "23.72469206", // crossed wallet balance + "crossUnPnl": "0.00000000" // unrealized profit of crossed positions + "availableBalance": "23.72469206", // available balance + "maxWithdrawAmount": "23.72469206", // maximum amount for transfer out + "marginAvailable": true, // whether the asset can be used as margin in Multi-Assets mode + "updateTime": 1625474304765 // last update time + }, + { + "asset": "BUSD", // asset name + "walletBalance": "103.12345678", // wallet balance + "unrealizedProfit": "0.00000000", // unrealized profit + "marginBalance": "103.12345678", // margin balance + "maintMargin": "0.00000000", // maintenance margin required + "initialMargin": "0.00000000", // total initial margin required with current mark price + "positionInitialMargin": "0.00000000", //initial margin required for positions with current mark price + "openOrderInitialMargin": "0.00000000", // initial margin required for open orders with current mark price + "crossWalletBalance": "103.12345678", // crossed wallet balance + "crossUnPnl": "0.00000000" // unrealized profit of crossed positions + "availableBalance": "103.12345678", // available balance + "maxWithdrawAmount": "103.12345678", // maximum amount for transfer out + "marginAvailable": true, // whether the asset can be used as margin in Multi-Assets mode + "updateTime": 1625474304765 // last update time + } + ], + "positions": [ // positions of all symbols in the market are returned + // only "BOTH" positions will be returned with One-way mode + // only "LONG" and "SHORT" positions will be returned with Hedge mode + { + "symbol": "BTCUSDT", // symbol name + "initialMargin": "0", // initial margin required with current mark price + "maintMargin": "0", // maintenance margin required + "unrealizedProfit": "0.00000000", // unrealized profit + "positionInitialMargin": "0", // initial margin required for positions with current mark price + "openOrderInitialMargin": "0", // initial margin required for open orders with current mark price + "leverage": "100", // current initial leverage + "isolated": true, // if the position is isolated + "entryPrice": "0.00000", // average entry price + "maxNotional": "250000", // maximum available notional with current leverage + "bidNotional": "0", // bids notional, ignore + "askNotional": "0", // ask notional, ignore + "positionSide": "BOTH", // position side + "positionAmt": "0", // position amount + "updateTime": 0 // last update time + } + ] + }, + "rateLimits": [ + { + "rateLimitType": "REQUEST_WEIGHT", + "interval": "MINUTE", + "intervalNum": 1, + "limit": 2400, + "count": 20 + } + ] +} +Multi-Asset Mode + +{ + "id": "605a6d20-6588-4cb9-afa0-b0ab087507ba", + "status": 200, + "result": { + "feeTier": 0, // account commission tier + "canTrade": true, // if can trade + "canDeposit": true, // if can transfer in asset + "canWithdraw": true, // if can transfer out asset + "updateTime": 0, // reserved property, please ignore + "multiAssetsMargin": true, + "tradeGroupId": -1, + "totalInitialMargin": "0.00000000", // the sum of USD value of all cross positions/open order initial margin + "totalMaintMargin": "0.00000000", // the sum of USD value of all cross positions maintenance margin + "totalWalletBalance": "126.72469206", // total wallet balance in USD + "totalUnrealizedProfit": "0.00000000", // total unrealized profit in USD + "totalMarginBalance": "126.72469206", // total margin balance in USD + "totalPositionInitialMargin": "0.00000000", // the sum of USD value of all cross positions initial margin + "totalOpenOrderInitialMargin": "0.00000000", // initial margin required for open orders with current mark price in USD + "totalCrossWalletBalance": "126.72469206", // crossed wallet balance in USD + "totalCrossUnPnl": "0.00000000", // unrealized profit of crossed positions in USD + "availableBalance": "126.72469206", // available balance in USD + "maxWithdrawAmount": "126.72469206" // maximum virtual amount for transfer out in USD + "assets": [ + { + "asset": "USDT", // asset name + "walletBalance": "23.72469206", // wallet balance + "unrealizedProfit": "0.00000000", // unrealized profit + "marginBalance": "23.72469206", // margin balance + "maintMargin": "0.00000000", // maintenance margin required + "initialMargin": "0.00000000", // total initial margin required with current mark price + "positionInitialMargin": "0.00000000", //initial margin required for positions with current mark price + "openOrderInitialMargin": "0.00000000", // initial margin required for open orders with current mark price + "crossWalletBalance": "23.72469206", // crossed wallet balance + "crossUnPnl": "0.00000000" // unrealized profit of crossed positions + "availableBalance": "126.72469206", // available balance + "maxWithdrawAmount": "23.72469206", // maximum amount for transfer out + "marginAvailable": true, // whether the asset can be used as margin in Multi-Assets mode + "updateTime": 1625474304765 // last update time + }, + { + "asset": "BUSD", // asset name + "walletBalance": "103.12345678", // wallet balance + "unrealizedProfit": "0.00000000", // unrealized profit + "marginBalance": "103.12345678", // margin balance + "maintMargin": "0.00000000", // maintenance margin required + "initialMargin": "0.00000000", // total initial margin required with current mark price + "positionInitialMargin": "0.00000000", //initial margin required for positions with current mark price + "openOrderInitialMargin": "0.00000000", // initial margin required for open orders with current mark price + "crossWalletBalance": "103.12345678", // crossed wallet balance + "crossUnPnl": "0.00000000" // unrealized profit of crossed positions + "availableBalance": "126.72469206", // available balance + "maxWithdrawAmount": "103.12345678", // maximum amount for transfer out + "marginAvailable": true, // whether the asset can be used as margin in Multi-Assets mode + "updateTime": 1625474304765 // last update time + } + ], + "positions": [ // positions of all symbols in the market are returned + // only "BOTH" positions will be returned with One-way mode + // only "LONG" and "SHORT" positions will be returned with Hedge mode + { + "symbol": "BTCUSDT", // symbol name + "initialMargin": "0", // initial margin required with current mark price + "maintMargin": "0", // maintenance margin required + "unrealizedProfit": "0.00000000", // unrealized profit + "positionInitialMargin": "0", // initial margin required for positions with current mark price + "openOrderInitialMargin": "0", // initial margin required for open orders with current mark price + "leverage": "100", // current initial leverage + "isolated": true, // if the position is isolated + "entryPrice": "0.00000", // average entry price + "breakEvenPrice": "0.0", // average entry price + "maxNotional": "250000", // maximum available notional with current leverage + "bidNotional": "0", // bids notional, ignore + "askNotional": "0", // ask notional, ignore + "positionSide": "BOTH", // position side + "positionAmt": "0", // position amount + "updateTime": 0 // last update time + } + ] + }, + "rateLimits": [ + { + "rateLimitType": "REQUEST_WEIGHT", + "interval": "MINUTE", + "intervalNum": 1, + "limit": 2400, + "count": 20 + } + ] +} +Get current account information. User in single-asset/ multi-assets mode will see different value, see comments in response section for detail. + +Weight: 5 + +Method: account.status + +Parameters + +Name Type Mandatory Description +recvWindow INT NO +timestamp INT YES +Futures Account Balance V2(USER_DATA) +Request + +{ + "id": "605a6d20-6588-4cb9-afa0-b0ab087507ba", + "method": "v2/account.balance", + "params": { + "apiKey": "xTaDyrmvA9XT2oBHHjy39zyPzKCvMdtH3b9q4xadkAg2dNSJXQGCxzui26L823W2", + "timestamp": 1702561978458, + "signature": "208bb94a26f99aa122b1319490ca9cb2798fccc81d9b6449521a26268d53217a" + } +} +Response + +{ + "id": "605a6d20-6588-4cb9-afa0-b0ab087507ba", + "status": 200, + "result": { + [ + { + "accountAlias": "SgsR", // unique account code + "asset": "USDT", // asset name + "balance": "122607.35137903", // wallet balance + "crossWalletBalance": "23.72469206", // crossed wallet balance + "crossUnPnl": "0.00000000" // unrealized profit of crossed positions + "availableBalance": "23.72469206", // available balance + "maxWithdrawAmount": "23.72469206", // maximum amount for transfer out + "marginAvailable": true, // whether the asset can be used as margin in Multi-Assets mode + "updateTime": 1617939110373 + } + ] + }, + "rateLimits": [ + { + "rateLimitType": "REQUEST_WEIGHT", + "interval": "MINUTE", + "intervalNum": 1, + "limit": 2400, + "count": 20 + } + ] +} +Weight: 5 + +Method: v2/account.balance + +Parameters + +Name Type Mandatory Description +recvWindow INT NO +timestamp INT YES +Futures Account Balance(USER_DATA) +Request + +{ + "id": "605a6d20-6588-4cb9-afa0-b0ab087507ba", + "method": "account.balance", + "params": { + "apiKey": "xTaDyrmvA9XT2oBHHjy39zyPzKCvMdtH3b9q4xadkAg2dNSJXQGCxzui26L823W2", + "timestamp": 1702561978458, + "signature": "208bb94a26f99aa122b1319490ca9cb2798fccc81d9b6449521a26268d53217a" + } +} +Response + +{ + "id": "605a6d20-6588-4cb9-afa0-b0ab087507ba", + "status": 200, + "result": { + [ + { + "accountAlias": "SgsR", // unique account code + "asset": "USDT", // asset name + "balance": "122607.35137903", // wallet balance + "crossWalletBalance": "23.72469206", // crossed wallet balance + "crossUnPnl": "0.00000000" // unrealized profit of crossed positions + "availableBalance": "23.72469206", // available balance + "maxWithdrawAmount": "23.72469206", // maximum amount for transfer out + "marginAvailable": true, // whether the asset can be used as margin in Multi-Assets mode + "updateTime": 1617939110373 + } + ] + }, + "rateLimits": [ + { + "rateLimitType": "REQUEST_WEIGHT", + "interval": "MINUTE", + "intervalNum": 1, + "limit": 2400, + "count": 20 + } + ] +} +Weight: 5 + +Method: account.balance + +Parameters + +Name Type Mandatory Description +recvWindow INT NO +timestamp INT YES +Position Information V2(USER_DATA) +Request + +{ + "id": "605a6d20-6588-4cb9-afa0-b0ab087507ba", + "method": "v2/account.position", + "params": { + "apiKey": "xTaDyrmvA9XT2oBHHjy39zyPzKCvMdtH3b9q4xadkAg2dNSJXQGCxzui26L823W2", + "symbol": "BTCUSDT", + "timestamp": 1702920680303, + "signature": "31ab02a51a3989b66c29d40fcdf78216978a60afc6d8dc1c753ae49fa3164a2a" + } +} +Response + +For One-way position mode: + +{ + "id": "605a6d20-6588-4cb9-afa0-b0ab087507ba", + "status": 200, + "result": [ + { + "symbol": "BTCUSDT", + "positionSide": "BOTH", + "positionAmt": "1.000", + "entryPrice": "0.00000", + "breakEvenPrice": "0.0", + "markPrice": "6679.50671178", + "unrealizedProfit": "0.00000000", + "liquidationPrice": "0", + "isolatedMargin": "0.00000000", + "notional": "0", + "marginAsset": "USDT", + "isolatedWallet": "0", + "initialMargin": "0", + "maintMargin": "0", + "positionInitialMargin": "0", + "openOrderInitialMargin": "0", + "adl": 0, + "bidNotional": "0", + "askNotional": "0", + "updateTime": 0 + } +], + "rateLimits": [ + { + "rateLimitType": "REQUEST_WEIGHT", + "interval": "MINUTE", + "intervalNum": 1, + "limit": 2400, + "count": 20 + } + ] +} +For Hedge position mode: javascript { "id": "605a6d20-6588-4cb9-afa0-b0ab087507ba", "status": 200, "result": [ { "symbol": "BTCUSDT", "positionSide": "LONG", "positionAmt": "1.000", "entryPrice": "0.00000", "breakEvenPrice": "0.0", "markPrice": "6679.50671178", "unrealizedProfit": "0.00000000", "liquidationPrice": "0", "isolatedMargin": "0.00000000", "notional": "0", "marginAsset": "USDT", "isolatedWallet": "0", "initialMargin": "0", "maintMargin": "0", "positionInitialMargin": "0", "openOrderInitialMargin": "0", "adl": 0, "bidNotional": "0", "askNotional": "0", "updateTime": 0 }, { "symbol": "BTCUSDT", "positionSide": "SHORT", "positionAmt": "1.000", "entryPrice": "0.00000", "breakEvenPrice": "0.0", "markPrice": "6679.50671178", "unrealizedProfit": "0.00000000", "liquidationPrice": "0", "isolatedMargin": "0.00000000", "notional": "0", "marginAsset": "USDT", "isolatedWallet": "0", "initialMargin": "0", "maintMargin": "0", "positionInitialMargin": "0", "openOrderInitialMargin": "0", "adl": 0, "bidNotional": "0", "askNotional": "0", "updateTime": 0 } ], "rateLimits": [ { "rateLimitType": "REQUEST_WEIGHT", "interval": "MINUTE", "intervalNum": 1, "limit": 2400, "count": 20 } ] } + +Weight: 5 + +Method: v2/account.position + +Parameters + +Name Type Mandatory Description +symbol STRING NO +recvWindow INT NO +timestamp INT YES +Note + +Please use with user data stream ACCOUNT_UPDATE to meet your timeliness and accuracy needs. + +Position Information(USER_DATA) +Request + +{ + "id": "605a6d20-6588-4cb9-afa0-b0ab087507ba", + "method": "account.position", + "params": { + "apiKey": "xTaDyrmvA9XT2oBHHjy39zyPzKCvMdtH3b9q4xadkAg2dNSJXQGCxzui26L823W2", + "symbol": "BTCUSDT", + "timestamp": 1702920680303, + "signature": "31ab02a51a3989b66c29d40fcdf78216978a60afc6d8dc1c753ae49fa3164a2a" + } +} +Response + +For One-way position mode: + +{ + "id": "605a6d20-6588-4cb9-afa0-b0ab087507ba", + "status": 200, + "result": [ + { + "entryPrice": "0.00000", + "breakEvenPrice": "0.0", + "marginType": "isolated", + "isAutoAddMargin": "false", + "isolatedMargin": "0.00000000", + "leverage": "10", + "liquidationPrice": "0", + "markPrice": "6679.50671178", + "maxNotionalValue": "20000000", + "positionAmt": "0.000", + "notional": "0", + "isolatedWallet": "0", + "symbol": "BTCUSDT", + "unRealizedProfit": "0.00000000", + "positionSide": "BOTH", + "updateTime": 0 + } +], + "rateLimits": [ + { + "rateLimitType": "REQUEST_WEIGHT", + "interval": "MINUTE", + "intervalNum": 1, + "limit": 2400, + "count": 20 + } + ] +} +For Hedge position mode: + +{ + "id": "605a6d20-6588-4cb9-afa0-b0ab087507ba", + "status": 200, + "result": [ + { + "symbol": "BTCUSDT", + "positionAmt": "0.001", + "entryPrice": "22185.2", + "breakEvenPrice": "0.0", + "markPrice": "21123.05052574", + "unRealizedProfit": "-1.06214947", + "liquidationPrice": "19731.45529116", + "leverage": "4", + "maxNotionalValue": "100000000", + "marginType": "cross", + "isolatedMargin": "0.00000000", + "isAutoAddMargin": "false", + "positionSide": "LONG", + "notional": "21.12305052", + "isolatedWallet": "0", + "updateTime": 1655217461579 + }, + { + "symbol": "BTCUSDT", + "positionAmt": "0.000", + "entryPrice": "0.0", + "breakEvenPrice": "0.0", + "markPrice": "21123.05052574", + "unRealizedProfit": "0.00000000", + "liquidationPrice": "0", + "leverage": "4", + "maxNotionalValue": "100000000", + "marginType": "cross", + "isolatedMargin": "0.00000000", + "isAutoAddMargin": "false", + "positionSide": "SHORT", + "notional": "0", + "isolatedWallet": "0", + "updateTime": 0 + } +], + "rateLimits": [ + { + "rateLimitType": "REQUEST_WEIGHT", + "interval": "MINUTE", + "intervalNum": 1, + "limit": 2400, + "count": 20 + } + ] +} +Weight: 5 + +Method: account.position + +Parameters + +Name Type Mandatory Description +symbol STRING NO +recvWindow INT NO +timestamp INT YES +Note + +Please use with user data stream ACCOUNT_UPDATE to meet your timeliness and accuracy needs. + +Order book +Request + +{ + "id": "51e2affb-0aba-4821-ba75-f2625006eb43", + "method": "depth", + "params": { + "symbol": "BTCUSDT" + } +} +Response + +{ + "id": "51e2affb-0aba-4821-ba75-f2625006eb43", + "status": 200, + "result": { + "lastUpdateId": 1027024, + "E": 1589436922972, // Message output time + "T": 1589436922959, // Transaction time + "bids": [ + [ + "4.00000000", // PRICE + "431.00000000" // QTY + ] + ], + "asks": [ + [ + "4.00000200", + "12.00000000" + ] + ] + }, + "rateLimits": [ + { + "rateLimitType": "REQUEST_WEIGHT", + "interval": "MINUTE", + "intervalNum": 1, + "limit": 2400, + "count": 5 + } + ] +} +Get current order book. Note that this request returns limited market depth. If you need to continuously monitor order book updates, please consider using Websocket Market Streams: * @depth * @depth + +You can use depth request together with @depth streams to maintain a local order book. + +Weight: Adjusted based on the limit: + +Limit Weight +5,10,20,50 2 +100 5 +500 10 +1000 20 +Update Speed: 15ms + +Method: depth + +Parameters + +Name Type Mandatory Description +symbol STRING YES +limit INT NO Default 500; Valid limits:[5, 10, 20, 50, 100, 500, 1000] +Symbol Price Ticker +Request + +{ + "id": "9d32157c-a556-4d27-9866-66760a174b57", + "method": "ticker.price", + "params": { + "symbol": "BTCUSDT" + } +} +Response + +{ + "id": "9d32157c-a556-4d27-9866-66760a174b57", + "status": 200, + "result": { + "symbol": "BTCUSDT", + "price": "6000.01", + "time": 1589437530011 // Transaction time + }, + "rateLimits": [ + { + "rateLimitType": "REQUEST_WEIGHT", + "interval": "MINUTE", + "intervalNum": 1, + "limit": 2400, + "count": 2 + } + ] +} +OR + +{ + "id": "9d32157c-a556-4d27-9866-66760a174b57", + "status": 200, + "result": [ + { + "symbol": "BTCUSDT", + "price": "6000.01", + "time": 1589437530011 + } + ], + "rateLimits": [ + { + "rateLimitType": "REQUEST_WEIGHT", + "interval": "MINUTE", + "intervalNum": 1, + "limit": 2400, + "count": 2 + } + ] +} +Latest price for a symbol or symbols. + +Weight: * with symbol 1 * no symbol 2 + +Method: ticker.price + +Update Speed: real time + +Parameters + +Name Type Mandatory Description +symbol STRING NO +If the symbol is not sent, prices for all symbols will be returned in an array. +Symbol Order Book Ticker +Request + +{ + "id": "9d32157c-a556-4d27-9866-66760a174b57", + "method": "ticker.book", + "params": { + "symbol": "BTCUSDT" + } +} +Response + +{ + "id": "9d32157c-a556-4d27-9866-66760a174b57", + "status": 200, + "result": { + "lastUpdateId": 1027024, + "symbol": "BTCUSDT", + "bidPrice": "4.00000000", + "bidQty": "431.00000000", + "askPrice": "4.00000200", + "askQty": "9.00000000", + "time": 1589437530011 // Transaction time + }, + "rateLimits": [ + { + "rateLimitType": "REQUEST_WEIGHT", + "interval": "MINUTE", + "intervalNum": 1, + "limit": 2400, + "count": 2 + } + ] +} +OR + +{ + "id": "9d32157c-a556-4d27-9866-66760a174b57", + "status": 200, + "result": [ + { + "lastUpdateId": 1027024, + "symbol": "BTCUSDT", + "bidPrice": "4.00000000", + "bidQty": "431.00000000", + "askPrice": "4.00000200", + "askQty": "9.00000000", + "time": 1589437530011 + } + ], + "rateLimits": [ + { + "rateLimitType": "REQUEST_WEIGHT", + "interval": "MINUTE", + "intervalNum": 1, + "limit": 2400, + "count": 2 + } + ] +} +Best price/qty on the order book for a symbol or symbols. + +Weight: + +2 for a single symbol; 5 when the symbol parameter is omitted. + +Method: ticker.book + +Update Speed: real time + +Parameters + +Name Type Mandatory Description +symbol STRING NO +If the symbol is not sent, bookTickers for all symbols will be returned in an array. +Start user data stream (USER STREAM) +Request + +{ + "id": "d3df8a61-98ea-4fe0-8f4e-0fcea5d418b0", + "method": "userDataStream.start", + "params": { + "apiKey": "vmPUZE6mv9SD5VNHk4HlWFsOr6aKE2zvsw0MuIgwCIPy6utIco14y7Ju91duEh8A" + } +} +Response + +{ + "id": "d3df8a61-98ea-4fe0-8f4e-0fcea5d418b0", + "status": 200, + "result": { + "listenKey": "xs0mRXdAKlIPDRFrlPcw0qI41Eh3ixNntmymGyhrhgqo7L6FuLaWArTD7RLP" + }, + "rateLimits": [ + { + "rateLimitType": "REQUEST_WEIGHT", + "interval": "MINUTE", + "intervalNum": 1, + "limit": 2400, + "count": 2 + } + ] +} +The following requests manage User Data Stream subscriptions. + +Note: You will need to establish a separate WebSocket connection to listen to user data streams. + +Start a new user data stream. + +The response will output a listen key that can be subscribed through on the Websocket stream afterwards. + +Note: the stream will close in 60 minutes unless userDataStream.ping requests are sent regularly. + +Weight: 5 + +Method: userDataStream.start + +Parameters + +Name Type Mandatory Description +apiKey STRING YES +Ping user data stream (USER_STREAM) +Request + +{ + "id": "815d5fce-0880-4287-a567-80badf004c74", + "method": "userDataStream.ping", + "params": { + "listenKey": "xs0mRXdAKlIPDRFrlPcw0qI41Eh3ixNntmymGyhrhgqo7L6FuLaWArTD7RLP", + "apiKey": "vmPUZE6mv9SD5VNHk9HlWFsOr9aLE2zvsw0MuIgwCIPy8atIco14y7Ju91duEh8A" + } +} +Response + +{ + "id": "815d5fce-0880-4287-a567-80badf004c74", + "status": 200, + "result": { + "listenKey": "3HBntNTepshgEdjIwSUIBgB9keLyOCg5qv3n6bYAtktG8ejcaW5HXz9Vx1JgIieg" + }, + "rateLimits": [ + { + "rateLimitType": "REQUEST_WEIGHT", + "interval": "MINUTE", + "intervalNum": 1, + "limit": 2400, + "count": 2 + } + ] +} +Ping a user data stream to keep it alive. + +User data streams close automatically after 60 minutes, even if you're listening to them on WebSocket Streams. In order to keep the stream open, you have to regularly send pings using the userDataStream.ping request. + +It is recommended to send a ping once every 30 minutes. + +Weight: 5 + +Method: userDataStream.ping + +Parameters + +Name Type Mandatory Description +listenKey STRING YES +apiKey STRING YES +Stop user data stream (USER_STREAM) +Request + +{ + "id": "819e1b1b-8c06-485b-a13e-131326c69599", + "method": "userDataStream.stop", + "params": { + "listenKey": "xs0mRXdAKlIPDRFrlPcw0qI41Eh3ixNntmymGyhrhgqo7L6FuLaWArTD7RLP", + "apiKey": "vmPUZE6mv9SD5VNHk9HlWFsOr9aLE2zvsw0MuIgwCIPy8atIco14y7Ju91duEh8A" + } +} +Response + +{ + "id": "819e1b1b-8c06-485b-a13e-131326c69599", + "status": 200, + "result": {}, + "rateLimits": [ + { + "rateLimitType": "REQUEST_WEIGHT", + "interval": "MINUTE", + "intervalNum": 1, + "limit": 2400, + "count": 2 + } + ] +} +Explicitly stop and close the user data stream. + +Weight: 5 + +Method: userDataStream.stop + +Parameters + +Name Type Mandatory Description +listenKey STRING YES +apiKey STRING YES +Error Codes +Here is the error JSON payload: + +{ + "code":-1121, + "msg":"Invalid symbol." +} +Errors consist of two parts: an error code and a message. +Codes are universal,but messages can vary. + +10xx - General Server or Network issues +-1000 UNKNOWN +An unknown error occured while processing the request. +-1001 DISCONNECTED +Internal error; unable to process your request. Please try again. +-1002 UNAUTHORIZED +You are not authorized to execute this request. +-1003 TOO_MANY_REQUESTS +Too many requests queued. +Too many requests; please use the websocket for live updates. +Too many requests; current limit is %s requests per minute. Please use the websocket for live updates to avoid polling the API. +Way too many requests; IP banned until %s. Please use the websocket for live updates to avoid bans. +-1004 DUPLICATE_IP +This IP is already on the white list +-1005 NO_SUCH_IP +No such IP has been white listed +-1006 UNEXPECTED_RESP +An unexpected response was received from the message bus. Execution status unknown. +-1007 TIMEOUT +Timeout waiting for response from backend server. Send status unknown; execution status unknown. +-1008 SERVER_BUSY +Server is currently overloaded with other requests. Please try again in a few minutes. +-1010 ERROR_MSG_RECEIVED +ERROR_MSG_RECEIVED. +-1011 NON_WHITE_LIST +This IP cannot access this route. +-1013 INVALID_MESSAGE +INVALID_MESSAGE. +-1014 UNKNOWN_ORDER_COMPOSITION +Unsupported order combination. +-1015 TOO_MANY_ORDERS +Too many new orders. +Too many new orders; current limit is %s orders per %s. +-1016 SERVICE_SHUTTING_DOWN +This service is no longer available. +-1020 UNSUPPORTED_OPERATION +This operation is not supported. +-1021 INVALID_TIMESTAMP +Timestamp for this request is outside of the recvWindow. +Timestamp for this request was 1000ms ahead of the server's time. +-1022 INVALID_SIGNATURE +Signature for this request is not valid. +-1023 START_TIME_GREATER_THAN_END_TIME +Start time is greater than end time. +-1099 NOT_FOUND +Not found, unauthenticated, or unauthorized. +11xx - Request issues +-1100 ILLEGAL_CHARS +Illegal characters found in a parameter. +Illegal characters found in parameter '%s'; legal range is '%s'. +-1101 TOO_MANY_PARAMETERS +Too many parameters sent for this endpoint. +Too many parameters; expected '%s' and received '%s'. +Duplicate values for a parameter detected. +-1102 MANDATORY_PARAM_EMPTY_OR_MALFORMED +A mandatory parameter was not sent, was empty/null, or malformed. +Mandatory parameter '%s' was not sent, was empty/null, or malformed. +Param '%s' or '%s' must be sent, but both were empty/null! +-1103 UNKNOWN_PARAM +An unknown parameter was sent. +-1104 UNREAD_PARAMETERS +Not all sent parameters were read. +Not all sent parameters were read; read '%s' parameter(s) but was sent '%s'. +-1105 PARAM_EMPTY +A parameter was empty. +Parameter '%s' was empty. +-1106 PARAM_NOT_REQUIRED +A parameter was sent when not required. +Parameter '%s' sent when not required. +-1108 BAD_ASSET +Invalid asset. +-1109 BAD_ACCOUNT +Invalid account. +-1110 BAD_INSTRUMENT_TYPE +Invalid symbolType. +-1111 BAD_PRECISION +Precision is over the maximum defined for this asset. +-1112 NO_DEPTH +No orders on book for symbol. +-1113 WITHDRAW_NOT_NEGATIVE +Withdrawal amount must be negative. +-1114 TIF_NOT_REQUIRED +TimeInForce parameter sent when not required. +-1115 INVALID_TIF +Invalid timeInForce. +-1116 INVALID_ORDER_TYPE +Invalid orderType. +-1117 INVALID_SIDE +Invalid side. +-1118 EMPTY_NEW_CL_ORD_ID +New client order ID was empty. +-1119 EMPTY_ORG_CL_ORD_ID +Original client order ID was empty. +-1120 BAD_INTERVAL +Invalid interval. +-1121 BAD_SYMBOL +Invalid symbol. +-1122 INVALID_SYMBOL_STATUS +Invalid symbol status. +-1125 INVALID_LISTEN_KEY +This listenKey does not exist. Please use POST /fapi/v1/listenKey to recreate listenKey +-1126 ASSET_NOT_SUPPORTED +This asset is not supported. +-1127 MORE_THAN_XX_HOURS +Lookup interval is too big. +More than %s hours between startTime and endTime. +-1128 OPTIONAL_PARAMS_BAD_COMBO +Combination of optional parameters invalid. +-1130 INVALID_PARAMETER +Invalid data sent for a parameter. +Data sent for parameter '%s' is not valid. +-1136 INVALID_NEW_ORDER_RESP_TYPE +Invalid newOrderRespType. +20xx - Processing Issues +-2010 NEW_ORDER_REJECTED +NEW_ORDER_REJECTED +-2011 CANCEL_REJECTED +CANCEL_REJECTED +-2012 CANCEL_ALL_FAIL +Batch cancel failure. +-2013 NO_SUCH_ORDER +Order does not exist. +-2014 BAD_API_KEY_FMT +API-key format invalid. +-2015 REJECTED_MBX_KEY +Invalid API-key, IP, or permissions for action. +-2016 NO_TRADING_WINDOW +No trading window could be found for the symbol. Try ticker/24hrs instead. +-2017 API_KEYS_LOCKED +API Keys are locked on this account. +-2018 BALANCE_NOT_SUFFICIENT +Balance is insufficient. +-2019 MARGIN_NOT_SUFFICIEN +Margin is insufficient. +-2020 UNABLE_TO_FILL +Unable to fill. +-2021 ORDER_WOULD_IMMEDIATELY_TRIGGER +Order would immediately trigger. +-2022 REDUCE_ONLY_REJECT +ReduceOnly Order is rejected. +-2023 USER_IN_LIQUIDATION +User in liquidation mode now. +-2024 POSITION_NOT_SUFFICIENT +Position is not sufficient. +-2025 MAX_OPEN_ORDER_EXCEEDED +Reach max open order limit. +-2026 REDUCE_ONLY_ORDER_TYPE_NOT_SUPPORTED +This OrderType is not supported when reduceOnly. +-2027 MAX_LEVERAGE_RATIO +Exceeded the maximum allowable position at current leverage. +-2028 MIN_LEVERAGE_RATIO +Leverage is smaller than permitted: insufficient margin balance. +40xx - Filters and other Issues +-4000 INVALID_ORDER_STATUS +Invalid order status. +-4001 PRICE_LESS_THAN_ZERO +Price less than 0. +-4002 PRICE_GREATER_THAN_MAX_PRICE +Price greater than max price. +-4003 QTY_LESS_THAN_ZERO +Quantity less than zero. +-4004 QTY_LESS_THAN_MIN_QTY +Quantity less than min quantity. +-4005 QTY_GREATER_THAN_MAX_QTY +Quantity greater than max quantity. +-4006 STOP_PRICE_LESS_THAN_ZERO +Stop price less than zero. +-4007 STOP_PRICE_GREATER_THAN_MAX_PRICE +Stop price greater than max price. +-4008 TICK_SIZE_LESS_THAN_ZERO +Tick size less than zero. +-4009 MAX_PRICE_LESS_THAN_MIN_PRICE +Max price less than min price. +-4010 MAX_QTY_LESS_THAN_MIN_QTY +Max qty less than min qty. +-4011 STEP_SIZE_LESS_THAN_ZERO +Step size less than zero. +-4012 MAX_NUM_ORDERS_LESS_THAN_ZERO +Max mum orders less than zero. +-4013 PRICE_LESS_THAN_MIN_PRICE +Price less than min price. +-4014 PRICE_NOT_INCREASED_BY_TICK_SIZE +Price not increased by tick size. +-4015 INVALID_CL_ORD_ID_LEN +Client order id is not valid. +Client order id length should not be more than 36 chars +-4016 PRICE_HIGHTER_THAN_MULTIPLIER_UP +Price is higher than mark price multiplier cap. +-4017 MULTIPLIER_UP_LESS_THAN_ZERO +Multiplier up less than zero. +-4018 MULTIPLIER_DOWN_LESS_THAN_ZERO +Multiplier down less than zero. +-4019 COMPOSITE_SCALE_OVERFLOW +Composite scale too large. +-4020 TARGET_STRATEGY_INVALID +Target strategy invalid for orderType '%s',reduceOnly '%b'. +-4021 INVALID_DEPTH_LIMIT +Invalid depth limit. +'%s' is not valid depth limit. +-4022 WRONG_MARKET_STATUS +market status sent is not valid. +-4023 QTY_NOT_INCREASED_BY_STEP_SIZE +Qty not increased by step size. +-4024 PRICE_LOWER_THAN_MULTIPLIER_DOWN +Price is lower than mark price multiplier floor. +-4025 MULTIPLIER_DECIMAL_LESS_THAN_ZERO +Multiplier decimal less than zero. +-4026 COMMISSION_INVALID +Commission invalid. +%s less than zero. +%s absolute value greater than %s +-4027 INVALID_ACCOUNT_TYPE +Invalid account type. +-4028 INVALID_LEVERAGE +Invalid leverage +Leverage %s is not valid +Leverage %s already exist with %s +-4029 INVALID_TICK_SIZE_PRECISION +Tick size precision is invalid. +-4030 INVALID_STEP_SIZE_PRECISION +Step size precision is invalid. +-4031 INVALID_WORKING_TYPE +Invalid parameter working type +Invalid parameter working type: %s +-4032 EXCEED_MAX_CANCEL_ORDER_SIZE +Exceed maximum cancel order size. +Invalid parameter working type: %s +-4033 INSURANCE_ACCOUNT_NOT_FOUND +Insurance account not found. +-4044 INVALID_BALANCE_TYPE +Balance Type is invalid. +-4045 MAX_STOP_ORDER_EXCEEDED +Reach max stop order limit. +-4046 NO_NEED_TO_CHANGE_MARGIN_TYPE +No need to change margin type. +-4047 THERE_EXISTS_OPEN_ORDERS +Margin type cannot be changed if there exists open orders. +-4048 THERE_EXISTS_QUANTITY +Margin type cannot be changed if there exists position. +-4049 ADD_ISOLATED_MARGIN_REJECT +Add margin only support for isolated position. +-4050 CROSS_BALANCE_INSUFFICIENT +Cross balance insufficient. +-4051 ISOLATED_BALANCE_INSUFFICIENT +Isolated balance insufficient. +-4052 NO_NEED_TO_CHANGE_AUTO_ADD_MARGIN +No need to change auto add margin. +-4053 AUTO_ADD_CROSSED_MARGIN_REJECT +Auto add margin only support for isolated position. +-4054 ADD_ISOLATED_MARGIN_NO_POSITION_REJECT +Cannot add position margin: position is 0. +-4055 AMOUNT_MUST_BE_POSITIVE +Amount must be positive. +-4056 INVALID_API_KEY_TYPE +Invalid api key type. +-4057 INVALID_RSA_PUBLIC_KEY +Invalid api public key +-4058 MAX_PRICE_TOO_LARGE +maxPrice and priceDecimal too large,please check. +-4059 NO_NEED_TO_CHANGE_POSITION_SIDE +No need to change position side. +-4060 INVALID_POSITION_SIDE +Invalid position side. +-4061 POSITION_SIDE_NOT_MATCH +Order's position side does not match user's setting. +-4062 REDUCE_ONLY_CONFLICT +Invalid or improper reduceOnly value. +-4063 INVALID_OPTIONS_REQUEST_TYPE +Invalid options request type +-4064 INVALID_OPTIONS_TIME_FRAME +Invalid options time frame +-4065 INVALID_OPTIONS_AMOUNT +Invalid options amount +-4066 INVALID_OPTIONS_EVENT_TYPE +Invalid options event type +-4067 POSITION_SIDE_CHANGE_EXISTS_OPEN_ORDERS +Position side cannot be changed if there exists open orders. +-4068 POSITION_SIDE_CHANGE_EXISTS_QUANTITY +Position side cannot be changed if there exists position. +-4069 INVALID_OPTIONS_PREMIUM_FEE +Invalid options premium fee +-4070 INVALID_CL_OPTIONS_ID_LEN +Client options id is not valid. +Client options id length should be less than 32 chars +-4071 INVALID_OPTIONS_DIRECTION +Invalid options direction +-4072 OPTIONS_PREMIUM_NOT_UPDATE +premium fee is not updated, reject order +-4073 OPTIONS_PREMIUM_INPUT_LESS_THAN_ZERO +input premium fee is less than 0, reject order +-4074 OPTIONS_AMOUNT_BIGGER_THAN_UPPER +Order amount is bigger than upper boundary or less than 0, reject order +-4075 OPTIONS_PREMIUM_OUTPUT_ZERO +output premium fee is less than 0, reject order +-4076 OPTIONS_PREMIUM_TOO_DIFF +original fee is too much higher than last fee +-4077 OPTIONS_PREMIUM_REACH_LIMIT +place order amount has reached to limit, reject order +-4078 OPTIONS_COMMON_ERROR +options internal error +-4079 INVALID_OPTIONS_ID +invalid options id +invalid options id: %s +duplicate options id %d for user %d +-4080 OPTIONS_USER_NOT_FOUND +user not found +user not found with id: %s +-4081 OPTIONS_NOT_FOUND +options not found +options not found with id: %s +-4082 INVALID_BATCH_PLACE_ORDER_SIZE +Invalid number of batch place orders. +Invalid number of batch place orders: %s +-4083 PLACE_BATCH_ORDERS_FAIL +Fail to place batch orders. +-4084 UPCOMING_METHOD +Method is not allowed currently. Upcoming soon. +-4085 INVALID_NOTIONAL_LIMIT_COEF +Invalid notional limit coefficient +-4086 INVALID_PRICE_SPREAD_THRESHOLD +Invalid price spread threshold +-4087 REDUCE_ONLY_ORDER_PERMISSION +User can only place reduce only order +-4088 NO_PLACE_ORDER_PERMISSION +User can not place order currently +-4104 INVALID_CONTRACT_TYPE +Invalid contract type +-4114 INVALID_CLIENT_TRAN_ID_LEN +clientTranId is not valid +Client tran id length should be less than 64 chars +-4115 DUPLICATED_CLIENT_TRAN_ID +clientTranId is duplicated +Client tran id should be unique within 7 days +-4118 REDUCE_ONLY_MARGIN_CHECK_FAILED +ReduceOnly Order Failed. Please check your existing position and open orders +-4131 MARKET_ORDER_REJECT +The counterparty's best price does not meet the PERCENT_PRICE filter limit +-4135 INVALID_ACTIVATION_PRICE +Invalid activation price +-4137 QUANTITY_EXISTS_WITH_CLOSE_POSITION +Quantity must be zero with closePosition equals true +-4138 REDUCE_ONLY_MUST_BE_TRUE +Reduce only must be true with closePosition equals true +-4139 ORDER_TYPE_CANNOT_BE_MKT +Order type can not be market if it's unable to cancel +-4140 INVALID_OPENING_POSITION_STATUS +Invalid symbol status for opening position +-4141 SYMBOL_ALREADY_CLOSED +Symbol is closed +-4142 STRATEGY_INVALID_TRIGGER_PRICE +REJECT: take profit or stop order will be triggered immediately +-4144 INVALID_PAIR +Invalid pair +-4161 ISOLATED_LEVERAGE_REJECT_WITH_POSITION +Leverage reduction is not supported in Isolated Margin Mode with open positions +-4164 MIN_NOTIONAL +Order's notional must be no smaller than 5.0 (unless you choose reduce only) +Order's notional must be no smaller than %s (unless you choose reduce only) +-4165 INVALID_TIME_INTERVAL +Invalid time interval +Maximum time interval is %s days +-4167 ISOLATED_REJECT_WITH_JOINT_MARGIN +Unable to adjust to Multi-Assets mode with symbols of USDⓈ-M Futures under isolated-margin mode. +-4168 JOINT_MARGIN_REJECT_WITH_ISOLATED +Unable to adjust to isolated-margin mode under the Multi-Assets mode. +-4169 JOINT_MARGIN_REJECT_WITH_MB +Unable to adjust Multi-Assets Mode with insufficient margin balance in USDⓈ-M Futures. +-4170 JOINT_MARGIN_REJECT_WITH_OPEN_ORDER +Unable to adjust Multi-Assets Mode with open orders in USDⓈ-M Futures. +-4171 NO_NEED_TO_CHANGE_JOINT_MARGIN +Adjusted asset mode is currently set and does not need to be adjusted repeatedly. +-4172 JOINT_MARGIN_REJECT_WITH_NEGATIVE_BALANCE +Unable to adjust Multi-Assets Mode with a negative wallet balance of margin available asset in USDⓈ-M Futures account. +-4183 ISOLATED_REJECT_WITH_JOINT_MARGIN +Price is higher than stop price multiplier cap. +Limit price can't be higher than %s. +-4184 PRICE_LOWER_THAN_STOP_MULTIPLIER_DOWN +Price is lower than stop price multiplier floor. +Limit price can't be lower than %s. +-4192 COOLING_OFF_PERIOD +Trade forbidden due to Cooling-off Period. +-4202 ADJUST_LEVERAGE_KYC_FAILED +Intermediate Personal Verification is required for adjusting leverage over 20x +-4203 ADJUST_LEVERAGE_ONE_MONTH_FAILED +More than 20x leverage is available one month after account registration. +-4205 ADJUST_LEVERAGE_X_DAYS_FAILED +More than 20x leverage is available %s days after Futures account registration. +-4206 ADJUST_LEVERAGE_KYC_LIMIT +Users in this country has limited adjust leverage. +Users in your location/country can only access a maximum leverage of %s +-4208 ADJUST_LEVERAGE_ACCOUNT_SYMBOL_FAILED +Current symbol leverage cannot exceed 20 when using position limit adjustment service. +-4209 ADJUST_LEVERAGE_SYMBOL_FAILED +The max leverage of Symbol is 20x +Leverage adjustment failed. Current symbol max leverage limit is %sx +-4210 STOP_PRICE_HIGHER_THAN_PRICE_MULTIPLIER_LIMIT +Stop price is higher than price multiplier cap. +Stop price can't be higher than %s +-4211 STOP_PRICE_LOWER_THAN_PRICE_MULTIPLIER_LIMIT +Stop price is lower than price multiplier floor. +Stop price can't be lower than %s +-4400 TRADING_QUANTITATIVE_RULE +Futures Trading Quantitative Rules violated, only reduceOnly order is allowed, please try again later. +-4401 COMPLIANCE_RESTRICTION +Compliance restricted account permission: can only place reduceOnly order. +-4402 COMPLIANCE_BLACK_SYMBOL_RESTRICTION +Dear user, as per our Terms of Use and compliance with local regulations, this feature is currently not available in your region. +-4403 ADJUST_LEVERAGE_COMPLIANCE_FAILED +Dear user, as per our Terms of Use and compliance with local regulations, the leverage can only up to 10x in your region +Dear user, as per our Terms of Use and compliance with local regulations, the leverage can only up to %sx in your region +50xx - Order Execution Issues +-5021 FOK_ORDER_REJECT +Due to the order could not be filled immediately, the FOK order has been rejected. +-5022 GTX_ORDER_REJECT +Due to the order could not be executed as maker, the Post Only order will be rejected. +-5024 MOVE_ORDER_NOT_ALLOWED_SYMBOL_REASON +Symbol is not in trading status. Order amendment is not permitted. +-5025 LIMIT_ORDER_ONLY +Only limit order is supported. +-5026 Exceed_Maximum_Modify_Order_Limit +Exceed maximum modify order limit. +-5027 SAME_ORDER +No need to modify the order. +-5028 ME_RECVWINDOW_REJECT +Timestamp for this request is outside of the ME recvWindow. +-5037 INVALID_PRICE_MATCH +Invalid price match +-5038 UNSUPPORTED_ORDER_TYPE_PRICE_MATCH +Price match only supports order type: LIMIT, STOP AND TAKE_PROFIT +-5039 INVALID_SELF_TRADE_PREVENTION_MODE +Invalid self trade prevention mode +-5040 FUTURE_GOOD_TILL_DATE +The goodTillDate timestamp must be greater than the current time plus 600 seconds and smaller than 253402300799000 (UTC 9999-12-31 23:59:59) +-5041 BBO_ORDER_REJECT +No depth matches this BBO order diff --git a/utils/futures_endpoints_list.txt b/utils/futures_endpoints_list.txt new file mode 100644 index 000000000..d71f90ea9 --- /dev/null +++ b/utils/futures_endpoints_list.txt @@ -0,0 +1,94 @@ +GET /fapi/v1/symbolConfig +GET /fapi/v1/accountConfig +GET /fapi/v3/account +GET /fapi/v2/account +GET /fapi/v3/balance +GET /fapi/v3/positionRisk +GET /fapi/v2/positionRisk +GET /fapi/v2/balance +GET /fapi/v1/userTrades +GET /fapi/v1/exchangeInfo +POST /fapi/v1/feeBurn +GET /fapi/v1/feeBurn +PUT /fapi/v1/listenKey +GET /fapi/v1/rateLimit/order +PUT /fapi/v1/order +PUT /fapi/v1/batchOrders +GET /fapi/v2/ticker/price +GET /futures/data/basis +GET /fapi/v1/fundingRate +GET /futures/data/delivery-price +GET /futures/data/openInterestHist +GET /futures/data/topLongShortAccountRatio +GET /futures/data/topLongShortPositionRatio +GET /futures/data/globalLongShortAccountRatio +GET /futures/data/takerlongshortRatio +GET /fapi/v1/fundingInfo +GET /fapi/v1/constituents +GET /fapi/v1/income/asyn +GET /fapi/v1/order/asyn +GET /fapi/v1/trade/asyn +GET /fapi/v1/income/asyn/id +GET /fapi/v1/order/asyn/id +GET /fapi/v1/trade/asyn/id +GET /fapi/v1/ticker/bookTicker +POST /fapi/v1/order +DELETE /fapi/v1/order +POST /fapi/v1/batchOrder +PUT /fapi/v1/batchOrder +DELETE /fapi/v1/batchOrder +POST /fapi/v1/order/test +DELETE /fapi/v1/allOpenOrders +POST /fapi/v1/batchOrders +GET /fapi/v1/order +GET /fapi/v1/openOrders +GET /fapi/v1/allOrders +DELETE /fapi/v1/batchOrders +GET /fapi/v1/income +GET /fapi/v1/leverageBracket +GET /fapi/v1/order/asynto +GET /fapi/v1/order/asyn/idto +GET /fapi/v1/trade/asynto +GET /fapi/v1/trade/asyn/idto +GET /fapi/v1/account +GET /fapi/v1/balance +GET /fapi/v1/positionRisk +GET /fapi/v1/orderAmendment +GET /fapi/v1/pmAccountInfo +GET /fapi/v1/trades +GET /fapi/v1/income/asynto +GET /fapi/v1/income/asyn/idto +GET /fapi/v1/assetIndexto +GET /fapi/v1/indexInfo +POST /fapi/v1/multiAssetsMargin +GET /fapi/v1/multiAssetsMargin +GET /fapi/v1/allForceOrders +GET /fapi/v1/indexPriceKlines +GET /fapi/v1/markPriceKlines +GET /fapi/v1/forceOrders +GET /fapi/v1/klines +GET /fapi/v1/continuousKlines +GET /fapi/v1/historicalTrades +GET /fapi/v1/aggTrades +GET /fapi/v1/premiumIndex +GET /fapi/v1/commissionRate +GET /fapi/v1/apiTradingStatus +GET /fapi/v1/adlQuantile +GET /fapi/v1/openOrder +GET /fapi/v1/openInterest +POST /fapi/v1/countdownCancelAll +GET /fapi/v1/positionSide/dual +POST /fapi/v1/positionSide/dual +POST /fapi/v1/positionMargin +GET /fapi/v1/positionMargin/history +POST /fapi/v1/marginType +GET /fapi/v1/accountrelated +POST /fapi/v1/leverage +GET /fapi/v1/ping +GET /fapi/v1/time +GET /fapi/v1/depth +GET /fapi/v1/premiumIndexKlines +GET /fapi/v1/ticker/24hr +GET /fapi/v1/assetIndex +POST /fapi/v1/listenKey +DELETE /fapi/v1/listenKey \ No newline at end of file diff --git a/utils/generate_missing_methods.js b/utils/generate_missing_methods.js new file mode 100644 index 000000000..6939f240f --- /dev/null +++ b/utils/generate_missing_methods.js @@ -0,0 +1,447 @@ +// Usage: node utils/generate_missing_methods.js from the root directory + +const fs = require('fs'); +const { parse } = require('path'); + +const SOURCE_FILES = { + 'spot': './utils/spot_docs.txt', + 'futures': './utils/futures_docs.txt', + 'coin': './utils/coin_docs.txt', + 'options': './utils/options_docs.txt', + 'portfolio': './utils/portfolio_docs.txt', +} + +const ENPOINTS_FILES = { + 'spot': './utils/spot_endpoints_list.txt', + 'futures': './utils/futures_endpoints_list.txt', + 'coin': './utils/coin_endpoints_list.txt', + 'options': './utils/options_endpoints_list.txt', + 'portfolio': './utils/portfolio_endpoints_list.txt', +} +const BINANCE_FILE = './binance/client.py' +const BINANCE_CALLS = [ + '_get', + '_post', + '_put', + '_delete', + '_request_margin_api', + '_request_futures_api', + '_request_futures_data_api', + '_request_futures_coin_api', + '_request_futures_coin_data_api', + '_request_options_api', + '_request_papi_api', +] +const TARGET_FILE_NAME = './utils/missing_endponts.txt' + +const SPECIFIC_CALLS = { + 'spot': { + 'sapi': '_request_margin_api' + }, + 'futures': { + 'fapi': '_request_futures_api', + 'futures/data': '_request_futures_data_api', + }, + 'coin': { + 'dapi': '_request_futures_coin_api', + 'futures/data': '_request_futures_coin_data_api', + }, + 'options': { + 'eapi': '_request_options_api' + }, + 'portfolio': { + 'papi': '_request_papi_api', + 'fapi': '_request_futures_api' + } +} + +const PREFIXES = { + 'spot': { + 'sapi': 'margin', + }, + 'futures': { + 'fapi': 'futures', + 'futures/data': 'futures_data', + }, + 'coin': { + 'dapi': 'futures_coin', + 'futures/data': 'futures_coin_data', + }, + 'options': { + 'eapi': 'options', + }, + 'portfolio': { + 'papi': 'portfolio', + 'fapi': 'futures', + } +} + +const SPOT_API_VERSIONS = { + 'v1': 'self.PUBLIC_API_VERSION', + 'v3': 'self.PRIVATE_API_VERSION' +} + +const OTHER_API_VERSIONS = { + 'v1': '1', + 'v2': '2', + 'v3': '3', + 'v4': '4' +} + +const DEPRECATED = [ + 'GET /fapi/v1/ticker/price', + 'GET /fapi/v1/pmExchangeInfo', + 'POST /api/v3/order/oco', + 'POST /sapi/v1/eth-staking/eth/stake', + 'GET /sapi/v1/eth-staking/account', + 'GET /sapi/v1/portfolio/interest-rate', + 'GET /api/v1/order', + 'GET /api/v1/openOrders', + 'POST /api/v1/order', + 'DELETE /api/v1/order', + 'GET /api/v1/allOrders', + 'GET /api/v1/account', + 'GET /api/v1/myTrades', + 'POST /sapi/v1/loan/flexible/borrow', + 'GET /sapi/v1/loan/flexible/ongoing/orders', + 'GET /sapi/v1/loan/flexible/borrow/history', + 'POST /sapi/v1/loan/flexible/repay', + 'GET /sapi/v1/loan/flexible/repay/history', + 'POST /sapi/v1/loan/flexible/adjust/ltv', + 'GET /sapi/v1/loan/flexible/ltv/adjustment/history', + 'GET /sapi/v1/loan/flexible/loanable/data', + 'GET /sapi/v1/loan/flexible/collateral/data' +] + +function parseEndpoint (data, type) { + const parts = data.split (' ') + const method = parts[0].toLowerCase () + const endpoint = parts[1] + let path = endpoint + let api = undefined + let version = undefined + let splitSymbols = 'v1/' + if (endpoint.indexOf ('futures/data') !== -1) { + api = 'futures/data' + splitSymbols = 'data/' + } else { + splittedEndpoint = endpoint.split ('/') + api = splittedEndpoint[1] + version = splittedEndpoint[2] + splitSymbols = version + '/' + } + path = endpoint.split (splitSymbols)[1] + const result = { + 'endpoint': method.toUpperCase() + ' ' + endpoint, + 'type': type, + 'method': method, + 'path': path, + 'api': api, + 'version': version + } + const methodName = generateMethodName (result) + result['methodName'] = methodName + const call = generateMethodCall (result) + result['call'] = call + return result +} + +function parseEndpoints (data) { + const result = {} + const types = Object.keys (data) + for (let type of types) { + const endpoints = data[type] + result[type] = {} + for (let endpoint of endpoints) { + const parsed = parseEndpoint (endpoint, type) + result[type][endpoint] = parsed + } + } + return result +} + + +function generateMethodCall (endpoint) { + const { type, method, path, api, version } = endpoint + const isSpot = type === 'spot' + const apiVersions = isSpot ? SPOT_API_VERSIONS : OTHER_API_VERSIONS + let func = 'self.' + if (isSpot && api !== 'sapi') { + func += '_' + method + '(' + '"' + path + '", ' + 'version=' + apiVersions[version] + ', data=params' + ')' + } else { + func += SPECIFIC_CALLS[type][api] + '(' + '"' + method + ', "' + path + '", ' + 'version=' + apiVersions[version] + ', data=params' + ')' + } + return func +} + +function generateListsOfEndpoints (writeFiles = false) { + const result = {} + for (let type in SOURCE_FILES) { + let file = SOURCE_FILES[type] + const methodMatch = /(GET|POST|PUT|DELETE) (\/[^ ][\w\/-]+)/g + const data = fs.readFileSync (file, 'utf8') + const mathces = [... new Set (data.match (methodMatch))] + for (let i = 0; i < DEPRECATED.length; i++) { + let index = mathces.indexOf (DEPRECATED[i]) + if (index !== -1) { + mathces.splice (index, 1) + } + } + result[type] = mathces + const targetData = mathces.join ('\n') + const targetFile = ENPOINTS_FILES[type] + if (writeFiles) { + fs.writeFile (targetFile, targetData, (err) => { + if (err) { + console.error (err) + return + } + console.log (targetFile + ' file is generated') + }) + } + } + return result +} + +function getCallsFromBinanceFile () { + const data = fs.readFileSync (BINANCE_FILE, 'utf8').replace (/\s/g, '') + const matchTemplate = /self._\w+\("[^\)]+\)/g + const matches = data.match (matchTemplate) + matches.forEach ((m, i) => matches[i] = m.replace ('self.', '')) + return matches +} + +function parseCall (call) { + const parts = call.split ('(') + const func = parts[0] + const argsString = parts[1].replaceAll ('"', '').replace(')', '') + const args = argsString.split (',') + const [ type, api ] = parseTypeAndApi (func) + if (type === undefined) { + return { func, args } + } + let method = args[0] + let path = args[1] + if (type === 'spot' && func !== '_request_margin_api') { + method = func.replace ('_', '') + path = args[0] + } + let versionString = '' + let version = undefined + if (api !== 'future/data') { + version = parseVersion (argsString, args, api) + versionString = version + '/' + } + const endpoint = method.toUpperCase () + ' /' + api + '/' + versionString + '' + path + return { endpoint, type, method, path, api, version, call } +} + +function parseVersion (argsString, args, api) { + let v = 'v1' + let version = undefined + const vMatch = /version=([^,]+),/ + const vMatchResult = argsString.match (vMatch) + if (vMatchResult) { + version = vMatchResult[1] + } else if (args.length > 3 && api !== 'api') { + version = args[3] + } + const versionTypes = { + '1': 'v1', + '2': 'v2', + '3': 'v3', + '4': 'v4', + 'PUBLIC_API_VERSION': 'v1', + 'PRIVATE_API_VERSION': 'v3' + } + if (versionTypes[version]) { + v = versionTypes[version] + } + return v +} + +function parseTypeAndApi (func) { + const funcs = { + '_get': { + 'type': 'spot', + 'api': 'api' + }, + '_post': { + 'type': 'spot', + 'api': 'api' + }, + '_put': { + 'type': 'spot', + 'api': 'api' + }, + '_delete': { + 'type': 'spot', + 'api': 'api' + }, + '_request_margin_api': { + 'type': 'spot', + 'api': 'sapi' + }, + '_request_futures_api': { + 'type': 'futures', + 'api': 'fapi' + }, + '_request_futures_data_api': { + 'type': 'futures', + 'api': 'futures/data' + }, + '_request_futures_coin_api': { + 'type': 'coin', + 'api': 'dapi' + }, + '_request_futures_coin_data_api': { + 'type': 'coin', + 'api': 'futures/data' + }, + '_request_options_api': { + 'type': 'options', + 'api': 'eapi' + }, + '_request_papi_api': { + 'type': 'portfolio', + 'api': 'papi' + } + } + const result = funcs[func] + return result ? [ result['type'], result['api'] ] : [ undefined, undefined ] +} + +function compareEndpoints (docs, binance) { + let missingInDocs = {} + let missingInBinance = {} + for (let type in docs) { + missingInDocs[type] = [] + missingInBinance[type] = [] + const d = docs[type] + const b = binance[type] + const docsEndpoints = Object.keys (d) + const binanceEndpoints = Object.keys (b) + let found = false + for (let key of docsEndpoints) { + const dEntry = d[key] + found = endpointIsInObject (dEntry, b) + if (!found) { + missingInBinance[type].push (dEntry) + } + } + for (let key of binanceEndpoints) { + const bEntry = b[key] + found = endpointIsInObject (bEntry, d) + if (!found) { + missingInDocs[type].push (bEntry) + } + } + console.log (type + '\nmissing in docs: ' + missingInDocs[type].length, '\nmissing in binance: ' + missingInBinance[type].length + '\ntotal in docs', docsEndpoints.length, '\ntotal in binance', binanceEndpoints.length) + } + return { missingInDocs, missingInBinance } +} + +function endpointIsInObject (endpoint, object) { + let found = false + if (object[endpoint]) { + found = true + } + const keys = Object.keys (object) + for (let key of keys) { + const entry = object[key] + if (entry.method === endpoint.method && + entry.path === endpoint.path && + entry.api === endpoint.api) { + found = true + break + } + } + return found +} + +function parsePath (path) { + path = path.replaceAll ('-', '_').replaceAll ('/', '_') + const capitalMatch = /[A-Z]/g + const capitalMatches = path.match (capitalMatch) + if (capitalMatches) { + for (let match of capitalMatches) { + path = path.replace (match, '_' + match.toLowerCase ()) + } + } + return path +} + +function generateMethodName (parsedEndpoint) { + let { type, method, path, api } = parsedEndpoint + let prefix = PREFIXES[type][api] + if (prefix) { + prefix += '_' + } else { // if spot api + prefix = '' + } + const methods = { + 'get': 'get_', + 'post': 'create_', + 'put': 'modify_', + 'delete': 'cancel_' + } + method = methods[method] + if (method === 'get_' && api !== 'api') { + method = '' + } + path = parsePath (path) + return prefix + method + path +} + +function generateMethodString (parsedEndpoint) { + let result = + parsedEndpoint.methodName + ' (self, **params):\n' + ' """\n ' + + parsedEndpoint.endpoint + '\n """\n' + + ' return ' + parsedEndpoint.call + '\n' + return result +} + +function main (generateNewEndpoints = false, writeNewFiles = false) { + let endpoints = {} + if (generateNewEndpoints) { + const endpoints = generateListsOfEndpoints (writeNewFiles) + } else { + for (let type in ENPOINTS_FILES) { + let file = ENPOINTS_FILES[type] + const data = fs.readFileSync (file, 'utf8') + endpoints[type] = data.split ('\n') + } + } + const calls = getCallsFromBinanceFile () + const binanceMethods = {} + calls.forEach ((call) => { + const parsedCall = parseCall (call) + if (parsedCall.type) { + if (!binanceMethods[parsedCall.type]) { + binanceMethods[parsedCall.type] = {} + } + binanceMethods[parsedCall.type][parsedCall.endpoint] = parsedCall + } + }) + const docsMethods = parseEndpoints (endpoints) + const { missingInDocs, missingInBinance } = compareEndpoints (docsMethods, binanceMethods) + let targetData = '' + let total = 0 + for (let type in missingInBinance) { + targetData += '#' + type + ' ====================\n\n' + for (let method of missingInBinance[type]) { + targetData += generateMethodString (method) + '\n' + total++ + } + } + console.log ('Total missing in Binance: ' + total) + fs.writeFile (TARGET_FILE_NAME, targetData, (err) => { + if (err) { + console.error (err) + return + } + console.log (TARGET_FILE_NAME + ' file is generated') + }) +} + +main () diff --git a/utils/missing_endponts.txt b/utils/missing_endponts.txt new file mode 100644 index 000000000..c97192a89 --- /dev/null +++ b/utils/missing_endponts.txt @@ -0,0 +1,2002 @@ +#spot ==================== + +create_sor_order (self, **params): + """ + POST /api/v3/sor/order + """ + return self._post("sor/order", version=self.PRIVATE_API_VERSION, data=params) + +create_order_list_oto (self, **params): + """ + POST /api/v3/orderList/oto + """ + return self._post("orderList/oto", version=self.PRIVATE_API_VERSION, data=params) + +create_order_list_otoco (self, **params): + """ + POST /api/v3/orderList/otoco + """ + return self._post("orderList/otoco", version=self.PRIVATE_API_VERSION, data=params) + +cancel_order_list (self, **params): + """ + DELETE /api/v3/orderList + """ + return self._delete("orderList", version=self.PRIVATE_API_VERSION, data=params) + +get_ui_klines (self, **params): + """ + GET /api/v3/uiKlines + """ + return self._get("uiKlines", version=self.PRIVATE_API_VERSION, data=params) + +margin_copy_trading_futures_user_status (self, **params): + """ + GET /sapi/v1/copyTrading/futures/userStatus + """ + return self._request_margin_api("get, "copyTrading/futures/userStatus", version=self.PUBLIC_API_VERSION, data=params) + +margin_copy_trading_futures_lead_symbol (self, **params): + """ + GET /sapi/v1/copyTrading/futures/leadSymbol + """ + return self._request_margin_api("get, "copyTrading/futures/leadSymbol", version=self.PUBLIC_API_VERSION, data=params) + +margin_account_info (self, **params): + """ + GET /sapi/v1/account/info + """ + return self._request_margin_api("get, "account/info", version=self.PUBLIC_API_VERSION, data=params) + +margin_capital_withdraw_address_list (self, **params): + """ + GET /sapi/v1/capital/withdraw/address/list + """ + return self._request_margin_api("get, "capital/withdraw/address/list", version=self.PUBLIC_API_VERSION, data=params) + +margin_create_loan_flexible_borrow (self, **params): + """ + POST /sapi/v2/loan/flexible/borrow + """ + return self._request_margin_api("post, "loan/flexible/borrow", version=undefined, data=params) + +margin_loan_flexible_ongoing_orders (self, **params): + """ + GET /sapi/v2/loan/flexible/ongoing/orders + """ + return self._request_margin_api("get, "loan/flexible/ongoing/orders", version=undefined, data=params) + +margin_loan_flexible_borrow_history (self, **params): + """ + GET /sapi/v2/loan/flexible/borrow/history + """ + return self._request_margin_api("get, "loan/flexible/borrow/history", version=undefined, data=params) + +margin_create_loan_flexible_repay (self, **params): + """ + POST /sapi/v2/loan/flexible/repay + """ + return self._request_margin_api("post, "loan/flexible/repay", version=undefined, data=params) + +margin_loan_flexible_repay_history (self, **params): + """ + GET /sapi/v2/loan/flexible/repay/history + """ + return self._request_margin_api("get, "loan/flexible/repay/history", version=undefined, data=params) + +margin_create_loan_flexible_adjust_ltv (self, **params): + """ + POST /sapi/v2/loan/flexible/adjust/ltv + """ + return self._request_margin_api("post, "loan/flexible/adjust/ltv", version=undefined, data=params) + +margin_loan_flexible_ltv_adjustment_history (self, **params): + """ + GET /sapi/v2/loan/flexible/ltv/adjustment/history + """ + return self._request_margin_api("get, "loan/flexible/ltv/adjustment/history", version=undefined, data=params) + +margin_loan_flexible_loanable_data (self, **params): + """ + GET /sapi/v2/loan/flexible/loanable/data + """ + return self._request_margin_api("get, "loan/flexible/loanable/data", version=undefined, data=params) + +margin_loan_flexible_collateral_data (self, **params): + """ + GET /sapi/v2/loan/flexible/collateral/data + """ + return self._request_margin_api("get, "loan/flexible/collateral/data", version=undefined, data=params) + +margin_dci_product_list (self, **params): + """ + GET /sapi/v1/dci/product/list + """ + return self._request_margin_api("get, "dci/product/list", version=self.PUBLIC_API_VERSION, data=params) + +margin_create_dci_product_subscribe (self, **params): + """ + POST /sapi/v1/dci/product/subscribe + """ + return self._request_margin_api("post, "dci/product/subscribe", version=self.PUBLIC_API_VERSION, data=params) + +margin_dci_product_positions (self, **params): + """ + GET /sapi/v1/dci/product/positions + """ + return self._request_margin_api("get, "dci/product/positions", version=self.PUBLIC_API_VERSION, data=params) + +margin_dci_product_accounts (self, **params): + """ + GET /sapi/v1/dci/product/accounts + """ + return self._request_margin_api("get, "dci/product/accounts", version=self.PUBLIC_API_VERSION, data=params) + +margin_create_dci_product_auto_compound_edit_status (self, **params): + """ + POST /sapi/v1/dci/product/auto_compound/edit-status + """ + return self._request_margin_api("post, "dci/product/auto_compound/edit-status", version=self.PUBLIC_API_VERSION, data=params) + +margin_create_convert_limit_place_order (self, **params): + """ + POST /sapi/v1/convert/limit/placeOrder + """ + return self._request_margin_api("post, "convert/limit/placeOrder", version=self.PUBLIC_API_VERSION, data=params) + +margin_create_convert_limit_cancel_order (self, **params): + """ + POST /sapi/v1/convert/limit/cancelOrder + """ + return self._request_margin_api("post, "convert/limit/cancelOrder", version=self.PUBLIC_API_VERSION, data=params) + +margin_convert_limit_query_open_orders (self, **params): + """ + GET /sapi/v1/convert/limit/queryOpenOrders + """ + return self._request_margin_api("get, "convert/limit/queryOpenOrders", version=self.PUBLIC_API_VERSION, data=params) + +margin_bswap_pools (self, **params): + """ + GET /sapi/v1/bswap/pools + """ + return self._request_margin_api("get, "bswap/pools", version=self.PUBLIC_API_VERSION, data=params) + +margin_bswap_liquidity (self, **params): + """ + GET /sapi/v1/bswap/liquidity + """ + return self._request_margin_api("get, "bswap/liquidity", version=self.PUBLIC_API_VERSION, data=params) + +margin_create_bswap_liquidity_add (self, **params): + """ + POST /sapi/v1/bswap/liquidityAdd + """ + return self._request_margin_api("post, "bswap/liquidityAdd", version=self.PUBLIC_API_VERSION, data=params) + +margin_create_bswap_liquidity_remove (self, **params): + """ + POST /sapi/v1/bswap/liquidityRemove + """ + return self._request_margin_api("post, "bswap/liquidityRemove", version=self.PUBLIC_API_VERSION, data=params) + +margin_bswap_liquidity_ops (self, **params): + """ + GET /sapi/v1/bswap/liquidityOps + """ + return self._request_margin_api("get, "bswap/liquidityOps", version=self.PUBLIC_API_VERSION, data=params) + +margin_bswap_quote (self, **params): + """ + GET /sapi/v1/bswap/quote + """ + return self._request_margin_api("get, "bswap/quote", version=self.PUBLIC_API_VERSION, data=params) + +margin_create_bswap_swap (self, **params): + """ + POST /sapi/v1/bswap/swap + """ + return self._request_margin_api("post, "bswap/swap", version=self.PUBLIC_API_VERSION, data=params) + +margin_bswap_swap (self, **params): + """ + GET /sapi/v1/bswap/swap + """ + return self._request_margin_api("get, "bswap/swap", version=self.PUBLIC_API_VERSION, data=params) + +margin_bswap_pool_configure (self, **params): + """ + GET /sapi/v1/bswap/poolConfigure + """ + return self._request_margin_api("get, "bswap/poolConfigure", version=self.PUBLIC_API_VERSION, data=params) + +margin_bswap_add_liquidity_preview (self, **params): + """ + GET /sapi/v1/bswap/addLiquidityPreview + """ + return self._request_margin_api("get, "bswap/addLiquidityPreview", version=self.PUBLIC_API_VERSION, data=params) + +margin_bswap_remove_liquidity_preview (self, **params): + """ + GET /sapi/v1/bswap/removeLiquidityPreview + """ + return self._request_margin_api("get, "bswap/removeLiquidityPreview", version=self.PUBLIC_API_VERSION, data=params) + +margin_bswap_unclaimed_rewards (self, **params): + """ + GET /sapi/v1/bswap/unclaimedRewards + """ + return self._request_margin_api("get, "bswap/unclaimedRewards", version=self.PUBLIC_API_VERSION, data=params) + +margin_create_bswap_claim_rewards (self, **params): + """ + POST /sapi/v1/bswap/claimRewards + """ + return self._request_margin_api("post, "bswap/claimRewards", version=self.PUBLIC_API_VERSION, data=params) + +margin_bswap_claimed_history (self, **params): + """ + GET /sapi/v1/bswap/claimedHistory + """ + return self._request_margin_api("get, "bswap/claimedHistory", version=self.PUBLIC_API_VERSION, data=params) + +margin_staking_staking_record (self, **params): + """ + GET /sapi/v1/staking/stakingRecord + """ + return self._request_margin_api("get, "staking/stakingRecord", version=self.PUBLIC_API_VERSION, data=params) + +margin_spot_delist_schedule (self, **params): + """ + GET /sapi/v1/spot/delist-schedule + """ + return self._request_margin_api("get, "spot/delist-schedule", version=self.PUBLIC_API_VERSION, data=params) + +margin_eth_staking_eth_history_wbeth_rewards_history (self, **params): + """ + GET /sapi/v1/eth-staking/eth/history/wbethRewardsHistory + """ + return self._request_margin_api("get, "eth-staking/eth/history/wbethRewardsHistory", version=self.PUBLIC_API_VERSION, data=params) + +margin_create_eth_staking_eth_stake (self, **params): + """ + POST /sapi/v2/eth-staking/eth/stake + """ + return self._request_margin_api("post, "eth-staking/eth/stake", version=undefined, data=params) + +margin_eth_staking_account (self, **params): + """ + GET /sapi/v2/eth-staking/account + """ + return self._request_margin_api("get, "eth-staking/account", version=undefined, data=params) + +margin_create_eth_staking_wbeth_unwrap (self, **params): + """ + POST /sapi/v1/eth-staking/wbeth/unwrap + """ + return self._request_margin_api("post, "eth-staking/wbeth/unwrap", version=self.PUBLIC_API_VERSION, data=params) + +margin_create_eth_staking_eth_redeem (self, **params): + """ + POST /sapi/v1/eth-staking/eth/redeem + """ + return self._request_margin_api("post, "eth-staking/eth/redeem", version=self.PUBLIC_API_VERSION, data=params) + +margin_eth_staking_eth_history_staking_history (self, **params): + """ + GET /sapi/v1/eth-staking/eth/history/stakingHistory + """ + return self._request_margin_api("get, "eth-staking/eth/history/stakingHistory", version=self.PUBLIC_API_VERSION, data=params) + +margin_eth_staking_eth_history_redemption_history (self, **params): + """ + GET /sapi/v1/eth-staking/eth/history/redemptionHistory + """ + return self._request_margin_api("get, "eth-staking/eth/history/redemptionHistory", version=self.PUBLIC_API_VERSION, data=params) + +margin_create_eth_staking_wbeth_wrap (self, **params): + """ + POST /sapi/v1/eth-staking/wbeth/wrap + """ + return self._request_margin_api("post, "eth-staking/wbeth/wrap", version=self.PUBLIC_API_VERSION, data=params) + +get_all_order_list (self, **params): + """ + GET /api/v3/allOrderList + """ + return self._get("allOrderList", version=self.PRIVATE_API_VERSION, data=params) + +get_account_commission (self, **params): + """ + GET /api/v3/account/commission + """ + return self._get("account/commission", version=self.PRIVATE_API_VERSION, data=params) + +get_ticker_trading_day (self, **params): + """ + GET /api/v3/ticker/tradingDay + """ + return self._get("ticker/tradingDay", version=self.PRIVATE_API_VERSION, data=params) + +create_sor_order_test (self, **params): + """ + POST /api/v3/sor/order/test + """ + return self._post("sor/order/test", version=self.PRIVATE_API_VERSION, data=params) + +margin_capital_deposit_address_list (self, **params): + """ + GET /sapi/v1/capital/deposit/address/list + """ + return self._request_margin_api("get, "capital/deposit/address/list", version=self.PUBLIC_API_VERSION, data=params) + +margin_margin_available_inventory (self, **params): + """ + GET /sapi/v1/margin/available-inventory + """ + return self._request_margin_api("get, "margin/available-inventory", version=self.PUBLIC_API_VERSION, data=params) + +margin_margin_leverage_bracket (self, **params): + """ + GET /sapi/v1/margin/leverageBracket + """ + return self._request_margin_api("get, "margin/leverageBracket", version=self.PUBLIC_API_VERSION, data=params) + +margin_loan_vip_request_interest_rate (self, **params): + """ + GET /sapi/v1/loan/vip/request/interestRate + """ + return self._request_margin_api("get, "loan/vip/request/interestRate", version=self.PUBLIC_API_VERSION, data=params) + +margin_futures_hist_data_link (self, **params): + """ + GET /sapi/v1/futures/histDataLink + """ + return self._request_margin_api("get, "futures/histDataLink", version=self.PUBLIC_API_VERSION, data=params) + +margin_asset_wallet_balance (self, **params): + """ + GET /sapi/v1/asset/wallet/balance + """ + return self._request_margin_api("get, "asset/wallet/balance", version=self.PUBLIC_API_VERSION, data=params) + +margin_asset_custody_transfer_history (self, **params): + """ + GET /sapi/v1/asset/custody/transfer-history + """ + return self._request_margin_api("get, "asset/custody/transfer-history", version=self.PUBLIC_API_VERSION, data=params) + +margin_loan_vip_loanable_data (self, **params): + """ + GET /sapi/v1/loan/vip/loanable/data + """ + return self._request_margin_api("get, "loan/vip/loanable/data", version=self.PUBLIC_API_VERSION, data=params) + +margin_loan_vip_ongoing_orders (self, **params): + """ + GET /sapi/v1/loan/vip/ongoing/orders + """ + return self._request_margin_api("get, "loan/vip/ongoing/orders", version=self.PUBLIC_API_VERSION, data=params) + +margin_create_portfolio_repay (self, **params): + """ + POST /sapi/v1/portfolio/repay + """ + return self._request_margin_api("post, "portfolio/repay", version=self.PUBLIC_API_VERSION, data=params) + +margin_lending_auto_invest_index_info (self, **params): + """ + GET /sapi/v1/lending/auto-invest/index/info + """ + return self._request_margin_api("get, "lending/auto-invest/index/info", version=self.PUBLIC_API_VERSION, data=params) + +margin_lending_auto_invest_index_user_summary (self, **params): + """ + GET /sapi/v1/lending/auto-invest/index/user-summary + """ + return self._request_margin_api("get, "lending/auto-invest/index/user-summary", version=self.PUBLIC_API_VERSION, data=params) + +margin_create_lending_auto_invest_one_off (self, **params): + """ + POST /sapi/v1/lending/auto-invest/one-off + """ + return self._request_margin_api("post, "lending/auto-invest/one-off", version=self.PUBLIC_API_VERSION, data=params) + +margin_lending_auto_invest_one_off_status (self, **params): + """ + GET /sapi/v1/lending/auto-invest/one-off/status + """ + return self._request_margin_api("get, "lending/auto-invest/one-off/status", version=self.PUBLIC_API_VERSION, data=params) + +margin_create_lending_auto_invest_redeem (self, **params): + """ + POST /sapi/v1/lending/auto-invest/redeem + """ + return self._request_margin_api("post, "lending/auto-invest/redeem", version=self.PUBLIC_API_VERSION, data=params) + +margin_lending_auto_invest_redeem_history (self, **params): + """ + GET /sapi/v1/lending/auto-invest/redeem/history + """ + return self._request_margin_api("get, "lending/auto-invest/redeem/history", version=self.PUBLIC_API_VERSION, data=params) + +margin_lending_auto_invest_rebalance_history (self, **params): + """ + GET /sapi/v1/lending/auto-invest/rebalance/history + """ + return self._request_margin_api("get, "lending/auto-invest/rebalance/history", version=self.PUBLIC_API_VERSION, data=params) + +margin_portfolio_margin_asset_leverage (self, **params): + """ + GET /sapi/v1/portfolio/margin-asset-leverage + """ + return self._request_margin_api("get, "portfolio/margin-asset-leverage", version=self.PUBLIC_API_VERSION, data=params) + +margin_create_portfolio_auto_collection (self, **params): + """ + POST /sapi/v1/portfolio/auto-collection + """ + return self._request_margin_api("post, "portfolio/auto-collection", version=self.PUBLIC_API_VERSION, data=params) + +margin_create_portfolio_asset_collection (self, **params): + """ + POST /sapi/v1/portfolio/asset-collection + """ + return self._request_margin_api("post, "portfolio/asset-collection", version=self.PUBLIC_API_VERSION, data=params) + +margin_create_portfolio_bnb_transfer (self, **params): + """ + POST /sapi/v1/portfolio/bnb-transfer + """ + return self._request_margin_api("post, "portfolio/bnb-transfer", version=self.PUBLIC_API_VERSION, data=params) + +margin_simple_earn_flexible_history_subscription_record (self, **params): + """ + GET /sapi/v1/simple-earn/flexible/history/subscriptionRecord + """ + return self._request_margin_api("get, "simple-earn/flexible/history/subscriptionRecord", version=self.PUBLIC_API_VERSION, data=params) + +margin_simple_earn_locked_history_subscription_record (self, **params): + """ + GET /sapi/v1/simple-earn/locked/history/subscriptionRecord + """ + return self._request_margin_api("get, "simple-earn/locked/history/subscriptionRecord", version=self.PUBLIC_API_VERSION, data=params) + +margin_simple_earn_flexible_history_redemption_record (self, **params): + """ + GET /sapi/v1/simple-earn/flexible/history/redemptionRecord + """ + return self._request_margin_api("get, "simple-earn/flexible/history/redemptionRecord", version=self.PUBLIC_API_VERSION, data=params) + +margin_create_loan_flexible_repay_history (self, **params): + """ + POST /sapi/v1/loan/flexible/repay/history + """ + return self._request_margin_api("post, "loan/flexible/repay/history", version=self.PUBLIC_API_VERSION, data=params) + +get_order_list (self, **params): + """ + GET /api/v3/orderList + """ + return self._get("orderList", version=self.PRIVATE_API_VERSION, data=params) + +get_open_orders_ (self, **params): + """ + GET /api/v3/openOrders- + """ + return self._get("openOrders-", version=self.PRIVATE_API_VERSION, data=params) + +get_ticker_price_ (self, **params): + """ + GET /api/v3/ticker/price- + """ + return self._get("ticker/price-", version=self.PRIVATE_API_VERSION, data=params) + +margin_create_loan_vip_borrow (self, **params): + """ + POST /sapi/v1/loan/vip/borrow + """ + return self._request_margin_api("post, "loan/vip/borrow", version=self.PUBLIC_API_VERSION, data=params) + +margin_create_portfolio_repay_futures_switch (self, **params): + """ + POST /sapi/v1/portfolio/repay-futures-switch + """ + return self._request_margin_api("post, "portfolio/repay-futures-switch", version=self.PUBLIC_API_VERSION, data=params) + +margin_portfolio_repay_futures_switch (self, **params): + """ + GET /sapi/v1/portfolio/repay-futures-switch + """ + return self._request_margin_api("get, "portfolio/repay-futures-switch", version=self.PUBLIC_API_VERSION, data=params) + +margin_create_portfolio_repay_futures_negative_balance (self, **params): + """ + POST /sapi/v1/portfolio/repay-futures-negative-balance + """ + return self._request_margin_api("post, "portfolio/repay-futures-negative-balance", version=self.PUBLIC_API_VERSION, data=params) + +margin_create_loan_vip_renew (self, **params): + """ + POST /sapi/v1/loan/vip/renew + """ + return self._request_margin_api("post, "loan/vip/renew", version=self.PUBLIC_API_VERSION, data=params) + +margin_loan_vip_collateral_data (self, **params): + """ + GET /sapi/v1/loan/vip/collateral/data + """ + return self._request_margin_api("get, "loan/vip/collateral/data", version=self.PUBLIC_API_VERSION, data=params) + +margin_loan_vip_request_data (self, **params): + """ + GET /sapi/v1/loan/vip/request/data + """ + return self._request_margin_api("get, "loan/vip/request/data", version=self.PUBLIC_API_VERSION, data=params) + +margin_create_sub_account_eoptions_enable (self, **params): + """ + POST /sapi/v1/sub-account/eoptions/enable + """ + return self._request_margin_api("post, "sub-account/eoptions/enable", version=self.PUBLIC_API_VERSION, data=params) + +margin_managed_subaccount_query_trans_log (self, **params): + """ + GET /sapi/v1/managed-subaccount/query-trans-log + """ + return self._request_margin_api("get, "managed-subaccount/query-trans-log", version=self.PUBLIC_API_VERSION, data=params) + +margin_lending_daily_product_list (self, **params): + """ + GET /sapi/v1/lending/daily/product/list + """ + return self._request_margin_api("get, "lending/daily/product/list", version=self.PUBLIC_API_VERSION, data=params) + +margin_lending_daily_user_left_quota (self, **params): + """ + GET /sapi/v1/lending/daily/userLeftQuota + """ + return self._request_margin_api("get, "lending/daily/userLeftQuota", version=self.PUBLIC_API_VERSION, data=params) + +margin_create_lending_daily_purchase (self, **params): + """ + POST /sapi/v1/lending/daily/purchase + """ + return self._request_margin_api("post, "lending/daily/purchase", version=self.PUBLIC_API_VERSION, data=params) + +margin_lending_daily_user_redemption_quota (self, **params): + """ + GET /sapi/v1/lending/daily/userRedemptionQuota + """ + return self._request_margin_api("get, "lending/daily/userRedemptionQuota", version=self.PUBLIC_API_VERSION, data=params) + +margin_create_lending_daily_redeem (self, **params): + """ + POST /sapi/v1/lending/daily/redeem + """ + return self._request_margin_api("post, "lending/daily/redeem", version=self.PUBLIC_API_VERSION, data=params) + +margin_lending_daily_token_position (self, **params): + """ + GET /sapi/v1/lending/daily/token/position + """ + return self._request_margin_api("get, "lending/daily/token/position", version=self.PUBLIC_API_VERSION, data=params) + +margin_lending_union_account (self, **params): + """ + GET /sapi/v1/lending/union/account + """ + return self._request_margin_api("get, "lending/union/account", version=self.PUBLIC_API_VERSION, data=params) + +margin_lending_union_purchase_record (self, **params): + """ + GET /sapi/v1/lending/union/purchaseRecord + """ + return self._request_margin_api("get, "lending/union/purchaseRecord", version=self.PUBLIC_API_VERSION, data=params) + +margin_lending_union_redemption_record (self, **params): + """ + GET /sapi/v1/lending/union/redemptionRecord + """ + return self._request_margin_api("get, "lending/union/redemptionRecord", version=self.PUBLIC_API_VERSION, data=params) + +margin_lending_union_interest_history (self, **params): + """ + GET /sapi/v1/lending/union/interestHistory + """ + return self._request_margin_api("get, "lending/union/interestHistory", version=self.PUBLIC_API_VERSION, data=params) + +margin_lending_auto_invest_target_asset_list (self, **params): + """ + GET /sapi/v1/lending/auto-invest/target-asset/list + """ + return self._request_margin_api("get, "lending/auto-invest/target-asset/list", version=self.PUBLIC_API_VERSION, data=params) + +margin_lending_auto_invest_target_asset_roi_list (self, **params): + """ + GET /sapi/v1/lending/auto-invest/target-asset/roi/list + """ + return self._request_margin_api("get, "lending/auto-invest/target-asset/roi/list", version=self.PUBLIC_API_VERSION, data=params) + +margin_lending_auto_invest_all_asset (self, **params): + """ + GET /sapi/v1/lending/auto-invest/all/asset + """ + return self._request_margin_api("get, "lending/auto-invest/all/asset", version=self.PUBLIC_API_VERSION, data=params) + +margin_lending_auto_invest_source_asset_list (self, **params): + """ + GET /sapi/v1/lending/auto-invest/source-asset/list + """ + return self._request_margin_api("get, "lending/auto-invest/source-asset/list", version=self.PUBLIC_API_VERSION, data=params) + +margin_create_lending_auto_invest_plan_add (self, **params): + """ + POST /sapi/v1/lending/auto-invest/plan/add + """ + return self._request_margin_api("post, "lending/auto-invest/plan/add", version=self.PUBLIC_API_VERSION, data=params) + +margin_create_lending_auto_invest_plan_edit_status (self, **params): + """ + POST /sapi/v1/lending/auto-invest/plan/edit-status + """ + return self._request_margin_api("post, "lending/auto-invest/plan/edit-status", version=self.PUBLIC_API_VERSION, data=params) + +margin_lending_auto_invest_plan_list (self, **params): + """ + GET /sapi/v1/lending/auto-invest/plan/list + """ + return self._request_margin_api("get, "lending/auto-invest/plan/list", version=self.PUBLIC_API_VERSION, data=params) + +margin_lending_auto_invest_plan_id (self, **params): + """ + GET /sapi/v1/lending/auto-invest/plan/id + """ + return self._request_margin_api("get, "lending/auto-invest/plan/id", version=self.PUBLIC_API_VERSION, data=params) + +margin_lending_auto_invest_history_list (self, **params): + """ + GET /sapi/v1/lending/auto-invest/history/list + """ + return self._request_margin_api("get, "lending/auto-invest/history/list", version=self.PUBLIC_API_VERSION, data=params) + +margin_margin_delist_schedule (self, **params): + """ + GET /sapi/v1/margin/delist-schedule + """ + return self._request_margin_api("get, "margin/delist-schedule", version=self.PUBLIC_API_VERSION, data=params) + +margin_create_capital_deposit_credit_apply (self, **params): + """ + POST /sapi/v1/capital/deposit/credit-apply + """ + return self._request_margin_api("post, "capital/deposit/credit-apply", version=self.PUBLIC_API_VERSION, data=params) + +margin_portfolio_asset_index_price (self, **params): + """ + GET /sapi/v1/portfolio/asset-index-price + """ + return self._request_margin_api("get, "portfolio/asset-index-price", version=self.PUBLIC_API_VERSION, data=params) + +margin_managed_subaccount_deposit_address (self, **params): + """ + GET /sapi/v1/managed-subaccount/deposit/address + """ + return self._request_margin_api("get, "managed-subaccount/deposit/address", version=self.PUBLIC_API_VERSION, data=params) + +margin_create_algo_spot_new_order_twap (self, **params): + """ + POST /sapi/v1/algo/spot/newOrderTwap + """ + return self._request_margin_api("post, "algo/spot/newOrderTwap", version=self.PUBLIC_API_VERSION, data=params) + +margin_cancel_algo_spot_order (self, **params): + """ + DELETE /sapi/v1/algo/spot/order + """ + return self._request_margin_api("delete, "algo/spot/order", version=self.PUBLIC_API_VERSION, data=params) + +margin_algo_spot_open_orders (self, **params): + """ + GET /sapi/v1/algo/spot/openOrders + """ + return self._request_margin_api("get, "algo/spot/openOrders", version=self.PUBLIC_API_VERSION, data=params) + +margin_algo_spot_historical_orders (self, **params): + """ + GET /sapi/v1/algo/spot/historicalOrders + """ + return self._request_margin_api("get, "algo/spot/historicalOrders", version=self.PUBLIC_API_VERSION, data=params) + +margin_algo_spot_sub_orders (self, **params): + """ + GET /sapi/v1/algo/spot/subOrders + """ + return self._request_margin_api("get, "algo/spot/subOrders", version=self.PUBLIC_API_VERSION, data=params) + +margin_managed_subaccount_query_trans_log_for_investor (self, **params): + """ + GET /sapi/v1/managed-subaccount/queryTransLogForInvestor + """ + return self._request_margin_api("get, "managed-subaccount/queryTransLogForInvestor", version=self.PUBLIC_API_VERSION, data=params) + +margin_managed_subaccount_query_trans_log_for_trade_parent (self, **params): + """ + GET /sapi/v1/managed-subaccount/queryTransLogForTradeParent + """ + return self._request_margin_api("get, "managed-subaccount/queryTransLogForTradeParent", version=self.PUBLIC_API_VERSION, data=params) + +margin_managed_subaccount_info (self, **params): + """ + GET /sapi/v1/managed-subaccount/info + """ + return self._request_margin_api("get, "managed-subaccount/info", version=self.PUBLIC_API_VERSION, data=params) + +margin_sub_account_transaction_statistics (self, **params): + """ + GET /sapi/v1/sub-account/transaction-statistics + """ + return self._request_margin_api("get, "sub-account/transaction-statistics", version=self.PUBLIC_API_VERSION, data=params) + +margin_portfolio_interest_history (self, **params): + """ + GET /sapi/v1/portfolio/interest-history + """ + return self._request_margin_api("get, "portfolio/interest-history", version=self.PUBLIC_API_VERSION, data=params) + +margin_create_loan_borrow (self, **params): + """ + POST /sapi/v1/loan/borrow + """ + return self._request_margin_api("post, "loan/borrow", version=self.PUBLIC_API_VERSION, data=params) + +margin_create_sub_account_sub_account_api_ip_restriction (self, **params): + """ + POST /sapi/v1/sub-account/subAccountApi/ipRestriction + """ + return self._request_margin_api("post, "sub-account/subAccountApi/ipRestriction", version=self.PUBLIC_API_VERSION, data=params) + +margin_create_sub_account_sub_account_api_ip_restriction_ip_list (self, **params): + """ + POST /sapi/v1/sub-account/subAccountApi/ipRestriction/ipList + """ + return self._request_margin_api("post, "sub-account/subAccountApi/ipRestriction/ipList", version=self.PUBLIC_API_VERSION, data=params) + +margin_managed_subaccount_fetch_future_asset (self, **params): + """ + GET /sapi/v1/managed-subaccount/fetch-future-asset + """ + return self._request_margin_api("get, "managed-subaccount/fetch-future-asset", version=self.PUBLIC_API_VERSION, data=params) + +margin_managed_subaccount_margin_asset (self, **params): + """ + GET /sapi/v1/managed-subaccount/marginAsset + """ + return self._request_margin_api("get, "managed-subaccount/marginAsset", version=self.PUBLIC_API_VERSION, data=params) + +margin_capital_contract_convertible_coins (self, **params): + """ + GET /sapi/v1/capital/contract/convertible-coins + """ + return self._request_margin_api("get, "capital/contract/convertible-coins", version=self.PUBLIC_API_VERSION, data=params) + +margin_create_capital_contract_convertible_coins (self, **params): + """ + POST /sapi/v1/capital/contract/convertible-coins + """ + return self._request_margin_api("post, "capital/contract/convertible-coins", version=self.PUBLIC_API_VERSION, data=params) + +get_acccount (self, **params): + """ + GET /api/v3/acccount + """ + return self._get("acccount", version=self.PRIVATE_API_VERSION, data=params) + +margin_loan_vip_collateral_account (self, **params): + """ + GET /sapi/v1/loan/vip/collateral/account + """ + return self._request_margin_api("get, "loan/vip/collateral/account", version=self.PUBLIC_API_VERSION, data=params) + +margin_convert_exchange_info (self, **params): + """ + GET /sapi/v1/convert/exchangeInfo + """ + return self._request_margin_api("get, "convert/exchangeInfo", version=self.PUBLIC_API_VERSION, data=params) + +margin_convert_asset_info (self, **params): + """ + GET /sapi/v1/convert/assetInfo + """ + return self._request_margin_api("get, "convert/assetInfo", version=self.PUBLIC_API_VERSION, data=params) + +margin_convert_order_status (self, **params): + """ + GET /sapi/v1/convert/orderStatus + """ + return self._request_margin_api("get, "convert/orderStatus", version=self.PUBLIC_API_VERSION, data=params) + +margin_asset_ledger_transfer_cloud_mining_query_by_page (self, **params): + """ + GET /sapi/v1/asset/ledger-transfer/cloud-mining/queryByPage + """ + return self._request_margin_api("get, "asset/ledger-transfer/cloud-mining/queryByPage", version=self.PUBLIC_API_VERSION, data=params) + +margin_create_sub_account_sub_account_api_ip_restriction (self, **params): + """ + POST /sapi/v2/sub-account/subAccountApi/ipRestriction + """ + return self._request_margin_api("post, "sub-account/subAccountApi/ipRestriction", version=undefined, data=params) + +margin_create_loan_vip_repay (self, **params): + """ + POST /sapi/v1/loan/vip/repay + """ + return self._request_margin_api("post, "loan/vip/repay", version=self.PUBLIC_API_VERSION, data=params) + +margin_loan_vip_repay_history (self, **params): + """ + GET /sapi/v1/loan/vip/repay/history + """ + return self._request_margin_api("get, "loan/vip/repay/history", version=self.PUBLIC_API_VERSION, data=params) + +margin_loan_loanable_data (self, **params): + """ + GET /sapi/v1/loan/loanable/data + """ + return self._request_margin_api("get, "loan/loanable/data", version=self.PUBLIC_API_VERSION, data=params) + +margin_loan_collateral_data (self, **params): + """ + GET /sapi/v1/loan/collateral/data + """ + return self._request_margin_api("get, "loan/collateral/data", version=self.PUBLIC_API_VERSION, data=params) + +margin_loan_repay_collateral_rate (self, **params): + """ + GET /sapi/v1/loan/repay/collateral/rate + """ + return self._request_margin_api("get, "loan/repay/collateral/rate", version=self.PUBLIC_API_VERSION, data=params) + +margin_create_loan_customize_margin_call (self, **params): + """ + POST /sapi/v1/loan/customize/margin_call + """ + return self._request_margin_api("post, "loan/customize/margin_call", version=self.PUBLIC_API_VERSION, data=params) + +margin_create_asset_convert_transfer (self, **params): + """ + POST /sapi/v1/asset/convert-transfer + """ + return self._request_margin_api("post, "asset/convert-transfer", version=self.PUBLIC_API_VERSION, data=params) + +margin_create_asset_convert_transfer_query_by_page (self, **params): + """ + POST /sapi/v1/asset/convert-transfer/queryByPage + """ + return self._request_margin_api("post, "asset/convert-transfer/queryByPage", version=self.PUBLIC_API_VERSION, data=params) + +margin_create_futures_loan_borrow (self, **params): + """ + POST /sapi/v1/futures/loan/borrow + """ + return self._request_margin_api("post, "futures/loan/borrow", version=self.PUBLIC_API_VERSION, data=params) + +margin_create_futures_loan_repay (self, **params): + """ + POST /sapi/v1/futures/loan/repay + """ + return self._request_margin_api("post, "futures/loan/repay", version=self.PUBLIC_API_VERSION, data=params) + +margin_futures_loan_configs (self, **params): + """ + GET /sapi/v1/futures/loan/configs + """ + return self._request_margin_api("get, "futures/loan/configs", version=self.PUBLIC_API_VERSION, data=params) + +margin_futures_loan_configs (self, **params): + """ + GET /sapi/v2/futures/loan/configs + """ + return self._request_margin_api("get, "futures/loan/configs", version=undefined, data=params) + +margin_futures_loan_calc_adjust_level (self, **params): + """ + GET /sapi/v1/futures/loan/calcAdjustLevel + """ + return self._request_margin_api("get, "futures/loan/calcAdjustLevel", version=self.PUBLIC_API_VERSION, data=params) + +margin_futures_loan_calc_adjust_level (self, **params): + """ + GET /sapi/v2/futures/loan/calcAdjustLevel + """ + return self._request_margin_api("get, "futures/loan/calcAdjustLevel", version=undefined, data=params) + +margin_futures_loan_calc_max_adjust_amount (self, **params): + """ + GET /sapi/v1/futures/loan/calcMaxAdjustAmount + """ + return self._request_margin_api("get, "futures/loan/calcMaxAdjustAmount", version=self.PUBLIC_API_VERSION, data=params) + +margin_futures_loan_calc_max_adjust_amount (self, **params): + """ + GET /sapi/v2/futures/loan/calcMaxAdjustAmount + """ + return self._request_margin_api("get, "futures/loan/calcMaxAdjustAmount", version=undefined, data=params) + +margin_create_futures_loan_adjust_collateral (self, **params): + """ + POST /sapi/v1/futures/loan/adjustCollateral + """ + return self._request_margin_api("post, "futures/loan/adjustCollateral", version=self.PUBLIC_API_VERSION, data=params) + +margin_create_futures_loan_adjust_collateral (self, **params): + """ + POST /sapi/v2/futures/loan/adjustCollateral + """ + return self._request_margin_api("post, "futures/loan/adjustCollateral", version=undefined, data=params) + +margin_futures_loan_collateral_repay_limit (self, **params): + """ + GET /sapi/v1/futures/loan/collateralRepayLimit + """ + return self._request_margin_api("get, "futures/loan/collateralRepayLimit", version=self.PUBLIC_API_VERSION, data=params) + +margin_futures_loan_collateral_repay (self, **params): + """ + GET /sapi/v1/futures/loan/collateralRepay + """ + return self._request_margin_api("get, "futures/loan/collateralRepay", version=self.PUBLIC_API_VERSION, data=params) + +margin_create_futures_loan_collateral_repay (self, **params): + """ + POST /sapi/v1/futures/loan/collateralRepay + """ + return self._request_margin_api("post, "futures/loan/collateralRepay", version=self.PUBLIC_API_VERSION, data=params) + +margin_futures_loan_collateral_repay_result (self, **params): + """ + GET /sapi/v1/futures/loan/collateralRepayResult + """ + return self._request_margin_api("get, "futures/loan/collateralRepayResult", version=self.PUBLIC_API_VERSION, data=params) + +margin_cancel_sub_account_sub_account_api_ip_restriction_ip_list (self, **params): + """ + DELETE /sapi/v1/sub-account/subAccountApi/ipRestriction/ipList + """ + return self._request_margin_api("delete, "sub-account/subAccountApi/ipRestriction/ipList", version=self.PUBLIC_API_VERSION, data=params) + +margin_create_lending_customized_fixed_purchase (self, **params): + """ + POST /sapi/v1/lending/customizedFixed/purchase + """ + return self._request_margin_api("post, "lending/customizedFixed/purchase", version=self.PUBLIC_API_VERSION, data=params) + +margin_margin_trade_coeff (self, **params): + """ + GET /sapi/v1/margin/tradeCoeff + """ + return self._request_margin_api("get, "margin/tradeCoeff", version=self.PUBLIC_API_VERSION, data=params) + +margin_loan_borrow_history (self, **params): + """ + GET /sapi/v1/loan/borrow/history + """ + return self._request_margin_api("get, "loan/borrow/history", version=self.PUBLIC_API_VERSION, data=params) + +margin_sub_account_sub_account_api_ip_restriction (self, **params): + """ + GET /sapi/v1/sub-account/subAccountApi/ipRestriction + """ + return self._request_margin_api("get, "sub-account/subAccountApi/ipRestriction", version=self.PUBLIC_API_VERSION, data=params) + +margin_portfolio_pm_loan (self, **params): + """ + GET /sapi/v1/portfolio/pmLoan + """ + return self._request_margin_api("get, "portfolio/pmLoan", version=self.PUBLIC_API_VERSION, data=params) + +margin_portfolio_collateral_rate (self, **params): + """ + GET /sapi/v1/portfolio/collateralRate + """ + return self._request_margin_api("get, "portfolio/collateralRate", version=self.PUBLIC_API_VERSION, data=params) + +margin_mining_pub_algo_list (self, **params): + """ + GET /sapi/v1/mining/pub/algoList + """ + return self._request_margin_api("get, "mining/pub/algoList", version=self.PUBLIC_API_VERSION, data=params) + +margin_mining_pub_coin_list (self, **params): + """ + GET /sapi/v1/mining/pub/coinList + """ + return self._request_margin_api("get, "mining/pub/coinList", version=self.PUBLIC_API_VERSION, data=params) + +margin_create_algo_futures_new_order_twap (self, **params): + """ + POST /sapi/v1/algo/futures/newOrderTwap + """ + return self._request_margin_api("post, "algo/futures/newOrderTwap", version=self.PUBLIC_API_VERSION, data=params) + +margin_margin_rate_limit_order (self, **params): + """ + GET /sapi/v1/margin/rateLimit/order + """ + return self._request_margin_api("get, "margin/rateLimit/order", version=self.PUBLIC_API_VERSION, data=params) + +margin_portfolio_account (self, **params): + """ + GET /sapi/v1/portfolio/account + """ + return self._request_margin_api("get, "portfolio/account", version=self.PUBLIC_API_VERSION, data=params) + +margin_create_algo_futures_new_order_vp (self, **params): + """ + POST /sapi/v1/algo/futures/newOrderVp + """ + return self._request_margin_api("post, "algo/futures/newOrderVp", version=self.PUBLIC_API_VERSION, data=params) + +margin_cancel_algo_futures_order (self, **params): + """ + DELETE /sapi/v1/algo/futures/order + """ + return self._request_margin_api("delete, "algo/futures/order", version=self.PUBLIC_API_VERSION, data=params) + +margin_algo_futures_open_orders (self, **params): + """ + GET /sapi/v1/algo/futures/openOrders + """ + return self._request_margin_api("get, "algo/futures/openOrders", version=self.PUBLIC_API_VERSION, data=params) + +margin_algo_futures_historical_orders (self, **params): + """ + GET /sapi/v1/algo/futures/historicalOrders + """ + return self._request_margin_api("get, "algo/futures/historicalOrders", version=self.PUBLIC_API_VERSION, data=params) + +margin_algo_futures_sub_orders (self, **params): + """ + GET /sapi/v1/algo/futures/subOrders + """ + return self._request_margin_api("get, "algo/futures/subOrders", version=self.PUBLIC_API_VERSION, data=params) + +margin_managed_subaccount_account_snapshot (self, **params): + """ + GET /sapi/v1/managed-subaccount/accountSnapshot + """ + return self._request_margin_api("get, "managed-subaccount/accountSnapshot", version=self.PUBLIC_API_VERSION, data=params) + +margin_sub_account_listto (self, **params): + """ + GET /sapi/v1/sub-account/listto + """ + return self._request_margin_api("get, "sub-account/listto", version=self.PUBLIC_API_VERSION, data=params) + +margin_mining_payment_uid (self, **params): + """ + GET /sapi/v1/mining/payment/uid + """ + return self._request_margin_api("get, "mining/payment/uid", version=self.PUBLIC_API_VERSION, data=params) + +margin_nft_history_transactions (self, **params): + """ + GET /sapi/v1/nft/history/transactions + """ + return self._request_margin_api("get, "nft/history/transactions", version=self.PUBLIC_API_VERSION, data=params) + +margin_nft_history_deposit (self, **params): + """ + GET /sapi/v1/nft/history/deposit + """ + return self._request_margin_api("get, "nft/history/deposit", version=self.PUBLIC_API_VERSION, data=params) + +margin_nft_history_withdraw (self, **params): + """ + GET /sapi/v1/nft/history/withdraw + """ + return self._request_margin_api("get, "nft/history/withdraw", version=self.PUBLIC_API_VERSION, data=params) + +margin_nft_user_get_asset (self, **params): + """ + GET /sapi/v1/nft/user/getAsset + """ + return self._request_margin_api("get, "nft/user/getAsset", version=self.PUBLIC_API_VERSION, data=params) + +margin_rebate_tax_query (self, **params): + """ + GET /sapi/v1/rebate/taxQuery + """ + return self._request_margin_api("get, "rebate/taxQuery", version=self.PUBLIC_API_VERSION, data=params) + +margin_pay_transactionsto (self, **params): + """ + GET /sapi/v1/pay/transactionsto + """ + return self._request_margin_api("get, "pay/transactionsto", version=self.PUBLIC_API_VERSION, data=params) + +margin_capital_withdraw_historyto (self, **params): + """ + GET /sapi/v1/capital/withdraw/historyto + """ + return self._request_margin_api("get, "capital/withdraw/historyto", version=self.PUBLIC_API_VERSION, data=params) + +margin_create_account_api_restrictions_ip_restriction (self, **params): + """ + POST /sapi/v1/account/apiRestrictions/ipRestriction + """ + return self._request_margin_api("post, "account/apiRestrictions/ipRestriction", version=self.PUBLIC_API_VERSION, data=params) + +margin_create_account_api_restrictions_ip_restriction_ip_list (self, **params): + """ + POST /sapi/v1/account/apiRestrictions/ipRestriction/ipList + """ + return self._request_margin_api("post, "account/apiRestrictions/ipRestriction/ipList", version=self.PUBLIC_API_VERSION, data=params) + +margin_account_api_restrictions_ip_restriction (self, **params): + """ + GET /sapi/v1/account/apiRestrictions/ipRestriction + """ + return self._request_margin_api("get, "account/apiRestrictions/ipRestriction", version=self.PUBLIC_API_VERSION, data=params) + +margin_cancel_account_api_restrictions_ip_restriction_ip_list (self, **params): + """ + DELETE /sapi/v1/account/apiRestrictions/ipRestriction/ipList + """ + return self._request_margin_api("delete, "account/apiRestrictions/ipRestriction/ipList", version=self.PUBLIC_API_VERSION, data=params) + +margin_loan_incometo (self, **params): + """ + GET /sapi/v1/loan/incometo + """ + return self._request_margin_api("get, "loan/incometo", version=self.PUBLIC_API_VERSION, data=params) + +margin_margin_all_order_list (self, **params): + """ + GET /sapi/v1/margin/allOrderList + """ + return self._request_margin_api("get, "margin/allOrderList", version=self.PUBLIC_API_VERSION, data=params) + +margin_create_managed_subaccount_deposit (self, **params): + """ + POST /sapi/v1/managed-subaccount/deposit + """ + return self._request_margin_api("post, "managed-subaccount/deposit", version=self.PUBLIC_API_VERSION, data=params) + +margin_managed_subaccount_asset (self, **params): + """ + GET /sapi/v1/managed-subaccount/asset + """ + return self._request_margin_api("get, "managed-subaccount/asset", version=self.PUBLIC_API_VERSION, data=params) + +margin_create_managed_subaccount_withdraw (self, **params): + """ + POST /sapi/v1/managed-subaccount/withdraw + """ + return self._request_margin_api("post, "managed-subaccount/withdraw", version=self.PUBLIC_API_VERSION, data=params) + +system_status (self, **params): + """ + GET /wapi/v3/systemStatus + """ + return self._get("systemStatus", version=self.PRIVATE_API_VERSION, data=params) + +create_withdraw (self, **params): + """ + POST /wapi/v3/withdraw + """ + return self._post("withdraw", version=self.PRIVATE_API_VERSION, data=params) + +deposit_history (self, **params): + """ + GET /wapi/v3/depositHistory + """ + return self._get("depositHistory", version=self.PRIVATE_API_VERSION, data=params) + +withdraw_history (self, **params): + """ + GET /wapi/v3/withdrawHistory + """ + return self._get("withdrawHistory", version=self.PRIVATE_API_VERSION, data=params) + +deposit_address (self, **params): + """ + GET /wapi/v3/depositAddress + """ + return self._get("depositAddress", version=self.PRIVATE_API_VERSION, data=params) + +account_status (self, **params): + """ + GET /wapi/v3/accountStatus + """ + return self._get("accountStatus", version=self.PRIVATE_API_VERSION, data=params) + +api_trading_status (self, **params): + """ + GET /wapi/v3/apiTradingStatus + """ + return self._get("apiTradingStatus", version=self.PRIVATE_API_VERSION, data=params) + +user_asset_dribblet_log (self, **params): + """ + GET /wapi/v3/userAssetDribbletLog + """ + return self._get("userAssetDribbletLog", version=self.PRIVATE_API_VERSION, data=params) + +asset_detail (self, **params): + """ + GET /wapi/v3/assetDetail + """ + return self._get("assetDetail", version=self.PRIVATE_API_VERSION, data=params) + +trade_fee (self, **params): + """ + GET /wapi/v3/tradeFee + """ + return self._get("tradeFee", version=self.PRIVATE_API_VERSION, data=params) + +sub_account_list (self, **params): + """ + GET /wapi/v3/sub-account/list + """ + return self._get("sub-account/list", version=self.PRIVATE_API_VERSION, data=params) + +sub_account_transfer_history (self, **params): + """ + GET /wapi/v3/sub-account/transfer/history + """ + return self._get("sub-account/transfer/history", version=self.PRIVATE_API_VERSION, data=params) + +create_sub_account_transfer (self, **params): + """ + POST /wapi/v3/sub-account/transfer + """ + return self._post("sub-account/transfer", version=self.PRIVATE_API_VERSION, data=params) + +sub_account_assets (self, **params): + """ + GET /wapi/v3/sub-account/assets + """ + return self._get("sub-account/assets", version=self.PRIVATE_API_VERSION, data=params) + +margin_account_status (self, **params): + """ + GET /sapi/v1/account/status + """ + return self._request_margin_api("get, "account/status", version=self.PUBLIC_API_VERSION, data=params) + +margin_asset_trade_fee (self, **params): + """ + GET /sapi/v1/asset/tradeFee + """ + return self._request_margin_api("get, "asset/tradeFee", version=self.PUBLIC_API_VERSION, data=params) + +margin_create_sub_account_virtual_sub_account (self, **params): + """ + POST /sapi/v1/sub-account/virtualSubAccount + """ + return self._request_margin_api("post, "sub-account/virtualSubAccount", version=self.PUBLIC_API_VERSION, data=params) + +margin_mining_payment_list (self, **params): + """ + GET /sapi/v1/mining/payment/list + """ + return self._request_margin_api("get, "mining/payment/list", version=self.PUBLIC_API_VERSION, data=params) + +margin_mining_payment_other (self, **params): + """ + GET /sapi/v1/mining/payment/other + """ + return self._request_margin_api("get, "mining/payment/other", version=self.PUBLIC_API_VERSION, data=params) + +margin_mining_hash_transfer_config_details (self, **params): + """ + GET /sapi/v1/mining/hash-transfer/config/details + """ + return self._request_margin_api("get, "mining/hash-transfer/config/details", version=self.PUBLIC_API_VERSION, data=params) + +margin_mining_hash_transfer_config_details_list (self, **params): + """ + GET /sapi/v1/mining/hash-transfer/config/details/list + """ + return self._request_margin_api("get, "mining/hash-transfer/config/details/list", version=self.PUBLIC_API_VERSION, data=params) + +margin_mining_hash_transfer_profit_details (self, **params): + """ + GET /sapi/v1/mining/hash-transfer/profit/details + """ + return self._request_margin_api("get, "mining/hash-transfer/profit/details", version=self.PUBLIC_API_VERSION, data=params) + +margin_create_mining_hash_transfer_config (self, **params): + """ + POST /sapi/v1/mining/hash-transfer/config + """ + return self._request_margin_api("post, "mining/hash-transfer/config", version=self.PUBLIC_API_VERSION, data=params) + +margin_create_mining_hash_transfer_config_cancel (self, **params): + """ + POST /sapi/v1/mining/hash-transfer/config/cancel + """ + return self._request_margin_api("post, "mining/hash-transfer/config/cancel", version=self.PUBLIC_API_VERSION, data=params) + +margin_create_sub_account_futures_transferto (self, **params): + """ + POST /sapi/v1/sub-account/futures/transferto + """ + return self._request_margin_api("post, "sub-account/futures/transferto", version=self.PUBLIC_API_VERSION, data=params) + +margin_lending_project_position_list (self, **params): + """ + GET /sapi/v1/lending/project/position/list + """ + return self._request_margin_api("get, "lending/project/position/list", version=self.PUBLIC_API_VERSION, data=params) + +margin_mining_worker_detail (self, **params): + """ + GET /sapi/v1/mining/worker/detail + """ + return self._request_margin_api("get, "mining/worker/detail", version=self.PUBLIC_API_VERSION, data=params) + +margin_mining_worker_list (self, **params): + """ + GET /sapi/v1/mining/worker/list + """ + return self._request_margin_api("get, "mining/worker/list", version=self.PUBLIC_API_VERSION, data=params) + +margin_mining_statistics_user_status (self, **params): + """ + GET /sapi/v1/mining/statistics/user/status + """ + return self._request_margin_api("get, "mining/statistics/user/status", version=self.PUBLIC_API_VERSION, data=params) + +margin_mining_statistics_user_list (self, **params): + """ + GET /sapi/v1/mining/statistics/user/list + """ + return self._request_margin_api("get, "mining/statistics/user/list", version=self.PUBLIC_API_VERSION, data=params) + +margin_create_account_disable_fast_withdraw_switch (self, **params): + """ + POST /sapi/v1/account/disableFastWithdrawSwitch + """ + return self._request_margin_api("post, "account/disableFastWithdrawSwitch", version=self.PUBLIC_API_VERSION, data=params) + +margin_create_account_enable_fast_withdraw_switch (self, **params): + """ + POST /sapi/v1/account/enableFastWithdrawSwitch + """ + return self._request_margin_api("post, "account/enableFastWithdrawSwitch", version=self.PUBLIC_API_VERSION, data=params) + +margin_asset_convert_transfer_query_by_page (self, **params): + """ + GET /sapi/v1/asset/convert-transfer/queryByPage + """ + return self._request_margin_api("get, "asset/convert-transfer/queryByPage", version=self.PUBLIC_API_VERSION, data=params) + +margin_create_margin_listen_key (self, **params): + """ + POST /sapi/v1/margin/listen-key + """ + return self._request_margin_api("post, "margin/listen-key", version=self.PUBLIC_API_VERSION, data=params) + +margin_modify_margin_listen_key (self, **params): + """ + PUT /sapi/v1/margin/listen-key + """ + return self._request_margin_api("put, "margin/listen-key", version=self.PUBLIC_API_VERSION, data=params) + +margin_cancel_margin_listen_key (self, **params): + """ + DELETE /sapi/v1/margin/listen-key + """ + return self._request_margin_api("delete, "margin/listen-key", version=self.PUBLIC_API_VERSION, data=params) + +margin_simple_earn_locked_history_redemption_record (self, **params): + """ + GET /sapi/v1/simple-earn/locked/history/redemptionRecord + """ + return self._request_margin_api("get, "simple-earn/locked/history/redemptionRecord", version=self.PUBLIC_API_VERSION, data=params) + +margin_simple_earn_flexible_history_rewards_record (self, **params): + """ + GET /sapi/v1/simple-earn/flexible/history/rewardsRecord + """ + return self._request_margin_api("get, "simple-earn/flexible/history/rewardsRecord", version=self.PUBLIC_API_VERSION, data=params) + +margin_simple_earn_locked_history_rewards_record (self, **params): + """ + GET /sapi/v1/simple-earn/locked/history/rewardsRecord + """ + return self._request_margin_api("get, "simple-earn/locked/history/rewardsRecord", version=self.PUBLIC_API_VERSION, data=params) + +margin_create_simple_earn_flexible_set_auto_subscribe (self, **params): + """ + POST /sapi/v1/simple-earn/flexible/setAutoSubscribe + """ + return self._request_margin_api("post, "simple-earn/flexible/setAutoSubscribe", version=self.PUBLIC_API_VERSION, data=params) + +margin_create_simple_earn_locked_set_auto_subscribe (self, **params): + """ + POST /sapi/v1/simple-earn/locked/setAutoSubscribe + """ + return self._request_margin_api("post, "simple-earn/locked/setAutoSubscribe", version=self.PUBLIC_API_VERSION, data=params) + +margin_simple_earn_flexible_personal_left_quota (self, **params): + """ + GET /sapi/v1/simple-earn/flexible/personalLeftQuota + """ + return self._request_margin_api("get, "simple-earn/flexible/personalLeftQuota", version=self.PUBLIC_API_VERSION, data=params) + +margin_simple_earn_locked_personal_left_quota (self, **params): + """ + GET /sapi/v1/simple-earn/locked/personalLeftQuota + """ + return self._request_margin_api("get, "simple-earn/locked/personalLeftQuota", version=self.PUBLIC_API_VERSION, data=params) + +margin_simple_earn_flexible_subscription_preview (self, **params): + """ + GET /sapi/v1/simple-earn/flexible/subscriptionPreview + """ + return self._request_margin_api("get, "simple-earn/flexible/subscriptionPreview", version=self.PUBLIC_API_VERSION, data=params) + +margin_simple_earn_locked_subscription_preview (self, **params): + """ + GET /sapi/v1/simple-earn/locked/subscriptionPreview + """ + return self._request_margin_api("get, "simple-earn/locked/subscriptionPreview", version=self.PUBLIC_API_VERSION, data=params) + +margin_simple_earn_flexible_history_rate_history (self, **params): + """ + GET /sapi/v1/simple-earn/flexible/history/rateHistory + """ + return self._request_margin_api("get, "simple-earn/flexible/history/rateHistory", version=self.PUBLIC_API_VERSION, data=params) + +margin_simple_earn_flexible_history_collateral_record (self, **params): + """ + GET /sapi/v1/simple-earn/flexible/history/collateralRecord + """ + return self._request_margin_api("get, "simple-earn/flexible/history/collateralRecord", version=self.PUBLIC_API_VERSION, data=params) + +margin_create_lending_auto_invest_plan_edit (self, **params): + """ + POST /sapi/v1/lending/auto-invest/plan/edit + """ + return self._request_margin_api("post, "lending/auto-invest/plan/edit", version=self.PUBLIC_API_VERSION, data=params) + +margin_eth_staking_eth_history_rewards_history (self, **params): + """ + GET /sapi/v1/eth-staking/eth/history/rewardsHistory + """ + return self._request_margin_api("get, "eth-staking/eth/history/rewardsHistory", version=self.PUBLIC_API_VERSION, data=params) + +margin_eth_staking_eth_quota (self, **params): + """ + GET /sapi/v1/eth-staking/eth/quota + """ + return self._request_margin_api("get, "eth-staking/eth/quota", version=self.PUBLIC_API_VERSION, data=params) + +margin_eth_staking_eth_history_rate_history (self, **params): + """ + GET /sapi/v1/eth-staking/eth/history/rateHistory + """ + return self._request_margin_api("get, "eth-staking/eth/history/rateHistory", version=self.PUBLIC_API_VERSION, data=params) + +margin_eth_staking_wbeth_history_wrap_history (self, **params): + """ + GET /sapi/v1/eth-staking/wbeth/history/wrapHistory + """ + return self._request_margin_api("get, "eth-staking/wbeth/history/wrapHistory", version=self.PUBLIC_API_VERSION, data=params) + +margin_eth_staking_wbeth_history_unwrap_history (self, **params): + """ + GET /sapi/v1/eth-staking/wbeth/history/unwrapHistory + """ + return self._request_margin_api("get, "eth-staking/wbeth/history/unwrapHistory", version=self.PUBLIC_API_VERSION, data=params) + +margin_loan_income (self, **params): + """ + GET /sapi/v1/loan/income + """ + return self._request_margin_api("get, "loan/income", version=self.PUBLIC_API_VERSION, data=params) + +margin_loan_ongoing_orders (self, **params): + """ + GET /sapi/v1/loan/ongoing/orders + """ + return self._request_margin_api("get, "loan/ongoing/orders", version=self.PUBLIC_API_VERSION, data=params) + +margin_create_loan_repay (self, **params): + """ + POST /sapi/v1/loan/repay + """ + return self._request_margin_api("post, "loan/repay", version=self.PUBLIC_API_VERSION, data=params) + +margin_loan_repay_history (self, **params): + """ + GET /sapi/v1/loan/repay/history + """ + return self._request_margin_api("get, "loan/repay/history", version=self.PUBLIC_API_VERSION, data=params) + +margin_create_loan_adjust_ltv (self, **params): + """ + POST /sapi/v1/loan/adjust/ltv + """ + return self._request_margin_api("post, "loan/adjust/ltv", version=self.PUBLIC_API_VERSION, data=params) + +margin_loan_ltv_adjustment_history (self, **params): + """ + GET /sapi/v1/loan/ltv/adjustment/history + """ + return self._request_margin_api("get, "loan/ltv/adjustment/history", version=self.PUBLIC_API_VERSION, data=params) + +#futures ==================== + +futures_create_fee_burn (self, **params): + """ + POST /fapi/v1/feeBurn + """ + return self._request_futures_api("post, "feeBurn", version=1, data=params) + +futures_fee_burn (self, **params): + """ + GET /fapi/v1/feeBurn + """ + return self._request_futures_api("get, "feeBurn", version=1, data=params) + +futures_rate_limit_order (self, **params): + """ + GET /fapi/v1/rateLimit/order + """ + return self._request_futures_api("get, "rateLimit/order", version=1, data=params) + +futures_modify_batch_orders (self, **params): + """ + PUT /fapi/v1/batchOrders + """ + return self._request_futures_api("put, "batchOrders", version=1, data=params) + +futures_data_basis (self, **params): + """ + GET /futures/data/basis + """ + return self._request_futures_data_api("get, "basis", version=undefined, data=params) + +futures_data_delivery_price (self, **params): + """ + GET /futures/data/delivery-price + """ + return self._request_futures_data_api("get, "delivery-price", version=undefined, data=params) + +futures_data_takerlongshort_ratio (self, **params): + """ + GET /futures/data/takerlongshortRatio + """ + return self._request_futures_data_api("get, "takerlongshortRatio", version=undefined, data=params) + +futures_funding_info (self, **params): + """ + GET /fapi/v1/fundingInfo + """ + return self._request_futures_api("get, "fundingInfo", version=1, data=params) + +futures_income_asyn (self, **params): + """ + GET /fapi/v1/income/asyn + """ + return self._request_futures_api("get, "income/asyn", version=1, data=params) + +futures_order_asyn (self, **params): + """ + GET /fapi/v1/order/asyn + """ + return self._request_futures_api("get, "order/asyn", version=1, data=params) + +futures_trade_asyn (self, **params): + """ + GET /fapi/v1/trade/asyn + """ + return self._request_futures_api("get, "trade/asyn", version=1, data=params) + +futures_income_asyn_id (self, **params): + """ + GET /fapi/v1/income/asyn/id + """ + return self._request_futures_api("get, "income/asyn/id", version=1, data=params) + +futures_order_asyn_id (self, **params): + """ + GET /fapi/v1/order/asyn/id + """ + return self._request_futures_api("get, "order/asyn/id", version=1, data=params) + +futures_trade_asyn_id (self, **params): + """ + GET /fapi/v1/trade/asyn/id + """ + return self._request_futures_api("get, "trade/asyn/id", version=1, data=params) + +futures_create_batch_order (self, **params): + """ + POST /fapi/v1/batchOrder + """ + return self._request_futures_api("post, "batchOrder", version=1, data=params) + +futures_modify_batch_order (self, **params): + """ + PUT /fapi/v1/batchOrder + """ + return self._request_futures_api("put, "batchOrder", version=1, data=params) + +futures_cancel_batch_order (self, **params): + """ + DELETE /fapi/v1/batchOrder + """ + return self._request_futures_api("delete, "batchOrder", version=1, data=params) + +futures_order_asynto (self, **params): + """ + GET /fapi/v1/order/asynto + """ + return self._request_futures_api("get, "order/asynto", version=1, data=params) + +futures_order_asyn_idto (self, **params): + """ + GET /fapi/v1/order/asyn/idto + """ + return self._request_futures_api("get, "order/asyn/idto", version=1, data=params) + +futures_trade_asynto (self, **params): + """ + GET /fapi/v1/trade/asynto + """ + return self._request_futures_api("get, "trade/asynto", version=1, data=params) + +futures_trade_asyn_idto (self, **params): + """ + GET /fapi/v1/trade/asyn/idto + """ + return self._request_futures_api("get, "trade/asyn/idto", version=1, data=params) + +futures_order_amendment (self, **params): + """ + GET /fapi/v1/orderAmendment + """ + return self._request_futures_api("get, "orderAmendment", version=1, data=params) + +futures_pm_account_info (self, **params): + """ + GET /fapi/v1/pmAccountInfo + """ + return self._request_futures_api("get, "pmAccountInfo", version=1, data=params) + +futures_income_asynto (self, **params): + """ + GET /fapi/v1/income/asynto + """ + return self._request_futures_api("get, "income/asynto", version=1, data=params) + +futures_income_asyn_idto (self, **params): + """ + GET /fapi/v1/income/asyn/idto + """ + return self._request_futures_api("get, "income/asyn/idto", version=1, data=params) + +futures_asset_indexto (self, **params): + """ + GET /fapi/v1/assetIndexto + """ + return self._request_futures_api("get, "assetIndexto", version=1, data=params) + +futures_all_force_orders (self, **params): + """ + GET /fapi/v1/allForceOrders + """ + return self._request_futures_api("get, "allForceOrders", version=1, data=params) + +futures_open_order (self, **params): + """ + GET /fapi/v1/openOrder + """ + return self._request_futures_api("get, "openOrder", version=1, data=params) + +futures_accountrelated (self, **params): + """ + GET /fapi/v1/accountrelated + """ + return self._request_futures_api("get, "accountrelated", version=1, data=params) + +futures_asset_index (self, **params): + """ + GET /fapi/v1/assetIndex + """ + return self._request_futures_api("get, "assetIndex", version=1, data=params) + +#coin ==================== + +futures_coin_data_delivery_price (self, **params): + """ + GET /futures/data/delivery-price + """ + return self._request_futures_coin_data_api("get, "delivery-price", version=undefined, data=params) + +futures_coin_data_top_long_short_account_ratio (self, **params): + """ + GET /futures/data/topLongShortAccountRatio + """ + return self._request_futures_coin_data_api("get, "topLongShortAccountRatio", version=undefined, data=params) + +futures_coin_data_top_long_short_position_ratio (self, **params): + """ + GET /futures/data/topLongShortPositionRatio + """ + return self._request_futures_coin_data_api("get, "topLongShortPositionRatio", version=undefined, data=params) + +futures_coin_data_global_long_short_account_ratio (self, **params): + """ + GET /futures/data/globalLongShortAccountRatio + """ + return self._request_futures_coin_data_api("get, "globalLongShortAccountRatio", version=undefined, data=params) + +futures_coin_data_takerlongshort_ratio (self, **params): + """ + GET /futures/data/takerlongshortRatio + """ + return self._request_futures_coin_data_api("get, "takerlongshortRatio", version=undefined, data=params) + +futures_coin_funding_info (self, **params): + """ + GET /dapi/v1/fundingInfo + """ + return self._request_futures_coin_api("get, "fundingInfo", version=1, data=params) + +futures_coin_income_asynto (self, **params): + """ + GET /dapi/v1/income/asynto + """ + return self._request_futures_coin_api("get, "income/asynto", version=1, data=params) + +futures_coin_income_asyn_idto (self, **params): + """ + GET /dapi/v1/income/asyn/idto + """ + return self._request_futures_coin_api("get, "income/asyn/idto", version=1, data=params) + +futures_coin_modify_order (self, **params): + """ + PUT /dapi/v1/order + """ + return self._request_futures_coin_api("put, "order", version=1, data=params) + +futures_coin_modify_batch_orders (self, **params): + """ + PUT /dapi/v1/batchOrders + """ + return self._request_futures_coin_api("put, "batchOrders", version=1, data=params) + +futures_coin_pm_account_info (self, **params): + """ + GET /dapi/v1/pmAccountInfo + """ + return self._request_futures_coin_api("get, "pmAccountInfo", version=1, data=params) + +futures_coin_pm_exchange_info (self, **params): + """ + GET /dapi/v1/pmExchangeInfo + """ + return self._request_futures_coin_api("get, "pmExchangeInfo", version=1, data=params) + +futures_coin_order_amendment (self, **params): + """ + GET /dapi/v1/orderAmendment + """ + return self._request_futures_coin_api("get, "orderAmendment", version=1, data=params) + +futures_coin_all_force_orders (self, **params): + """ + GET /dapi/v1/allForceOrders + """ + return self._request_futures_coin_api("get, "allForceOrders", version=1, data=params) + +futures_coin_commission_rate (self, **params): + """ + GET /dapi/v1/commissionRate + """ + return self._request_futures_coin_api("get, "commissionRate", version=1, data=params) + +futures_coin_adl_quantile (self, **params): + """ + GET /dapi/v1/adlQuantile + """ + return self._request_futures_coin_api("get, "adlQuantile", version=1, data=params) + +futures_coin_data_taker_buy_sell_vol (self, **params): + """ + GET /futures/data/takerBuySellVol + """ + return self._request_futures_coin_data_api("get, "takerBuySellVol", version=undefined, data=params) + +futures_coin_data_basis (self, **params): + """ + GET /futures/data/basis + """ + return self._request_futures_coin_data_api("get, "basis", version=undefined, data=params) + +futures_coin_create_countdown_cancel_all (self, **params): + """ + POST /dapi/v1/countdownCancelAll + """ + return self._request_futures_coin_api("post, "countdownCancelAll", version=1, data=params) + +futures_coin_open_order (self, **params): + """ + GET /dapi/v1/openOrder + """ + return self._request_futures_coin_api("get, "openOrder", version=1, data=params) + +futures_coin_income_asyn (self, **params): + """ + GET /dapi/v1/income/asyn + """ + return self._request_futures_coin_api("get, "income/asyn", version=1, data=params) + +futures_coin_income_asyn_id (self, **params): + """ + GET /dapi/v1/income/asyn/id + """ + return self._request_futures_coin_api("get, "income/asyn/id", version=1, data=params) + +create_listen_key (self, **params): + """ + POST /fapi/v1/listenKey + """ + return self.undefined("post, "listenKey", version=1, data=params) + +#options ==================== + +options_margin_account (self, **params): + """ + GET /eapi/v1/marginAccount + """ + return self._request_options_api("get, "marginAccount", version=1, data=params) + +options_income_asynto (self, **params): + """ + GET /eapi/v1/income/asynto + """ + return self._request_options_api("get, "income/asynto", version=1, data=params) + +options_income_asyn_idto (self, **params): + """ + GET /eapi/v1/income/asyn/idto + """ + return self._request_options_api("get, "income/asyn/idto", version=1, data=params) + +options_exercise_history (self, **params): + """ + GET /eapi/v1/exerciseHistory + """ + return self._request_options_api("get, "exerciseHistory", version=1, data=params) + +options_open_interest (self, **params): + """ + GET /eapi/v1/openInterest + """ + return self._request_options_api("get, "openInterest", version=1, data=params) + +options_create_countdown_cancel_all (self, **params): + """ + POST /eapi/v1/countdownCancelAll + """ + return self._request_options_api("post, "countdownCancelAll", version=1, data=params) + +options_countdown_cancel_all (self, **params): + """ + GET /eapi/v1/countdownCancelAll + """ + return self._request_options_api("get, "countdownCancelAll", version=1, data=params) + +options_create_countdown_cancel_all_heart_beat (self, **params): + """ + POST /eapi/v1/countdownCancelAllHeartBeat + """ + return self._request_options_api("post, "countdownCancelAllHeartBeat", version=1, data=params) + +options_cancel_all_open_orders_by_underlying (self, **params): + """ + DELETE /eapi/v1/allOpenOrdersByUnderlying + """ + return self._request_options_api("delete, "allOpenOrdersByUnderlying", version=1, data=params) + +options_exercise_record (self, **params): + """ + GET /eapi/v1/exerciseRecord + """ + return self._request_options_api("get, "exerciseRecord", version=1, data=params) + +options_bill (self, **params): + """ + GET /eapi/v1/bill + """ + return self._request_options_api("get, "bill", version=1, data=params) + +options_income_asyn (self, **params): + """ + GET /eapi/v1/income/asyn + """ + return self._request_options_api("get, "income/asyn", version=1, data=params) + +options_income_asyn_id (self, **params): + """ + GET /eapi/v1/income/asyn/id + """ + return self._request_options_api("get, "income/asyn/id", version=1, data=params) + +options_create_listen_key (self, **params): + """ + POST /eapi/v1/listenKey + """ + return self._request_options_api("post, "listenKey", version=1, data=params) + +options_modify_listen_key (self, **params): + """ + PUT /eapi/v1/listenKey + """ + return self._request_options_api("put, "listenKey", version=1, data=params) + +options_cancel_listen_key (self, **params): + """ + DELETE /eapi/v1/listenKey + """ + return self._request_options_api("delete, "listenKey", version=1, data=params) + +options_create_mmp_set (self, **params): + """ + POST /eapi/v1/mmpSet + """ + return self._request_options_api("post, "mmpSet", version=1, data=params) + +options_create_mmp_reset (self, **params): + """ + POST /eapi/v1/mmpReset + """ + return self._request_options_api("post, "mmpReset", version=1, data=params) + +#portfolio ==================== + +portfolio_create_ping (self, **params): + """ + POST /papi/v1/ping + """ + return self._request_papi_api("post, "ping", version=1, data=params) + +futures_exchange_info (self, **params): + """ + GET /fapi/v1/exchangeInfo + """ + return self._request_futures_api("get, "exchangeInfo", version=1, data=params) + +portfolio_create_cm_position_side_dual (self, **params): + """ + POST /papi/v1/cm/positionSide/dual + """ + return self._request_papi_api("post, "cm/positionSide/dual", version=1, data=params) + +portfolio_create_listen_key (self, **params): + """ + POST /papi/v1/listenKey + """ + return self._request_papi_api("post, "listenKey", version=1, data=params) + +portfolio_modify_listen_key (self, **params): + """ + PUT /papi/v1/listenKey + """ + return self._request_papi_api("put, "listenKey", version=1, data=params) + +portfolio_cancel_listen_key (self, **params): + """ + DELETE /papi/v1/listenKey + """ + return self._request_papi_api("delete, "listenKey", version=1, data=params) + diff --git a/utils/options_docs.txt b/utils/options_docs.txt new file mode 100644 index 000000000..2e324c1a1 --- /dev/null +++ b/utils/options_docs.txt @@ -0,0 +1,2300 @@ +Logo +Spot/Margin/Savings/Mining +USDⓈ-M Futures +COIN-M Futures +European Options +WebSocket API +Portfolio Margin +简体中文 +Search +Change Log +General Info +Market Data Endpoints +Account/Trades Endpoints +Websocket Market Streams +User Data Streams +Market Maker Endpoints +Error Codes +Binance Futures +Change Log +Important Documentation Notice + +Binance has launched its new API Documentation Portal. The existing GitHub API documentation is now deprecated and set to go offline in the upcoming few months following user migration; the exact date will be determined and communicated in due course. + +During this transition phase, both sites will be maintained. However, any new services will only be published in the new portal moving forward. + +Here's a reference table of the links for the current and new API documentation: + +Functionality Current Documentation New Documentation +Spot Trading Current Documentation New Documentation +Spot Websocket API Current Documentation New Documentation +Margin Trading Current Documentation New Documentation +Derivative UM Futures Current Documentation New Documentation +Derivative CM Futures Current Documentation New Documentation +Derivative Options Current Documentation New Documentation +Derivative Portfolio Margin Current Documentation New Documentation +Wallet Current Documentation New Documentation +Sub Account Current Documentation New Documentation +Simple Earn Current Documentation New Documentation +Dual Investment Current Documentation New Documentation +Auto Invest Current Documentation New Documentation +Staking Current Documentation New Documentation +Mining Current Documentation New Documentation +Algo Trading Current Documentation New Documentation +Copy Trading Current Documentation New Documentation +Derivative Porfolio Margin Pro Current Documentation New Documentation +Fiat Current Documentation New Documentation +C2C Current Documentation New Documentation +VIP Loan Current Documentation New Documentation +Crypto Loan Current Documentation New Documentation +Pay Current Documentation New Documentation +Convert Current Documentation New Documentation +Rebate Current Documentation New Documentation +NFT Current Documentation New Documentation +Gift Card Current Documentation New Documentation +2023-10-19 + +Binance Option is doing Websocket Service upgrade and the upgrade impacts the following: + +Before upgrade: + +The websocket server will send a ping frame every 5 minutes. If the websocket server does not receive a pong frame back from the connection within a 15 minute period, the connection will be disconnected. Unsolicited pong frames are allowed. +To connect websocket server without subscription, user can connect by using +wss://nbstream.binance.com/eoptions/ws +wss://nbstream.binance.com/eoptions/stream +wss://nbstream.binance.com/eoptions/ws/ +wss://nbstream.binance.com/eoptions/stream/ +After upgrade: + +The websocket server will send a ping frame every 3 minutes. If the websocket server does not receive a pong frame back from the connection within a 10 minute period, the connection will be disconnected. Unsolicited pong frames are allowed. +To connect websocket server without subscription: +Connect websocket server with subscription: +wss://nbstream.binance.com/eoptions/ws +wss://nbstream.binance.com/eoptions/stream +/ at the end is no longer supported +Raw stream like wss://nbstream.binance.com/eoptions/illegal_parameter/stream?steams= or wss://fstream.binance.com/illegal_parameter/ws/is not supported, please use remove illegal_parameter/ before /ws and /stream. +2023-08-29 + +REST + +GET /eapi/v1/account: add new field riskLevel to show account risk level +GET /eapi/v1/marginAccount: add new fieldriskLevel to show account risk level +Websocket User Data Stream + +Add new event RISK_LEVEL_CHANGE to show account riskLevel change +2023-07-21 + +REST + +New endpointGET /eapi/v1/income/asynto get Download Id For Option Transaction History +New endpointGET /eapi/v1/income/asyn/idto get Option Transaction History Download Link by Id +2023-07-13 + +Websocket Market Streams + +These change will be effective from 2023-07-14: +Add field T in streams @ticker and @ticker@ to show transaction time +Add field E in stream @depth to show event time +2023-05-30 + +General Information on Endpoints + +For GET endpoints, parameters must be sent as a query string without setting content type in the http headers. +2023-02-02 + +REST + +Endpoint POST /eapi/v1/transfer is disabled. +2023-01-11 + +REST + +Add endpoint GET /eapi/v1/order to check order status. +2022-12-13 + +WEBSOCKET + +Add u and pu in stream@depth1000 to get diff orderbook update. +2022-12-09 + +REST + +Add updateId field u in GET /eapi/v1/depth +Add parameter underlying in GET /eapi/v1/exerciseHistory to query exercise histroy by underlying +2022-11-18 + +REST + +New endpoint GET /eapi/v1/openInterest is added to get options open interest for specific underlying on certain expiration date. +WEBSOCKET + +New stream @openInterest@ is added for real-time option open interest feed. +2022-11-16 + +WEBSOCKET + +New trade stream @trade is added for all option trades on specific underlying asset. +Adjust format in stream option_pair. +2022-11-03 + +REST + +New endpoint for Auto-Cancel All Open Orders will be added on 2022-11-07: +POST /eapi/v1/countdownCancelAll:Set Auto-Cancel All Open Orders (Kill-Switch) Config +GET /eapi/v1/countdownCancelAll:Get Auto-Cancel All Open Orders (Kill-Switch) Config +POST /eapi/v1/countdownCancelAllHeartBeat:Auto-Cancel All Open Orders (Kill-Switch) Heartbeat +2022-09-20 + +WEBSOCKET + +New streams @markPrice and @ticker@ are added. +Streams will be deprecated on 2022/10/30. +2022-09-14 + +REST + +Adjust endpoint field strikePrice,makerFeeRate,takerFeeRate,minQty,maxQty,initialMargin,maintenanceMargin,minInitialMargin,minMaintenanceMargin to string in endpoint GET /eapi/v1/exchangeInfo +Only finished orders within 5 days can be queried in GET /eapi/v1/historyOrders +2022-09-05 + +REST + +Adjust response result in endpoint DELETE /eapi/v1/allOpenOrdersByUnderlying +2022-08-22 + +REST + +Add rateLimits information in endpoint GET /eapi/v1/exchangeInfo +Parameters symbol set to not mandatory in GET /eapi/v1/userTrades +General Info +General API Information +Some endpoints will require an API Key. Please refer to this page +The base endpoint is: **https://eapi.binance.com +All endpoints return either a JSON object or array. +Data is returned in ascending order. Oldest first, newest last. +All time and timestamp related fields are in milliseconds. +HTTP Return Codes +HTTP 4XX return codes are used for for malformed requests; the issue is on the sender's side. +HTTP 403 return code is used when the WAF Limit (Web Application Firewall) has been violated. +HTTP 429 return code is used when breaking a request rate limit. +HTTP 418 return code is used when an IP has been auto-banned for continuing to send requests after receiving 429 codes. +HTTP 5XX return codes are used for internal errors; the issue is on Binance's side. +HTTP 503 return code is used when: +If there is an error message "Unknown error, please check your request or try again later." returned in the response, the API successfully sent the request but not get a response within the timeout period. +It is important to NOT treat this as a failure operation; the execution status is UNKNOWN and could have been a success; +If there is an error message "Service Unavailable." returned in the response, it means this is a failure API operation and the service might be unavailable at the moment, you need to retry later. +If there is an error message "Internal error; unable to process your request. Please try again." returned in the response, it means this is a failure API operation and you can resend your request if you need. +Error Codes and Messages +Any endpoint can return an ERROR +The error payload is as follows: + +{ + "code": -1121, + "msg": "Invalid symbol." +} +Specific error codes and messages defined in Error Codes. +General Information on Endpoints +For GET endpoints, parameters must be sent as a query string without setting content type in the http headers. +For POST, PUT, and DELETE endpoints, the parameters may be sent as a query string or in the request body with content type application/x-www-form-urlencoded. You may mix parameters between both the query string and request body if you wish to do so. +Parameters may be sent in any order. +If a parameter sent in both the query string and request body, the query string parameter will be used. +LIMITS +The /eapi/v1/exchangeInfo rateLimits array contains objects related to the exchange's RAW_REQUEST, REQUEST_WEIGHT, and ORDER rate limits. These are further defined in the ENUM definitions section under Rate limiters (rateLimitType). +A 429 will be returned when either rate limit is violated. + Binance has the right to further tighten the rate limits on users with intent to attack. +IP Limits +Every request will contain X-MBX-USED-WEIGHT-(intervalNum)(intervalLetter) in the response headers which has the current used weight for the IP for all request rate limiters defined. +Each route has a weight which determines for the number of requests each endpoint counts for. Heavier endpoints and endpoints that do operations on multiple symbols will have a heavier weight. +When a 429 is received, it's your obligation as an API to back off and not spam the API. +Repeatedly violating rate limits and/or failing to back off after receiving 429s will result in an automated IP ban (HTTP status 418). +IP bans are tracked and scale in duration for repeat offenders, from 2 minutes to 3 days. +The limits on the API are based on the IPs, not the API keys. + It is strongly recommended to use websocket stream for getting data as much as possible, which can not only ensure the timeliness of the message, but also reduce the access restriction pressure caused by the request. +Order Rate Limits +Every order response will contain a X-MBX-ORDER-COUNT-(intervalNum)(intervalLetter) header which has the current order count for the account for all order rate limiters defined. +Rejected/unsuccessful orders are not guaranteed to have X-MBX-ORDER-COUNT-** headers in the response. +The order rate limit is counted against each account. +Endpoint Security Type +Each endpoint has a security type that determines the how you will interact with it. +API-keys are passed into the Rest API via the X-MBX-APIKEY header. +API-keys and secret-keys are case sensitive. +API-keys can be configured to only access certain types of secure endpoints. For example, one API-key could be used for TRADE only, while another API-key can access everything except for TRADE routes. +By default, API-keys can access all secure routes. +Security Type Description +NONE Endpoint can be accessed freely. +TRADE Endpoint requires sending a valid API-Key and signature. +USER_DATA Endpoint requires sending a valid API-Key and signature. +USER_STREAM Endpoint requires sending a valid API-Key. +MARKET_DATA Endpoint requires sending a valid API-Key. +TRADE and USER_DATA endpoints are SIGNED endpoints. +SIGNED (TRADE and USER_DATA) Endpoint Security +SIGNED endpoints require an additional parameter, signature, to be sent in the query string or request body. +Endpoints use HMAC SHA256 signatures. The HMAC SHA256 signature is a keyed HMAC SHA256 operation. Use your secretKey as the key and totalParams as the value for the HMAC operation. +The signature is not case sensitive. +Please make sure the signature is the end part of your query string or request body. +totalParams is defined as the query string concatenated with the request body. +Timing Security +A SIGNED endpoint also requires a parameter, timestamp, to be sent which should be the millisecond timestamp of when the request was created and sent. +An additional parameter, recvWindow, may be sent to specify the number of milliseconds after timestamp the request is valid for. If recvWindow is not sent, it defaults to 5000. +The logic is as follows: + + if (timestamp < (serverTime + 1000) && (serverTime - timestamp) <= recvWindow){ + // process request + } + else { + // reject request + } +Serious trading is about timing. Networks can be unstable and unreliable, which can lead to requests taking varying amounts of time to reach the servers. With recvWindow, you can specify that the request must be processed within a certain number of milliseconds or be rejected by the server. + + It is recommended to use a small recvWindow of 5000 or less! +SIGNED Endpoint Examples for POST /eapi/v1/order +Here is a step-by-step example of how to send a vaild signed payload from the Linux command line using echo, openssl, and curl. + +Key Value +apiKey dbefbc809e3e83c283a984c3a1459732ea7db1360ca80c5c2c8867408d28cc83 +secretKey 2b5eb11e18796d12d88f13dc27dbbd02c2cc51ff7059765ed9821957d82bb4d9 +Parameter Value +symbol BTCUSDT +side BUY +type LIMIT +timeInForce GTC +quantity 1 +price 9000 +recvWindow 5000 +timestamp 1591702613943 +Example 1: As a query string +Example 1 + +HMAC SHA256 signature: + + $ echo -n "symbol=BTC-210129-40000-C&side=BUY&type=LIMIT&timeInForce=GTC&quantity=1&price=2000&recvWindow=5000×tamp=1611825601400" | openssl dgst -sha256 -hmac "YtP1BudNOWZE1ag5uzCkh4hIC7qSmQOu797r5EJBFGhxBYivjj8HIX0iiiPof5yG" + (stdin)= 7c12045972f6140e765e0f2b67d28099718df805732676494238f50be830a7d7 +curl command: + + (HMAC SHA256) + $ curl -H "X-MBX-APIKEY: 22BjeOROKiXJ3NxbR3zjh3uoGcaflPu3VMyBXAg8Jj2J1xVSnY0eB4dzacdE9IWn" -X POST 'https://eapi.binance.com/eapi/v1/order' -d 'symbol=BTC-210129-40000-C&side=BUY&type=LIMIT&timeInForce=GTC&quantity=1&price=2000&recvWindow=5000×tamp=1611825601400&signature=7c12045972f6140e765e0f2b67d28099718df805732676494238f50be830a7d7' + +requestBody: +symbol=BTC-210129-40000-C +&side=BUY +&type=LIMIT +&timeInForce=GTC +&quantity=1 +&price=2000 +&recvWindow=5000 +×tamp=1611825601400 + +Example 2: As a request body +Example 2 + +HMAC SHA256 signature: + + $ echo -n "symbol=BTC-210129-40000-C&side=BUY&type=LIMIT&timeInForce=GTC&quantity=1&price=2000&recvWindow=5000×tamp=1611825601400" | openssl dgst -sha256 -hmac "YtP1BudNOWZE1ag5uzCkh4hIC7qSmQOu797r5EJBFGhxBYivjj8HIX0iiiPof5yG" + (stdin)= 7c12045972f6140e765e0f2b67d28099718df805732676494238f50be830a7d7 + +curl command: + + (HMAC SHA256) + $ curl -H "X-MBX-APIKEY: 22BjeOROKiXJ3NxbR3zjh3uoGcaflPu3VMyBXAg8Jj2J1xVSnY0eB4dzacdE9IWn" -X POST 'https://eapi.binance.com/eapi/v1/order?symbol=BTC-210129-40000-C&side=BUY&type=LIMIT&timeInForce=GTC&quantity=1&price=2000&recvWindow=5000×tamp=1611825601400&signature=7c12045972f6140e765e0f2b67d28099718df805732676494238f50be830a7d7' + +queryString: +symbol=BTC-210129-40000-C +&side=BUY +&type=LIMIT +&timeInForce=GTC +&quantity=1 +&price=2000 +&recvWindow=5000 +×tamp=1611825601400 + +Example 3: Mixed query string and request body +Example 3 + +HMAC SHA256 signature: + + $ echo -n "symbol=BTC-210129-40000-C&side=BUY&type=LIMIT&timeInForce=GTCquantity=0.01&price=2000&recvWindow=5000×tamp=1611825601400" | openssl dgst -sha256 -hmac "YtP1BudNOWZE1ag5uzCkh4hIC7qSmQOu797r5EJBFGhxBYivjj8HIX0iiiPof5yG" + (stdin)= fa6045c54fb02912b766442be1f66fab619217e551a4fb4f8a1ee000df914d8e + +curl command: + + (HMAC SHA256) + $ curl -H "X-MBX-APIKEY: 22BjeOROKiXJ3NxbR3zjh3uoGcaflPu3VMyBXAg8Jj2J1xVSnY0eB4dzacdE9IWn" -X POST 'https://eapi.binance.com/eapi/v1/order?symbol=BTC-210129-40000-C&side=BUY&type=LIMIT&timeInForce=GTC' -d 'quantity=0.01&price=2000&recvWindow=5000×tamp=1611825601400&signature=fa6045c54fb02912b766442be1f66fab619217e551a4fb4f8a1ee000df914d8e' +queryString: +symbol=BTC-210129-40000-C&side=BUY&type=LIMIT&timeInForce=GTC + +requestBody: +quantity=1&price=2000&recvWindow=5000×tamp=1611825601400 + +Note that the signature is different in example 3. There is no & between "GTC" and "quantity=1". + +Public Endpoints Info +Terminology +symbol refers to the symbol name of a options contract symbol +underlying refers to the underlying symbol of a options contract symbol +quoteAsset refers to the asset that is the price of a symbol. +settleAsset refers to the settlement asset when options are exercised +ENUM definitions +Options contract type + +CALL +PUT +Order side + +BUY +SELL +Position side + +LONG +SHORT +Time in force + +GTC - Good Till Cancel +IOC - Immediate or Cancel +FOK - Fill or Kill +Response Type (newOrderRespType) + +ACK +RESULT +Order types (type) + +LIMIT +Order status (status) + +ACCEPTED +REJECTED +PARTIALLY_FILLED +FILLED +CANCELLED +Kline/Candlestick chart intervals: + +m -> minutes; h -> hours; d -> days; w -> weeks; M -> months + +1m +3m +5m +15m +30m +1h +2h +4h +6h +8h +12h +1d +3d +1w +1M +Rate limiters (rateLimitType) + +REQUEST_WEIGHT javascript { "rateLimitType": "REQUEST_WEIGHT", "interval": "MINUTE", "intervalNum": 1, "limit": 2400 } + +ORDERS javascript { "rateLimitType": "ORDERS", "interval": "MINUTE", "intervalNum": 1, "limit": 1200 } + +REQUEST_WEIGHT + +ORDERS + +Rate limit intervals (interval) + +MINUTE +Filters +Filters define trading rules on a symbol or an exchange. + +Symbol filters +PRICE_FILTER +/exchangeInfo format: + + { + "filterType": "PRICE_FILTER", + "minPrice": "0.00000100", + "maxPrice": "100000.00000000", + "tickSize": "0.00000100" + } +The PRICE_FILTER defines the price rules for a symbol. There are 3 parts: + +minPrice defines the minimum price/stopPrice allowed; disabled on minPrice == 0. +maxPrice defines the maximum price/stopPrice allowed; disabled on maxPrice == 0. +tickSize defines the intervals that a price/stopPrice can be increased/decreased by; disabled on tickSize == 0. +Any of the above variables can be set to 0, which disables that rule in the price filter. In order to pass the price filter, the following must be true for price/stopPrice of the enabled rules: + +sell order price >= minPrice +buy order price <= maxPrice +(price-minPrice) % tickSize == 0 +LOT_SIZE +/exchangeInfo format: + + { + "filterType": "LOT_SIZE", + "minQty": "0.00100000", + "maxQty": "100000.00000000", + "stepSize": "0.00100000" + } +The LOT_SIZE filter defines the quantity (aka "lots" in auction terms) rules for a symbol. There are 3 parts: + +minQty defines the minimum quantity allowed. +maxQty defines the maximum quantity allowed. +stepSize defines the intervals that a quantity can be increased/decreased by. +In order to pass the lot size, the following must be true for quantity: + +quantity >= minQty +quantity <= maxQty +(quantity-minQty) % stepSize == 0 +Market Data Endpoints +Test Connectivity +Response: + +{} +GET /eapi/v1/ping + +Test connectivity to the Rest API. + +Weight: 1 + +Parameters: NONE + +Check Server Time +Response: + +{ + "serverTime": 1499827319559 +} +GET /eapi/v1/time + +Test connectivity to the Rest API and get the current server time. + +Weight: 1 + +Parameters: NONE + +Exchange Information +Response: + +{ + "timezone": "UTC", // Time zone used by the server + "serverTime": 1592387337630, // Current system time + "optionContracts": [ // Option contract underlying asset info + { + "id": 1, + "baseAsset": "BTC", // Base currency + "quoteAsset": "USDT", // Quotation asset + "underlying": "BTCUSDT", // Name of the underlying asset of the option contract + "settleAsset": "USDT" // Settlement currency + } + ], + "optionAssets": [ // Option asset info + { + "id": 1, + "name": "USDT" // Asset name + } + ], + "optionSymbols": [ // Option trading pair info + { + "contractId": 2, + "expiryDate": 1660521600000, // expiry time + "filters": [ + { + "filterType": "PRICE_FILTER", + "minPrice": "0.02", + "maxPrice": "80000.01", + "tickSize": "0.01" + }, + { + "filterType": "LOT_SIZE", + "minQty": "0.01", + "maxQty": "100", + "stepSize": "0.01" + } + ], + "id": 17, + "symbol": "BTC-220815-50000-C", // Trading pair name + "side": "CALL", // Direction: CALL long, PUT short + "strikePrice": "50000", // Strike price + "underlying": "BTCUSDT", // Underlying asset of the contract + "unit": 1, // Contract unit, the quantity of the underlying asset represented by a single contract. + "makerFeeRate": "0.0002", // maker commission rate + "takerFeeRate": "0.0002", // taker commission rate + "minQty": "0.01", // Minimum order quantity + "maxQty": "100", // Maximum order quantity + "initialMargin": "0.15", // Initial Magin Ratio + "maintenanceMargin": "0.075", // Maintenance Margin Ratio + "minInitialMargin": "0.1", // Min Initial Margin Ratio + "minMaintenanceMargin": "0.05", // Min Maintenance Margin Ratio + "priceScale": 2, // price precision + "quantityScale": 2, // quantity precision + "quoteAsset": "USDT" // Quotation asset + } + ], + "rateLimits": [ + { + "rateLimitType": "REQUEST_WEIGHT", + "interval": "MINUTE", + "intervalNum": 1, + "limit": 2400 + }, + { + "rateLimitType": "ORDERS", + "interval": "MINUTE", + "intervalNum": 1, + "limit": 1200 + }, + { + "rateLimitType": "ORDERS", + "interval": "SECOND", + "intervalNum": 10, + "limit": 300 + } + ] +} +GET /eapi/v1/exchangeInfo + +Current exchange trading rules and symbol information + +Weight: 1 + +Parameters: NONE + +Order Book +Response: + +{ + "T": 1589436922972, // transaction time + "u": 37461 // update id + "bids": [ // Buy order + [ + "1000", // Price + "0.9" // Quantity + ] + ], + "asks": [ // Sell order + [ + "1100", // Price + "0.1" // Quantity + ] + ] +} +GET /eapi/v1/depth + +Weight: 1 + +Parameters: + +Name Type Mandatory Description +symbol STRING YES Option trading pair, e.g BTC-200730-9000-C +limit INT NO Default:100 Max:1000.Optional value:[10, 20, 50, 100, 500, 1000] +Recent Trades List +Response: + +[ + { + "id":"1", // TradeId + "symbol": "BTC-220722-19000-C", + "price": "1000", // Completed trade price + "qty": "-0.1", // Completed trade quantity + "quoteQty": "-100", // Completed trade amount + "side": -1 // Completed trade direction(-1 Sell,1 Buy) + "time": 1592449455993,// Time + } +] +GET /eapi/v1/trades + +Get recent market trades + +Weight: 5 + +Parameters: + +Name Type Mandatory Description +symbol STRING YES Option trading pair, e.g BTC-200730-9000-C +limit INT NO Number of records Default:100 Max:500 +Old Trades Lookup (MARKET_DATA) +Response: + +[ + { + "id":"1", // UniqueId + "tradeId": "159244329455993", // TradeId + "price": "1000", // Completed trade price + "qty": "-0.1", // Completed trade Quantity + "quoteQty": "-100", // Completed trade amount + "side": -1 // Completed trade direction(-1 Sell,1 Buy) + "time": 1592449455993,// Time + } +] +GET /eapi/v1/historicalTrades + +Get older market historical trades. + +Weight: 20 + +Parameters: + +Name Type Mandatory Description +symbol STRING YES Option trading pair, e.g BTC-200730-9000-C +fromId LONG NO The UniqueId ID from which to return. The latest deal record is returned by default +limit INT NO Number of records Default:100 Max:500 +Kline/Candlestick Data +Response: + +[ + { + "open": "950", // Opening price + "high": "1100", // Highest price + "low": "900", // Lowest price + "close": "1000", // Closing price (latest price if the current candle has not closed) + "volume": "100" // Trading volume(contracts) + "amount": "2", // Trading amount(in quote asset) + "interval": "5m", // Candle type + "tradeCount": 10, // Number of completed trades + "takerVolume": "100", // Taker trading volume(contracts) + "takerAmount": "10000", // Taker trade amount(in quote asset) + "openTime": 1499040000000, // Opening time + "closeTime": 1499644799999, // Closing time + } +] +GET /eapi/v1/klines + +Kline/candlestick bars for an option symbol. Klines are uniquely identified by their open time. + +Weight: 1 + +Parameters: + +Name Type Mandatory Description +symbol STRING YES Option trading pair, e.g BTC-200730-9000-C +interval STRING YES Time interval +startTime LONG NO Start Time 1592317127349 +endTime LONG NO End Time +limit INT NO Number of records Default:500 Max:1500 +If startTime and endTime are not sent, the most recent klines are returned. +Option Mark Price +Response: + +[ + { + "symbol": "BTC-200730-9000-C", + "markPrice": "1343.2883", // Mark price + "bidIV": "1.40000077", // Implied volatility Buy + "askIV": "1.50000153", // Implied volatility Sell + "markIV": "1.45000000" // Implied volatility mark + "delta": "0.55937056", // delta + "theta": "3739.82509871", // theta + "gamma": "0.00010969", // gamma + "vega": "978.58874732", // vega + "highPriceLimit": "1618.241", // Current highest buy price + "lowPriceLimit": "1068.3356" // Current lowest sell price + } +] +GET /eapi/v1/mark + +Option mark price and greek info. + +Weight: 5 + +Parameters: + +Name Type Mandatory Description +symbol STRING NO Option trading pair, e.g BTC-200730-9000-C +24hr Ticker Price Change Statistics +Response: + +[ + { + "symbol": "BTC-200730-9000-C", + "priceChange": "-16.2038", //24-hour price change + "priceChangePercent": "-0.0162", //24-hour percent price change + "lastPrice": "1000", //Last trade price + "lastQty": "1000", //Last trade amount + "open": "1016.2038", //24-hour open price + "high": "1016.2038", //24-hour high + "low": "0", //24-hour low + "volume": "5", //Trading volume(contracts) + "amount": "1", //Trade amount(in quote asset) + "bidPrice":"999.34", //The best buy price + "askPrice":"1000.23", //The best sell price + "openTime": 1592317127349, //Time the first trade occurred within the last 24 hours + "closeTime": 1592380593516, //Time the last trade occurred within the last 24 hours + "firstTradeId": 1, //First trade ID + "tradeCount": 5, //Number of trades + "strikePrice": "9000", //Strike price + "exercisePrice": "3000.3356" //return estimated settlement price one hour before exercise, return index price at other times + } +] +GET /eapi/v1/ticker + +24 hour rolling window price change statistics. + +Weight: +5 + +Parameters: + +Name Type Mandatory Description +symbol STRING NO Option trading pair, e.g BTC-200730-9000-C +Symbol Price Ticker +Response: + +{ + "time": 1656647305000, + "indexPrice": "9200" // Current spot index price +} +GET /eapi/v1/index + +Get spot index price for option underlying. + +Weight: +1 + +Parameters: + +Name Type Mandatory Description +underlying STRING YES Spot pair(Option contract underlying asset, e.g BTCUSDT) +Historical Exercise Records +Response: + +[ + { + "symbol": "BTC-220121-60000-P", // symbol + "strikePrice": "60000", // strike price + "realStrikePrice": "38844.69652571", // real strike price + "expiryDate": 1642752000000, // Exercise time + "strikeResult": "REALISTIC_VALUE_STRICKEN" // strike result + } +] +GET /eapi/v1/exerciseHistory + +REALISTIC_VALUE_STRICKEN -> Exercised + +EXTRINSIC_VALUE_EXPIRED -> Expired OTM + +Get historical exercise records. + +Weight: +3 + +Parameters: + +Name Type Mandatory Description +underlying STRING NO Underlying index like BTCUSDT +startTime LONG NO Start Time +endTime LONG NO End Time +limit INT NO Number of records Default:100 Max:100 +Open interest +Response: + +[ + { + "symbol": "ETH-221119-1175-P", + "sumOpenInterest": "4.01", + "sumOpenInterestUsd": "4880.2985615624", + "timestamp": "1668754020000" + } +] +GET /eapi/v1/openInterest + +Get open interest for specific underlying asset on specific expiration date. + +Parameters: + +Name Type Mandatory Description +underlyingAsset STRING YES underlying asset, e.g ETH/BTC +expiration STRING YES expiration date, e.g 221225 +Account/Trades Endpoints + Considering the possible data latency from RESTful endpoints during an extremely volatile market, it is highly recommended to get the order status, position, etc from the Websocket user data stream. +Option Account Information (TRADE) +Response: + +{ + "asset": [ + { + "asset": "USDT", // Asset type + "marginBalance": "1877.52214415", // Account balance + "equity": "617.77711415", // Account equity + "available": "0", // Available funds + "locked": "2898.92389933", // locked balance for order and position + "unrealizedPNL": "222.23697000", // Unrealized profit/loss + } + ], + "greek": [ + { + "underlying":"BTCUSDT" // Option Underlying + "delta": "-0.05" // Account delta + "gamma": "-0.002" // Account gamma + "theta": "-0.05" // Account theta + "vega": "-0.002" // Account vega + } + ], + "riskLevel": "NORMAL", // Account risk level + "time": 1592449455993 // Time +} +GET /eapi/v1/account (HMAC SHA256) + +Get current account information. + +Weight: 3 + +Parameters: + +Name Type Mandatory Description +recvWindow LONG NO +timestamp LONG YES +Funds Transfer (TRADE) +Please find details from here. + +New Order (TRADE) +Response ACK: + +{ + "orderId": 4611875134427365377, // System order number + "clientOrderId": "" // Client order ID + "symbol": "BTC-200730-9000-C", // Option trading pair + "price": "100", // Order Price + "quantity": "1", // Order Quantity + "side": "BUY", // Buy/sell direction + "type": "LIMIT", // Order type + "createDate": 1592465880683, // Order Time + "updateTime": 1566818724722, // Update time +} +Response RESULT: + +{ + "orderId": 4611875134427365377, // System order number + "symbol": "BTC-200730-9000-C", // Option trading pair + "price": "100", // Order Price + "quantity": "1", // Order Quantity + "executedQty": "0", // Number of executed quantity + "fee": "0", // Fee + "side": "BUY", // Buy/sell direction + "type": "LIMIT", // Order type + "timeInForce": "GTC", // Time in force method + "reduceOnly": false, // Order is reduce only Y/N + "postOnly": false, // Order is post only + "createTime": 1592465880683, // Order Time + "updateTime": 1566818724722, // Update time + "status": "ACCEPTED", // Order status + "avgPrice": "0", // Average price of completed trade + "clientOrderId": "" // Client order ID + "priceScale": 2, + "quantityScale": 2, + "optionSide": "CALL", + "quoteAsset": "USDT", + "mmp": false +} +POST /eapi/v1/order (HMAC SHA256) + +Send a new order. + +Parameters: + +Name Type Mandatory Description +symbol STRING YES Option trading pair, e.g BTC-200730-9000-C +side ENUM YES Buy/sell direction: SELL, BUY +type ENUM YES Order Type: LIMIT(only support limit) +quantity DECIMAL YES Order Quantity +price DECIMAL NO Order Price +timeInForce ENUM NO Time in force method(Default GTC) +reduceOnly BOOLEAN NO Reduce Only(Default false) +postOnly BOOLEAN NO Post Only(Default false) +newOrderRespType ENUM NO "ACK", "RESULT", Default "ACK" +clientOrderId STRING NO User-defined order ID cannot be repeated in pending orders +isMmp BOOLEAN NO is market maker protection order, true/false +recvWindow LONG NO +timestamp LONG YES +Some parameters are mandatory depending on the order type as follows: + +Type Mandatory parameters +LIMIT timeInForce, quantity, price +Place Multiple Orders (TRADE) +Response: + +[ + { + "orderId": 4612288550799409153, // System order number + "symbol": "ETH-220826-1800-C", // Option trading pair + "price": "100", // Order Price + "quantity": "0.01", // Order Quantity + "side": "BUY", // Buy/sell direction + "type": "LIMIT", // Order type + "reduceOnly": false, // Order is reduce only Y/N + "postOnly": false, // Post only or not + "clientOrderId": "1001", // Client order ID + "mmp": false // MMP + } +] +POST /eapi/v1/batchOrders + +Send multiple option orders. + +Weight: 5 + +Parameters: + +Name Type Mandatory Description +orders LIST YES order list. Max 5 orders +recvWindow LONG NO +timestamp LONG YES +Where batchOrders is the list of order parameters in JSON: + +example: /eapi/v1/batchOrders?orders=[{"symbol":"BTC-210115-35000-C", "price":"100","quantity":"0.0002","side":"BUY","type":"LIMIT"}] +Name Type Mandatory Description +symbol STRING YES Option trading pair, e.g BTC-200730-9000-C +side ENUM YES Buy/sell direction: SELL, BUY +type ENUM YES Order Type: LIMIT (Only support LIMIT) +quantity DECIMAL YES Order Quantity +price DECIMAL NO Order Price +timeInForce ENUM NO Time in force method(Default GTC) +reduceOnly BOOLEAN NO Reduce Only(Default false) +postOnly BOOLEAN NO Post Only(Default false) +clientOrderId STRING NO User-defined order ID cannot be repeated in pending orders +isMmp BOOLEAN NO is market maker protection order, true/false + Some parameters are mandatory depending on the order type as follows: + +Type Mandatory parameters +LIMIT timeInForce, quantity, price +Parameter rules are same with New Order +Batch orders are processed concurrently, and the order of matching is not guaranteed. +The order of returned contents for batch orders is the same as the order of the order list. +Query Single Order (TRADE) +Response: + +{ + "orderId": 4611875134427365377, // System order id + "symbol": "BTC-200730-9000-C", // Option trading pair + "price": "100", // Order Price + "quantity": "1", // Order Quantity + "executedQty": "0", // Number of executed quantity + "fee": "0", // Fee + "side": "BUY", // Buy/sell direction + "type": "LIMIT", // Order type + "timeInForce": "GTC", // Time in force method + "reduceOnly": false, // Order is reduce only Y/N + "postOnly": false, // Order is post only + "createTime": 1592465880683, // Order Time + "updateTime": 1566818724722, // Update time + "status": "ACCEPTED", // Order status + "avgPrice": "0", // Average price of completed trade + "source": "API", // Order source + "clientOrderId": "" // Client order ID + "priceScale": 2, + "quantityScale": 2, + "optionSide": "CALL", + "quoteAsset": "USDT", + "mmp": false +} +No Order Response: + +{ + "code": -2013, + "msg": "Order does not exist" +} +GET /eapi/v1/order (HMAC SHA256) + +Check an order status. + +Weight: 1 + +These orders will not be found: +order status is CANCELED or REJECTED, AND +order has NO filled trade, AND +created time + 3 days < current time +Parameters: + +Name Type Mandatory Description +symbol STRING YES Option trading pair, e.g BTC-200730-9000-C +orderId LONG NO Order id +clientOrderId STRING NO User-defined order ID cannot be repeated in pending orders +recvWindow LONG NO +timestamp LONG YES +Either orderId or clientOrderId must be sent. +Cancel Option Order (TRADE) +Response: + +{ + "orderId": 4611875134427365377, // System order number + "symbol": "BTC-200730-9000-C", // Option trading pair + "price": "100", // Order Price + "quantity": "1", // Order Quantity + "executedQty": "0", // Number of executed quantity + "fee": "0", // Fee + "side": "BUY", // Buy/sell direction + "type": "LIMIT", // Order type + "timeInForce": "GTC", // Time in force method + "reduceOnly": false, // Order is reduce only Y/N + "postOnly": false, + "createDate": 1592465880683, // Order Time + "updateTime": 1566818724722, // Update time + "status": "ACCEPTED", // Order status + "avgPrice": "0", // Average price of completed trade + "source": "API", + "clientOrderId": "", // Client order ID + "priceScale": 4, + "quantityScale": 4, + "optionSide": "CALL", + "quoteAsset": "USDT", + "mmp": false +} +DELETE /eapi/v1/order (HMAC SHA256) + +Cancel an active order. + +Weight: 1 + +Parameters: + +Name Type Mandatory Description +symbol STRING YES Option trading pair, e.g BTC-200730-9000-C +orderId LONG NO Order ID, e.g 4611875134427365377 +clientOrderId STRING NO User-defined order ID, e.g 10000 +recvWindow LONG NO +timestamp LONG YES +At least one instance of orderId and clientOrderId must be sent. + +Cancel Multiple Option Orders (TRADE) +Response: + +[ + { + "orderId": 4611875134427365377, // System order number + "symbol": "BTC-200730-9000-C", // Option trading pair + "price": "100", // Order Price + "quantity": "1", // Order Quantity + "executedQty": "0", // Number of completed quantity + "fee": 0, // Fee + "side": "BUY", // Buy/sell direction + "type": "LIMIT", // Order type + "timeInForce": "GTC", // Time in force method + "createTime": 1592465880683, // Order Time + "status": "ACCEPTED", // Order status + "avgPrice": "0", // Average price of completed trade + "reduceOnly": false, // Order is reduce only Y/N + "clientOrderId": "" // Client order ID + "updateTime": 1566818724722, // Update time + } +] +DELETE /eapi/v1/batchOrders (HMAC SHA256) + +Cancel an active order. + +Weight: 1 + +Parameters: + +Name Type Mandatory Description +symbol STRING YES Option trading pair, e.g BTC-200730-9000-C +orderIds LIST NO Order ID, e.g [4611875134427365377,4611875134427365378] +clientOrderIds LIST NO User-defined order ID, e.g ["my_id_1","my_id_2"] +recvWindow LONG NO +timestamp LONG YES +At least one instance of orderId and clientOrderId must be sent. + +Cancel all Option orders on specific symbol (TRADE) +Response: + +{ + "code": 0, + "msg": "success" +} +DELETE /eapi/v1/allOpenOrders (HMAC SHA256) + +Cancel all active order on a symbol. + +Weight: 1 + +Parameters: + +Name Type Mandatory Description +symbol STRING YES Option trading pair, e.g BTC-200730-9000-C +recvWindow LONG NO +timestamp LONG YES +Cancel All Option Orders By Underlying (TRADE) +Response: + +{ + "code": 0, + "msg": "success", + "data": 0 +} +DELETE /eapi/v1/allOpenOrdersByUnderlying (HMAC SHA256) + +Cancel all active orders on specified underlying. + +Weight: 1 + +Parameters: + +Name Type Mandatory Description +underlying STRING YES Option underlying, e.g BTCUSDT +recvWindow LONG NO +timestamp LONG YES +Query Current Open Option Orders (USER_DATA) +Response: + +[ + { + "orderId": 4611875134427365377, // System order number + "symbol": "BTC-200730-9000-C", // Option trading pair + "price": "100", // Order Price + "quantity": "1", // Order Quantity + "executedQty": "0", // Number of completed trades + "fee": "0", // Fee + "side": "BUY", // Buy/sell direction + "type": "LIMIT", // Order type + "timeInForce": "GTC", // Time in force method + "reduceOnly": false, // Order is reduce only Y/N + "postOnly": false, + "createTime": 1592465880683, // Order Time + "updateTime": 1592465880683, // Update Time + "status": "ACCEPTED", // Order status + "avgPrice": "0", // Average price of completed trade + "clientOrderId": "" // Client order ID + "priceScale": 2, + "quantityScale": 2, + "optionSide": "CALL", + "quoteAsset": "USDT", + "mmp": false + } +] +GET /eapi/v1/openOrders (HMAC SHA256) + +Query current all open orders, status: ACCEPTED PARTIALLY_FILLED + +Weight: 1 for a single symbol; 40 when the symbol parameter is omitted + +Parameters: + +Name Type Mandatory Description +symbol STRING NO return all orders if don't pass, Option trading pair, e.g BTC-200730-9000-C, +orderId LONG NO Returns the orderId and subsequent orders, the most recent order is returned by default +startTime LONG NO Start Time +endTime LONG NO End Time +limit INT NO Number of result sets returned Default:100 Max:1000 +recvWindow LONG NO +timestamp LONG YES +Query Option Order History (TRADE) +Response: + +[ + { + "orderId": 4611922413427359795, + "symbol": "BTC-220715-2000-C", + "price": "18000.00000000", + "quantity": "-0.50000000", + "executedQty": "-0.50000000", + "fee": "3.00000000", + "side": "SELL", + "type": "LIMIT", + "timeInForce": "GTC", + "reduceOnly": false, + "postOnly": false, + "createTime": 1657867694244, + "updateTime": 1657867888216, + "status": "FILLED", + "reason": "0", + "avgPrice": "18000.00000000", + "source": "API", + "clientOrderId": "", + "priceScale": 2, + "quantityScale": 2, + "optionSide": "CALL", + "quoteAsset": "USDT", + "mmp": false + } +] +GET /eapi/v1/historyOrders (HMAC SHA256) + +Query all finished orders within 5 days, finished status: CANCELLED FILLED REJECTED. + +Weight: 3 + +Parameters: + +Name Type Mandatory Description +symbol STRING YES Option trading pair +orderId LONG NO Returns the orderId and subsequent orders, the most recent order is returned by default +startTime LONG NO Start Time, e.g 1593511200000 +endTime LONG NO End Time, e.g 1593512200000 +limit INT NO Number of result sets returned Default:100 Max:1000 +recvWindow LONG NO +timestamp LONG YES +Option Position Information (USER_DATA) +Response: + +[ + { + "entryPrice": "1000", // Average entry price + "symbol": "BTC-200730-9000-C", // Option trading pair + "side": "SHORT", // Position direction + "quantity": "-0.1", // Number of positions (positive numbers represent long positions, negative number represent short positions) + "reducibleQty": "0", // Number of positions that can be reduced + "markValue": "105.00138", // Current market value + "ror": "-0.05", // Rate of return + "unrealizedPNL": "-5.00138", // Unrealized profit/loss + "markPrice": "1050.0138", // Mark price + "strikePrice": "9000", // Strike price + "positionCost": "1000.0000", // Position cost + "expiryDate": 1593511200000 // Exercise time + "priceScale": 2, + "quantityScale": 2, + "optionSide": "CALL", + "quoteAsset": "USDT" + } +] +GET /eapi/v1/position (HMAC SHA256) + +Get current position information. + +Weight: 5 + +Parameters: + +Name Type Mandatory Description +symbol STRING NO Option trading pair, e.g BTC-200730-9000-C +recvWindow LONG NO +timestamp LONG YES +Account Trade List (USER_DATA) +Response: + +[ + { + "id": 4611875134427365377, // unique id + "tradeId": 239, // trade id + "orderId": 4611875134427365377, // order id + "symbol": "BTC-200730-9000-C", // option symbol + "price": "100", // trade price + "quantity": "1", // trade quantity + "fee": "0", // fee + "realizedProfit": "0.00000000", // realized profit/loss + "side": "BUY", // order side + "type": "LIMIT", // order type + "volatility": "0.9", // volatility + "liquidity": "TAKER", // TAKER or MAKER + "quoteAsset": "USDT", // quote asset + "time": 1592465880683 // trade time + "priceScale": 2, + "quantityScale": 2, + "optionSide": "CALL", + "quoteAsset": "USDT" + } +] +GET /eapi/v1/userTrades (HMAC SHA256) + +Get trades for a specific account and symbol. + +Weight: 5 + +Parameters: + +Name Type Mandatory Description +symbol STRING NO Option symbol, e.g BTC-200730-9000-C +fromId LONG NO Trade id to fetch from. Default gets most recent trades, e.g 4611875134427365376 +startTime LONG NO Start time, e.g 1593511200000 +endTime LONG NO End time, e.g 1593512200000 +limit INT NO Default 100; max 1000 +recvWindow LONG NO +timestamp LONG YES +User Exercise Record (USER_DATA) +Response: + +[ + { + "id": "1125899906842624042", + "currency": "USDT", + "symbol": "BTC-220721-25000-C", + "exercisePrice": "25000.00000000", + "markPrice": "25000.00000000", + "quantity": "1.00000000", + "amount": "0.00000000", + "fee": "0.00000000", + "createDate": 1658361600000, + "priceScale": 2, + "quantityScale": 2, + "optionSide": "CALL", + "positionSide": "LONG", + "quoteAsset": "USDT" + } +] +GET /eapi/v1/exerciseRecord (HMAC SHA256) + +Get account exercise records. + +Weight: 5 + +Parameters: + +Name Type Mandatory Description +symbol STRING NO Option trading pair, e.g BTC-200730-9000-C +startTime LONG NO startTime +endTime LONG NO endTime +limit INT NO default 1000, max 1000 +recvWindow LONG NO +timestamp LONG YES +Account Funding Flow (USER_DATA) +Response: + +[ + { + "id": 1125899906842624000, + "asset": "USDT", // Asset type + "amount": "-0.552", // Amount (positive numbers represent inflow, negative numbers represent outflow) + "type": "FEE", // type (fees) + "createDate": 1592449456000, // Time + }, + { + "id": 1125899906842624000, + "asset": "USDT", // Asset type + "amount": "100", // Amount (positive numbers represent inflow, negative numbers represent outflow) + "type": "CONTRACT", // type (buy/sell contracts) + "createDate": 1592449456000, // Time + }, + { + "id": 1125899906842624000, + "asset": "USDT", // Asset type + "amount": "10000", // Amount (positive numbers represent inflow, negative numbers represent outflow) + "type": "TRANSFER", // type(Funds transfer) + "createDate": 1592448410000, // Time + } +] +GET /eapi/v1/bill (HMAC SHA256) + +Query account funding flows. + +Weight: 1 + +Parameters: + +Name Type Mandatory Description +currency STRING YES Asset type, e.g USDT +recordId LONG NO Return the recordId and subsequent data, the latest data is returned by default, e.g 100000 +startTime LONG NO Start Time, e.g 1593511200000 +endTime LONG NO End Time, e.g 1593512200000 +limit INT NO Number of result sets returned Default:100 Max:1000 +recvWindow LONG NO +timestamp LONG YES +Get Download Id For Option Transaction History (USER_DATA) +Response: + +{ + "avgCostTimestampOfLast30d":7241837, // Average time taken for data download in the past 30 days + "downloadId":"546975389218332672", +} +GET /eapi/v1/income/asyn (HMAC SHA256) + +Weight: 5 + +Parameters: + +Name Type Mandatory Description +startTime LONG YES Timestamp in ms +endTime LONG YES Timestamp in ms +recvWindow LONG NO +timestamp LONG YES +Request Limitation is 5 times per month, shared by front end download page and rest api +The time between startTime and endTime can not be longer than 1 year +Get Option Transaction History Download Link by Id (USER_DATA) +Response: + +{ + "downloadId":"545923594199212032", + "status":"completed", // Enum:completed,processing + "url":"www.binance.com", // The link is mapped to download id + "notified":true, // ignore + "expirationTimestamp":1645009771000, // The link would expire after this timestamp + "isExpired":null, +} +OR (Response when server is processing) + +{ + "downloadId":"545923594199212032", + "status":"processing", + "url":"", + "notified":false, + "expirationTimestamp":-1 + "isExpired":null, + +} +GET /eapi/v1/income/asyn/id (HMAC SHA256) + +Weight: 5 + +Parameters: + +Name Type Mandatory Description +downloadId STRING YES get by download id api +recvWindow LONG NO +timestamp LONG YES +Download link expiration: 24h +Websocket Market Streams +The baseurl of the websocket interface is: *wss://nbstream.binance.com/eoptions/* +Streams can be access either in a single raw stream or a combined stream +Raw streams are accessed at /ws/ +Combined streams are accessed at /stream?streams=// +Example: +wss://nbstream.binance.com/eoptions/ws/BTC-210630-9000-P@ticker +wss://nbstream.binance.com/eoptions/stream?streams=BTC-210630-9000-P@trade/BTC-210630-9000-P@ticker + +A single connection is only valid for 24 hours; expect to be disconnected at the 24 hour mark + +The websocket server will send a ping frame every 5 minutes. If the websocket server does not receive a pong frame back from the connection within a 15 minute period, the connection will be disconnected. Unsolicited pong frames are allowed. + +WebSocket connections have a limit of 10 incoming messages per second. + +A connection that goes beyond the limit will be disconnected; IPs that are repeatedly disconnected may be banned. + +A single connection can listen to a maximum of 200 streams. + +Considering the possible data latency from RESTful endpoints during an extremely volatile market, it is highly recommended to get the order status, position, etc from the Websocket user data stream. + +Combined stream events are wrapped as follows: {"stream":"","data":} + +All symbols for streams are uppercase + +Live Subscribing/Unsubscribing to streams +The following data can be sent through the websocket instance in order to subscribe/unsubscribe from streams. Examples can be seen below. +The id used in the JSON payloads is an unsigned INT used as an identifier to uniquely identify the messages going back and forth. +Subscribe to a stream +Response + +{ + "result": null, + "id": 1 +} +Request +{ +"method": "SUBSCRIBE", +"params": +[ +"BTC-210630-9000-P@ticker", +"BTC-210630-9000-P@depth" +], +"id": 1 +} + +Unsubscribe to a stream +Response + + { + "result": null, + "id": 312 + } +Request +{ +"method": "UNSUBSCRIBE", +"params": +[ +"BTC-210630-9000-P@ticker" +], +"id": 312 +} + +Listing Subscriptions +Response + + { + "result": [ + "BTC-210630-9000-P@ticker" + ], + "id": 3 + } +Request +{ +"method": "LIST_SUBSCRIPTIONS", +"id": 3 +} + +Setting Properties +Currently, the only property can be set is to set whether combined stream payloads are enabled are not. The combined property is set to false when connecting using /ws/ ("raw streams") and true when connecting using /stream/. + +Response + + { + "result": null, + "id": 5 + } +Request +{ +"method": "SET_PROPERTY", +"params": +[ +"combined", +true +], +"id": 5 +} + +Retrieving Properties +Response javascript { "result": true, // Indicates that combined is set to true. "id": 2 } + +Request +{ +"method": "GET_PROPERTY", +"params": +[ +"combined" +], +"id": 2 +} + +Error Messages +Error Message Description +{"code": 0, "msg": "Unknown property"} Parameter used in the SET_PROPERTY or GET_PROPERTY was invalid +{"code": 1, "msg": "Invalid value type: expected Boolean"} Value should only be true or false +{"code": 2, "msg": "Invalid request: property name must be a string"} Property name provided was invalid +{"code": 2, "msg": "Invalid request: request ID must be an unsigned integer"} Parameter id had to be provided or the value provided in the id parameter is an unsupported type +{"code": 2, "msg": "Invalid request: unknown variant %s, expected one of SUBSCRIBE, UNSUBSCRIBE, LIST_SUBSCRIPTIONS, SET_PROPERTY, GET_PROPERTY at line 1 column 28"} Possible typo in the provided method or provided method was neither of the expected values +{"code": 2, "msg": "Invalid request: too many parameters"} Unnecessary parameters provided in the data +{"code": 2, "msg": "Invalid request: property name must be a string"} Property name was not provided +{"code": 2, "msg": "Invalid request: missing field method at line 1 column 73"} method was not provided in the data +{"code":3,"msg":"Invalid JSON: expected value at line %s column %s"} JSON data sent has incorrect syntax. ## Trade Streams +Trade Streams +** Payload: ** + +{ + "e":"trade", // event type + "E":1591677941092, // event time + "s":"BTC-200630-9000-P", // Option trading symbol + "t":1, // trade ID + "p":"1000", // price + "q":"-2", // quantity + "b":4611781675939004417, // buy order ID + "a":4611781675939004418, // sell order ID + "T":1591677567872, // trade completed time + "S":"-1" // direction, -1 for taker sell, 1 for taker buy +} +The Trade Streams push raw trade information for specific symbol or underlying asset. E.g.ETH@trade + +Stream Name: +@trade or @trade + +Update Speed: 50ms + +Index Price Streams +** Payload: ** + +{ + "e":"index", // event type + "E":1661415480351, // time + "s":"ETHUSDT", // underlying symbol + "p":"1707.89008607" // index price +} +Underlying(e.g ETHUSDT) index stream. + +Stream Name: +@index + +Update Speed: 1000ms + +Mark Price +** Payload: ** + +[ + { + "e":"markPrice", // Event Type + "E":1663684594227, // Event time + "s":"ETH-220930-1500-C", // Symbol + "mp":"30.3" // Option mark price + }, + { + "e":"markPrice", + "E":1663684594228, + "s":"ETH-220923-1000-C", + "mp":"341.5" + } +】 +The mark price for all option symbols on specific underlying asset. E.g.ETH@markPrice + +Stream Name: +@markPrice + +Update Speed: 1000ms + +Kline/Candlestick Streams +** Payload: ** + +{ + "e":"kline", // event type + "E":1638747660000, // event time + "s":"BTC-200630-9000-P", // Option trading symbol + "k":{ + "t":1638747660000, // kline start time + "T":1638747719999, // kline end time + "s":"BTC-200630-9000-P", // Option trading symbol + "i":"1m", // candle period + "F":0, // first trade ID + "L":0, // last trade ID + "o":"1000", // open + "c":"1000", // close + "h":"1000", // high + "l":"1000", // low + "v":"0", // volume(in contracts) + "n":0, // number of trades + "x":false, // current candle has been completed Y/N + "q":"0", // completed trade amount (in quote asset) + "V":"0", // taker completed trade volume (in contracts) + "Q":"0" // taker trade amount(in quote asset) + } +} +The Kline/Candlestick Stream push updates to the current klines/candlestick every 1000 milliseconds (if existing). + +Kline/Candlestick chart intervals: + +m -> minutes; h -> hours; d -> days; w -> weeks; M -> months + +"1m", "3m", "5m", "15m" "30m" "1h", "2h", "4h", "6h", "12h", "1d", "3d", "1w", + +Stream Name: +@kline_ + +Update Speed: 1000ms + +24-hour TICKER +** Payload: ** + +{ + "e":"24hrTicker", // event type + "E":1657706425200, // event time + "T":1657706425220, // transaction time + "s":"BTC-220930-18000-C", // Option symbol + "o":"2000", // 24-hour opening price + "h":"2020", // Highest price + "l":"2000", // Lowest price + "c":"2020", // latest price + "V":"1.42", // Trading volume(in contracts) + "A":"2841", // trade amount(in quote asset) + "P":"0.01", // price change percent + "p":"20", // price change + "Q":"0.01", // volume of last completed trade(in contracts) + "F":"27", // first trade ID + "L":"48", // last trade ID + "n":22, // number of trades + "bo":"2012", // The best buy price + "ao":"2020", // The best sell price + "bq":"4.9", // The best buy quantity + "aq":"0.03", // The best sell quantity + "b":"0.1202", // BuyImplied volatility + "a":"0.1318", // SellImplied volatility + "d":"0.98911", // delta + "t":"-0.16961", // theta + "g":"0.00004", // gamma + "v":"2.66584", // vega + "vo":"0.10001", // Implied volatility + "mp":"2003.5102", // Mark price + "hl":"2023.511", // Buy Maximum price + "ll":"1983.511", // Sell Minimum price + "eep":"0" // Estimated strike price (return estimated strike price half hour before exercise) + } +24hr ticker info for all symbols. Only symbols whose ticker info changed will be sent. + +Stream Name: +@ticker + +Update Speed: 1000ms + +24-hour TICKER by underlying asset and expiration data +** Payload: ** + +[ +{ + "e":"24hrTicker", // event type + "E":1657706425200, // event time + "T":1657706425220, // transaction time + "s":"ETH-220930-1600-C", // Option symbol + "o":"2000", // 24-hour opening price + "h":"2020", // Highest price + "l":"2000", // Lowest price + "c":"2020", // latest price + "V":"1.42", // Trading volume(in contracts) + "A":"2841", // trade amount(in quote asset) + "P":"0.01", // price change percent + "p":"20", // price change + "Q":"0.01", // volume of last completed trade(in contracts) + "F":"27", // first trade ID + "L":"48", // last trade ID + "n":22, // number of trades + "bo":"2012", // The best buy price + "ao":"2020", // The best sell price + "bq":"4.9", // The best buy quantity + "aq":"0.03", // The best sell quantity + "b":"0.1202", // BuyImplied volatility + "a":"0.1318", // SellImplied volatility + "d":"0.98911", // delta + "t":"-0.16961", // theta + "g":"0.00004", // gamma + "v":"2.66584", // vega + "vo":"0.10001", // Implied volatility + "mp":"2003.5102", // Mark price + "hl":"2023.511", // Buy Maximum price + "ll":"1983.511", // Sell Minimum price + "eep":"0" // Estimated strike price (return estimated strike price half hour before exercise) + }, + { + "e":"24hrTicker", + "E":1663685112123, + "s":"ETH-220930-1500-C", + "o":"34.9", + "h":"44.6", + "l":"26.8", + "c":"26.8", + "V":"11.84", + "A":"444.37", + "P":"-0.232", + "p":"-8.1", + "Q":"0", + "F":"91", + "L":"129", + "n":39, + "bo":"26.8", + "ao":"33.9", + "bq":"0.65", + "aq":"0.01", + "b":"0.88790536", + "a":"0.98729014", + "d":"0.2621153", + "t":"-3.44806807", + "g":"0.00158298", + "v":"0.7148147", + "vo":"0.93759775", + "mp":"30.3", + "hl":"228.7", + "ll":"0.1", + "eep":"0" + } +] +24hr ticker info by underlying asset and expiration date. E.g.ETH@ticker@220930 + +Stream Name: +@ticker@ + +Update Speed: 1000ms + +Open Interest +[ + { + "e":"openInterest", // Event type + "E":1668759300045, // Event time + "s":"ETH-221125-2700-C", // option symbol + "o":"1580.87", // Open interest in contracts + "h":"1912992.178168204" // Open interest in USDT + } +] +Option open interest for specific underlying asset on specific expiration date. E.g.ETH@openInterest@221125 + +Stream Name: +@openInterest@ + +Update Speed: 60s + +New Symbol Info +{ + "e":"OPTION_PAIR", //eventType + "E":1668573571842, //eventTime + "id":652, //option id + "cid":2, //underlying asset id + "u":"BTCUSDT", //Underlying index of the contract + "qa":"USDT", //Quotation asset + "s":"BTC-221116-21000-C", //Trading pair name + "unit":1, //Conversion ratio, the quantity of the underlying asset represented by a single contract. + "mq":"0.01", //Minimum trade volume of the underlying asset + "d":"CALL", //Option type + "sp":"21000", //Strike price + "ed":1668585600000 //expiration time +} +New symbol listing stream. + +Stream Name: +option_pair + +Update Speed: 50ms + +Partial Book Depth Streams +** Payload: ** + +{ + "e":"depth", // event type + "E":1591695934010, // event time + "T":1591695934000, // transaction time + "s":"BTC-200630-9000-P", // Option symbol + "u":162, // update id in event + "pu":162, // same as update id in event + "b":[ // Buy order + [ + "200", // Price + "3", // quantity + ], + [ + "101", + "1" + ], + [ + "100", + "2" + ] + ], + "a":[ // Sell order + [ + "1000", + "89" + ] + ] +} +Top bids and asks, Valid levels are are 10, 20, 50, 100. + +Stream Names: @depth OR @depth@100ms OR @depth@1000ms. + +Update Speed: 100ms or 1000ms, 500ms(default when update speed isn't used) + +User Data Streams +The base API endpoint is: https://eapi.binance.com +A User Data Stream listenKey is valid for 60 minutes after creation. +Doing a PUT on a listenKey will extend its validity for 60 minutes. +Doing a DELETE on a listenKey will close the stream and invalidate the listenKey. +Doing a POST on an account with an active listenKey will return the currently active listenKey and extend its validity for 60 minutes. +Connection method for Websocket: +Base Url: wss://nbstream.binance.com/eoptions/ +User Data Streams are accessed at /ws/ +Example: wss://nbstream.binance.com/eoptions/ws/XaEAKTsQSRLZAGH9tuIu37plSRsdjmlAVBoNYPUITlTAko1WI22PgmBMpI1rS8Yh +A single connection is only valid for 24 hours; expect to be disconnected at the 24 hour mark +Start User Data Stream (USER_STREAM) +Response: + +{ + "listenKey": "pqia91ma19a5s61cv6a81va65sdf19v8a65a1a5s61cv6a81va65sdf19v8a65a1", + "expiration":1710140106000 +} +POST /eapi/v1/listenKey + +Start a new user data stream. The stream will close after 60 minutes unless a keepalive is sent. If the account has an active listenKey, that listenKey will be returned and its validity will be extended for 60 minutes. + +Weight: 1 + +Parameters: + +None + +Keepalive User Data Stream (USER_STREAM) +Response: + +{} +PUT /eapi/v1/listenKey + +Keepalive a user data stream to prevent a time out. User data streams will close after 60 minutes. It's recommended to send a ping about every 60 minutes. + +Weight: 1 + +Parameters: + +None + +Close User Data Stream (USER_STREAM) +Response: + +{} +DELETE /eapi/v1/listenKey + +Close out a user data stream. + +Weight: 1 + +Parameters: + +None + +Event: Risk level change +Payload: + +{ + "e":"RISK_LEVEL_CHANGE", //Event Type + "E":1587727187525, //Event Time + "s":"REDUCE_ONLY", //risk level + "mb":"1534.11708371", //margin balance + "mm":"254789.11708371" //maintenance margin +} +Update Speed: 50ms +Updates whenever there is an account risk level change. The following are possibly values: +NORMAL +REDUCE_ONLY +Note: Risk level changes are only applicable to VIP and Market Makers user accounts. VIP and certain Market Maker accounts will be automatically placed into REDUCE_ONLY mode if their margin balance is insufficient to meet their maintenance margin obligations. Once in REDUCE_ONLY mode, the system will re-evaluate the risk level only upon the following events: +Funds transfer +Trade fill +Option expiry +Event: Account data +Payload: + +{ + "e":"ACCOUNT_UPDATE", // Event type + "E":1591696384141, // Event time + "B":[ + { + "b":"100007992.26053177", // Account balance + "m":"0", // Position value + "u":"458.782655111111", // Unrealized profit/loss + "U":200, // Positive unrealized profit for long position + "M":"-15452.328456", // Maintenance margin + "i":"-18852.328456", // Initial margin + "a":"USDT", // Margin asset + } + ], + "G":[ + { + "ui":"SOLUSDT", // Underlying + "d":-33.2933905, // Delta + "t":35.5926375, // Theta + "g":-14.3023855, // Gamma + "v":-0.1929375 // Vega + } + ], + "P":[ + { + "s":"SOL-220912-35-C", // Contract symbol + "c":"-50", // Number of current positions + "r":"-50", // Number of positions that can be reduced + "p":"-100", // Position value + "a":"2.2", // Average entry price + } + ], + "uid":1000006559949 +} +Update Speed: 50ms +Update under the following conditions: +Account deposit or withdrawal +Position info change. Includes a P attribute if there are changes, otherwise does not include a P attribute. +Greek update +Event: Order update +Payload: + +{ + "e":"ORDER_TRADE_UPDATE", //Event Type + "E":1657613775883, //Event Time + "o":[ + { + "T":1657613342918, //Order Create Time + "t":1657613342918, //Order Update Time + "s":"BTC-220930-18000-C", //Symbol + "c":"", //clientOrderId + "oid":"4611869636869226548", //order id + "p":"1993", //order price + "q":"1", //order quantity + "stp":0, //not used for now + "r":false, //reduce only + "po":true, //post only + "S":"PARTIALLY_FILLED", //status + "e":"0.1", //completed trade volume(in contracts) + "ec":"199.3", //completed trade amount(in quote asset) + "f":"2", //fee + "tif": "GTC", //time in force + "oty":"LIMIT", //order type + "fi":[ + { + "t":"20", //tradeId + "p":"1993", //trade price + "q":"0.1", //trade quantity + "T":1657613774336, //trade time + "m":"TAKER" //taker or maker + "f":"0.0002" //commission(>0) or rebate(<0) + } + ] + } + ] +} +Update Speed: 50ms +Update under the following conditions: +Order fills +Order placed +Order cancelled +Market Maker Endpoints +Market maker endpoints only work for option market makers, api users will get error when send requests to these endpoints. + +Option Margin Account Information (USER_DATA) +Response: + +{ + "asset": [ + { + "asset": "USDT", // Asset type + "marginBalance": "10099.448" // Account balance + "equity": "10094.44662", // Account equity + "available": "8725.92524", // Available funds + "initialMargin": "1084.52138", // Initial margin + "maintMargin": "151.00138", // Maintenance margin + "unrealizedPNL": "-5.00138", // Unrealized profit/loss + "lpProfit": "-5.00138", // Unrealized profit for long position + } + ], + "greek": [ + { + "underlying":"BTCUSDT" // Option Underlying + "delta": "-0.05" // Account delta + "gamma": "-0.002" // Account gamma + "theta": "-0.05" // Account theta + "vega": "-0.002" // Account vega + } + ], + "riskLevel": "NORMAL", // Account risk level + "time": 1592449455993 // Time +} +GET /eapi/v1/marginAccount (HMAC SHA256) + +Get current account information. + +Weight: 3 + +Parameters: + +Name Type Mandatory Description +recvWindow LONG NO +timestamp LONG YES +Set Market Maker Protection Config (TRADE) +{ + "underlyingId": 2, + "underlying": "BTCUSDT", + "windowTimeInMilliseconds": 3000, + "frozenTimeInMilliseconds": 300000, + "qtyLimit": "2", + "deltaLimit": "2.3", + "lastTriggerTime": 0 + +} +POST /eapi/v1/mmpSet (HMAC SHA256) + +Set config for MMP. Market Maker Protection(MMP) is a set of protection mechanism for option market maker, this mechanism is able to prevent mass trading in short period time. Once market maker's account branches the threshold, the Market Maker Protection will be triggered. When Market Maker Protection triggers, all the current MMP orders will be canceled, new MMP orders will be rejected. Market maker can use this time to reevaluate market and modify order price. + +Weight: 1 + +Parameters: + +Name Type Mandatory Description +underlying STRING TRUE underlying, e.g BTCUSDT +windowTimeInMilliseconds LONG TRUE MMP Interval in milliseconds; Range (0,5000] +frozenTimeInMilliseconds LONG TRUE MMP frozen time in milliseconds, if set to 0 manual reset is required +qtyLimit DECIMAL TRUE quantity limit +deltaLimit DECIMAL TRUE net delta limit +recvWindow LONG NO +timestamp LONG YES +Get Market Maker Protection Config (TRADE) +{ + "underlyingId": 2, + "underlying": "BTCUSDT", + "windowTimeInMilliseconds": 3000, + "frozenTimeInMilliseconds": 300000, + "qtyLimit": "2", + "deltaLimit": "2.3", + "lastTriggerTime": 0 +} +Get /eapi/v1/mmp (HMAC SHA256) + +Get config for MMP. + +Weight: 1 + +Parameters: + +Name Type Mandatory Description +underlying STRING TRUE underlying, e.g BTCUSDT +recvWindow LONG NO +timestamp LONG YES +Reset Market Maker Protection Config (TRADE) +{ + "underlyingId": 2, + "underlying": "BTCUSDT", + "windowTimeInMilliseconds": 3000, + "frozenTimeInMilliseconds": 300000, + "qtyLimit": "2", + "deltaLimit": "2.3", + "lastTriggerTime": 0 +} +POST /eapi/v1/mmpReset (HMAC SHA256) + +Reset MMP, start MMP order again. + +Weight: 1 + +Parameters: + +Name Type Mandatory Description +underlying STRING TRUE underlying, e.g BTCUSDT +recvWindow LONG NO +timestamp LONG YES +Set Auto-Cancel All Open Orders (Kill-Switch) Config (TRADE) +Response: + +{ + "underlying": "ETHUSDT", + "countdownTime": 30000 +} +POST /eapi/v1/countdownCancelAll (HMAC SHA256) + +This endpoint sets the parameters of the auto-cancel feature which cancels all open orders (both market maker protection and non market maker protection order types) of the underlying symbol at the end of the specified countdown time period if no heartbeat message is sent. After the countdown time period, all open orders will be cancelled and new orders will be rejected with error code -2010 until either a heartbeat message is sent or the auto-cancel feature is turned off by setting countdownTime to 0. + +Weight: 1 + +Parameters: + +Name Type Mandatory Description +underlying STRING YES Option underlying, e.g BTCUSDT +countdownTime LONG YES Countdown time in milliseconds (ex. 1,000 for 1 second). 0 to disable the timer. Negative values (ex. -10000) are not accepted. Minimum acceptable value is 5,000 +recvWindow LONG NO +timestamp LONG YES +This rest endpoint sets up the parameters to cancel your open orders in case of an outage or disconnection. +Example usage: Call this endpoint with a countdownTime value of 10000 (10 seconds) to turn on the auto-cancel feature. If the corresponding countdownCancelAllHeartBeat endpoint is not called within 10 seconds with the specified underlying symbol, all open orders of the specified symbol will be automatically canceled. If this endpoint is called with an countdownTime of 0, the countdown timer will be stopped. +The system will check all countdowns approximately every 1000 milliseconds, please note that sufficient redundancy should be considered when using this function. We do not recommend setting the countdown time to be too precise or too small. +Get Auto-Cancel All Open Orders (Kill-Switch) Config (TRADE) +Response: + +{ + "underlying": "ETHUSDT", + "countdownTime": 100000 +} +GET /eapi/v1/countdownCancelAll (HMAC SHA256) + +This endpoint returns the auto-cancel parameters for each underlying symbol. Note only active auto-cancel parameters will be returned, if countdownTime is set to 0 (ie. countdownTime has been turned off), the underlying symbol and corresponding countdownTime parameter will not be returned in the response. + +Weight: 1 + +Parameters: + +Name Type Mandatory Description +underlying STRING NO Option underlying, e.g BTCUSDT +recvWindow LONG NO +timestamp LONG YES +countdownTime = 0 means the function is disabled. +Auto-Cancel All Open Orders (Kill-Switch) Heartbeat (TRADE) +Response: + +{ + "underlyings":["BTCUSDT","ETHUSDT"] +} +POST /eapi/v1/countdownCancelAllHeartBeat (HMAC SHA256) + +This endpoint resets the time from which the countdown will begin to the time this messaged is received. It should be called repeatedly as heartbeats. Multiple heartbeats can be updated at once by specifying the underlying symbols as a list (ex. BTCUSDT,ETHUSDT) in the underlyings parameter. + +Weight: 10 + +Parameters: + +Name Type Mandatory Description +underlyings STRING YES Option Underlying Symbols, e.g BTCUSDT,ETHUSDT +recvWindow LONG NO +timestamp LONG YES +The response will only include underlying symbols where the heartbeat has been successfully updated. +Error Codes +Here is the error JSON payload: + +{ + "code":-1121, + "msg":"Invalid symbol." +} +Errors consist of two parts: an error code and a message. +Codes are universal,but messages can vary. + +## 10xx - General Server or Network issues + +-1000 UNKNOWN +An unknown error occurred while processing the request. +-1001 DISCONNECTED +Internal error; unable to process your request. Please try again. +-1002 UNAUTHORIZED +You are not authorized to execute this request. +-1008 TOO_MANY_REQUESTS +Too many requests queued. +Too much request weight used; please use the websocket for live updates to avoid polling the API. +Too much request weight used; current limit is %s request weight per %s %s. Please use the websocket for live updates to avoid polling the API. +Way too much request weight used; IP banned until %s. Please use the websocket for live updates to avoid bans. +-1014 UNKNOWN_ORDER_COMPOSITION +Unsupported order combination. +-1015 TOO_MANY_ORDERS +Too many new orders. +Too many new orders; current limit is %s orders per %s. +-1016 SERVICE_SHUTTING_DOWN +This service is no longer available. +-1020 UNSUPPORTED_OPERATION +This operation is not supported. +-1021 INVALID_TIMESTAMP +Timestamp for this request is outside of the recvWindow. +Timestamp for this request was 1000ms ahead of the server's time. +-1022 INVALID_SIGNATURE +Signature for this request is not valid. +11xx - 2xxx Request issues +-1100 ILLEGAL_CHARS +Illegal characters found in a parameter. +Illegal characters found in a parameter. %s +Illegal characters found in parameter %s; legal range is %s. +-1101 TOO_MANY_PARAMETERS +Too many parameters sent for this endpoint. +Too many parameters; expected %s and received %s. +Duplicate values for a parameter detected. +-1102 MANDATORY_PARAM_EMPTY_OR_MALFORMED +A mandatory parameter was not sent, was empty/null, or malformed. +Mandatory parameter %s was not sent, was empty/null, or malformed. +Param %s or %s must be sent, but both were empty/null! +-1103 UNKNOWN_PARAM +An unknown parameter was sent. +-1104 UNREAD_PARAMETERS +Not all sent parameters were read. +Not all sent parameters were read; read %s parameter(s) but was sent %s. +-1105 PARAM_EMPTY +A parameter was empty. +Parameter %s was empty. +-1106 PARAM_NOT_REQUIRED +A parameter was sent when not required. +Parameter %s sent when not required. +-1111 BAD_PRECISION +Precision is over the maximum defined for this asset. +-1115 INVALID_TIF +Invalid timeInForce. +-1116 INVALID_ORDER_TYPE +Invalid orderType. +-1117 INVALID_SIDE +Invalid side. +-1118 EMPTY_NEW_CL_ORD_ID +New client order ID was empty. +-1119 EMPTY_ORG_CL_ORD_ID +Original client order ID was empty. +-1120 BAD_INTERVAL +Invalid interval. +-1121 BAD_SYMBOL +Invalid symbol. +-1125 INVALID_LISTEN_KEY +This listenKey does not exist. +-1127 MORE_THAN_XX_HOURS +Lookup interval is too big. +More than %s hours between startTime and endTime. +-1128 BAD_CONTRACT +Invalid underlying +-1129 BAD_CURRENCY +Invalid asset。 +-1130 INVALID_PARAMETER +Invalid data sent for a parameter. +Data sent for paramter %s is not valid. +-1131 BAD_RECV_WINDOW +recvWindow must be less than 60000 +-2010 NEW_ORDER_REJECTED +NEW_ORDER_REJECTED +-2013 NO_SUCH_ORDER +Order does not exist. +-2014 BAD_API_KEY_FMT +API-key format invalid. +-2015 INVALID_API_KEY +Invalid API-key, IP, or permissions for action. +-2018 BALANCE_NOT_SUFFICIENT +Balance is insufficient. +-2027 OPTION_MARGIN_NOT_SUFFICIENT +Option margin is insufficient. +3xxx-5xxx Filters and other issues +-3029 TRANSFER_FAILED +Asset transfer fail. +-4001 PRICE_LESS_THAN_ZERO +Price less than 0. +-4002 PRICE_GREATER_THAN_MAX_PRICE +Price greater than max price. +-4003 QTY_LESS_THAN_ZERO +Quantity less than zero. +-4004 QTY_LESS_THAN_MIN_QTY +Quantity less than min quantity. +-4005 QTY_GREATER_THAN_MAX_QTY +Quantity greater than max quantity. +-4013 PRICE_LESS_THAN_MIN_PRICE +Price less than min price. +-4029 INVALID_TICK_SIZE_PRECISION +Tick size precision is invalid. +-4030 INVALID_QTY_PRECISION +Step size precision is invalid. +-4055 AMOUNT_MUST_BE_POSITIVE +Amount must be positive. diff --git a/utils/options_endpoints_list.txt b/utils/options_endpoints_list.txt new file mode 100644 index 000000000..80017d126 --- /dev/null +++ b/utils/options_endpoints_list.txt @@ -0,0 +1,40 @@ +GET /eapi/v1/account +GET /eapi/v1/marginAccount +GET /eapi/v1/income/asynto +GET /eapi/v1/income/asyn/idto +POST /eapi/v1/transfer +GET /eapi/v1/order +GET /eapi/v1/depth +GET /eapi/v1/exerciseHistory +GET /eapi/v1/openInterest +POST /eapi/v1/countdownCancelAll +GET /eapi/v1/countdownCancelAll +POST /eapi/v1/countdownCancelAllHeartBeat +GET /eapi/v1/exchangeInfo +GET /eapi/v1/historyOrders +DELETE /eapi/v1/allOpenOrdersByUnderlying +GET /eapi/v1/userTrades +POST /eapi/v1/order +GET /eapi/v1/ping +GET /eapi/v1/time +GET /eapi/v1/trades +GET /eapi/v1/historicalTrades +GET /eapi/v1/klines +GET /eapi/v1/mark +GET /eapi/v1/ticker +GET /eapi/v1/index +POST /eapi/v1/batchOrders +DELETE /eapi/v1/order +DELETE /eapi/v1/batchOrders +DELETE /eapi/v1/allOpenOrders +GET /eapi/v1/openOrders +GET /eapi/v1/position +GET /eapi/v1/exerciseRecord +GET /eapi/v1/bill +GET /eapi/v1/income/asyn +GET /eapi/v1/income/asyn/id +POST /eapi/v1/listenKey +PUT /eapi/v1/listenKey +DELETE /eapi/v1/listenKey +POST /eapi/v1/mmpSet +POST /eapi/v1/mmpReset \ No newline at end of file diff --git a/utils/portfolio_docs.txt b/utils/portfolio_docs.txt new file mode 100644 index 000000000..de76f83ed --- /dev/null +++ b/utils/portfolio_docs.txt @@ -0,0 +1,4766 @@ +Logo +Spot/Margin/Savings/Mining +USDⓈ-M Futures +COIN-M Futures +European Options +WebSocket API +Portfolio Margin +简体中文 +Search +Change Log +General Info +Market Data Endpoints +New Order +Cancel Order +Query Order +Account +User Data Streams +Error Codes +Binance Futures +Change Log +Important Documentation Notice + +Binance has launched its new API Documentation Portal. The existing GitHub API documentation is now deprecated and set to go offline in the upcoming few months following user migration; the exact date will be determined and communicated in due course. + +During this transition phase, both sites will be maintained. However, any new services will only be published in the new portal moving forward. + +Here's a reference table of the links for the current and new API documentation: + +Functionality Current Documentation New Documentation +Spot Trading Current Documentation New Documentation +Spot Websocket API Current Documentation New Documentation +Margin Trading Current Documentation New Documentation +Derivative UM Futures Current Documentation New Documentation +Derivative CM Futures Current Documentation New Documentation +Derivative Options Current Documentation New Documentation +Derivative Portfolio Margin Current Documentation New Documentation +Wallet Current Documentation New Documentation +Sub Account Current Documentation New Documentation +Simple Earn Current Documentation New Documentation +Dual Investment Current Documentation New Documentation +Auto Invest Current Documentation New Documentation +Staking Current Documentation New Documentation +Mining Current Documentation New Documentation +Algo Trading Current Documentation New Documentation +Copy Trading Current Documentation New Documentation +Derivative Porfolio Margin Pro Current Documentation New Documentation +Fiat Current Documentation New Documentation +C2C Current Documentation New Documentation +VIP Loan Current Documentation New Documentation +Crypto Loan Current Documentation New Documentation +Pay Current Documentation New Documentation +Convert Current Documentation New Documentation +Rebate Current Documentation New Documentation +NFT Current Documentation New Documentation +Gift Card Current Documentation New Documentation +2024-04-09 + +Futures Good-Till-Cancel (GTC) timeInForce will have a one-year validity period after order placement. GTC orders longer than one-year will be automatically canceled. This applies to all order types including reduceOnly but does not affect part-filled orders or strategy trading or copy-trading orders. +2024-01-19 + +REST + +New endpoints PUT /papi/v1/um/order and PUT /papi/v1/cm/order to support UM/CM limit order modify +New endpoints GET /papi/v1/um/orderAmendment and GET /papi/v1/cm/orderAmendment to get UM/CM order modify history +2024-01-11 + +Self-Trade Prevention(Released): + +Self-Trade Prevention (aka STP) will be added to the system. This will prevent orders from matching with orders from the same account, or accounts under the same tradeGroupId. For more detail, please check FAQ +User can set selfTradePreventionMode when placing new orders. All symbols support the following STP mode: +NONE: No Self-Trade Prevention +EXPIRE_TAKER: expire taker order when STP trigger +EXPIRE_BOTH: expire taker and maker order when STP trigger +EXPIRE_MAKER: expire maker order when STP trigger +REST Update: +New order status EXPIRED_IN_MATCH - This means that the order expired due to STP being triggered. +GET /papi/v1/um/account: Add new field tradeGroupId in response to show user's tradeGroupId +Add optional parameter selfTradePreventionMode in the endpoints below to set order's STP mode: +POST /papi/v1/um/order +POST/papi/v1/um/conditional/order +POST /papi/v1/margin/order +POST /papi/v1/margin/order/oco +Add new field selfTradePreventionMode in response of the endpoints below to show order's STP mode: + +POST /papi/v1/um/order +POST/papi/v1/um/conditional/order +GET /papi/v1/um/order +GET /papi/v1/um/openOrder +GET /papi/v1/um/openOrders +GET /papi/v1/um/allOrders +GET /papi/v1/um/conditional/openOrder +GET /papi/v1/um/conditional/openOrders +GET /papi/v1/um/conditional/orderHistory +GET /papi/v1/um/conditional/allOrders +DELETE /papi/v1/um/order +DELETE /papi/v1/um/conditional/order +DELETE /papi/v1/margin/order +DELETE /papi/v1/margin/allOpenOrders +DELETE /papi/v1/margin/orderList +GET /papi/v1/margin/order +GET /papi/v1/margin/allOrders +GET /papi/v1/margin/orderList +GET /papi/v1/margin/allOrderList +GET /papi/v1/margin/openOrderList +WEBSOCKET User Data Stream: + +Add new field V in ORDER_TRADE_UPDATE and CONDITIONAL_ORDER_TRADE_UPDATE to order STP mode. + +New fields for executionReport (These fields will only appear if the order has expired due to STP trigger) + +u - tradeGroupId +v - preventedMatchId +U - counterOrderId +A - preventedQuantity +B - lastPreventedQuantity +Good Till Date TIF(Released) + +USDⓈ margin future will support Good To Date TIF. Orders with the TIF set to GTD will be automatically canceled by the goodTillDate time. + +REST Update: + +Add optional parameter goodTillDate in the endpoints below to set order's goodTillDate : + +POST /papi/v1/um/order +POST/papi/v1/um/conditional/order +Add new field goodTillDate in response of the endpoints below to show order's goodTillDate: + +POST /papi/v1/um/order +POST/papi/v1/um/conditional/order +GET /papi/v1/um/order +GET /papi/v1/um/openOrder +GET /papi/v1/um/openOrders +GET /papi/v1/um/allOrders +GET /papi/v1/um/conditional/openOrder +GET /papi/v1/um/conditional/openOrders +GET /papi/v1/um/conditional/orderHistory +GET /papi/v1/um/conditional/allOrders +DELETE /papi/v1/um/order +DELETE /papi/v1/um/conditional/order +WEBSOCKET User Data Stream: + +Add new field gtd in ORDER_TRADE_UPDATE and CONDITIONAL_ORDER_TRADE_UPDATE to order good till date. + +Breakeven Price(Released) + +REST Update + +Add new field breakEvenPrice in The following endpoint + +GET /papi/v1/um/account +GET /papi/v1/um/positionRisk +GET /papi/v1/cm/account +GET /papi/v1/cm/positionRisk +WEBSOCKET + +New field bep represents Break-Even Price in position P of payload to event: Balance and Position Update – "e": "ACCOUNT_UPDATE" + +2023-09-22 + +Update on endpoints: + +GET /papi/v1/um/positionRisk: add response field liquidationPrice +GET /papi/v1/cm/positionRisk: add response field liquidationPrice +GET /papi/v1/um/leverageBracket: add response field notionalCoef +GET /papi/v1/cm/leverageBracket: add response field notionalCoef +Websocket User Data Streams Update: + +outboundAccountPosition event add new field updateId U +balanceUpdate event add new field updateId U +2023-09-04 + +Expect 2023-09-07 Release + +Overall papi order ratelimit change from 2400 orders/min to 1200 orders/min, impacted endpoints are: +POST /papi/v1/um/order +POST /papi/v1/cm/order +POST /papi/v1/margin/order +POST /papi/v1/margin/order/oco +POST /papi/v1/um/conditional/order +POST /papi/v1/cm/conditional/order +2023-08-18 + +New endpoints for Query Order: +GET /papi/v1/margin/order: Query Margin Account Order +GET /papi/v1/margin/openOrders: Query Current Margin Open Order +GET /papi/v1/margin/allOrders: Query All Margin Account Orders +GET /papi/v1/margin/orderList: Query Margin Account's OCO +GET /papi/v1/margin/allOrderList: Query Margin Account's all OCO +GET /papi/v1/margin/openOrderList: Query Margin Account's Open OCO +GET /papi/v1/margin/myTrades: Query Margin Account's Trade List +2023-07-28 + +New endpoints for account: +POST /papi/v1/asset-collection: Fund Collection by Asset +2023-07-20 + +New endpoints for account: +GET /papi/v1/um/adlQuantile: UM Position ADL Quantile Estimation +GET /papi/v1/cm/adlQuantile: CM Position ADL Quantile Estimation +2023-07-18 + +New endpoints for account: +POST /papi/v1/repay-futures-switch: Change Auto-repay-futures Status +GET /papi/v1/repay-futures-switch: Get Auto-repay-futures Status +POST /papi/v1/repay-futures-negative-balance: Repay futures Negative Balance +2023-07-13 + +New USER DATA STREAM event riskLevelChange(effective 2023-07-14) +2023-07-11 + +REST + +Add new endpoint POST /papi/v1/ping for connectivity test +2023-06-19 + +REST + +Add fields CONTRACT_PRICE,priceProtect in endpoints POST /papi/v1/um/conditional/order and POST/papi/v1/cm/conditional/order +2023-06-01 + +REST + +The endpoints below will be deployed on 2023-06-02: +New endpoints GET /papi/v1/um/income and GET /papi/v1/cm/income to query portfolio margin UM/CM income history +New endpoints GET /papi/v1/um/account and GET /papi/v1/cm/account to query portfolio margin UM/CM account history +2023-05-04 + +API doc for portfolio margin +General Info +General API Information +The base endpoint is: https://papi.binance.com +All endpoints return either a JSON object or raw primitive. +Data is returned in ascending order. Oldest first, newest last. +All time and timestamp related fields are in UTC milliseconds. +All data types adopt definition in JAVA. +HTTP Return Codes +HTTP 4XX return codes are used for for malformed requests; the issue is on the sender's side. +HTTP 403 return code is used when the WAF Limit (Web Application Firewall) has been violated. +HTTP 429 return code is used when breaking a request rate limit. +HTTP 418 return code is used when an IP has been auto-banned for continuing to send requests after receiving 429 codes. +HTTP 5XX return codes are used for internal errors; the issue is on Binance's side. +If there is an error message "Request occur unknown error.", please retry later. +HTTP 503 return code is used when: +If there is an error message "Unknown error, please check your request or try again later." returned in the response, the API successfully sent the request but not get a response within the timeout period.It is important to NOT treat this as a failure operation; the execution status is UNKNOWN and could have been a success; +If there is an error message "Service Unavailable." returned in the response, it means this is a failure API operation and the service might be unavailable at the moment, you need to retry later. +If there is an error message "Internal error; unable to process your request. Please try again." returned in the response, it means this is a failure API operation and you can resend your request if you need. +Error Codes and Messages +Any endpoint can return an ERROR +Specific error codes and messages defined in Error Codes. +General Information on Endpoints +For GET endpoints, parameters must be sent as a query string. +For POST, PUT, and DELETE endpoints, the parameters may be sent as a query string or in the request body with content type application/x-www-form-urlencoded. You may mix parameters between both the query string and request body if you wish to do so. +Parameters may be sent in any order. +If a parameter sent in both the query string and request body, the query string parameter will be used. +LIMITS +A 429 will be returned when either rate limit is violated. + Binance has the right to further tighten the rate limits on users with intent to attack. +IP Limits +Every request will contain X-MBX-USED-WEIGHT-(intervalNum)(intervalLetter) in the response headers which has the current used weight for the IP for all request rate limiters defined. +Each route has a weight which determines for the number of requests each endpoint counts for. Heavier endpoints and endpoints that do operations on multiple symbols will have a heavier weight. +When a 429 is received, it's your obligation as an API to back off and not spam the API. +Repeatedly violating rate limits and/or failing to back off after receiving 429s will result in an automated IP ban (HTTP status 418). +IP bans are tracked and scale in duration for repeat offenders, from 2 minutes to 3 days. +The limits on the API are based on the IPs, not the API keys. +Portfolio Margin IP Limit is 6000/min. + It is strongly recommended to use websocket stream for getting data as much as possible, which can not only ensure the timeliness of the message, but also reduce the access restriction pressure caused by the request. +Order Rate Limits +Every order response will contain a X-MBX-ORDER-COUNT-(intervalNum)(intervalLetter) header which has the current order count for the account for all order rate limiters defined. +Rejected/unsuccessful orders are not guaranteed to have X-MBX-ORDER-COUNT-** headers in the response. +The order rate limit is counted against each account. +Portfolio Margin Order Limits are 1200/min. +Endpoint Security Type +Each endpoint has a security type that determines the how you will interact with it. +API-keys are passed into the Rest API via the X-MBX-APIKEY header. +API-keys and secret-keys are case sensitive. +API-keys can be configured to only access certain types of secure endpoints. For example, one API-key could be used for TRADE only, while another API-key can access everything except for TRADE routes. +By default, API-keys can access all secure routes. +Security Type Description +NONE Endpoint can be accessed freely. +TRADE Endpoint requires sending a valid API-Key and signature. +USER_DATA Endpoint requires sending a valid API-Key and signature. +USER_STREAM Endpoint requires sending a valid API-Key and signature. +SIGNED (TRADE and USER_DATA) Endpoint Security +SIGNED endpoints require an additional parameter, signature, to be sent in the query string or request body. +Endpoints use HMAC SHA256 signatures. The HMAC SHA256 signature is a keyed HMAC SHA256 operation. Use your secretKey as the key and totalParams as the value for the HMAC operation. +The signature is not case sensitive. +Please make sure the signature is the end part of your query string or request body. +totalParams is defined as the query string concatenated with the request body. +Timing security +A SIGNED endpoint also requires a parameter, timestamp, to be sent which should be the millisecond timestamp of when the request was created and sent. +An additional parameter, recvWindow, may be sent to specify the number of milliseconds after timestamp the request is valid for. If recvWindow is not sent, it defaults to 5000. recvWindow cannot exceed 60000. +If the server determines that the timestamp sent by the client is more than one second in the future of the server time, the request will also be rejected. +Serious trading is about timing. Networks can be unstable and unreliable, which can lead to requests taking varying amounts of time to reach the servers. With recvWindow, you can specify that the request must be processed within a certain number of milliseconds or be rejected by the server. + + It is recommended to use a small recvWindow of 5000 or less! The max cannot go beyond 60,000! +SIGNED Endpoint Examples for POST /papi/v1/um/order +Here is a step-by-step example of how to send a valid signed payload from the Linux command line using echo, openssl, and curl. + +Key Value +apiKey 22BjeOROKiXJ3NxbR3zjh3uoGcaflPu3VMyBXAg8Jj2J1xVSnY0eB4dzacdE9IWn +secretKey YtP1BudNOWZE1ag5uzCkh4hIC7qSmQOu797r5EJBFGhxBYivjj8HIX0iiiPof5yG +Parameter Value +symbol BTCUSDT +side BUY +type LIMIT +timeInForce GTC +quantity 1 +price 2000 +recvWindow 5000 +timestamp 1611825601400 +Example 1: As a request body +Example 1 + +HMAC SHA256 signature: + + $ echo -n "symbol=BTCUSDT&side=BUY&type=LIMIT&timeInForce=GTC&quantity=1&price=2000&recvWindow=5000×tamp=1611825601400" | openssl dgst -sha256 -hmac "YtP1BudNOWZE1ag5uzCkh4hIC7qSmQOu797r5EJBFGhxBYivjj8HIX0iiiPof5yG" + (stdin)= 7c12045972f6140e765e0f2b67d28099718df805732676494238f50be830a7d7 +curl command: + + (HMAC SHA256) + $ curl -H "X-MBX-APIKEY: 22BjeOROKiXJ3NxbR3zjh3uoGcaflPu3VMyBXAg8Jj2J1xVSnY0eB4dzacdE9IWn" -X POST 'https://papi.binance.com/papi/v1/order' -d 'symbol=BTCUSDT&side=BUY&type=LIMIT&timeInForce=GTC&quantity=1&price=2000&recvWindow=5000×tamp=1611825601400&signature=7c12045972f6140e765e0f2b67d28099718df805732676494238f50be830a7d7' + +requestBody: +symbol=BTCUSDT &side=BUY +&type=LIMIT +&timeInForce=GTC +&quantity=1 +&price=2000 +&recvWindow=5000 +×tamp=1611825601400 + +Example 2: As a query string +Example 2 + +HMAC SHA256 signature: + + $ echo -n "symbol=BTCUSDT&side=BUY&type=LIMIT&timeInForce=GTC&quantity=1&price=2000&recvWindow=5000×tamp=1611825601400" | openssl dgst -sha256 -hmac "YtP1BudNOWZE1ag5uzCkh4hIC7qSmQOu797r5EJBFGhxBYivjj8HIX0iiiPof5yG" + (stdin)= 7c12045972f6140e765e0f2b67d28099718df805732676494238f50be830a7d7 +curl command: + + (HMAC SHA256) + $ curl -H "X-MBX-APIKEY: 22BjeOROKiXJ3NxbR3zjh3uoGcaflPu3VMyBXAg8Jj2J1xVSnY0eB4dzacdE9IWn" -X POST 'https://papi.binance.com/papi/v1/order?symbol=BTCUSDT&side=BUY&type=LIMIT&timeInForce=GTC&quantity=1&price=2000&recvWindow=5000×tamp=1611825601400&signature=7c12045972f6140e765e0f2b67d28099718df805732676494238f50be830a7d7' +queryString: + +symbol=BTCUSDT +&side=BUY +&type=LIMIT +&timeInForce=GTC +&quantity=1 +&price=2000 +&recvWindow=5000 +×tamp=1611825601400 + +Example 3: Mixed query string and request body +Example 3 + +HMAC SHA256 signature: + + $ echo -n "symbol=BTCUSDT&side=BUY&type=LIMIT&timeInForce=GTCquantity=0.01&price=2000&recvWindow=5000×tamp=1611825601400" | openssl dgst -sha256 -hmac "YtP1BudNOWZE1ag5uzCkh4hIC7qSmQOu797r5EJBFGhxBYivjj8HIX0iiiPof5yG" + (stdin)= fa6045c54fb02912b766442be1f66fab619217e551a4fb4f8a1ee000df914d8e +curl command: + + (HMAC SHA256) + $ curl -H "X-MBX-APIKEY: 22BjeOROKiXJ3NxbR3zjh3uoGcaflPu3VMyBXAg8Jj2J1xVSnY0eB4dzacdE9IWn" -X POST 'https://papi.binance.com/papi/v1/order?symbol=BTCUSDT&side=BUY&type=LIMIT&timeInForce=GTC' -d 'quantity=0.01&price=2000&recvWindow=5000×tamp=1611825601400&signature=fa6045c54fb02912b766442be1f66fab619217e551a4fb4f8a1ee000df914d8e' +queryString: +symbol=BTCUSDT&side=BUY&type=LIMIT&timeInForce=GTC + +requestBody: +quantity=1&price=2000&recvWindow=5000×tamp=1611825601400 + +Note that the signature is different in example 3. There is no & between "GTC" and "quantity=1". + +### RSA Keys - SIGNED Endpoint Examples for POST /papi/v1/um/order + +This will be a step by step process how to create the signature payload to send a valid signed payload. +We support PKCS#8 currently. +To get your API key, you need to upload your RSA Public Key to your account and a corresponding API key will be provided for you. +For this example, the private key will be referenced as test-prv-key.pem + +Key Value +apiKey vE3BDAL1gP1UaexugRLtteaAHg3UO8Nza20uexEuW1Kh3tVwQfFHdAiyjjY428o2 +Parameter Value +symbol BTCUSDT +side BUY +type LIMIT +timeInForce GTC +quantity 1 +price 2000 +recvWindow 5000 +timestamp 1611825601400 +Step 1: Construct the payload + +Arrange the list of parameters into a string. Separate each parameter with a &. + +Step 2: Compute the signature: + +2.1 - Encode signature payload as ASCII data. + +Step 2.2 console $ echo -n 'timestamp=1671090801999&recvWindow=9999999&symbol=BTCUSDT&side=SELL&type=MARKET&quantity=1.23' | openssl dgst -keyform PEM -sha256 -sign ./test-prv-key.pem + +2.2 - Sign payload using RSASSA-PKCS1-v1_5 algorithm with SHA-256 hash function. + +Step 2.3 console $ echo -n 'timestamp=1671090801999&recvWindow=9999999&symbol=BTCUSDT&side=SELL&type=MARKET&quantity=1.23' | openssl dgst -keyform PEM -sha256 -sign ./test-prv-key.pem | openssl enc -base64 aap36wD5loVXizxvvPI3wz9Cjqwmb3KVbxoym0XeWG1jZq8umqrnSk8H8dkLQeySjgVY91Ufs%2BBGCW%2B4sZjQEpgAfjM76riNxjlD3coGGEsPsT2lG39R%2F1q72zpDs8pYcQ4A692NgHO1zXcgScTGgdkjp%2Brp2bcddKjyz5XBrBM%3D + +2.3 - Encode output as base64 string. + +Step 2.4 console $ echo -n 'timestamp=1671090801999&recvWindow=9999999&symbol=BTCUSDT&side=SELL&type=MARKET&quantity=1.23' | openssl dgst -keyform PEM -sha256 -sign ./test-prv-key.pem | openssl enc -base64 | tr -d '\n' aap36wD5loVXizxvvPI3wz9Cjqwmb3KVbxoym0XeWG1jZq8umqrnSk8H8dkLQeySjgVY91Ufs%2BBGCW%2B4sZjQEpgAfjM76riNxjlD3coGGEsPsT2lG39R%2F1q72zpDs8pYcQ4A692NgHO1zXcgScTGgdkjp%2Brp2bcddKjyz5XBrBM%3D + +2.4 - Delete any newlines in the signature. + +Step 2.5 console aap36wD5loVXizxvvPI3wz9Cjqwmb3KVbxoym0XeWG1jZq8umqrnSk8H8dkLQeySjgVY91Ufs%2BBGCW%2B4sZjQEpgAfjM76riNxjlD3coGGEsPsT2lG39R%2F1q72zpDs8pYcQ4A692NgHO1zXcgScTGgdkjp%2Brp2bcddKjyz5XBrBM%3D + +2.5 - Since the signature may contain / and =, this could cause issues with sending the request. So the signature has to be URL encoded. + +Step 2.6 console curl -H "X-MBX-APIKEY: vE3BDAL1gP1UaexugRLtteaAHg3UO8Nza20uexEuW1Kh3tVwQfFHdAiyjjY428o2" -X POST 'https://papi.binance.com/papi/v1/um/order?timestamp=1671090801999&recvWindow=9999999&symbol=BTCUSDT&side=SELL&type=MARKET&quantity=1.23&signature=aap36wD5loVXizxvvPI3wz9Cjqwmb3KVbxoym0XeWG1jZq8umqrnSk8H8dkLQeySjgVY91Ufs%2BBGCW%2B4sZjQEpgAfjM76riNxjlD3coGGEsPsT2lG39R%2F1q72zpDs8pYcQ4A692NgHO1zXcgScTGgdkjp%2Brp2bcddKjyz5XBrBM%3D' + +2.6 - curl command + +Bash script + +#!/usr/bin/env bash +# Set up authentication: +apiKey="vE3BDAL1gP1UaexugRLtteaAHg3UO8Nza20uexEuW1Kh3tVwQfFHdAiyjjY428o2" ### REPLACE THIS WITH YOUR API KEY +# Set up the request: +apiMethod="POST" +apiCall="v1/order" +apiParams="timestamp=1671090801999&recvWindow=9999999&symbol=BTCUSDT&side=SELL&type=MARKET&quantity=1.23" +function rawurlencode { + local value="$1" + local len=${#value} + local encoded="" + local pos c o + for (( pos=0 ; pos= minPrice +buy order price <= maxPrice +(price-minPrice) % tickSize == 0 +ExchangeInfo format: javascript { "filterType": "PRICE_FILTER", "minPrice": "0.00000100", "maxPrice": "100000.00000000", "tickSize": "0.00000100" } + +LOT_SIZE +The LOT_SIZE filter defines the quantity (aka "lots" in auction terms) rules for a symbol. There are 3 parts: + +minQty defines the minimum quantity allowed. +maxQty defines the maximum quantity allowed. +stepSize defines the intervals that a quantity can be increased/decreased by. +In order to pass the lot size, the following must be true for quantity: + +quantity >= minQty +quantity <= maxQty +(quantity-minQty) % stepSize == 0 +/exchangeInfo format: javascript { "filterType": "LOT_SIZE", "minQty": "0.00100000", "maxQty": "100000.00000000", "stepSize": "0.00100000" } + +PERCENT_PRICE +The PERCENT_PRICE filter defines valid range for a price based on the mark price in Futures and on the average of the previous trades in Cross Margin. For Cross Margin avgPriceMins is the number of minutes the average price is calculated over. 0 means the last price is used. + +In order to pass the percent price, the following must be true for price: * Futures BUY: price <= markPrice * multiplierUp SELL: price >= markPrice * multiplierDown * Cross Margin BUY: price <= weightedAveragePrice * multiplierUp SELL: price >= weightedAveragePrice * multiplierDown + +MIN_NOTIONAL +The MIN_NOTIONAL filter defines the minimum notional value allowed for an order on a symbol. An order's notional value is the price * quantity. Since MARKET orders have no price, the mark price is used in Futures and the average price is used over the last avgPriceMins for Cross Margin. avgPriceMins is the number of minutes the average price is calculated over. 0 means the last price is used. + +MARKET_LOT_SIZE +The MARKET_LOT_SIZE filter defines the quantity (aka "lots" in auction terms) rules for MARKET orders on a symbol. There are 3 parts: + +minQty defines the minimum quantity allowed. +maxQty defines the maximum quantity allowed. +stepSize defines the intervals that a quantity can be increased/decreased by. +In order to pass the market lot size, the following must be true for quantity: + +quantity >= minQty +quantity <= maxQty +(quantity-minQty) % stepSize == 0 +/exchangeInfo format: + +{ + "filterType": "MARKET_LOT_SIZE", + "minQty": "0.00100000", + "maxQty": "100000.00000000", + "stepSize": "0.00100000" +} +MAX_NUM_ORDERS +The MAX_NUM_ORDERS filter defines the maximum number of orders an account is allowed to have open on a symbol. Note that both "algo" orders and normal orders are counted for this filter. + +/exchangeInfo format: javascript { "filterType": "MAX_NUM_ORDERS", "limit": 200 } + +MAX_NUM_ALGO_ORDERS +The MAX_NUM_ALGO_ORDERS filter defines the maximum number of all kinds of algo orders an account is allowed to have open on a symbol. The algo orders include STOP, STOP_MARKET, TAKE_PROFIT, TAKE_PROFIT_MARKET, and TRAILING_STOP_MARKET orders. + +/exchangeInfo format: javascript { "filterType": "MAX_NUM_ALGO_ORDERS", "limit": 100 } + +Market Data Endpoints +Test Connectivity +Response: + +{} +GET /papi/v1/ping + +Test connectivity to the Rest API. + +Weight: 1 + +Parameters: NONE + +New Order +Send in a new order/orders. + +New UM Order (TRADE) +Response: + +{ + "clientOrderId": "testOrder", + "cumQty": "0", + "cumQuote": "0", + "executedQty": "0", + "orderId": 22542179, + "avgPrice": "0.00000", + "origQty": "10", + "price": "0", + "reduceOnly": false, + "side": "BUY", + "positionSide": "SHORT", + "status": "NEW", + "symbol": "BTCUSDT", + "timeInForce": "GTD", + "type": "MARKET", + "selfTradePreventionMode": "NONE", //self trading preventation mode + "goodTillDate": 1693207680000, //order pre-set auot cancel time for TIF GTD order + "updateTime": 1566818724722 +} +POST /papi/v1/um/order (HMAC SHA256) + +Weight(order): 1 + +Parameters: + +Name Type Mandatory Description +symbol STRING YES +side ENUM YES +positionSide ENUM NO Default BOTH for One-way Mode ; LONG or SHORT for Hedge Mode. It must be sent in Hedge Mode. +type ENUM YES LIMIT, MARKET +timeInForce ENUM NO +quantity DECIMAL NO +reduceOnly STRING NO "true" or "false". default "false". Cannot be sent in Hedge Mode . +price DECIMAL NO +newClientOrderId STRING NO A unique id among open orders. Automatically generated if not sent. Can only be string following the rule: ^[\.A-Z\:/a-z0-9_-]{1,32}$ +newOrderRespType ENUM NO ACK, RESULT, default ACK +selfTradePreventionMode ENUM NO NONE:No STP / EXPIRE_TAKER:expire taker order when STP triggers/ EXPIRE_MAKER:expire taker order when STP triggers/ EXPIRE_BOTH:expire both orders when STP triggers +goodTillDate LONG NO order cancel time for timeInForce GTD, mandatory when timeInforce set to GTD; order the timestamp only retains second-level precision, ms part will be ignored; The goodTillDate timestamp must be greater than the current time plus 600 seconds and smaller than 253402300799000Mode. It must be sent in Hedge Mode. +recvWindow LONG NO +timestamp LONG YES +Additional mandatory parameters based on type: + +Type Additional mandatory parameters +LIMIT timeInForce, quantity, price +MARKET quantity +If newOrderRespType is sent as RESULT : + +MARKET order: the final FILLED result of the order will be return directly. +LIMIT order with special timeInForce: the final status result of the order(FILLED or EXPIRED) will be returned directly. +selfTradePreventionMode is only effective when timeInForce set to IOC or GTC or GTD. + +In extreme market conditions, timeInForce GTD order auto cancel time might be delayed comparing to goodTillDate + +New CM Order (TRADE) +Response: + +{ + "clientOrderId": "testOrder", + "cumQty": "0", + "cumBase": "0", + "executedQty": "0", + "orderId": 22542179, + "avgPrice": "0.0", + "origQty": "10", + "price": "0", + "reduceOnly": false, + "side": "BUY", + "positionSide": "SHORT", + "status": "NEW", + "symbol": "BTCUSD_200925", + "pair": "BTCUSD", + "timeInForce": "GTC", + "type": "MARKET", + "updateTime": 1566818724722 +} +POST /papi/v1/cm/order (HMAC SHA256) + +Weight(order): 1 + +Parameters: + +Name Type Mandatory Description +symbol STRING YES +side ENUM YES +positionSide ENUM NO Default BOTH for One-way Mode ; LONG or SHORT for Hedge Mode. It must be sent in Hedge Mode. +type ENUM YES "LIMIT", "MARKET" +timeInForce ENUM NO +quantity DECIMAL NO +reduceOnly STRING NO "true" or "false". default "false". Cannot be sent in Hedge Mode. +price DECIMAL NO +newClientOrderId STRING NO A unique id among open orders. Automatically generated if not sent. Can only be string following the rule: ^[\.A-Z\:/a-z0-9_-]{1,32}$ +newOrderRespType ENUM NO "ACK", "RESULT", default "ACK" +recvWindow LONG NO +timestamp LONG YES +Additional mandatory parameters based on type: + +Type Additional mandatory parameters +LIMIT timeInForce, quantity, price +MARKET quantity +If newOrderRespType is sent as RESULT : +MARKET order: the final FILLED result of the order will be return directly. +LIMIT order with special timeInForce: the final status result of the order(FILLED or EXPIRED) will be returned directly. +New Margin Order (TRADE) +Response: + +{ + "symbol": "BTCUSDT", + "orderId": 28, + "clientOrderId": "6gCrw2kRUAF9CvJDGP16IP", + "transactTime": 1507725176595, + "price": "1.00000000", + "selfTradePreventionMode": "NONE", //self trading preventation mode + "origQty": "10.00000000", + "executedQty": "10.00000000", + "cummulativeQuoteQty": "10.00000000", + "status": "FILLED", + "timeInForce": "GTC", + "type": "MARKET", + "side": "SELL", + "marginBuyBorrowAmount": 5, // will not return if no margin trade happens + "marginBuyBorrowAsset": "BTC", // will not return if no margin trade happens + "fills": [ + { + "price": "4000.00000000", + "qty": "1.00000000", + "commission": "4.00000000", + "commissionAsset": "USDT" + }, + { + "price": "3999.00000000", + "qty": "5.00000000", + "commission": "19.99500000", + "commissionAsset": "USDT" + } + ] +} +POST /papi/v1/margin/order + +Weight(order): 1 + +Parameters: + +Name Type Mandatory Description +symbol STRING YES +side ENUM YES BUY ; SELL +type ENUM YES +quantity DECIMAL NO +quoteOrderQty DECIMAL NO +price DECIMAL NO +stopPrice DECIMAL NO Used with STOP_LOSS, STOP_LOSS_LIMIT, TAKE_PROFIT, and TAKE_PROFIT_LIMIT orders. +newClientOrderId STRING NO A unique id among open orders. Automatically generated if not sent. +newOrderRespType ENUM NO Set the response JSON. ACK, RESULT, or FULL; MARKET and LIMIT order types default to FULL, all other orders default to ACK. +icebergQty DECIMAL NO Used with LIMIT, STOP_LOSS_LIMIT, and TAKE_PROFIT_LIMIT to create an iceberg order +sideEffectType ENUM NO NO_SIDE_EFFECT, MARGIN_BUY, AUTO_REPAY,AUTO_BORROW_REPAY; default NO_SIDE_EFFECT. +timeInForce ENUM NO GTC,IOC,FOK +selfTradePreventionMode ENUM NO NONE:No STP / EXPIRE_TAKER:expire taker order when STP triggers/ EXPIRE_MAKER:expire taker order when STP triggers/ EXPIRE_BOTH:expire both orders when STP triggers +autoRepayAtCancel BOOLEAN NO 只有在自动借款单或者自动借还单生效,true表示的是撤单后需要把订单产生的借款归还,默认为true +recvWindow LONG NO The value cannot be greater than 60000 +timestamp LONG YES +Margin Account Borrow (MARGIN) +Response: + +{ + //transaction id + "tranId": 100000001 +} +POST /papi/v1/marginLoan + +Apply for a margin loan. + +Weight: 100 + +Parameters: + +Name Type Mandatory Description +asset STRING YES +amount DECIMAL YES +recvWindow LONG NO The value cannot be greater than 60000 +timestamp LONG YES +Margin Account Repay (MARGIN) +Response: + +{ + //transaction id + "tranId": 100000001 +} +POST /papi/v1/repayLoan + +Repay for a margin loan. + +Weight: 100 + +Parameters: + +Name Type Mandatory Description +asset STRING YES +amount DECIMAL YES +recvWindow LONG NO The value cannot be greater than 60000 +timestamp LONG YES +Margin Account New OCO (TRADE) +Response: + +{ + "orderListId": 0, + "contingencyType": "OCO", + "listStatusType": "EXEC_STARTED", + "listOrderStatus": "EXECUTING", + "listClientOrderId": "JYVpp3F0f5CAG15DhtrqLp", + "transactionTime": 1563417480525, + "symbol": "LTCBTC", + "marginBuyBorrowAmount": "5", // will not return if no margin trade happens + "marginBuyBorrowAsset": "BTC", // will not return if no margin trade happens + "orders": [ + { + "symbol": "LTCBTC", + "orderId": 2, + "clientOrderId": "Kk7sqHb9J6mJWTMDVW7Vos" + }, + { + "symbol": "LTCBTC", + "orderId": 3, + "clientOrderId": "xTXKaGYd4bluPVp78IVRvl" + } + ], + "orderReports": [ + { + "symbol": "LTCBTC", + "orderId": 2, + "orderListId": 0, + "clientOrderId": "Kk7sqHb9J6mJWTMDVW7Vos", + "transactTime": 1563417480525, + "price": "0.000000", + "origQty": "0.624363", + "executedQty": "0.000000", + "cummulativeQuoteQty": "0.000000", + "status": "NEW", + "timeInForce": "GTC", + "type": "STOP_LOSS", + "side": "BUY", + "stopPrice": "0.960664", + "selfTradePreventionMode": "EXPIRE_BOTH" + }, + { + "symbol": "LTCBTC", + "orderId": 3, + "orderListId": 0, + "clientOrderId": "xTXKaGYd4bluPVp78IVRvl", + "transactTime": 1563417480525, + "price": "0.036435", + "origQty": "0.624363", + "executedQty": "0.000000", + "cummulativeQuoteQty": "0.000000", + "status": "NEW", + "timeInForce": "GTC", + "type": "LIMIT_MAKER", + "side": "BUY", + "selfTradePreventionMode": "EXPIRE_BOTH" + } + ] +} +POST /papi/v1/margin/order/oco + +Send in a new OCO for a margin account + +Weight(order): 1 + +Parameters: + +Name Type Mandatory Description +symbol STRING YES +listClientOrderId STRING NO A unique Id for the entire orderList +side ENUM YES +quantity DECIMAL YES +limitClientOrderId STRING NO A unique Id for the limit order +price DECIMAL YES +limitIcebergQty DECIMAL NO +stopClientOrderId STRING NO A unique Id for the stop loss/stop loss limit leg +stopPrice DECIMAL YES +stopLimitPrice DECIMAL NO If provided, stopLimitTimeInForce is required. +stopIcebergQty DECIMAL NO +stopLimitTimeInForce ENUM NO Valid values are GTC/FOK/IOC +newOrderRespType ENUM NO Set the response JSON. +sideEffectType ENUM NO NO_SIDE_EFFECT, MARGIN_BUY, AUTO_REPAY,AUTO_BORROW_REPAY; default NO_SIDE_EFFECT. +selfTradePreventionMode ENUM NO NONE:No STP / EXPIRE_TAKER:expire taker order when STP triggers/ EXPIRE_MAKER:expire taker order when STP triggers/ EXPIRE_BOTH:expire both orders when STP triggers +autoRepayAtCancel BOOLEAN NO 只有在自动借款单或者自动借还单生效,true表示的是撤单后需要把订单产生的借款归还,默认为true +recvWindow LONG NO The value cannot be greater than 60000 +timestamp LONG YES +Other Info: * Price Restrictions: * SELL: Limit Price > Last Price > Stop Price * BUY: Limit Price < Last Price < Stop Price * Quantity Restrictions: * Both legs must have the same quantity * ICEBERG quantities however do not have to be the same. * Order Rate Limit * OCO counts as 2 orders against the order rate limit. + +New UM Conditional Order (TRADE) +Response: + +{ + "newClientStrategyId": "testOrder", + "strategyId":123445, + "strategyStatus":"NEW", + "strategyType": "TRAILING_STOP_MARKET", + "origQty": "10", + "price": "0", + "reduceOnly": false, + "side": "BUY", + "positionSide": "SHORT", + "stopPrice": "9300", // please ignore when order type is TRAILING_STOP_MARKET + "symbol": "BTCUSDT", + "timeInForce": "GTD", + "activatePrice": "9020", // activation price, only return with TRAILING_STOP_MARKET order + "priceRate": "0.3", // callback rate, only return with TRAILING_STOP_MARKET order + "bookTime": 1566818724710, // order place time + "updateTime": 1566818724722 + "workingType":"CONTRACT_PRICE", + "priceProtect": false, + "selfTradePreventionMode": "NONE", //self trading preventation mode + "goodTillDate": 1693207680000 //order pre-set auot cancel time for TIF GTD order +} +POST/papi/v1/um/conditional/order + +Weight(Order): 1 + +Parameters: + +Name Type Mandatory Description +symbol STRING YES +side ENUM YES +positionSide ENUM NO Default BOTH for One-way Mode ; LONG or SHORT for Hedge Mode. It must be sent in Hedge Mode. +strategyType ENUM YES "STOP", "STOP_MARKET", "TAKE_PROFIT", "TAKE_PROFIT_MARKET", and "TRAILING_STOP_MARKET" +timeInForce ENUM NO +quantity DECIMAL NO +reduceOnly STRING NO "true" or "false". default "false". Cannot be sent in Hedge Mode ; cannot be sent with closePosition=true +price DECIMAL NO +workingType ENUM NO stopPrice triggered by: "MARK_PRICE", "CONTRACT_PRICE". Default "CONTRACT_PRICE" +priceProtect STRING NO "TRUE" or "FALSE", default "FALSE". Used with STOP/STOP_MARKET or TAKE_PROFIT/TAKE_PROFIT_MARKET orders +newClientStrategyId STRING NO A unique id among open orders. Automatically generated if not sent. Can only be string following the rule: ^[\.A-Z\:/a-z0-9_-]{1,32}$ +stopPrice DECIMAL NO Used with STOP/STOP_MARKET or TAKE_PROFIT/TAKE_PROFIT_MARKET orders. +activationPrice DECIMAL NO Used with TRAILING_STOP_MARKET orders, default as the mark price +callbackRate DECIMAL NO Used with TRAILING_STOP_MARKET orders, min 0.1, max 5 where 1 for 1% +selfTradePreventionMode ENUM NO NONE:No STP / EXPIRE_TAKER:expire taker order when STP triggers/ EXPIRE_MAKER:expire taker order when STP triggers/ EXPIRE_BOTH:expire both orders when STP triggers +goodTillDate LONG NO order cancel time for timeInForce GTD, mandatory when timeInforce set to GTD; order the timestamp only retains second-level precision, ms part will be ignored; The goodTillDate timestamp must be greater than the current time plus 600 seconds and smaller than 253402300799000Mode. It must be sent in Hedge Mode. +recvWindow LONG NO +timestamp LONG YES +Additional mandatory parameters based on type: + +Type Additional mandatory parameters +STOP/TAKE_PROFIT quantity, price, stopPrice +STOP_MARKET/TAKE_PROFIT_MARKET stopPrice +TRAILING_STOP_MARKET callbackRate +Order with type STOP/TAKE_PROFIT, parameter timeInForce can be sent ( default GTC). +Condition orders will be triggered when: +STOP, STOP_MARKET: +BUY: "MARK_PRICE" >= stopPrice +SELL: "MARK_PRICE" <= stopPrice +TAKE_PROFIT, TAKE_PROFIT_MARKET: +BUY: "MARK_PRICE" <= stopPrice +SELL: "MARK_PRICE" >= stopPrice +TRAILING_STOP_MARKET: +BUY: the lowest mark price after order placed <= activationPrice, and the latest mark price >= the lowest mark price * (1 + callbackRate) +SELL: the highest mark price after order placed >= activationPrice, and the latest mark price <= the highest mark price * (1 - callbackRate) +For TRAILING_STOP_MARKET, if you got such error code. {"code": -2021, "msg": "Order would immediately trigger."} means that the parameters you send do not meet the following requirements: +BUY: activationPrice should be smaller than latest mark price. +SELL: activationPrice should be larger than latest mark price. +Condition orders will be triggered when: + +If parameterpriceProtectis sent as true: +when price reaches the stopPrice ,the difference rate between "MARK_PRICE" and "CONTRACT_PRICE" cannot be larger than the "triggerProtect" of the symbol +"triggerProtect" of a symbol can be got from GET /fapi/v1/exchangeInfo +STOP, STOP_MARKET: +BUY: latest price ("MARK_PRICE" or "CONTRACT_PRICE") >= stopPrice +SELL: latest price ("MARK_PRICE" or "CONTRACT_PRICE") <= stopPrice +TAKE_PROFIT, TAKE_PROFIT_MARKET: +BUY: latest price ("MARK_PRICE" or "CONTRACT_PRICE") <= stopPrice +SELL: latest price ("MARK_PRICE" or "CONTRACT_PRICE") >= stopPrice +selfTradePreventionMode is only effective when timeInForce set to IOC or GTC or GTD. + +In extreme market conditions, timeInForce GTD order auto cancel time might be delayed comparing to goodTillDate + +New CM Conditional Order (TRADE) +Response: + +{ + "newClientStrategyId": "testOrder", + "strategyId":123445, + "strategyStatus":"NEW", + "strategyType": "TRAILING_STOP_MARKET", + "origQty": "10", + "price": "0", + "reduceOnly": false, + "side": "BUY", + "positionSide": "SHORT", + "stopPrice": "9300", // please ignore when order type is TRAILING_STOP_MARKET + "symbol": "BTCUSD_200925", + "pair": "BTCUSD", + "timeInForce": "GTC", + "activatePrice": "9020", // activation price, only return with TRAILING_STOP_MARKET order + "priceRate": "0.3", // callback rate, only return with TRAILING_STOP_MARKET order + "bookTime": 1566818724710, // order place time + "updateTime": 1566818724722 + "workingType":"CONTRACT_PRICE", + "priceProtect": false +} +POST /papi/v1/cm/conditional/order + +Weight(Order): 1 + +Parameters: + +Name Type Mandatory Description +symbol STRING YES +side ENUM YES +positionSide ENUM NO Default BOTH for One-way Mode ; LONG or SHORT for Hedge Mode. It must be sent in Hedge Mode. +strategyType ENUM YES "STOP", "STOP_MARKET", "TAKE_PROFIT", "TAKE_PROFIT_MARKET", and "TRAILING_STOP_MARKET" +timeInForce ENUM NO +quantity DECIMAL NO +reduceOnly STRING NO "true" or "false". default "false". Cannot be sent in Hedge Mode +price DECIMAL NO +workingType ENUM NO stopPrice triggered by: "MARK_PRICE", "CONTRACT_PRICE". Default "CONTRACT_PRICE" +priceProtect STRING NO "TRUE" or "FALSE", default "FALSE". Used with STOP/STOP_MARKET or TAKE_PROFIT/TAKE_PROFIT_MARKET orders +newClientStrategyId STRING NO A unique id among open orders. Automatically generated if not sent. Can only be string following the rule: ^[\.A-Z\:/a-z0-9_-]{1,36}$ +stopPrice DECIMAL NO Used with STOP/STOP_MARKET or TAKE_PROFIT/TAKE_PROFIT_MARKET orders. +activationPrice DECIMAL NO Used with TRAILING_STOP_MARKET orders, default as the mark price +callbackRate DECIMAL NO Used with TRAILING_STOP_MARKET orders, min 0.1, max 5 where 1 for 1% +recvWindow LONG NO +timestamp LONG YES +Additional mandatory parameters based on type: + +Type Additional mandatory parameters +STOP/TAKE_PROFIT quantity, price, stopPrice +STOP_MARKET/TAKE_PROFIT_MARKET stopPrice +TRAILING_STOP_MARKET callbackRate +Order with type STOP/TAKE_PROFIT, parameter timeInForce can be sent ( default GTC). +Condition orders will be triggered when: +STOP, STOP_MARKET: +BUY: "MARK_PRICE" >= stopPrice +SELL: "MARK_PRICE" <= stopPrice +TAKE_PROFIT, TAKE_PROFIT_MARKET: +BUY: "MARK_PRICE" <= stopPrice +SELL: "MARK_PRICE" >= stopPrice +TRAILING_STOP_MARKET: +BUY: the lowest mark price after order placed <= activationPrice, and the latest mark price >= the lowest mark price * (1 + callbackRate) +SELL: the highest mark price after order placed >= activationPrice, and the latest mark price <= the highest mark price * (1 - callbackRate) +For TRAILING_STOP_MARKET, if you got such error code. {"code": -2021, "msg": "Order would immediately trigger."} means that the parameters you send do not meet the following requirements: +BUY: activationPrice should be smaller than latest mark price. +SELL: activationPrice should be larger than latest mark price. +Condition orders will be triggered when: + +If parameterpriceProtectis sent as true: +when price reaches the stopPrice ,the difference rate between "MARK_PRICE" and "CONTRACT_PRICE" cannot be larger than the "triggerProtect" of the symbol +"triggerProtect" of a symbol can be got from GET /fapi/v1/exchangeInfo +STOP, STOP_MARKET: +BUY: latest price ("MARK_PRICE" or "CONTRACT_PRICE") >= stopPrice +SELL: latest price ("MARK_PRICE" or "CONTRACT_PRICE") <= stopPrice +TAKE_PROFIT, TAKE_PROFIT_MARKET: +BUY: latest price ("MARK_PRICE" or "CONTRACT_PRICE") <= stopPrice +SELL: latest price ("MARK_PRICE" or "CONTRACT_PRICE") >= stopPrice +Modify UM Order (TRADE) +Response: + +{ + "orderId": 20072994037, + "symbol": "BTCUSDT", + "status": "NEW", + "clientOrderId": "LJ9R4QZDihCaS8UAOOLpgW", + "price": "30005", + "avgPrice": "0.0", + "origQty": "1", + "executedQty": "0", + "cumQty": "0", + "cumQuote": "0", + "timeInForce": "GTC", + "type": "LIMIT", + "reduceOnly": false, + "side": "BUY", + "positionSide": "LONG", + "origType": "LIMIT", + "selfTradePreventionMode": "NONE", //self trading preventation mode + "goodTillDate": 0 //order pre-set auot cancel time for TIF GTD order + "updateTime": 1629182711600 +} +PUT /papi/v1/um/order (HMAC SHA256) + +Order modify function, currently only LIMIT order modification is supported, modified orders will be reordered in the match queue + +Weight(order): 1 + +Parameters: + +Name Type Mandatory Description +orderId LONG NO +origClientOrderId STRING NO +symbol STRING YES +side ENUM YES SELL, BUY +quantity DECIMAL YES Order quantity +price DECIMAL YES +recvWindow LONG NO +timestamp LONG YES +Either orderId or origClientOrderId must be sent, and the orderId will prevail if both are sent. +Both quantity and price must be sent +When the new quantity or price doesn't satisfy PRICE_FILTER / PERCENT_FILTER / LOT_SIZE, amendment will be rejected and the order will stay as it is. +However the order will be cancelled by the amendment in the following situations: +when the order is in partially filled status and the new quantity <= executedQty +When the order is GTX and the new price will cause it to be executed immediately +Modify CM Order (TRADE) +Response: + + +{ + "orderId": 20072994037, + "symbol": "BTCUSD_PERP", + "pair": "BTCUSD", + "status": "NEW", + "clientOrderId": "LJ9R4QZDihCaS8UAOOLpgW", + "price": "30005", + "avgPrice": "0.0", + "origQty": "1", + "executedQty": "0", + "cumQty": "0", + "cumBase": "0", + "timeInForce": "GTC", + "type": "LIMIT", + "reduceOnly": false, + "side": "BUY", + "positionSide": "LONG", + "origType": "LIMIT", + "updateTime": 1629182711600 +} +PUT/papi/v1/cm/order (HMAC SHA256) + +Order modify function, currently only LIMIT order modification is supported, modified orders will be reordered in the match queue + +Weight(order): 1 + +Parameters: + +Name Type Mandatory Description +orderId LONG NO +origClientOrderId STRING NO +symbol STRING YES +side ENUM YES SELL, BUY +quantity DECIMAL YES Order quantity +price DECIMAL YES +recvWindow LONG NO +timestamp LONG YES +Either orderId or origClientOrderId must be sent, and the orderId will prevail if both are sent. +Both quantity and price must be sent +When the new quantity or price doesn't satisfy PRICE_FILTER / PERCENT_FILTER / LOT_SIZE, amendment will be rejected and the order will stay as it is. +However the order will be cancelled by the amendment in the following situations: +when the order is in partially filled status and the new quantity <= executedQty +When the order is GTX and the new price will cause it to be executed immediately +Cancel Order +Cancel an active order/orders. + +Cancel UM Order (TRADE) +Response: + +{ + "avgPrice": "0.00000", + "clientOrderId": "myOrder1", + "cumQty": "0", + "cumQuote": "0", + "executedQty": "0", + "orderId": 4611875134427365377, + "origQty": "0.40", + "price": "0", + "reduceOnly": false, + "side": "BUY", + "positionSide": "SHORT", + "status": "CANCELED", + "symbol": "BTCUSDT", + "timeInForce": "GTC", + "type": "LIMIT", + "updateTime": 1571110484038, + "selfTradePreventionMode": "NONE", //self trading preventation mode + "goodTillDate": 0 +} +DELETE /papi/v1/um/order (HMAC SHA256) + +Cancel an active UM LIMIT order + +Weight: 1 + +Parameters: + +Name Type Mandatory Description +symbol STRING YES +orderId LONG NO +origClientOrderId STRING NO +recvWindow LONG NO +timestamp LONG YES +Either orderId or origClientOrderId must be sent. +Cancel All UM Open Orders (TRADE) +Response: + +{ + "code": 200, + "msg": "The operation of cancel all open order is done." +} +DELETE /papi/v1/um/allOpenOrders (HMAC SHA256) + +Cancel all active LIMIT orders on specific symbol + +Weight: 1 + +Parameters: + +Name Type Mandatory Description +symbol STRING YES +recvWindow LONG NO +timestamp LONG YES +Cancel CM Order (TRADE) +Response: + +{ + "avgPrice": "0.0", + "clientOrderId": "myOrder1", + "cumQty": "0", + "cumBase": "0", + "executedQty": "0", + "orderId": 283194212, + "origQty": "2", + "price": "0", + "reduceOnly": false, + "side": "BUY", + "positionSide": "SHORT", + "status": "CANCELED", + "symbol": "BTCUSD_200925", + "pair": "BTCUSD", + "timeInForce": "GTC", + "type": "LIMIT", + "updateTime": 1571110484038, +} +DELETE /papi/v1/cm/order (HMAC SHA256) + +Cancel an active LIMIT order + +Weight: 1 + +Parameters: + +Name Type Mandatory Description +symbol STRING YES +orderId LONG NO +origClientOrderId STRING NO +recvWindow LONG NO +timestamp LONG YES +Either orderId or origClientOrderId must be sent. +Cancel All CM Open Orders (TRADE) +Response: + +{ + "code": 200, + "msg": "The operation of cancel all open order is done." +} +DELETE /papi/v1/cm/allOpenOrders (HMAC SHA256) + +Cancel all active LIMIT orders on specific symbol + +Weight: 1 + +Parameters: + +Name Type Mandatory Description +symbol STRING YES +recvWindow LONG NO +timestamp LONG YES +Cancel Margin Account Order (TRADE) +Response: + +{ + "symbol": "LTCBTC", + "orderId": 28, + "origClientOrderId": "myOrder1", + "clientOrderId": "cancelMyOrder1", + "price": "1.00000000", + "origQty": "10.00000000", + "executedQty": "8.00000000", + "cummulativeQuoteQty": "8.00000000", + "status": "CANCELED", + "timeInForce": "GTC", + "type": "LIMIT", + "side": "SELL", + "selfTradePreventionMode": "EXPIRE_TAKER" +} +DELETE /papi/v1/margin/order (HMAC SHA256) + +Cancel Margin Account Order + +Weight: 2 + +Parameters: + +Name Type Mandatory Description +symbol STRING YES +orderId LONG NO +origClientOrderId STRING NO +newClientOrderId STRING NO Used to uniquely identify this cancel. Automatically generated by default. +recvWindow LONG NO The value cannot be greater than 60000 +timestamp LONG YES +Either orderId or origClientOrderId must be sent. +Cancel Margin Account All Open Orders on a Symbol (TRADE) +Response: + +[ + { + "symbol": "BTCUSDT", + "origClientOrderId": "E6APeyTJvkMvLMYMqu1KQ4", + "orderId": 11, + "orderListId": -1, + "clientOrderId": "pXLV6Hz6mprAcVYpVMTGgx", + "price": "0.089853", + "origQty": "0.178622", + "executedQty": "0.000000", + "cummulativeQuoteQty": "0.000000", + "status": "CANCELED", + "timeInForce": "GTC", + "type": "LIMIT", + "side": "BUY" + }, + { + "orderListId": 1929, + "contingencyType": "OCO", + "listStatusType": "ALL_DONE", + "listOrderStatus": "ALL_DONE", + "listClientOrderId": "2inzWQdDvZLHbbAmAozX2N", + "transactionTime": 1585230948299, + "symbol": "BTCUSDT", + "orders": [ + { + "symbol": "BTCUSDT", + "orderId": 20, + "clientOrderId": "CwOOIPHSmYywx6jZX77TdL" + }, + { + "symbol": "BTCUSDT", + "orderId": 21, + "clientOrderId": "461cPg51vQjV3zIMOXNz39" + } + ], + "orderReports": [ + { + "symbol": "BTCUSDT", + "origClientOrderId": "CwOOIPHSmYywx6jZX77TdL", + "orderId": 20, + "orderListId": 1929, + "clientOrderId": "pXLV6Hz6mprAcVYpVMTGgx", + "price": "0.668611", + "origQty": "0.690354", + "executedQty": "0.000000", + "cummulativeQuoteQty": "0.000000", + "status": "CANCELED", + "timeInForce": "GTC", + "type": "STOP_LOSS_LIMIT", + "side": "BUY", + "stopPrice": "0.378131", + "icebergQty": "0.017083", + "selfTradePreventionMode": "EXPIRE_TAKER" + }, + { + "symbol": "BTCUSDT", + "origClientOrderId": "461cPg51vQjV3zIMOXNz39", + "orderId": 21, + "orderListId": 1929, + "clientOrderId": "pXLV6Hz6mprAcVYpVMTGgx", + "price": "0.008791", + "origQty": "0.690354", + "executedQty": "0.000000", + "cummulativeQuoteQty": "0.000000", + "status": "CANCELED", + "timeInForce": "GTC", + "type": "LIMIT_MAKER", + "side": "BUY", + "icebergQty": "0.639962", + "selfTradePreventionMode": "EXPIRE_TAKER" + } + ] + } +] +DELETE /papi/v1/margin/allOpenOrders (HMAC SHA256) + +Weight: 5 + +Parameters: + +Name Type Mandatory Description +symbol STRING YES +recvWindow LONG NO The value cannot be greater than 60000 +timestamp LONG YES +Cancel Margin Account OCO Orders(TRADE) +Response: + +{ + "orderListId": 0, + "contingencyType": "OCO", + "listStatusType": "ALL_DONE", + "listOrderStatus": "ALL_DONE", + "listClientOrderId": "C3wyj4WVEktd7u9aVBRXcN", + "transactionTime": 1574040868128, + "symbol": "LTCBTC", + "orders": [ + { + "symbol": "LTCBTC", + "orderId": 2, + "clientOrderId": "pO9ufTiFGg3nw2fOdgeOXa" + }, + { + "symbol": "LTCBTC", + "orderId": 3, + "clientOrderId": "TXOvglzXuaubXAaENpaRCB" + } + ], + "orderReports": [ + { + "symbol": "LTCBTC", + "origClientOrderId": "pO9ufTiFGg3nw2fOdgeOXa", + "orderId": 2, + "orderListId": 0, + "clientOrderId": "unfWT8ig8i0uj6lPuYLez6", + "price": "1.00000000", + "origQty": "10.00000000", + "executedQty": "0.00000000", + "cummulativeQuoteQty": "0.00000000", + "status": "CANCELED", + "timeInForce": "GTC", + "type": "STOP_LOSS_LIMIT", + "side": "SELL", + "stopPrice": "1.00000000", + "selfTradePreventionMode": "EXPIRE_BOTH" + }, + { + "symbol": "LTCBTC", + "origClientOrderId": "TXOvglzXuaubXAaENpaRCB", + "orderId": 3, + "orderListId": 0, + "clientOrderId": "unfWT8ig8i0uj6lPuYLez6", + "price": "3.00000000", + "origQty": "10.00000000", + "executedQty": "0.00000000", + "cummulativeQuoteQty": "0.00000000", + "status": "CANCELED", + "timeInForce": "GTC", + "type": "LIMIT_MAKER", + "side": "SELL", + "stopPrice": "1.00000000", + "selfTradePreventionMode": "EXPIRE_BOTH" + } + ] +} +DELETE /papi/v1/margin/orderList (HMAC SHA256) + +Cancel Margin Account OCO Orders + +Weight: 2 + +Parameters: + +Name Type Mandatory Description +symbol STRING YES +orderListId LONG NO Either orderListId or listClientOrderId must be provided +listClientOrderId STRING NO Either orderListId or listClientOrderId must be provided +newClientOrderId STRING NO Used to uniquely identify this cancel. Automatically generated by default +recvWindow LONG NO The value cannot be greater than 60000 +timestamp LONG YES +Additional notes: Canceling an individual leg will cancel the entire OCO +Cancel UM Conditional Order (TRADE) +Response: + +{ + "newClientStrategyId": "myOrder1", + "strategyId":123445, + "strategyStatus":"CANCELED", + "strategyType": "TRAILING_STOP_MARKET", + "origQty": "11", + "price": "0", + "reduceOnly": false, + "side": "BUY", + "positionSide": "SHORT", + "stopPrice": "9300", // please ignore when order type is TRAILING_STOP_MARKET + "symbol": "BTCUSDT", + "timeInForce": "GTC", + "activatePrice": "9020", // activation price, only return with TRAILING_STOP_MARKET order + "priceRate": "0.3", // callback rate, only return with TRAILING_STOP_MARKET order + "bookTime": 1566818724710, + "updateTime": 1566818724722, + "workingType":"CONTRACT_PRICE", + "priceProtect": false, + "selfTradePreventionMode": "NONE", //self trading preventation mode + "goodTillDate": 0 +} +DELETE /papi/v1/um/conditional/order (HMAC SHA256) + +Weight: 1 + +Parameters: + +Name Type Mandatory Description +symbol STRING YES +strategyId LONG NO +newClientStrategyId STRING NO +recvWindow LONG NO +timestamp LONG YES +Either strategyId or newClientStrategyId must be sent. +Cancel All UM Open Conditional Orders (TRADE) +Response: + +{ + "code": "200", + "msg": "The operation of cancel all conditional open order is done." +} +DELETE /papi/v1/um/conditional/allOpenOrders (HMAC SHA256) + +Weight: 1 + +Parameters: + +Name Type Mandatory Description +symbol STRING YES +recvWindow LONG NO +timestamp LONG YES +Cancel CM Conditional Order (TRADE) +Response: + +{ + "newClientStrategyId": "myOrder1", + "strategyId":123445, + "strategyStatus":"CANCELED", + "strategyType": "TRAILING_STOP_MARKET", + "origQty": "11", + "price": "0", + "reduceOnly": false, + "side": "BUY", + "positionSide": "SHORT", + "stopPrice": "9300", // please ignore when order type is TRAILING_STOP_MARKET + "symbol": "BTCUSD", + "timeInForce": "GTC", + "activatePrice": "9020", // activation price, only return with TRAILING_STOP_MARKET order + "priceRate": "0.3", // callback rate, only return with TRAILING_STOP_MARKET order + "bookTime": 1566818724710, + "updateTime": 1566818724722, + "workingType":"CONTRACT_PRICE", + "priceProtect": false +} +DELETE /papi/v1/cm/conditional/order (HMAC SHA256) + +Weight: 1 + +Parameters: + +Name Type Mandatory Description +symbol STRING YES +strategyId LONG NO +newClientStrategyId STRING NO +recvWindow LONG NO +timestamp LONG YES +Either strategyId or newClientStrategyId must be sent. +Cancel All CM Open Conditional Orders (TRADE) +Response: + +{ + "code": "200", + "msg": "The operation of cancel all conditional open order is done." +} +DELETE /papi/v1/cm/conditional/allOpenOrders (HMAC SHA256) + +Weight: 1 + +Parameters: + +Name Type Mandatory Description +symbol STRING YES +recvWindow LONG NO +timestamp LONG YES +Query Order +Query UM Order (USER_DATA) +Response: + +{ + "avgPrice": "0.00000", + "clientOrderId": "abc", + "cumQuote": "0", + "executedQty": "0", + "orderId": 1917641, + "origQty": "0.40", + "origType": "LIMIT", + "price": "0", + "reduceOnly": false, + "side": "BUY", + "positionSide": "SHORT", + "status": "NEW", + "symbol": "BTCUSDT", + "time": 1579276756075, // order time + "timeInForce": "GTC", + "type": "LIMIT", + "updateTime": 1579276756075, // update time + "selfTradePreventionMode": "NONE", //self trading preventation mode + "goodTillDate": 0 +} +GET /papi/v1/um/order (HMAC SHA256) + +Check an UM order's status. + +Weight: 1 + +Parameters: + +Name Type Mandatory Description +symbol STRING YES +orderId LONG NO +origClientOrderId STRING NO +recvWindow LONG NO +timestamp LONG YES +Notes: * Either orderId or origClientOrderId must be sent. * These orders will not be found: * order status is CANCELED or EXPIRED, AND * order has NO filled trade, AND * created time + 3 days < current time + +Query Current UM Open Order (USER_DATA) +Response: + +{ + "avgPrice": "0.00000", + "clientOrderId": "abc", + "cumQuote": "0", + "executedQty": "0", + "orderId": 1917641, + "origQty": "0.40", + "origType": "LIMIT", + "price": "0", + "reduceOnly": false, + "side": "BUY", + "positionSide": "SHORT", + "status": "NEW", + "symbol": "BTCUSDT", + "time": 1579276756075, // order time + "timeInForce": "GTC", + "type": "LIMIT", + "updateTime": 1579276756075, + "selfTradePreventionMode": "NONE", //self trading preventation mode + "goodTillDate": 0 +} +GET /papi/v1/um/openOrder (HMAC SHA256) + +Query current UM open order + +Weight: 1 + +Parameters: + +Name Type Mandatory Description +symbol STRING YES +orderId LONG NO +origClientOrderId STRING NO +recvWindow LONG NO +timestamp LONG YES +Notes: * Either orderId or origClientOrderId must be sent. * If the queried order has been filled or cancelled, the error message "Order does not exist" will be returned. + +Query All Current UM Open Orders (USER_DATA) +Response: + +[ + { + "avgPrice": "0.00000", + "clientOrderId": "abc", + "cumQuote": "0", + "executedQty": "0", + "orderId": 1917641, + "origQty": "0.40", + "origType": "LIMIT", + "price": "0", + "reduceOnly": false, + "side": "BUY", + "positionSide": "SHORT", + "status": "NEW", + "symbol": "BTCUSDT", + "time": 1579276756075, // order time + "timeInForce": "GTC", + "type": "LIMIT", + "updateTime": 1579276756075, // update time + "selfTradePreventionMode": "NONE", //self trading preventation mode + "goodTillDate": 0 + } +] +GET /papi/v1/um/openOrders (HMAC SHA256) + +Get all open orders on a symbol. Careful when accessing this with no symbol. + +Weight: 1 for a single symbol; 40 when the symbol parameter is omitted + +Parameters: + +Name Type Mandatory Description +symbol STRING NO +recvWindow LONG NO +timestamp LONG YES +Notes: * If the symbol is not sent, orders for all symbols will be returned in an array. + +Query All UM Orders (USER_DATA) +Response: + +[ + { + "avgPrice": "0.00000", + "clientOrderId": "abc", + "cumQuote": "0", + "executedQty": "0", + "orderId": 1917641, + "origQty": "0.40", + "origType": "LIMIT", + "price": "0", + "reduceOnly": false, + "side": "BUY", + "positionSide": "SHORT", + "status": "NEW", + "symbol": "BTCUSDT", + "time": 1579276756075, // order time + "timeInForce": "GTC", + "type": "LIMIT", + "updateTime": 1579276756075, // update time + "selfTradePreventionMode": "NONE", //self trading preventation mode + "goodTillDate": 0 + } +] +GET /papi/v1/um/allOrders (HMAC SHA256) + +Get all account UM orders; active, canceled, or filled. + +These orders will not be found: +order status is CANCELED or EXPIRED, AND +order has NO filled trade, AND +created time + 3 days < current time +Weight: 5 + +Parameters: + +Name Type Mandatory Description +symbol STRING YES +orderId LONG NO +startTime LONG NO +endTime LONG NO +limit INT NO Default 500; max 1000. +recvWindow LONG NO +timestamp LONG YES +If orderId is set, it will get orders >= that orderId. Otherwise most recent orders are returned. +The query time period must be less then 7 days( default as the recent 7 days). +Query CM Order (USER_DATA) +Response: + +{ + "avgPrice": "0.0", + "clientOrderId": "abc", + "cumBase": "0", + "executedQty": "0", + "orderId": 1917641, + "origQty": "0.40", + "origType": "LIMIT", + "price": "0", + "reduceOnly": false, + "side": "BUY", + "status": "NEW", + "symbol": "BTCUSD_200925", + "pair": "BTCUSD", + "positionSide": "SHORT", + "time": 1579276756075, // order time + "timeInForce": "GTC", + "type": "LIMIT", + "updateTime": 1579276756075 // update time +} +GET /papi/v1/cm/order (HMAC SHA256) + +Check an CM order's status. + +Weight: 1 + +Parameters: + +Name Type Mandatory Description +symbol STRING YES +orderId LONG NO +origClientOrderId STRING NO +recvWindow LONG NO +timestamp LONG YES +Notes: * Either orderId or origClientOrderId must be sent. * These orders will not be found: * order status is CANCELED or EXPIRED, AND * order has NO filled trade, AND * created time + 3 days < current time + +Query Current CM Open Order (USER_DATA) +Response: + +{ + "avgPrice": "0.0", + "clientOrderId": "abc", + "cumBase": "0", + "executedQty": "0", + "orderId": 1917641, + "origQty": "0.40", + "origType": "LIMIT", + "price": "0", + "reduceOnly": false, + "side": "BUY", + "positionSide": "SHORT", + "status": "NEW", + "symbol": "BTCUSD_200925", + "pair": "BTCUSD" + "time": 1579276756075, // order time + "timeInForce": "GTC", + "type": "LIMIT", + "updateTime": 1579276756075 // update time +} +GET /papi/v1/cm/openOrder (HMAC SHA256) + +Query current CM open order + +Weight: 1 + +Parameters: + +Name Type Mandatory Description +symbol STRING YES +orderId LONG NO +origClientOrderId STRING NO +recvWindow LONG NO +timestamp LONG YES +Notes: * Either orderId or origClientOrderId must be sent. * If the queried order has been filled or cancelled, the error message "Order does not exist" will be returned. + +Query All Current CM Open Orders (USER_DATA) +Response: + +[ + { + "avgPrice": "0.0", + "clientOrderId": "abc", + "cumBase": "0", + "executedQty": "0", + "orderId": 1917641, + "origQty": "0.40", + "origType": "LIMIT", + "price": "0", + "reduceOnly": false, + "side": "BUY", + "positionSide": "SHORT", + "status": "NEW", + "symbol": "BTCUSD_200925", + "pair":"BTCUSD", + "time": 1579276756075, // order time + "timeInForce": "GTC", + "type": "LIMIT", + "updateTime": 1579276756075 // update time + } +] +GET /papi/v1/cm/openOrders (HMAC SHA256) + +Get all open orders on a symbol. Careful when accessing this with no symbol. + +Weight: + +1 for a single symbol; 40 when the symbol parameter is omitted + +Parameters: + +Name Type Mandatory Description +symbol STRING NO +pair STRING NO +recvWindow LONG NO +timestamp LONG YES +Notes: * If the symbol is not sent, orders for all symbols will be returned in an array. + +Query All CM Orders (USER_DATA) +Response: + +[ + { + "avgPrice": "0.0", + "clientOrderId": "abc", + "cumBase": "0", + "executedQty": "0", + "orderId": 1917641, + "origQty": "0.40", + "origType": "LIMIT", + "price": "0", + "reduceOnly": false, + "side": "BUY", + "positionSide": "SHORT", + "status": "NEW", + "symbol": "BTCUSD_200925", + "pair": "BTCUSD", + "time": 1579276756075, // order time + "timeInForce": "GTC", + "type": "LIMIT", + "updateTime": 1579276756075 // update time + } +] +GET /papi/v1/cm/allOrders (HMAC SHA256) + +Get all account CM orders; active, canceled, or filled. + +Weight: + +20 with symbol 40 with pair + +Parameters: + +Name Type Mandatory Description +symbol STRING YES +pair STRING NO +orderId LONG NO +startTime LONG NO +endTime LONG NO +limit INT NO Default 50; max 100. +recvWindow LONG NO +timestamp LONG YES +Either symbol or pair must be sent. +If orderId is set, it will get orders >= that orderId. Otherwise most recent orders are returned. +These orders will not be found: +order status is CANCELED or EXPIRED, AND +order has NO filled trade, AND +created time + 3 days < current time +Query Current UM Open Conditional Order (USER_DATA) +Response: + +{ + "newClientStrategyId": "abc", + "strategyId":123445, + "strategyStatus":"NEW", + "strategyType": "TRAILING_STOP_MARKET", + "origQty": "0.40", + "price": "0", + "reduceOnly": false, + "side": "BUY", + "positionSide": "SHORT", + "stopPrice": "9300", // please ignore when order type is TRAILING_STOP_MARKET + "symbol": "BTCUSDT", + "bookTime": 1566818724710, // order time + "updateTime": 1566818724722, + "timeInForce": "GTC", + "activatePrice": "9020", // activation price, only return with TRAILING_STOP_MARKET order + "priceRate": "0.3", // callback rate, only return with TRAILING_STOP_MARKET order + "selfTradePreventionMode": "NONE", //self trading preventation mode + "goodTillDate": 0 +} +GET /papi/v1/um/conditional/openOrder (HMAC SHA256) + +Weight: 1 + +Parameters: + +Name Type Mandatory Description +symbol STRING YES +strategyId LONG NO +newClientStrategyId STRING NO +recvWindow LONG NO +timestamp LONG YES +Notes: * Either strategyId or newClientStrategyId must be sent. * If the queried order has been CANCELED, TRIGGERED或EXPIRED, the error message "Order does not exist" will be returned. + +Query All Current UM Open Conditional Orders (USER_DATA) +Response: + +[ + { + "newClientStrategyId": "abc", + "strategyId":123445, + "strategyStatus":"NEW", + "strategyType": "TRAILING_STOP_MARKET", + "origQty": "0.40", + "price": "0", + "reduceOnly": false, + "side": "BUY", + "positionSide": "SHORT", + "stopPrice": "9300", // please ignore when order type is TRAILING_STOP_MARKET + "symbol": "BTCUSDT", + "bookTime": 1566818724710, // order time + "updateTime": 1566818724722, + "timeInForce": "GTC", + "activatePrice": "9020", // activation price, only return with TRAILING_STOP_MARKET order + "priceRate": "0.3", // callback rate, only return with TRAILING_STOP_MARKET order + "selfTradePreventionMode": "NONE", //self trading preventation mode + "goodTillDate": 0 + } +] +GET /papi/v1/um/conditional/openOrders (HMAC SHA256) + +Get all open conditional orders on a symbol. Careful when accessing this with no symbol. + +Weight: 1 for a single symbol; 40 when the symbol parameter is omitted + +Parameters: + +Name Type Mandatory Description +symbol STRING NO +recvWindow LONG NO +timestamp LONG YES +Notes: * If the symbol is not sent, orders for all symbols will be returned in an array. + +Query UM Conditional Order History (USER_DATA) +Response: + +{ + "newClientStrategyId": "abc", + "strategyId":123445, + "strategyStatus":"TRIGGERED", + "strategyType": "TRAILING_STOP_MARKET", + "origQty": "0.40", + "price": "0", + "reduceOnly": false, + "side": "BUY", + "positionSide": "SHORT", + "stopPrice": "9300", // please ignore when order type is TRAILING_STOP_MARKET + "symbol": "BTCUSDT", + "orderId":12132343435, //Normal orderID after trigger if appliable,only have when the strategy is triggered + "status": "NEW", //Normal order status after trigger if appliable, only have when the strategy is triggered + "bookTime": 1566818724710, // order time + "updateTime": 1566818724722, + "triggerTime": 1566818724750, + "timeInForce": "GTC", + "type": "MARKET", //Normal order type after trigger if appliable + "activatePrice": "9020", // activation price, only return with TRAILING_STOP_MARKET order + "priceRate": "0.3", // callback rate, only return with TRAILING_STOP_MARKET order + "workingType":"CONTRACT_PRICE", + "priceProtect": false, + "selfTradePreventionMode": "NONE", //self trading preventation mode + "goodTillDate": 0 +} +GET /papi/v1/um/conditional/orderHistory (HMAC SHA256) + +Weight: 1 + +Parameters: + +Name Type Mandatory Description +symbol STRING YES +strategyId LONG NO +newClientStrategyId STRING NO +recvWindow LONG NO +timestamp LONG YES +Notes: * Either strategyId or newClientStrategyId must be sent. * NEW orders will not be found. * These orders will not be found: * order status is CANCELED or EXPIRED, AND * order has NO filled trade, AND * created time + 7 days < current time + +Query All UM Conditional Orders (USER_DATA) +Response: + +[ + { + "newClientStrategyId": "abc", + "strategyId":123445, + "strategyStatus":"TRIGGERED", + "strategyType": "TRAILING_STOP_MARKET", + "origQty": "0.40", + "price": "0", + "reduceOnly": false, + "side": "BUY", + "positionSide": "SHORT", + "stopPrice": "9300", // please ignore when order type is TRAILING_STOP_MARKET + "symbol": "BTCUSDT", + "orderId":12132343435, //Normal orderID after trigger if appliable, only have when the strategy is triggered + "status": "NEW", //Normal order status after trigger if appliable, only have when the strategy is triggered + "bookTime": 1566818724710, // order time + "updateTime": 1566818724722, + "triggerTime": 1566818724750, + "timeInForce": "GTC", + "type": "MARKET", //Normal order type after trigger if appliable + "activatePrice": "9020", // activation price, only return with TRAILING_STOP_MARKET order + "priceRate": "0.3", // callback rate, only return with TRAILING_STOP_MARKET order + "selfTradePreventionMode": "NONE", //self trading preventation mode + "goodTillDate": 0 + } +] +GET /papi/v1/um/conditional/allOrders (HMAC SHA256) + +Weight: 1 for a single symbol; 40 when the symbol parameter is omitted + +Parameters: + +Name Type Mandatory Description +symbol STRING NO +strategyId LONG NO +startTime LONG NO +endTime LONG NO +limit INT NO Default 500; max 1000. +recvWindow LONG NO +timestamp LONG YES +Notes: * These orders will not be found: * order strategyStatus is CANCELED or EXPIRED, AND * order has NO filled trade, AND * created time + 7 days < current time * The query time period must be less than 7 days( default as the recent 7 days). + +Query Current CM Open Conditional Order (USER_DATA) +Response: + +{ + "newClientStrategyId": "abc", + "strategyId":123445, + "strategyStatus":"NEW", + "strategyType": "TRAILING_STOP_MARKET", + "origQty": "0.40", + "price": "0", + "reduceOnly": false, + "side": "BUY", + "positionSide": "SHORT", + "stopPrice": "9300", // please ignore when order type is TRAILING_STOP_MARKET + "symbol": "BTCUSD", + "bookTime": 1566818724710, // order time + "updateTime": 1566818724722, + "timeInForce": "GTC", + "activatePrice": "9020", // activation price, only return with TRAILING_STOP_MARKET order + "priceRate": "0.3" // callback rate, only return with TRAILING_STOP_MARKET order +} +GET /papi/v1/cm/conditional/openOrder (HMAC SHA256) + +Weight: 1 + +Parameters: + +Name Type Mandatory Description +symbol STRING YES +strategyId LONG NO +newClientStrategyId STRING NO +recvWindow LONG NO +timestamp LONG YES +Notes: * Either strategyId or newClientStrategyId must be sent. * If the queried order has been triggered, cancelled or expired, the error message "Order does not exist" will be returned. + +Query All Current CM Open Conditional Orders (USER_DATA) +Response: + +[ + { + "newClientStrategyId": "abc", + "strategyId":123445, + "strategyStatus":"NEW", + "strategyType": "TRAILING_STOP_MARKET", + "origQty": "0.40", + "price": "0", + "reduceOnly": false, + "side": "BUY", + "positionSide": "SHORT", + "stopPrice": "9300", // please ignore when order type is TRAILING_STOP_MARKET + "symbol": "BTCUSD", + "bookTime": 1566818724710, // order time + "updateTime": 1566818724722, + "timeInForce": "GTC", + "activatePrice": "9020", // activation price, only return with TRAILING_STOP_MARKET order + "priceRate": "0.3" // callback rate, only return with TRAILING_STOP_MARKET order + } +] +GET /papi/v1/cm/conditional/openOrders (HMAC SHA256) + +Get all open conditional orders on a symbol. Careful when accessing this with no symbol. + +Weight: 1 for a single symbol; 40 when the symbol parameter is omitted + +Parameters: + +Name Type Mandatory Description +symbol STRING NO +recvWindow LONG NO +timestamp LONG YES +Notes: * If the symbol is not sent, orders for all symbols will be returned in an array. + +Query CM Conditional Order History (USER_DATA) +Response: + +{ + "newClientStrategyId": "abc", + "strategyId":123445, + "strategyStatus":"TRIGGERED", + "strategyType": "TRAILING_STOP_MARKET", + "origQty": "0.40", + "price": "0", + "reduceOnly": false, + "side": "BUY", + "positionSide": "SHORT", + "stopPrice": "9300", // please ignore when order type is TRAILING_STOP_MARKET + "symbol": "BTCUSD", + "orderId": 12123343534, //Normal orderID after trigger if appliable,only have when the strategy is triggered + "status": "NEW", //Normal order status after trigger if appliable, only have when the strategy is triggered + "bookTime": 1566818724710, // order time + "updateTime": 1566818724722, + "triggerTime": 1566818724750, + "timeInForce": "GTC", + "type": "MARKET", //Normal order type after trigger if appliable + "activatePrice": "9020", // activation price, only return with TRAILING_STOP_MARKET order + "priceRate": "0.3" // callback rate, only return with TRAILING_STOP_MARKET order + "workingType":"CONTRACT_PRICE", + "priceProtect": false +} +GET /papi/v1/cm/conditional/orderHistory (HMAC SHA256) + +Weight: 1 + +Parameters: + +Name Type Mandatory Description +symbol STRING YES +strategyId LONG NO +newClientStrategyId STRING NO +recvWindow LONG NO +timestamp LONG YES +Notes: * Either strategyId or newClientStrategyId must be sent. * NEW orders will not be found. * These orders will not be found: * order status is CANCELED or EXPIRED, AND * order has NO filled trade, AND * created time + 7 days < current time + +Query All CM Conditional Orders (USER_DATA) +Response: + +[ + { + "newClientStrategyId": "abc", + "strategyId":123445, + "strategyStatus":"TRIGGERED", + "strategyType": "TRAILING_STOP_MARKET", + "origQty": "0.40", + "price": "0", + "reduceOnly": false, + "side": "BUY", + "positionSide": "SHORT", + "stopPrice": "9300", // please ignore when order type is TRAILING_STOP_MARKET + "symbol": "BTCUSD", + "orderId": 12123343534, //Normal orderID after trigger if appliable, only have when the strategy is triggered + "status": "NEW", //Normal order status after trigger if appliable, only have when the strategy is triggered + "bookTime": 1566818724710, // order time + "updateTime": 1566818724722, + "triggerTime": 1566818724750, + "timeInForce": "GTC", + "type": "MARKET", //Normal order type after trigger if appliable + "activatePrice": "9020", // activation price, only return with TRAILING_STOP_MARKET order + "priceRate": "0.3" // callback rate, only return with TRAILING_STOP_MARKET order + } +] +GET /papi/v1/cm/conditional/allOrders + +Weight: 1 for a single symbol; 40 when the symbol parameter is omitted + +Parameters: + +Name Type Mandatory Description +symbol STRING NO +strategyId LONG NO +startTime LONG NO +endTime LONG NO +limit INT NO Default 500; max 1000. +recvWindow LONG NO +timestamp LONG YES +Notes: * These orders will not be found: * order strategyStatus is CANCELED or EXPIRED, AND * order has NO filled trade, AND * created time + 7 days < current time * The query time period must be less than 7 days( default as the recent 7 days). + +Query Margin Account Order (USER_DATA) +Response: + +{ + "clientOrderId": "ZwfQzuDIGpceVhKW5DvCmO", + "cummulativeQuoteQty": "0.00000000", + "executedQty": "0.00000000", + "icebergQty": "0.00000000", + "isWorking": true, + "orderId": 213205622, + "origQty": "0.30000000", + "price": "0.00493630", + "side": "SELL", + "status": "NEW", + "stopPrice": "0.00000000", + "symbol": "BNBBTC", + "time": 1562133008725, + "timeInForce": "GTC", + "type": "LIMIT", + "updateTime": 1562133008725, + "accountId": 152950866, + "selfTradePreventionMode": "EXPIRE_TAKER", + "preventedMatchId": null, + "preventedQuantity": null +} +GET /papi/v1/margin/order + +Weight: 5 + +Parameters: + +Name Type Mandatory Description +symbol STRING YES +orderId LONG NO +origClientOrderId STRING NO +recvWindow LONG NO The value cannot be greater than 60000 +timestamp LONG YES +Either orderId or origClientOrderId must be sent. +For some historical orders cummulativeQuoteQty will be < 0, meaning the data is not available at this time. +Query Current Margin Open Order (USER_DATA) +Response: + +[ + { + "clientOrderId": "qhcZw71gAkCCTv0t0k8LUK", + "cummulativeQuoteQty": "0.00000000", + "executedQty": "0.00000000", + "icebergQty": "0.00000000", + "isWorking": true, + "orderId": 211842552, + "origQty": "0.30000000", + "price": "0.00475010", + "side": "SELL", + "status": "NEW", + "stopPrice": "0.00000000", + "symbol": "BNBBTC", + "time": 1562040170089, + "timeInForce": "GTC", + "type": "LIMIT", + "updateTime": 1562040170089, + "accountId": 152950866, + "selfTradePreventionMode": "EXPIRE_TAKER", + "preventedMatchId": null, + "preventedQuantity": null + } +] +GET /papi/v1/margin/openOrders (HMAC SHA256) + +Weight: 5 + +Parameters: + +Name Type Mandatory Description +symbol STRING NO +recvWindow LONG NO The value cannot be greater than 60000 +timestamp LONG YES +Notes: * If the symbol is not sent, orders for all symbols will be returned in an array. * When all symbols are returned, the number of requests counted against the rate limiter is equal to the number of symbols currently trading on the exchange. + +Query All Margin Account Orders (USER_DATA) +Response: + +[ + { + "clientOrderId": "D2KDy4DIeS56PvkM13f8cP", + "cummulativeQuoteQty": "0.00000000", + "executedQty": "0.00000000", + "icebergQty": "0.00000000", + "isWorking": false, + "orderId": 41295, + "origQty": "5.31000000", + "price": "0.22500000", + "side": "SELL", + "status": "CANCELED", + "stopPrice": "0.18000000", + "symbol": "BNBBTC", + "time": 1565769338806, + "timeInForce": "GTC", + "type": "TAKE_PROFIT_LIMIT", + "updateTime": 1565769342148, + "accountId": 152950866, + "selfTradePreventionMode": "EXPIRE_TAKER", + "preventedMatchId": null, + "preventedQuantity": null + } +] +GET /papi/v1/margin/allOrders (HMAC SHA256) + +Weight: 100 + +Request Limit: 60times/min per IP + +Parameters: + +Name Type Mandatory Description +symbol STRING YES +orderId LONG NO +startTime LONG NO +endTime LONG NO +limit INT NO Default 500; max 500. +recvWindow LONG NO The value cannot be greater than 60000 +timestamp LONG YES +If orderId is set, it will get orders >= that orderId. Otherwise most recent orders are returned. +For some historical orders cummulativeQuoteQty will be < 0, meaning the data is not available at this time. +Query Margin Account's OCO (USER_DATA) +Response: + +{ + "orderListId": 27, + "contingencyType": "OCO", + "listStatusType": "EXEC_STARTED", + "listOrderStatus": "EXECUTING", + "listClientOrderId": "h2USkA5YQpaXHPIrkd96xE", + "transactionTime": 1565245656253, + "symbol": "LTCBTC", + "orders": [ + { + "symbol": "LTCBTC", + "orderId": 4, + "clientOrderId": "qD1gy3kc3Gx0rihm9Y3xwS" + }, + { + "symbol": "LTCBTC", + "orderId": 5, + "clientOrderId": "ARzZ9I00CPM8i3NhmU9Ega" + } + ] +} +GET /papi/v1/margin/orderList (HMAC SHA256) + +Retrieves a specific OCO based on provided optional parameters + +Weight: 5 + +Parameters: + +Name Type Mandatory Description +orderListId LONG NO Either orderListId or origClientOrderId must be provided +origClientOrderId STRING NO Either orderListId or origClientOrderId must be provided +recvWindow LONG NO The value cannot be greater than 60000 +timestamp LONG YES +Query Margin Account's all OCO (USER_DATA) +Response: + + +[ + { + "orderListId": 29, + "contingencyType": "OCO", + "listStatusType": "EXEC_STARTED", + "listOrderStatus": "EXECUTING", + "listClientOrderId": "amEEAXryFzFwYF1FeRpUoZ", + "transactionTime": 1565245913483, + "symbol": "LTCBTC", + "orders": [ + { + "symbol": "LTCBTC", + "orderId": 4, + "clientOrderId": "oD7aesZqjEGlZrbtRpy5zB" + }, + { + "symbol": "LTCBTC", + "orderId": 5, + "clientOrderId": "Jr1h6xirOxgeJOUuYQS7V3" + } + ] + }, + { + "orderListId": 28, + "contingencyType": "OCO", + "listStatusType": "EXEC_STARTED", + "listOrderStatus": "EXECUTING", + "listClientOrderId": "hG7hFNxJV6cZy3Ze4AUT4d", + "transactionTime": 1565245913407, + "symbol": "LTCBTC", + "orders": [ + { + "symbol": "LTCBTC", + "orderId": 2, + "clientOrderId": "j6lFOfbmFMRjTYA7rRJ0LP" + }, + { + "symbol": "LTCBTC", + "orderId": 3, + "clientOrderId": "z0KCjOdditiLS5ekAFtK81" + } + ] + } +] +GET /papi/v1/margin/allOrderList (HMAC SHA256) + +Query all OCO for a specific margin account based on provided optional parameters + +Weight: 100 + +Parameters: + +Name Type Mandatory Description +fromId LONG NO If supplied, neither startTime or endTime can be provided +startTime LONG NO +endTime LONG NO +limit INT NO Default Value: 500; Max Value: 1000 +recvWindow LONG NO The value cannot be greater than 60000 +timestamp LONG YES +Query Margin Account's Open OCO (USER_DATA) +Response: + +[ + { + "orderListId": 31, + "contingencyType": "OCO", + "listStatusType": "EXEC_STARTED", + "listOrderStatus": "EXECUTING", + "listClientOrderId": "wuB13fmulKj3YjdqWEcsnp", + "transactionTime": 1565246080644, + "symbol": "LTCBTC", + "orders": [ + { + "symbol": "LTCBTC", + "orderId": 4, + "clientOrderId": "r3EH2N76dHfLoSZWIUw1bT" + }, + { + "symbol": "LTCBTC", + "orderId": 5, + "clientOrderId": "Cv1SnyPD3qhqpbjpYEHbd2" + } + ] + } +] +GET /papi/v1/margin/openOrderList (HMAC SHA256) + +Weight: 5 + +Parameters: + +Name Type Mandatory Description +recvWindow LONG NO The value cannot be greater than 60000 +timestamp LONG YES +Margin Account Trade List (USER_DATA) +Response: + +[ + { + "commission": "0.00006000", + "commissionAsset": "BTC", + "id": 34, + "isBestMatch": true, + "isBuyer": false, + "isMaker": false, + "orderId": 39324, + "price": "0.02000000", + "qty": "3.00000000", + "symbol": "BNBBTC", + "time": 1561973357171 + } +] +GET /papi/v1/margin/myTrades (HMAC SHA256) + +Weight: 5 + +Parameters: + +Name Type Mandatory Description +symbol STRING YES +orderId LONG NO +startTime LONG NO +endTime LONG NO +fromId LONG NO TradeId to fetch from. Default gets most recent trades. +limit INT NO Default 500; max 1000. +recvWindow LONG NO The value cannot be greater than 60000 +timestamp LONG YES +If fromId is set, it will get trades >= that fromId. Otherwise most recent trades are returned. +Query UM Modify Order History (TRADE) +Response: + +[ + { + "amendmentId": 5363, // Order modification ID + "symbol": "BTCUSDT", + "pair": "BTCUSDT", + "orderId": 20072994037, + "clientOrderId": "LJ9R4QZDihCaS8UAOOLpgW", + "time": 1629184560899, // Order modification time + "amendment": { + "price": { + "before": "30004", + "after": "30003.2" + }, + "origQty": { + "before": "1", + "after": "1" + }, + "count": 3 // Order modification count, representing the number of times the order has been modified + } + }, + { + "amendmentId": 5361, + "symbol": "BTCUSDT", + "pair": "BTCUSDT", + "orderId": 20072994037, + "clientOrderId": "LJ9R4QZDihCaS8UAOOLpgW", + "time": 1629184533946, + "amendment": { + "price": { + "before": "30005", + "after": "30004" + }, + "origQty": { + "before": "1", + "after": "1" + }, + "count": 2 + } + }, + { + "amendmentId": 5325, + "symbol": "BTCUSDT", + "pair": "BTCUSDT", + "orderId": 20072994037, + "clientOrderId": "LJ9R4QZDihCaS8UAOOLpgW", + "time": 1629182711787, + "amendment": { + "price": { + "before": "30002", + "after": "30005" + }, + "origQty": { + "before": "1", + "after": "1" + }, + "count": 1 + } + } +] +GET /papi/v1/um/orderAmendment (HMAC SHA256) + +Get order modification history + +Weight(order): 1 + +Parameters: + +Name Type Mandatory Description +symbol STRING YES +orderId LONG NO +origClientOrderId STRING NO +startTime LONG NO Timestamp in ms to get modification history from INCLUSIVE +endTime LONG NO Timestamp in ms to get modification history until INCLUSIVE +limit INT NO Default 500, max 1000 +recvWindow LONG NO +timestamp LONG YES +Notes: + +Either orderId or origClientOrderId must be sent, and the orderId will prevail if both are sent. +Query CM Modify Order History (TRADE) +Response: + + +[ + { + "amendmentId": 5363, // Order modification ID + "symbol": "BTCUSD_PERP", + "pair": "BTCUSD", + "orderId": 20072994037, + "clientOrderId": "LJ9R4QZDihCaS8UAOOLpgW", + "time": 1629184560899, // Order modification time + "amendment": { + "price": { + "before": "30004", + "after": "30003.2" + }, + "origQty": { + "before": "1", + "after": "1" + }, + "count": 3 // Order modification count, representing the number of times the order has been modified + } + }, + { + "amendmentId": 5361, + "symbol": "BTCUSD_PERP", + "pair": "BTCUSD", + "orderId": 20072994037, + "clientOrderId": "LJ9R4QZDihCaS8UAOOLpgW", + "time": 1629184533946, + "amendment": { + "price": { + "before": "30005", + "after": "30004" + }, + "origQty": { + "before": "1", + "after": "1" + }, + "count": 2 + } + }, + { + "amendmentId": 5325, + "symbol": "BTCUSD_PERP", + "pair": "BTCUSD", + "orderId": 20072994037, + "clientOrderId": "LJ9R4QZDihCaS8UAOOLpgW", + "time": 1629182711787, + "amendment": { + "price": { + "before": "30002", + "after": "30005" + }, + "origQty": { + "before": "1", + "after": "1" + }, + "count": 1 + } + } +] +GET /papi/v1/cm/orderAmendment (HMAC SHA256) + +Get order modification history + +Weight(order): 1 + +Parameters: + +Name Type Mandatory Description +symbol STRING YES +orderId LONG NO +origClientOrderId STRING NO +startTime LONG NO Timestamp in ms to get modification history from INCLUSIVE +endTime LONG NO Timestamp in ms to get modification history until INCLUSIVE +limit INT NO Default 50, max 100 +recvWindow LONG NO +timestamp LONG YES +Notes: + +Either orderId or origClientOrderId must be sent, and the orderId will prevail if both are sent. +Account +Account Balance(USER_DATA) +Response: + + +[ + { + "asset": "USDT", // asset name + "totalWalletBalance": "122607.35137903", // wallet balance = cross margin free + cross margin locked + UM wallet balance + CM wallet balance + "crossMarginAsset": "92.27530794", // crossMarginAsset = crossMarginFree + crossMarginLocked + "crossMarginBorrowed": "10.00000000", // principal of cross margin + "crossMarginFree": "100.00000000", // free asset of cross margin + "crossMarginInterest": "0.72469206", // interest of cross margin + "crossMarginLocked": "3.00000000", //lock asset of cross margin + "umWalletBalance": "0.00000000", // wallet balance of um + "umUnrealizedPNL": "23.72469206", // unrealized profit of um + "cmWalletBalance": "23.72469206", // wallet balance of cm + "cmUnrealizedPNL": "", // unrealized profit of cm + "updateTime": 1617939110373, + "negativeBalance": "0" + } +] + +**OR (when symbol sent)** +{ + "asset": "USDT", // asset name + "totalWalletBalance": "122607.35137903", // wallet balance = cross margin free + cross margin locked + UM wallet balance + CM wallet balance + "crossMarginBorrowed": "10.00000000", // principal of cross margin + "crossMarginFree": "100.00000000", // free asset of cross margin + "crossMarginInterest": "0.72469206", // interest of cross margin + "crossMarginLocked": "3.00000000", //lock asset of cross margin + "umWalletBalance": "0.00000000", // wallet balance of um + "umUnrealizedPNL": "23.72469206", // unrealized profit of um + "cmWalletBalance": "23.72469206", // wallet balance of cm + "cmUnrealizedPNL": "", // unrealized profit of cm + "updateTime": 1617939110373, + "negativeBalance": "0" +} +GET /papi/v1/balance (HMAC SHA256) + +query account balance + +Weight: 20 + +Parameters: + +Name Type Mandatory Description +asset STRING NO +recvWindow LONG NO +timestamp LONG YES +Account Information(USER_DATA) +Response: + +{ + "uniMMR": "5167.92171923", // Portfolio margin account maintenance margin rate + "accountEquity": "122607.35137903", // Account equity, in USD value + "actualEquity": "73.47428058", //Account equity calculated without discount on collateral rate, in USD value + "accountInitialMargin": "23.72469206", + "accountMaintMargin": "23.72469206", // Portfolio margin account maintenance margin, unit:USD + "accountStatus": "NORMAL" // Portfolio margin account status:"NORMAL", "MARGIN_CALL", "SUPPLY_MARGIN", "REDUCE_ONLY", "ACTIVE_LIQUIDATION", "FORCE_LIQUIDATION", "BANKRUPTED" + "virtualMaxWithdrawAmount": "1627523.32459208" // Portfolio margin maximum amount for transfer out in USD + "totalAvailableBalance":"", + "totalMarginOpenLoss":"", // in USD margin open order + "updateTime": 1657707212154 // last update time +} +GET /papi/v1/account (HMAC SHA256) + +Query account information + +Weight: 20 + +Parameters: + +Name Type Mandatory Description +recvWindow LONG NO +timestamp LONG YES +Margin Max Borrow(USER_DATA) +Response: + +{ + "amount": 125 // account's currently max borrowable amount with sufficient system availability + "borrowLimit": 60 // max borrowable amount limited by the account level +} +GET /papi/v1/margin/maxBorrowable (HMAC SHA256) + +Weight: 5 + +Query margin max borrow + +Parameters: + +Name Type Mandatory Description +asset STRING YES +recvWindow LONG NO The value cannot be greater than 60000 +timestamp LONG YES +Query Margin Max Withdraw(USER_DATA) +Response: + +{ + "amount": "60" +} +GET /papi/v1/margin/maxWithdraw (HMAC SHA256) + +Weight: 5 + +Parameters: + +Name Type Mandatory Description +asset STRING YES +recvWindow LONG NO The value cannot be greater than 60000 +timestamp LONG YES +Query UM Position Information(USER_DATA) +Response: + +* For One-way position mode(only return with position): + [ + { + "entryPrice": "0.00000", + "leverage": "10", + "markPrice": "6679.50671178", + "maxNotionalValue": "20000000", + "positionAmt": "0.000", + "notional": "0", + "symbol": "BTCUSDT", + "unRealizedProfit": "0.00000000", + "liquidationPrice": "6170.20509059", + "positionSide": "BOTH", + "updateTime": 1625474304765 + } +] + +* For Hedge position mode(only return with position): +[ + { + "symbol": "BTCUSDT", + "positionAmt": "0.001", + "entryPrice": "22185.2", + "markPrice": "21123.05052574", + "unRealizedProfit": "-1.06214947", + "liquidationPrice": "6170.20509059", + "leverage": "4", + "maxNotionalValue": "100000000", + "positionSide": "LONG", + "notional": "21.12305052", + "updateTime": 1655217461579 + }, + { + "symbol": "BTCUSDT", + "positionAmt": "0.001", + "entryPrice": "0.0", + "markPrice": "21123.05052574", + "unRealizedProfit": "0.00000000", + "liquidationPrice": "6170.20509059", + "leverage": "4", + "maxNotionalValue": "100000000", + "positionSide": "SHORT", + "notional": "0", + "updateTime": 0 + } +] +GET /papi/v1/um/positionRisk + +Get current UM position information. + +Weight: 5 + +Parameters: + +Name Type Mandatory Description +symbol STRING NO +recvWindow LONG NO +timestamp LONG YES +Note Please use with user data stream ACCOUNT_UPDATE to meet your timeliness and accuracy needs. + +for One-way Mode user, the response will only show the "BOTH" positions +for Hedge Mode user, the response will show "LONG", and "SHORT" positions. +Query CM Position Information(USER_DATA) +Response: + +* For One-way position mode: + [ + { + "symbol": "BTCUSD_201225", + "positionAmt": "1", + "entryPrice": "11707.70000003", + "markPrice": "11788.66626667", + "liquidationPrice": "6170.20509059", + "unRealizedProfit": "0.00005866", + "leverage": "125", + "positionSide": "LONG", + "updateTime": 1627026881327, + "maxQty": "50", + "notionalValue": "0.00084827", + "breakEvenPrice": "0.00000" + } +] + +* For Hedge position mode(only return with position): +[ + { + "symbol": "BTCUSD_201225", + "positionAmt": "1", + "entryPrice": "11707.70000003", + "markPrice": "11788.66626667", + "unRealizedProfit": "0.00005866", + "liquidationPrice": "6170.20509059", + "leverage": "125", + "positionSide": "LONG", + "updateTime": 1627026881327, + "maxQty": "50", + "notionalValue": "0.00084827", + "breakEvenPrice": "0.00000" + }, + { + "symbol": "BTCUSD_201225", + "positionAmt": "1", + "entryPrice": "11707.70000003", + "markPrice": "11788.66626667", + "unRealizedProfit": "0.00005866", + "liquidationPrice": "6170.20509059", + "leverage": "125", + "positionSide": "LONG", + "updateTime": 1627026881327, + "maxQty": "50", + "notionalValue": "0.00084827", + "breakEvenPrice": "0.00000" + } +] +GET /papi/v1/cm/positionRisk (HMAC SHA256) + +Get current CM position information. + +Weight: 1 + +Parameters: + +Name Type Mandatory Description +marginAsset STRING NO +pair STRING NO +recvWindow LONG NO +timestamp LONG YES +If neither marginAsset nor pair is sent, positions of all symbols with TRADING status will be returned. +for One-way Mode user, the response will only show the "BOTH" positions +for Hedge Mode user, the response will show "LONG", and "SHORT" positions. +Note Please use with user data stream ACCOUNT_UPDATE to meet your timeliness and accuracy needs. + +Change UM Initial Leverage (TRADE) +Response: + +{ + "leverage": 21, + "maxNotionalValue": "1000000", + "symbol": "BTCUSDT" +} +POST /papi/v1/um/leverage (HMAC SHA256) + +Change user's initial leverage of specific symbol in UM. + +Weight: 1 + +Parameters: + +Name Type Mandatory Description +symbol STRING YES +leverage INT YES target initial leverage: int from 1 to 125 +recvWindow LONG NO +timestamp LONG YES +Change CM Initial Leverage (TRADE) +Response: + +{ + "leverage": 21, + "maxQty": "1000", + "symbol": "BTCUSD_200925" +} +Change user's initial leverage of specific symbol in CM. + +POST /papi/v1/cm/leverage (HMAC SHA256) + +Weight: 1 + +Parameters: + +Name Type Mandatory Description +symbol STRING YES +leverage INT YES target initial leverage: int from 1 to 125 +recvWindow LONG NO +timestamp LONG YES +Change UM Position Mode(TRADE) +Response: + +{ + "code": 200, + "msg": "success" +} +POST /papi/v1/um/positionSide/dual (HMAC SHA256) + +Change user's position mode (Hedge Mode or One-way Mode ) on EVERY symbol in UM + +Weight: 1 + +Parameters: + +Name Type Mandatory Description +dualSidePosition STRING YES "true": Hedge Mode; "false": One-way Mode +recvWindow LONG NO +timestamp LONG YES +Change CM Position Mode(TRADE) +Response: + +{ + "code": 200, + "msg": "success" +} +POST /papi/v1/cm/positionSide/dual (HMAC SHA256) + +Change user's position mode (Hedge Mode or One-way Mode ) on EVERY symbol in CM + +Weight: 1 + +Parameters: + +Name Type Mandatory Description +dualSidePosition STRING YES "true": Hedge Mode; "false": One-way Mode +recvWindow LONG NO +timestamp LONG YES +Get UM Current Position Mode(USER_DATA) +Response: + +{ + "dualSidePosition": true // "true": Hedge Mode; "false": One-way Mode +} +GET /papi/v1/um/positionSide/dual (HMAC SHA256) + +Get user's position mode (Hedge Mode or One-way Mode ) on EVERY symbol in UM + +Weight: 30 + +Parameters: + +Name Type Mandatory Description +recvWindow LONG NO +timestamp LONG YES +Get CM Current Position Mode(USER_DATA) +Response: + +{ + "dualSidePosition": true // "true": Hedge Mode; "false": One-way Mode +} +GET /papi/v1/cm/positionSide/dual (HMAC SHA256) + +Get user's position mode (Hedge Mode or One-way Mode ) on EVERY symbol in CM + +Weight: 30 + +Parameters: + +Name Type Mandatory Description +recvWindow LONG NO +timestamp LONG YES +UM Account Trade List (USER_DATA) +Response: + +[ + { + "symbol": "BTCUSDT", + "id": 67880589, + "orderId": 270093109, + "side": "SELL", + "price": "28511.00", + "qty": "0.010", + "realizedPnl": "2.58500000", + "marginAsset": "USDT", + "quoteQty": "285.11000", + "commission": "-0.11404400", + "commissionAsset": "USDT", + "time": 1680688557875, + "buyer": false, + "maker": false, + "positionSide": "BOTH" + } +] +GET /papi/v1/um/userTrades (HMAC SHA256) + +Get trades for a specific account and UM symbol. + +Weight: 5 + +Parameters: + +Name Type Mandatory Description +symbol STRING YES +orderId INT NO +startTime LONG NO +endTime LONG NO +fromId LONG NO Trade id to fetch from. Default gets most recent trades. +limit INT NO Default 500; max 1000. +recvWindow LONG NO +timestamp LONG YES +If startTime and endTime are both not sent, then the last '24 hours' data will be returned. +The time between startTime and endTime cannot be longer than 24 hours. +The parameter fromId cannot be sent with startTime or endTime. +CM Account Trade List (USER_DATA) +Response: + +[ + { + 'symbol': 'BTCUSD_200626', + 'id': 6, + 'orderId': 28, + 'pair': 'BTCUSD', + 'side': 'SELL', + 'price': '8800', + 'qty': '1', + 'realizedPnl': '0', + 'marginAsset': 'BTC', + 'baseQty': '0.01136364', + 'commission': '0.00000454', + 'commissionAsset': 'BTC', + 'time': 1590743483586, + 'positionSide': 'BOTH', + 'buyer': false, + 'maker': false + } +] +GET /papi/v1/cm/userTrades + +Get trades for a specific account and CM symbol. + +Weight: 20 with symbol 40 with pair + +Parameters: + +Name Type Mandatory Description +symbol STRING NO +pair STRING NO +startTime LONG NO +endTime LONG NO +fromId LONG NO Trade id to fetch from. Default gets most recent trades. +limit INT NO Default 50; max 1000. +recvWindow LONG NO +timestamp LONG YES +Either symbol or pair must be sent +symbol and pair cannot be sent together +pair and fromId cannot be sent together +If a pair is sent, tickers for all symbols of the pair will be returned +The parameter fromId cannot be sent with startTime or endTime +If startTime and endTime are both not sent, then the last '24 hours' data will be returned. +The time between startTime and endTime cannot be longer than 24 hours. +UM Notional and Leverage Brackets (USER_DATA) +Response: + +[ + { + "symbol": "ETHUSDT", + "notionalCoef": "4.0", + "brackets": [ + { + "bracket": 1, // Notional bracket + "initialLeverage": 75, // Max initial leverage for this bracket + "notionalCap": 10000, // Cap notional of this bracket + "notionalFloor": 0, // Notional threshold of this bracket + "maintMarginRatio": 0.0065, // Maintenance ratio for this bracket + "cum":0 // Auxiliary number for quick calculation + }, + ] + } +] +GET /papi/v1/um/leverageBracket + +Query UM notional and leverage brackets + +Weight: 1 + +Parameters: + +Name Type Mandatory Description +symbol STRING NO +recvWindow LONG NO +timestamp LONG YES +CM Notional and Leverage Brackets (USER_DATA) +Response: + +[ + { + "symbol": "BTCUSD_PERP", + "notionalCoef": "4.0", + "brackets": [ + { + "bracket": 1, // bracket level + "initialLeverage": 125, // the maximum leverage + "qtyCap": 50, // upper edge of base asset quantity + "qtyFloor": 0, // lower edge of base asset quantity + "maintMarginRatio": 0.004, // maintenance margin rate + "cum": 0.0 // Auxiliary number for quick calculation + }, + ] + } +] +GET /papi/v1/cm/leverageBracket + +Query CM notional and leverage brackets + +Weight: 1 + +Parameters: + +Name Type Mandatory Description +symbol STRING NO +recvWindow LONG NO +timestamp LONG YES +Query User's Margin Force Orders (USER_DATA) +Response: + +{ + "rows": [ + { + "avgPrice": "0.00388359", + "executedQty": "31.39000000", + "orderId": 180015097, + "price": "0.00388110", + "qty": "31.39000000", + "side": "SELL", + "symbol": "BNBBTC", + "timeInForce": "GTC", + "updatedTime": 1558941374745 + } + ], + "total": 1 +} +GET /papi/v1/margin/forceOrders (HMAC SHA256) + +Query user's margin force orders + +Weight: 1 + +Parameters: + +Name Type Mandatory Description +startTime LONG NO +endTime LONG NO +current LONG NO Currently querying page. Start from 1. Default:1 +size LONG NO Default:10 Max:100 +recvWindow LONG NO The value cannot be greater than 60000 +timestamp LONG YES +Query User's UM Force Orders (USER_DATA) +Response: + +[ + { + "orderId": 6071832819, + "symbol": "BTCUSDT", + "status": "FILLED", + "clientOrderId": "autoclose-1596107620040000020", + "price": "10871.09", + "avgPrice": "10913.21000", + "origQty": "0.001", + "executedQty": "0.001", + "cumQuote": "10.91321", + "timeInForce": "IOC", + "type": "LIMIT", + "reduceOnly": false, + "side": "SELL", + "positionSide": "BOTH", + "origType": "LIMIT", + "time": 1596107620044, + "updateTime": 1596107620087 + } +] +GET /papi/v1/um/forceOrders (HMAC SHA256) + +Query User's UM Force Orders + +Weight: + +20 with symbol, 50 without symbol + +Parameters: + +Name Type Mandatory Description +symbol STRING NO +autoCloseType ENUM NO LIQUIDATION for liquidation orders, ADL for ADL orders. +startTime LONG NO +endTime LONG NO +limit INT NO Default 50; max 100. +recvWindow LONG NO The value cannot be greater than 60000 +timestamp LONG YES +If autoCloseType is not sent, orders with both of the types will be returned +If startTime is not sent, data within 7 days before endTime can be queried +Query User's CM Force Orders (USER_DATA) +Response: + +[ + { + "orderId": 165123080, + "symbol": "BTCUSD_200925", + "pair": "BTCUSD", + "status": "FILLED", + "clientOrderId": "autoclose-1596542005017000006", + "price": "11326.9", + "avgPrice": "11326.9", + "origQty": "1", + "executedQty": "1", + "cumBase": "0.00882854", + "timeInForce": "IOC", + "type": "LIMIT", + "reduceOnly": false, + "side": "SELL", + "positionSide": "BOTH", + "origType": "LIMIT", + "time": 1596542005019, + "updateTime": 1596542005050 + } +] +GET /papi/v1/cm/forceOrders (HMAC SHA256) + +Query User's CM Force Orders + +Weight: + +20 with symbol, 50 without symbol + +Parameters: + +Name Type Mandatory Description +symbol STRING NO +autoCloseType ENUM NO "LIQUIDATION" for liquidation orders, "ADL" for ADL orders. +startTime LONG NO +endTime LONG NO +limit INT NO Default 50; max 100. +recvWindow LONG NO The value cannot be greater than 60000 +timestamp LONG YES +If "autoCloseType" is not sent, orders with both of the types will be returned +If "startTime" is not sent, data within 7 days before "endTime" can be queried +Portfolio Margin UM Trading Quantitative Rules Indicators (USER_DATA) +Response: + +{ + "indicators": { // indicator: quantitative rules indicators, value: user's indicators value, triggerValue: trigger indicator value threshold of quantitative rules. + "BTCUSDT": [ + { + "isLocked": true, + "plannedRecoverTime": 1545741270000, + "indicator": "UFR", // Unfilled Ratio (UFR) + "value": 0.05, // Current value + "triggerValue": 0.995 // Trigger value + }, + { + "isLocked": true, + "plannedRecoverTime": 1545741270000, + "indicator": "IFER", // IOC/FOK Expiration Ratio (IFER) + "value": 0.99, // Current value + "triggerValue": 0.99 // Trigger value + }, + { + "isLocked": true, + "plannedRecoverTime": 1545741270000, + "indicator": "GCR", // GTC Cancellation Ratio (GCR) + "value": 0.99, // Current value + "triggerValue": 0.99 // Trigger value + }, + { + "isLocked": true, + "plannedRecoverTime": 1545741270000, + "indicator": "DR", // Dust Ratio (DR) + "value": 0.99, // Current value + "triggerValue": 0.99 // Trigger value + } + ] + }, + "updateTime": 1545741270000 +} +Or (account violation triggered) + +{ + "indicators":{ + "ACCOUNT":[ + { + "indicator":"TMV", // Too many violations under multiple symbols trigger account violation + "value":10, + "triggerValue":1, + "plannedRecoverTime":1644919865000, + "isLocked":true + } + ] + }, + "updateTime":1644913304748 +} +GET /papi/v1/um/apiTradingStatus + +Weight: 1 for a single symbol 10 when the symbol parameter is omitted + +Parameters: + +Name Type Mandatory Description +symbol STRING NO +recvWindow LONG NO +timestamp LONG YES +Get User Commission Rate for UM (USER_DATA) +Response: + +{ + "symbol": "BTCUSDT", + "makerCommissionRate": "0.0002", // 0.02% + "takerCommissionRate": "0.0004" // 0.04% +} +GET /papi/v1/um/commissionRate (HMAC SHA256) + +Weight: 20 + +Parameters: + +Name Type Mandatory Description +symbol STRING YES +recvWindow LONG NO +timestamp LONG YES +Get User Commission Rate for CM (USER_DATA) +Response: + +{ + "symbol": "BTCUSD_PERP", + "makerCommissionRate": "0.00015", // 0.015% + "takerCommissionRate": "0.00040" // 0.040% +} +GET /papi/v1/cm/commissionRate (HMAC SHA256) + +Weight: 20 + +Parameters: + +Name Type Mandatory Description +symbol STRING YES +recvWindow LONG NO +timestamp LONG YES +Query Margin Loan Record(USER_DATA) +Response: + +{ + "rows": [ + { + "txId": 12807067523, + "asset": "BNB", + "principal": "0.84624403", + "timestamp": 1555056425000, + "status": "CONFIRMED" //one of PENDING (pending execution), CONFIRMED (successfully loaned), FAILED (execution failed, nothing happened to your account); + } + ], + "total": 1 +} +GET /papi/v1/margin/marginLoan + +Query margin loan record + +Weight: 10 + +Parameters: + +Name Type Mandatory Description +asset STRING YES +txId LONG NO the tranId in POST/papi/v1/marginLoan +startTime LONG NO +endTime LONG NO +current LONG NO Currently querying page. Start from 1. Default:1 +size LONG NO Default:10 Max:100 +recvWindow LONG NO The value cannot be greater than 60000 +timestamp LONG YES +txId or startTime must be sent. txId takes precedence. +Response in descending order +If an asset is sent, data within 30 days before endTime; If an asset is not sent, data within 7 days before endTime +If neither startTime nor endTime is sent, the recent 7-day data will be returned. +startTime set as endTime - 7days by default, endTime set as current time by default +Query Margin repay Record(USER_DATA) +Response: javascript { "rows": [ { "amount": "14.00000000", //Total amount repaid "asset": "BNB", "interest": "0.01866667", //Interest repaid "principal": "13.98133333", //Principal repaid "status": "CONFIRMED", //one of PENDING (pending execution), CONFIRMED (successfully execution), FAILED (execution failed, nothing happened to your account) "timestamp": 1563438204000, "txId": 2970933056 } ], "total": 1 } + +GET /papi/v1/margin/repayLoan + +Query margin repay record. + +Weight: 10 + +Parameters: + +Name Type Mandatory Description +asset STRING YES +txId LONG NO the tranId in POST/papi/v1/repayLoan +startTime LONG NO +endTime LONG NO +current LONG NO Currently querying page. Start from 1. Default:1 +size LONG NO Default:10 Max:100 +recvWindow LONG NO The value cannot be greater than 60000 +timestamp LONG YES +txId or startTime must be sent. txId takes precedence. +Response in descending order +If an asset is sent, data within 30 days before endTime; If an asset is not sent, data within 7 days before endTime +If neither startTime nor endTime is sent, the recent 7-day data will be returned. +startTime set as endTime - 7days by default, endTime set as current time by default +Get Margin Borrow/Loan Interest History (USER_DATA) +Response: + +{ + "rows": [ + { + "txId": 1352286576452864727, + "interestAccuredTime": 1672160400000, + "asset": "USDT", + "rawAsset": “USDT”, + "principal": "45.3313", + "interest": "0.00024995", + "interestRate": "0.00013233", + "type": "ON_BORROW" + } + ], + "total": 1 +} +GET/papi/v1/margin/marginInterestHistory (HMAC SHA256) + +Weight: 1 + +Parameters: + +Name Type Mandatory Description +asset STRING NO +startTime LONG NO +endTime LONG NO +current LONG NO Currently querying page. Start from 1. Default:1 +size LONG NO Default:10 Max:100 +recvWindow LONG NO The value cannot be greater than 60000 +timestamp LONG YES +Response in descending order +The max interval between startTime and endTime is 30 days. +If startTime and endTime not sent, return records of the last 7 days by default +Set archived to true to query data from 6 months ago +type in response has 4 enums: +PERIODIC interest charged per hour +ON_BORROW first interest charged on borrow +PERIODIC_CONVERTED interest charged per hour converted into BNB +ON_BORROW_CONVERTED first interest charged on borrow converted into BNB +Query Portfolio Margin Negative Balance Interest History(USER_DATA) +Response: + + +[ + { + "asset": "USDT", + "interest": "24.4440", //interest amount + "interestAccuredTime": 1670227200000, + "interestRate": "0.0001164", //daily interest rate + "principal": "210000" + } +] +GET /papi/v1/portfolio/interest-history + +Query interest history of negative balance for portfolio margin. + +Weight: 50 + +Parameters: + +Name Type Mandatory Description +asset STRING NO +startTime LONG NO +endTime LONG NO +size LONG NO Default:10 Max:100 +recvWindow LONG NO +timestamp LONG YES +Fund Auto-collection (TRADE) +Response: + +{ + "msg": "success" +} +POST /papi/v1/auto-collection + +Fund collection for Portfolio Margin + +Weight: 750 + +Parameters: + +Name Type Mandatory Description +recvWindow LONG NO The value cannot be greater than 60000 +timestamp LONG YES +The BNB would not be collected from UM-PM account to the Portfolio Margin account. +You can only use this function 500 times per hour in a rolling manner. +Fund Collection by Asset (TRADE) +Response: + +{ + "msg": "success" +} +POST /papi/v1/asset-collection + +Transfers specific asset from Futures Account to Margin account + +Weight(IP): + +30 + +Parameters: + +Name Type Mandatory Description +asset STRING YES +recvWindow LONG NO +timestamp LONG YES +The BNB transfer is not be supported +BNB transfer (TRADE) +Response: + +{ + "tranId": 100000001 //transaction id +} +POST /papi/v1/bnb-transfer + +Weight: 750 + +Parameters: + +Name Type Mandatory Description +amount DECIMAL YES +transferSide STRING YES "TO_UM","FROM_UM" +recvWindow LONG NO The value cannot be greater than 60000 +timestamp LONG YES +The endpoint can only be called 10 times per 10 minutes in a rolling manner +Get UM Income History (USER_DATA) +Response: + + +[ + { + "symbol": "", // trade symbol, if existing + "incomeType": "TRANSFER", // income type + "income": "-0.37500000", // income amount + "asset": "USDT", // income asset + "info":"TRANSFER", // extra information + "time": 1570608000000, + "tranId":"9689322392", // transaction id + "tradeId":"" // trade id, if existing + }, + { + "symbol": "BTCUSDT", + "incomeType": "COMMISSION", + "income": "-0.01000000", + "asset": "USDT", + "info":"COMMISSION", + "time": 1570636800000, + "tranId":"9689322392", + "tradeId":"2059192" + } +] +GET /papi/v1/um/income (HMAC SHA256) + +Weight: 30 + +Parameters: + +Name Type Mandatory Description +symbol STRING NO +incomeType STRING NO TRANSFER, WELCOME_BONUS, REALIZED_PNL, FUNDING_FEE, COMMISSION, INSURANCE_CLEAR, REFERRAL_KICKBACK, COMMISSION_REBATE, API_REBATE, CONTEST_REWARD, CROSS_COLLATERAL_TRANSFER, OPTIONS_PREMIUM_FEE, OPTIONS_SETTLE_PROFIT, INTERNAL_TRANSFER, AUTO_EXCHANGE, DELIVERED_SETTELMENT, COIN_SWAP_DEPOSIT, COIN_SWAP_WITHDRAW, POSITION_LIMIT_INCREASE_FEE +startTime LONG NO Timestamp in ms to get funding from INCLUSIVE. +endTime LONG NO Timestamp in ms to get funding until INCLUSIVE. +limit INT NO Default 100; max 1000 +recvWindow LONG NO +timestamp LONG YES +If neither startTime nor endTime is sent, the recent 7-day data will be returned. +If incomeType is not sent, all kinds of flow will be returned +"trandId" is unique in the same incomeType for a user +Income history only contains data for the last three months +Get CM Income History(USER_DATA) +Response: + + +[ + { + "symbol": "", // trade symbol, if existing + "incomeType": "TRANSFER", // income type + "income": "-0.37500000", // income amount + "asset": "BTC", // income asset + "info":"WITHDRAW", // extra information + "time": 1570608000000, + "tranId":"9689322392", // transaction id + "tradeId":"" // trade id, if existing + }, + { + "symbol": "BTCUSD_200925", + "incomeType": "COMMISSION", + "income": "-0.01000000", + "asset": "BTC", + "info":"", + "time": 1570636800000, + "tranId":"9689322392", + "tradeId":"2059192" + } +] +GET /papi/v1/cm/income (HMAC SHA256) + +Weight: 30 + +Parameters: + +Name Type Mandatory Description +symbol STRING NO +incomeType STRING NO "TRANSFER","WELCOME_BONUS", "FUNDING_FEE", "REALIZED_PNL", "COMMISSION", "INSURANCE_CLEAR", and "DELIVERED_SETTELMENT" +startTime LONG NO Timestamp in ms to get funding from INCLUSIVE. +endTime LONG NO Timestamp in ms to get funding until INCLUSIVE. +limit INT NO Default 100; max 1000 +recvWindow LONG NO +timestamp LONG YES +If incomeType is not sent, all kinds of flow will be returned +"trandId" is unique in the same "incomeType" for a user +The interval between startTime and endTime can not exceed 200 days: +If startTime and endTime are not sent, the last 200 days will be returned +Get UM Account Detail (USER_DATA) +Response: + +{ + "tradeGroupId": -1, + "assets": [ + { + "asset": "USDT", // asset name + "crossWalletBalance": "23.72469206", // wallet balance + "crossUnPnl": "0.00000000", // unrealized profit + "maintMargin": "0.00000000", // maintenance margin required + "initialMargin": "0.00000000", // total initial margin required with current mark price + "positionInitialMargin": "0.00000000", //initial margin required for positions with current mark price + "openOrderInitialMargin": "0.00000000", // initial margin required for open orders with current mark price + "updateTime": 1625474304765 // last update time + } + ], + "positions": [ // positions of all symbols in the market are returned + // only "BOTH" positions will be returned with One-way mode + // only "LONG" and "SHORT" positions will be returned with Hedge mode + { + "symbol": "BTCUSDT", // symbol name + "initialMargin": "0", // initial margin required with current mark price + "maintMargin": "0", // maintenance margin required + "unrealizedProfit": "0.00000000", // unrealized profit + "positionInitialMargin": "0", // initial margin required for positions with current mark price + "openOrderInitialMargin": "0", // initial margin required for open orders with current mark price + "leverage": "100", // current initial leverage + "entryPrice": "0.00000", // average entry price + "maxNotional": "250000", // maximum available notional with current leverage + "bidNotional": "0", // bids notional, ignore + "askNotional": "0", // ask notional, ignore + "positionSide": "BOTH", // position side + "positionAmt": "0", // position amount + "updateTime": 0, // last update time + "breakEvenPrice": "0.0" + } + ] +} +GET /papi/v1/um/account (HMAC SHA256) + +Get current UM account asset and position information. + +Weight: 5 + +Parameters: + +Name Type Mandatory Description +recvWindow LONG NO +timestamp LONG YES +Get CM Account Detail (USER_DATA) +Response: + +{ + "assets": [ + { + "asset": "BTC", // asset name + "crossWalletBalance": "0.00241969", // total wallet balance + "crossUnPnl": "0.00000000", // unrealized profit or loss + "maintMargin": "0.00000000", // maintenance margin + "initialMargin": "0.00000000", // total intial margin required with the latest mark price + "positionInitialMargin": "0.00000000", // positions" margin required with the latest mark price + "openOrderInitialMargin": "0.00000000", // open orders" intial margin required with the latest mark price + "updateTime": 1625474304765 // last update time + } + ], + "positions": [ + { + "symbol": "BTCUSD_201225", + "positionAmt":"0", // position amount + "initialMargin": "0", + "maintMargin": "0", + "unrealizedProfit": "0.00000000", + "positionInitialMargin": "0", + "openOrderInitialMargin": "0", + "leverage": "125", + "positionSide": "BOTH", // BOTH means that it is the position of One-way Mode + "entryPrice": "0.0", + "maxQty": "50", // maximum quantity of base asset + "updateTime": 0, + "breakEvenPrice": "0.0" + } + ] + } +GET /papi/v1/cm/account (HMAC SHA256) + +Get current CM account asset and position information. + +Weight: 5 + +Parameters: + +Name Type Mandatory Description +recvWindow LONG NO +timestamp LONG YES +Change Auto-repay-futures Status (TRADE) +Response: + +{ + "msg": "success" +} +POST /papi/v1/repay-futures-switch (HMAC SHA256) + +Change Auto-repay-futures Status + +Weight(IP): + +750 + +Parameters: + +Name Type Mandatory Description +autoRepay STRING YES Default: true; false for turn off the auto-repay futures negative balance function +recvWindow LONG NO +timestamp LONG YES +Get Auto-repay-futures Status (USER_DATA) +Response: + +{ + "autoRepay": true // "true" for turn on the auto-repay futures; "false" for turn off the auto-repay futures +} +GET /papi/v1/repay-futures-switch (HMAC SHA256) + +Query Auto-repay-futures Status + +Weight(IP): + +30 + +Parameters: + +Name Type Mandatory Description +recvWindow LONG NO +timestamp LONG YES +Repay futures Negative Balance (USER_DATA) +Response: + +{ + "msg": "success" +} +POST /papi/v1/repay-futures-negative-balance (HMAC SHA256) + +Repay futures Negative Balance + +Weight(IP): + +750 + +Parameters: + +Name Type Mandatory Description +recvWindow LONG NO +timestamp LONG YES +UM Position ADL Quantile Estimation (USER_DATA) +Response: + +[ + { + "symbol": "ETHUSDT", + "adlQuantile": + { + // if the positions of the symbol are crossed margined in Hedge Mode, "LONG" and "SHORT" will be returned a same quantile value, and "HEDGE" will be returned instead of "BOTH". + "LONG": 3, + "SHORT": 3, + "HEDGE": 0 // only a sign, ignore the value + } + }, + { + "symbol": "BTCUSDT", + "adlQuantile": + { + // for positions of the symbol are in One-way Mode or isolated margined in Hedge Mode + "LONG": 1, // adl quantile for "LONG" position in hedge mode + "SHORT": 2, // adl qauntile for "SHORT" position in hedge mode + "BOTH": 0 // adl qunatile for position in one-way mode + } + } + ] +GET /papi/v1/um/adlQuantile + +Weight: 5 + +Parameters: + +Name Type Mandatory Description +symbol STRING NO +recvWindow LONG NO +timestamp LONG YES +Values update every 30s. + +Values 0, 1, 2, 3, 4 shows the queue position and possibility of ADL from low to high. + +For positions of the symbol are in One-way Mode or isolated margined in Hedge Mode, "LONG", "SHORT", and "BOTH" will be returned to show the positions' adl quantiles of different position sides. + +If the positions of the symbol are crossed margined in Hedge Mode: + +"HEDGE" as a sign will be returned instead of "BOTH"; +A same value caculated on unrealized pnls on long and short sides' positions will be shown for "LONG" and "SHORT" when there are positions in both of long and short sides. +CM Position ADL Quantile Estimation (USER_DATA) +Response: + +[ + { + "symbol": "BTCUSD_200925", + "adlQuantile": + { + // if the positions of the symbol are crossed margined in Hedge Mode, "LONG" and "SHORT" will be returned a same quantile value, and "HEDGE" will be returned instead of "BOTH". + "LONG": 3, + "SHORT": 3, + "HEDGE": 0 // only a sign, ignore the value + } + }, + { + "symbol": "BTCUSD_201225", + "adlQuantile": + { + // for positions of the symbol are in One-way Mode + "LONG": 1, // adl quantile for "LONG" position in hedge mode + "SHORT": 2, // adl qauntile for "SHORT" position in hedge mode + "BOTH": 0 // adl qunatile for position in one-way mode + } + } +] +GET /papi/v1/cm/adlQuantile + +Weight: 5 + +Parameters: + +Name Type Mandatory Description +symbol STRING NO +recvWindow LONG NO +timestamp LONG YES +Values update every 30s. + +Values 0, 1, 2, 3, 4 shows the queue position and possibility of ADL from low to high. + +For positions of the symbol are in One-way Mode or isolated margined in Hedge Mode, "LONG", "SHORT", and "BOTH" will be returned to show the positions' adl quantiles of different position sides. + +If the positions of the symbol are crossed margined in Hedge Mode: + +"HEDGE" as a sign will be returned instead of "BOTH"; +A same value caculated on unrealized pnls on long and short sides' positions will be shown for "LONG" and "SHORT" when there are positions in both of long and short sides. +User Data Streams +The base API endpoint is: https://papi.binance.com +A User Data Stream listenKey is valid for 60 minutes after creation. +Doing a PUT on a listenKey will extend its validity for 60 minutes. +Doing a DELETE on a listenKey will close the stream and invalidate the listenKey. +Doing a POST on an account with an active listenKey will return the currently active listenKey and extend its validity for 60 minutes. +Connection method for Websocket: +Base Url: wss://fstream.binance.com/pm +User Data Streams are accessed at /ws/ +Example: wss://fstream.binance.com/pm/ws/pqia91ma19a5s61cv6a81va65sdf19v8a65a1a5s61cv6a81va65sdf19v8a65a1 +A single connection is only valid for 24 hours; expect to be disconnected at the 24 hour mark. +Start User Data Stream (USER_STREAM) +Response: + +{ + "listenKey": "pqia91ma19a5s61cv6a81va65sdf19v8a65a1a5s61cv6a81va65sdf19v8a65a1" +} +POST /papi/v1/listenKey + +Start a new user data stream. The stream will close after 60 minutes unless a keepalive is sent. If the account has an active listenKey, that listenKey will be returned and its validity will be extended for 60 minutes. + +Weight: 1 + +Keepalive User Data Stream (USER_STREAM) +Response: + +{} +PUT /papi/v1/listenKey + +Keepalive a user data stream to prevent a time out. User data streams will close after 60 minutes. It's recommended to send a ping about every 60 minutes. + +Weight: 1 + +Parameters: + +None + +Close User Data Stream (USER_STREAM) +Response: + +{} +DELETE /papi/v1/listenKey + +Close out a user data stream. + +Weight: 1 + +Parameters: + +None + +Event: User Data Stream Expired +Payload: + +{ + 'e': 'listenKeyExpired', // event type + 'E': 1576653824250 // event time +} +When the listenKey used for the user data stream turns expired, this event will be pushed. + +Notice: + +This event is not related to the websocket disconnection. +This event will be received only when a valid listenKey in connection got expired. +No more user data event will be updated after this event received until a new valid listenKey used. +Event: Futures Balance and Position Update +Payload: + +{ + "e": "ACCOUNT_UPDATE", // Event Type + "fs": "UM", // Event business unit. 'UM' for USDS-M futures and 'CM' for COIN-M futures + "E": 1564745798939, // Event Time + "T": 1564745798938 , // Transaction + "i":"", // Account Alias, ignore for UM + "a": // Update Data + { + "m":"ORDER", // Event reason type + "B":[ // Balances + { + "a":"USDT", // Asset + "wb":"122624.12345678", // Wallet Balance + "cw":"100.12345678", // Cross Wallet Balance + "bc":"50.12345678" // Balance Change except PnL and Commission + }, + { + "a":"BUSD", + "wb":"1.00000000", + "cw":"0.00000000", + "bc":"-49.12345678" + } + ], + "P":[ + { + "s":"BTCUSDT", // Symbol + "pa":"0", // Position Amount + "ep":"0.00000", // Entry Price + "cr":"200", // (Pre-fee) Accumulated Realized + "up":"0", // Unrealized PnL + "ps":"BOTH", // Position Side + "bep":"0.00000" // breakeven price + }, + { + "s":"BTCUSDT", + "pa":"20", + "ep":"6563.66500", + "cr":"0", + "up":"2850.21200", + "ps":"LONG", + "bep":"0.00000" // breakeven price + } + ] + } +} +Update Speed: 50ms +Update under the following conditions: +Account deposit or withdrawal +A transfer occurs between trading accounts (e.g. transfer from spot to option accounts) +Position changes +Greek update +Event: Futures Order update +Payload: + +{ + + "e":"ORDER_TRADE_UPDATE", // Event Type + "fs": "UM", // Event business unit. 'UM' for USDS-M futures and 'CM' for COIN-M futures + "E":1568879465651, // Event Time + "T":1568879465650, // Transaction Time + "i":"", // Account Alias,ignore for UM + "o":{ + "s":"BTCUSDT", // Symbol + "c":"TEST", // Client Order Id + // special client order id: + // starts with "autoclose-": liquidation order + // "adl_autoclose": ADL auto close order + // "settlement_autoclose-": settlement order for delisting or delivery + "S":"SELL", // Side + "o":"MARKET", // Order Type + "f":"GTC", // Time in Force + "q":"0.001", // Original Quantity + "p":"0", // Original Price + "ap":"0", // Average Price + "sp":"7103.04", // Ignore + "x":"NEW", // Execution Type + "X":"NEW", // Order Status + "i":8886774, // Order Id + "l":"0", // Order Last Filled Quantity + "z":"0", // Order Filled Accumulated Quantity + "L":"0", // Last Filled Price + "N":"USDT", // Commission Asset, will not push if no commission + "n":"0", // Commission, will not push if no commission + "T":1568879465650, // Order Trade Time + "t":0, // Trade Id + "b":"0", // Bids Notional + "a":"9.91", // Ask Notional + "m":false, // Is this trade the maker side? + "R":false, // Is this reduce only + "ps":"LONG", // Position Side + "rp":"0", // Realized Profit of the trade + "st":"C_TAKE_PROFIT", // Strategy type, only pushed with conditional order triggered + "si":12893, // StrategyId,only pushed with conditional order triggered + "V":"EXPIRE_TAKER", // STP mode + "gtd":0 + } +} +When new order created, order status changed will push such event. event type is ORDER_TRADE_UPDATE. + +Side + +BUY +SELL +Order Type + +MARKET +LIMIT +LIQUIDATION +Execution Type + +NEW +CANCELED +CALCULATED - Liquidation Execution +EXPIRED +TRADE +Order Status + +NEW +PARTIALLY_FILLED +FILLED +CANCELED +EXPIRED +Time in force + +GTC +IOC +FOK +GTX +Liquidation and ADL: + +If user gets liquidated due to insufficient margin balance: +c shows as "autoclose-XXX",X shows as "NEW" +If user has enough margin balance but gets ADL: +c shows as “adl_autoclose”,X shows as “NEW” +Event: Conditional Order Trade Update +Payload: + +{ + "e": "CONDITIONAL_ORDER_TRADE_UPDATE", // Event Type + "T": 1669262908216, // Transaction Time + "E": 1669262908218, // Event Time + "fs": "UM", // Event business unit + "so": { + "s": "BTCUSDT", // Symbol + "c":"TEST", // Strategy Client Order Id + "si": 176057039, // Strategy ID + "S":"SELL", // Side + "st": "TRAILING_STOP_MARKET", // Strategy Type + "f":"GTC", // Time in Force + "q":"0.001", //Quantity + "p":"0", //Price + "sp":"7103.04", // Stop Price. Please ignore with TRAILING_STOP_MARKET order + "os":"NEW", // Strategy Order Status + "T":1568879465650, // Order book Time + "ut": 1669262908216, // Order update Time + "R":false, // Is this reduce only + "wt":"MARK_PRICE", // Stop Price Working Type + "ps":"LONG", // Position Side + "cp":false, // If Close-All, pushed with conditional order + "AP":"7476.89", // Activation Price, only pushed with TRAILING_STOP_MARKET order + "cr":"5.0", // Callback Rate, only puhed with TRAILING_STOP_MARKET order + "i":8886774, // Order Id + "V":"EXPIRE_TAKER", // STP mode + "gtd":0 + } +} +When new order created, order status changed will push such event. event type is CONDITIONAL_ORDER_TRADE_UPDATE. + +Side + +BUY +SELL +Conditional Order Type + +STOP +TAKE_PROFIT +STOP_MARKET +TAKE_PROFIT_MARKET +TRAILING_STOP_MARKET +Execution Type + +NEW +CANCELED +CALCULATED - Liquidation Execution +EXPIRED +TRADE +Order Status + +NEW +CANCELED +EXPIRED +TRIGGERING //Order meet the trigger condition +TRIGGERED //Order pass the trigger condition check +FINISHED +Time in force + +GTC +IOC +FOK +GTX +Event: riskLevelChange +Payload: + +{ + "e":"riskLevelChange", // Event Type + "E":1587727187525, // Event Time + "u":"1.99999999", // uniMMR level + "s":"MARGIN_CALL", //MARGIN_CALL, SUPPLY_MARGIN, REDUCE_ONLY, FORCE_LIQUIDATION + "eq":"30.23416728", // account equity in USD value + "ae":"30.23416728", // actual equity without collateral rate in USD value + "m":"15.11708371" // total maintenance margin in USD value +} +When the user's position risk ratio is too high, this stream will be pushed. +This message is only used as risk guidance information and is not recommended for investment strategies. +RISK_LEVEL_CHANGEincludes following types:MARGIN_CALL, SUPPLY_MARGIN, REDUCE_ONLY, FORCE_LIQUIDATION +In the case of a highly volatile market, there may be the possibility that the user's position has been liquidated at the same time when this stream is pushed out. +Event: Futures Account Configuration Update (Leverage Update) +Payload: + +{ + "e":"ACCOUNT_CONFIG_UPDATE", // Event Type + "fs": "UM", // Event business unit + "E":1611646737479, // Event Time + "T":1611646737476, // Transaction Time + "ac":{ + "s":"BTCUSD_PERP", // symbol + "l":25 // leverage + + } +} +When the account configuration is changed, the event type will be pushed as ACCOUNT_CONFIG_UPDATE + +When the leverage of a trade pair changes, the payload will contain the object ac to represent the account configuration of the trade pair, where s represents the specific trade pair and l represents the leverage. + +Event: OpenOrderLoss Update +Payload: + +{ + "e": "openOrderLoss", //Event Type + "E": 1678710578788, // Event Time + "O": [{ // Update Data + "a": "BUSD", + "o": "-0.1232313" // Amount + }, { + "a": "BNB", + "o": "-12.1232313" + }] +} +Event: Liability Update +Payload: + +{ + "e": "liabilityChange", //Event Type + "E": 1573200697110, //Event Time + "a": "BTC", //Asset + "t": “BORROW” //Type + "tx": 1352286576452864727, //Transaction ID + "p": "1.03453430", //Principal + "i": "0", //Interest + "l": "1.03476851" //Total Liability +} +Event: Margin Account Update +Payload: + +{ + "e": "outboundAccountPosition", //Event type + "E": 1564034571105, //Event Time + "u": 1564034571073, //Time of last account update + "U": 1027053479517, //Event update ID + "B": [ //Balances Array + { + "a": "ETH", //Asset + "f": "10000.000000", //Free + "l": "0.000000" //Locked + } + ] +} +outboundAccountPosition is sent any time an account balance has changed and contains the assets that were possibly changed by the event that generated the balance change. + +Event: Margin Balance Update +Payload: + +{ + "e": "balanceUpdate", //Event Type + "E": 1573200697110, //Event Time + "a": "BTC", //Asset + "d": "100.00000000", //Balance Delta + "U": 1027053479517 //Event update ID + "T": 1573200697068 //Clear Time +} +Event: Margin Order Update +Payload: + +{ + "e": "executionReport", // Event type + "E": 1499405658658, // Event time + "s": "ETHBTC", // Symbol + "c": "mUvoqJxFIILMdfAW5iGSOW", // Client order ID + "S": "BUY", // Side + "o": "LIMIT", // Order type + "f": "GTC", // Time in force + "q": "1.00000000", // Order quantity + "p": "0.10264410", // Order price + "P": "0.00000000", // Stop price + "d": 4, // Trailing Delta; This is only visible if the order was a trailing stop order. + "F": "0.00000000", // Iceberg quantity + "g": -1, // OrderListId + "C": "", // Original client order ID; This is the ID of the order being canceled + "x": "NEW", // Current execution type + "X": "NEW", // Current order status + "r": "NONE", // Order reject reason; will be an error code. + "i": 4293153, // Order ID + "l": "0.00000000", // Last executed quantity + "z": "0.00000000", // Cumulative filled quantity + "L": "0.00000000", // Last executed price + "n": "0", // Commission amount + "N": null, // Commission asset + "T": 1499405658657, // Transaction time + "t": -1, // Trade ID + "v": 3, // Prevented Match Id; This is only visible if the order expire due to STP trigger. + "I": 8641984, // Ignore + "w": true, // Is the order on the book? + "m": false, // Is this trade the maker side? + "M": false, // Ignore + "O": 1499405658657, // Order creation time + "Z": "0.00000000", // Cumulative quote asset transacted quantity + "Y": "0.00000000", // Last quote asset transacted quantity (i.e. lastPrice * lastQty) + "Q": "0.00000000", // Quote Order Quantity + "D": 1668680518494, // Trailing Time; This is only visible if the trailing stop order has been activated. + "j": 1, // Strategy ID; This is only visible if the strategyId parameter was provided upon order placement + "J": 1000000, // Strategy Type; This is only visible if the strategyType parameter was provided upon order placement + "W": 1499405658657, // Working Time; This is only visible if the order has been placed on the book. + "V": "NONE", // selfTradePreventionMode + "u":1, // TradeGroupId; This is only visible if the account is part of a trade group and the order expired due to STP trigger. + "U":37, // CounterOrderId; This is only visible if the order expired due to STP trigger. + "A":"3.000000", // Prevented Quantity; This is only visible if the order expired due to STP trigger. + "B":"3.000000", // Last Prevented Quantity; This is only visible if the order expired due to STP trigger. + "x": "NEW", // Current execution type + "X": "NEW", // Current order status + "V": "NONE", // selfTradePreventionMode +} +Margin orders are updated with the executionReport event. + +Execution types: + +NEW - The order has been accepted into the engine. +CANCELED - The order has been canceled by the user. +REJECTED - The order has been rejected and was not processed (This message appears only with Cancel Replace Orders wherein the new order placement is rejected but the request to cancel request succeeds.) +TRADE - Part of the order or all of the order's quantity has filled. +EXPIRED - The order was canceled according to the order type's rules (e.g. LIMIT FOK orders with no fill, LIMIT IOC or MARKET orders that partially fill) or by the exchange, (e.g. orders canceled during liquidation, orders canceled during maintenance). +TRADE_PREVENTION - The order has expired due to STP trigger. Check the Public API Definitions for more relevant enum definitions. +Error Codes +Here is the error JSON payload: + +{ + "code":-1121, + "msg":"Invalid symbol." +} +Errors consist of two parts: an error code and a message. +Codes are universal,but messages can vary. + +10xx - General Server or Network issues +-1000 UNKNOWN +An unknown error occured while processing the request. +-1001 DISCONNECTED +Internal error; unable to process your request. Please try again. +-1002 UNAUTHORIZED +You are not authorized to execute this request. +-1003 TOO_MANY_REQUESTS +Too many requests queued. +Too many requests; please use the websocket for live updates. +Too many requests; current limit is %s requests per minute. Please use the websocket for live updates to avoid polling the API. +Way too many requests; IP banned until %s. Please use the websocket for live updates to avoid bans. +-1004 DUPLICATE_IP +This IP is already on the white list +-1005 NO_SUCH_IP +No such IP has been white listed +-1006 UNEXPECTED_RESP +An unexpected response was received from the message bus. Execution status unknown. +-1007 TIMEOUT +Timeout waiting for response from backend server. Send status unknown; execution status unknown. +-1010 ERROR_MSG_RECEIVED +ERROR_MSG_RECEIVED. +-1011 NON_WHITE_LIST +This IP cannot access this route. +-1013 INVALID_MESSAGE +INVALID_MESSAGE. +-1014 UNKNOWN_ORDER_COMPOSITION +Unsupported order combination. +-1015 TOO_MANY_ORDERS +Too many new orders. +Too many new orders; current limit is %s orders per %s. +-1016 SERVICE_SHUTTING_DOWN +This service is no longer available. +-1020 UNSUPPORTED_OPERATION +This operation is not supported. +-1021 INVALID_TIMESTAMP +Timestamp for this request is outside of the recvWindow. +Timestamp for this request was 1000ms ahead of the server's time. +-1022 INVALID_SIGNATURE +Signature for this request is not valid. +-1023 START_TIME_GREATER_THAN_END_TIME +Start time is greater than end time. +11xx - Request issues +-1100 ILLEGAL_CHARS +Illegal characters found in a parameter. +Illegal characters found in parameter '%s'; legal range is '%s'. +-1101 TOO_MANY_PARAMETERS +Too many parameters sent for this endpoint. +Too many parameters; expected '%s' and received '%s'. +Duplicate values for a parameter detected. +-1102 MANDATORY_PARAM_EMPTY_OR_MALFORMED +A mandatory parameter was not sent, was empty/null, or malformed. +Mandatory parameter '%s' was not sent, was empty/null, or malformed. +Param '%s' or '%s' must be sent, but both were empty/null! +-1103 UNKNOWN_PARAM +An unknown parameter was sent. +-1104 UNREAD_PARAMETERS +Not all sent parameters were read. +Not all sent parameters were read; read '%s' parameter(s) but was sent '%s'. +-1105 PARAM_EMPTY +A parameter was empty. +Parameter '%s' was empty. +-1106 PARAM_NOT_REQUIRED +A parameter was sent when not required. +Parameter '%s' sent when not required. +-1108 BAD_ASSET +Invalid asset. +-1109 BAD_ACCOUNT +Invalid account. +-1110 BAD_INSTRUMENT_TYPE +Invalid symbolType. +-1111 BAD_PRECISION +Precision is over the maximum defined for this asset. +-1112 NO_DEPTH +No orders on book for symbol. +-1113 WITHDRAW_NOT_NEGATIVE +Withdrawal amount must be negative. +-1114 TIF_NOT_REQUIRED +TimeInForce parameter sent when not required. +-1115 INVALID_TIF +Invalid timeInForce. +-1116 INVALID_ORDER_TYPE +Invalid orderType. +-1117 INVALID_SIDE +Invalid side. +-1118 EMPTY_NEW_CL_ORD_ID +New client order ID was empty. +-1119 EMPTY_ORG_CL_ORD_ID +Original client order ID was empty. +-1120 BAD_INTERVAL +Invalid interval. +-1121 BAD_SYMBOL +Invalid symbol. +-1125 INVALID_LISTEN_KEY +This listenKey does not exist. Please use POST /papi/v1/listenKey to recreate listenKey +-1127 MORE_THAN_XX_HOURS +Lookup interval is too big. +More than %s hours between startTime and endTime. +-1128 OPTIONAL_PARAMS_BAD_COMBO +Combination of optional parameters invalid. +-1130 INVALID_PARAMETER +Invalid data sent for a parameter. +Data sent for parameter '%s' is not valid. +-1136 INVALID_NEW_ORDER_RESP_TYPE +Invalid newOrderRespType. +20xx - Processing Issues +-2010 NEW_ORDER_REJECTED +NEW_ORDER_REJECTED +-2011 CANCEL_REJECTED +CANCEL_REJECTED +-2013 NO_SUCH_ORDER +Order does not exist. +-2014 BAD_API_KEY_FMT +API-key format invalid. +-2015 REJECTED_MBX_KEY +Invalid API-key, IP, or permissions for action. +-2016 NO_TRADING_WINDOW +No trading window could be found for the symbol. Try ticker/24hrs instead. +-2018 BALANCE_NOT_SUFFICIENT +Balance is insufficient. +-2019 MARGIN_NOT_SUFFICIEN +Margin is insufficient. +-2020 UNABLE_TO_FILL +Unable to fill. +-2021 ORDER_WOULD_IMMEDIATELY_TRIGGER +Order would immediately trigger. +-2022 REDUCE_ONLY_REJECT +ReduceOnly Order is rejected. +-2023 USER_IN_LIQUIDATION +User in liquidation mode now. +-2024 POSITION_NOT_SUFFICIENT +Position is not sufficient. +-2025 MAX_OPEN_ORDER_EXCEEDED +Reach max open order limit. +-2026 REDUCE_ONLY_ORDER_TYPE_NOT_SUPPORTED +This OrderType is not supported when reduceOnly. +-2027 MAX_LEVERAGE_RATIO +Exceeded the maximum allowable position at current leverage. +-2028 MIN_LEVERAGE_RATIO +Leverage is smaller than permitted: insufficient margin balance. +40xx - Filters and other Issues +-4000 INVALID_ORDER_STATUS +Invalid order status. +-4001 PRICE_LESS_THAN_ZERO +Price less than 0. +-4002 PRICE_GREATER_THAN_MAX_PRICE +Price greater than max price. +-4003 QTY_LESS_THAN_ZERO +Quantity less than zero. +-4004 QTY_LESS_THAN_MIN_QTY +Quantity less than min quantity. +-4005 QTY_GREATER_THAN_MAX_QTY +Quantity greater than max quantity. +-4006 STOP_PRICE_LESS_THAN_ZERO +Stop price less than zero. +-4007 STOP_PRICE_GREATER_THAN_MAX_PRICE +Stop price greater than max price. +-4008 TICK_SIZE_LESS_THAN_ZERO +Tick size less than zero. +-4009 MAX_PRICE_LESS_THAN_MIN_PRICE +Max price less than min price. +-4010 MAX_QTY_LESS_THAN_MIN_QTY +Max qty less than min qty. +-4011 STEP_SIZE_LESS_THAN_ZERO +Step size less than zero. +-4012 MAX_NUM_ORDERS_LESS_THAN_ZERO +Max mum orders less than zero. +-4013 PRICE_LESS_THAN_MIN_PRICE +Price less than min price. +-4014 PRICE_NOT_INCREASED_BY_TICK_SIZE +Price not increased by tick size. +-4015 INVALID_CL_ORD_ID_LEN +Client order id is not valid. +Client order id length should not be more than 36 chars +-4016 PRICE_HIGHTER_THAN_MULTIPLIER_UP +Price is higher than mark price multiplier cap. +-4017 MULTIPLIER_UP_LESS_THAN_ZERO +Multiplier up less than zero. +-4018 MULTIPLIER_DOWN_LESS_THAN_ZERO +Multiplier down less than zero. +-4019 COMPOSITE_SCALE_OVERFLOW +Composite scale too large. +-4020 TARGET_STRATEGY_INVALID +Target strategy invalid for orderType '%s',reduceOnly '%b'. +-4021 INVALID_DEPTH_LIMIT +Invalid depth limit. +'%s' is not valid depth limit. +-4022 WRONG_MARKET_STATUS +market status sent is not valid. +-4023 QTY_NOT_INCREASED_BY_STEP_SIZE +Qty not increased by step size. +-4024 PRICE_LOWER_THAN_MULTIPLIER_DOWN +Price is lower than mark price multiplier floor. +-4025 MULTIPLIER_DECIMAL_LESS_THAN_ZERO +Multiplier decimal less than zero. +-4026 COMMISSION_INVALID +Commission invalid. +%s less than zero. +%s absolute value greater than %s +-4027 INVALID_ACCOUNT_TYPE +Invalid account type. +-4028 INVALID_LEVERAGE +Invalid leverage +Leverage %s is not valid +Leverage %s already exist with %s +-4029 INVALID_TICK_SIZE_PRECISION +Tick size precision is invalid. +-4030 INVALID_STEP_SIZE_PRECISION +Step size precision is invalid. +-4031 INVALID_WORKING_TYPE +Invalid parameter working type +Invalid parameter working type: %s +-4032 EXCEED_MAX_CANCEL_ORDER_SIZE +Exceed maximum cancel order size. +Invalid parameter working type: %s +-4033 INSURANCE_ACCOUNT_NOT_FOUND +Insurance account not found. +-4044 INVALID_BALANCE_TYPE +Balance Type is invalid. +-4045 MAX_STOP_ORDER_EXCEEDED +Reach max stop order limit. +-4046 NO_NEED_TO_CHANGE_MARGIN_TYPE +No need to change margin type. +-4047 THERE_EXISTS_OPEN_ORDERS +Margin type cannot be changed if there exists open orders. +-4048 THERE_EXISTS_QUANTITY +Margin type cannot be changed if there exists position. +-4049 ADD_ISOLATED_MARGIN_REJECT +Add margin only support for isolated position. +-4050 CROSS_BALANCE_INSUFFICIENT +Cross balance insufficient. +-4051 ISOLATED_BALANCE_INSUFFICIENT +Isolated balance insufficient. +-4052 NO_NEED_TO_CHANGE_AUTO_ADD_MARGIN +No need to change auto add margin. +-4053 AUTO_ADD_CROSSED_MARGIN_REJECT +Auto add margin only support for isolated position. +-4054 ADD_ISOLATED_MARGIN_NO_POSITION_REJECT +Cannot add position margin: position is 0. +-4055 AMOUNT_MUST_BE_POSITIVE +Amount must be positive. +-4056 INVALID_API_KEY_TYPE +Invalid api key type. +-4057 INVALID_RSA_PUBLIC_KEY +Invalid api public key +-4058 MAX_PRICE_TOO_LARGE +maxPrice and priceDecimal too large,please check. +-4059 NO_NEED_TO_CHANGE_POSITION_SIDE +No need to change position side. +-4060 INVALID_POSITION_SIDE +Invalid position side. +-4061 POSITION_SIDE_NOT_MATCH +Order's position side does not match user's setting. +-4062 REDUCE_ONLY_CONFLICT +Invalid or improper reduceOnly value. +-4063 INVALID_OPTIONS_REQUEST_TYPE +Invalid options request type +-4064 INVALID_OPTIONS_TIME_FRAME +Invalid options time frame +-4065 INVALID_OPTIONS_AMOUNT +Invalid options amount +-4066 INVALID_OPTIONS_EVENT_TYPE +Invalid options event type +-4067 POSITION_SIDE_CHANGE_EXISTS_OPEN_ORDERS +Position side cannot be changed if there exists open orders. +-4068 POSITION_SIDE_CHANGE_EXISTS_QUANTITY +Position side cannot be changed if there exists position. +-4069 INVALID_OPTIONS_PREMIUM_FEE +Invalid options premium fee +-4070 INVALID_CL_OPTIONS_ID_LEN +Client options id is not valid. +Client options id length should be less than 32 chars +-4071 INVALID_OPTIONS_DIRECTION +Invalid options direction +-4072 OPTIONS_PREMIUM_NOT_UPDATE +premium fee is not updated, reject order +-4073 OPTIONS_PREMIUM_INPUT_LESS_THAN_ZERO +input premium fee is less than 0, reject order +-4074 OPTIONS_AMOUNT_BIGGER_THAN_UPPER +Order amount is bigger than upper boundary or less than 0, reject order +-4075 OPTIONS_PREMIUM_OUTPUT_ZERO +output premium fee is less than 0, reject order +-4076 OPTIONS_PREMIUM_TOO_DIFF +original fee is too much higher than last fee +-4077 OPTIONS_PREMIUM_REACH_LIMIT +place order amount has reached to limit, reject order +-4078 OPTIONS_COMMON_ERROR +options internal error +-4079 INVALID_OPTIONS_ID +invalid options id +invalid options id: %s +duplicate options id %d for user %d +-4080 OPTIONS_USER_NOT_FOUND +user not found +user not found with id: %s +-4081 OPTIONS_NOT_FOUND +options not found +options not found with id: %s +-4082 INVALID_BATCH_PLACE_ORDER_SIZE +Invalid number of batch place orders. +Invalid number of batch place orders: %s +-4083 PLACE_BATCH_ORDERS_FAIL +Fail to place batch orders. +-4084 UPCOMING_METHOD +Method is not allowed currently. Upcoming soon. +-4085 INVALID_NOTIONAL_LIMIT_COEF +Invalid notional limit coefficient +-4086 INVALID_PRICE_SPREAD_THRESHOLD +Invalid price spread threshold +-4087 REDUCE_ONLY_ORDER_PERMISSION +User can only place reduce only order +-4088 NO_PLACE_ORDER_PERMISSION +User can not place order currently +-4104 INVALID_CONTRACT_TYPE +Invalid contract type +-4114 INVALID_CLIENT_TRAN_ID_LEN +clientTranId is not valid +Client tran id length should be less than 64 chars +-4115 DUPLICATED_CLIENT_TRAN_ID +clientTranId is duplicated +Client tran id should be unique within 7 days +-4118 REDUCE_ONLY_MARGIN_CHECK_FAILED +ReduceOnly Order Failed. Please check your existing position and open orders +-4131 MARKET_ORDER_REJECT +The counterparty's best price does not meet the PERCENT_PRICE filter limit +-4135 INVALID_ACTIVATION_PRICE +Invalid activation price +-4137 QUANTITY_EXISTS_WITH_CLOSE_POSITION +Quantity must be zero with closePosition equals true +-4138 REDUCE_ONLY_MUST_BE_TRUE +Reduce only must be true with closePosition equals true +-4139 ORDER_TYPE_CANNOT_BE_MKT +Order type can not be market if it's unable to cancel +-4140 INVALID_OPENING_POSITION_STATUS +Invalid symbol status for opening position +-4141 SYMBOL_ALREADY_CLOSED +Symbol is closed +-4142 STRATEGY_INVALID_TRIGGER_PRICE +REJECT: take profit or stop order will be triggered immediately +-4144 INVALID_PAIR +Invalid pair +-4161 ISOLATED_LEVERAGE_REJECT_WITH_POSITION +Leverage reduction is not supported in Isolated Margin Mode with open positions +-4164 MIN_NOTIONAL +Order's notional must be no smaller than 5.0 (unless you choose reduce only) +Order's notional must be no smaller than %s (unless you choose reduce only) +-4165 INVALID_TIME_INTERVAL +Invalid time interval +Maximum time interval is %s days +-4183 PRICE_HIGHTER_THAN_STOP_MULTIPLIER_UP +Price is higher than stop price multiplier cap. +Limit price can't be higher than %s. +-4184 PRICE_LOWER_THAN_STOP_MULTIPLIER_DOWN +Price is lower than stop price multiplier floor. +Limit price can't be lower than %s. +50xx - Order Execution Issues +-5021 FOK_ORDER_REJECT +Due to the order could not be filled immediately, the FOK order has been rejected. +-5022 GTX_ORDER_REJECT +Due to the order could not be executed as maker, the Post Only order will be rejected. diff --git a/utils/portfolio_endpoints_list.txt b/utils/portfolio_endpoints_list.txt new file mode 100644 index 000000000..00cdf7129 --- /dev/null +++ b/utils/portfolio_endpoints_list.txt @@ -0,0 +1,89 @@ +PUT /papi/v1/um/order +PUT /papi/v1/cm/order +GET /papi/v1/um/orderAmendment +GET /papi/v1/cm/orderAmendment +GET /papi/v1/um/account +POST /papi/v1/um/order +POST /papi/v1/margin/order +POST /papi/v1/margin/order/oco +GET /papi/v1/um/order +GET /papi/v1/um/openOrder +GET /papi/v1/um/openOrders +GET /papi/v1/um/allOrders +GET /papi/v1/um/conditional/openOrder +GET /papi/v1/um/conditional/openOrders +GET /papi/v1/um/conditional/orderHistory +GET /papi/v1/um/conditional/allOrders +DELETE /papi/v1/um/order +DELETE /papi/v1/um/conditional/order +DELETE /papi/v1/margin/order +DELETE /papi/v1/margin/allOpenOrders +DELETE /papi/v1/margin/orderList +GET /papi/v1/margin/order +GET /papi/v1/margin/allOrders +GET /papi/v1/margin/orderList +GET /papi/v1/margin/allOrderList +GET /papi/v1/margin/openOrderList +GET /papi/v1/um/positionRisk +GET /papi/v1/cm/account +GET /papi/v1/cm/positionRisk +GET /papi/v1/um/leverageBracket +GET /papi/v1/cm/leverageBracket +POST /papi/v1/cm/order +POST /papi/v1/um/conditional/order +POST /papi/v1/cm/conditional/order +GET /papi/v1/margin/openOrders +GET /papi/v1/margin/myTrades +POST /papi/v1/asset-collection +GET /papi/v1/um/adlQuantile +GET /papi/v1/cm/adlQuantile +POST /papi/v1/repay-futures-switch +GET /papi/v1/repay-futures-switch +POST /papi/v1/repay-futures-negative-balance +POST /papi/v1/ping +GET /papi/v1/um/income +GET /papi/v1/cm/income +GET /papi/v1/ping +POST /papi/v1/marginLoan +POST /papi/v1/repayLoan +GET /fapi/v1/exchangeInfo +DELETE /papi/v1/um/allOpenOrders +DELETE /papi/v1/cm/order +DELETE /papi/v1/cm/allOpenOrders +DELETE /papi/v1/um/conditional/allOpenOrders +DELETE /papi/v1/cm/conditional/order +DELETE /papi/v1/cm/conditional/allOpenOrders +GET /papi/v1/cm/order +GET /papi/v1/cm/openOrder +GET /papi/v1/cm/openOrders +GET /papi/v1/cm/allOrders +GET /papi/v1/cm/conditional/openOrder +GET /papi/v1/cm/conditional/openOrders +GET /papi/v1/cm/conditional/orderHistory +GET /papi/v1/cm/conditional/allOrders +GET /papi/v1/balance +GET /papi/v1/account +GET /papi/v1/margin/maxBorrowable +GET /papi/v1/margin/maxWithdraw +POST /papi/v1/um/leverage +POST /papi/v1/cm/leverage +POST /papi/v1/um/positionSide/dual +POST /papi/v1/cm/positionSide/dual +GET /papi/v1/um/positionSide/dual +GET /papi/v1/cm/positionSide/dual +GET /papi/v1/um/userTrades +GET /papi/v1/cm/userTrades +GET /papi/v1/margin/forceOrders +GET /papi/v1/um/forceOrders +GET /papi/v1/cm/forceOrders +GET /papi/v1/um/apiTradingStatus +GET /papi/v1/um/commissionRate +GET /papi/v1/cm/commissionRate +GET /papi/v1/margin/marginLoan +GET /papi/v1/margin/repayLoan +GET /papi/v1/portfolio/interest-history +POST /papi/v1/auto-collection +POST /papi/v1/bnb-transfer +POST /papi/v1/listenKey +PUT /papi/v1/listenKey +DELETE /papi/v1/listenKey \ No newline at end of file diff --git a/utils/spot_docs.txt b/utils/spot_docs.txt new file mode 100644 index 000000000..18514e7d3 --- /dev/null +++ b/utils/spot_docs.txt @@ -0,0 +1,17873 @@ +Logo +Spot/Margin/Savings/Mining +USDⓈ-M Futures +COIN-M Futures +European Options +WebSocket API +Portfolio Margin +简体中文 +Search +Change Log +Introduction +General Info +Wallet Endpoints +Sub-Account Endpoints +Market Data Endpoints +Websocket Market Streams +Spot Trading Endpoints +Spot Account Endpoints +Margin Account/Trade +User Data Streams +Margin User Data Streams +Simple Earn Endpoints +Dual Investment Endpoints +Auto-Invest Endpoints +Staking Endpoints +Mining Endpoints +Futures +Futures Algo Endpoints +Spot Algo Endpoints +Portfolio Margin Pro Endpoints +Fiat Endpoints +C2C Endpoints +VIP Loans Endpoints +Crypto Loans Endpoints +Copy Trading Endpoints +Pay Endpoints +Convert Endpoints +Rebate Endpoints +NFT Endpoints +Binance Gift Card Endpoints +Error Codes +Notes +Binance Exchange +Change Log +Important Documentation Notice + +Binance has launched its new API Documentation Portal. The existing GitHub API documentation is now deprecated(2024-06-17) and set to go offline in the upcoming few months following user migration; the exact date will be determined and communicated in due course. + +During this transition phase, both sites will be maintained. However, any new services will only be published in the new portal moving forward. + +Here's a reference table of the links for the current and new API documentation: + +Functionality Current Documentation New Documentation +Spot Trading Current Documentation New Documentation +Spot Websocket API Current Documentation New Documentation +Margin Trading Current Documentation New Documentation +Derivative UM Futures Current Documentation New Documentation +Derivative CM Futures Current Documentation New Documentation +Derivative Options Current Documentation New Documentation +Derivative Portfolio Margin Current Documentation New Documentation +Wallet Current Documentation New Documentation +Sub Account Current Documentation New Documentation +Simple Earn Current Documentation New Documentation +Dual Investment Current Documentation New Documentation +Auto Invest Current Documentation New Documentation +Staking Current Documentation New Documentation +Mining Current Documentation New Documentation +Algo Trading Current Documentation New Documentation +Copy Trading Current Documentation New Documentation +Porfolio Margin Pro Current Documentation New Documentation +Fiat Current Documentation New Documentation +C2C Current Documentation New Documentation +VIP Loan Current Documentation New Documentation +Crypto Loan Current Documentation New Documentation +Pay Current Documentation New Documentation +Convert Current Documentation New Documentation +Rebate Current Documentation New Documentation +NFT Current Documentation New Documentation +Gift Card Current Documentation New Documentation +2024-12-17 + +General Changes: + +The system now supports microseconds in all related time and/or timestamp fields. Microsecond support is opt-in, by default the requests and responses still use milliseconds. Examples in documentation are also using milliseconds for the foreseeable future. + +WebSocket Streams + +A new optional parameter timeUnit can be used in the connection URL to select the time unit. +For example: /stream?streams=btcusdt@trade&timeUnit=millisecond +Supported values are: +MILLISECOND +millisecond +MICROSECOND +microsecond +If the time unit is not selected, milliseconds will be used by default. +REST API + +A new optional header X-MBX-TIME-UNIT can be sent in the request to select the time unit. +Supported values: +MILLISECOND +millisecond +MICROSECOND +microsecond +The time unit affects timestamp fields in JSON responses (e.g., time, transactTime). +SBE responses continue to be in microseconds regardless of time unit. +If the time unit is not selected, milliseconds will be used by default. +Timestamp parameters (e.g. startTime, endTime, timestamp) can now be passed in milliseconds or microseconds. +User Data Streams + +A new optional parameter timeUnit can be used in the connection URL to select the time unit. +Supported values +MILLISECOND +MICROSECOND. +microsecond +millisecond +2024-12-09 + +Notice: The changes below will be rolled out starting at 2024-12-12 and may take approximately a week to complete. + +General Changes + +Timestamp parameters now reject values too far into the past or the future. To be specific, the parameter will be rejected if: +timestamp before 2017-01-01 (less than 1483228800000) +timestamp is more than 10 seconds after the current time (e.g., if current time is 1729745280000 then it is an error to use 1729745291000 or greater) +If startTime and/or endTime values are outside of range, the values will be adjusted to fit the correct range. +The field for quote order quantity (origQuoteOrderQty) has been added to responses that previously did not have it. Note that for order placement endpoints the field will only appear for requests with newOrderRespType set to RESULT or FULL. +Please refer to the table below for affected requests with: origQuoteOrderQty: +Service Request +REST POST /api/v3/order +POST /api/v3/sor/order +POST /api/v3/order/oco +POST /api/v3/orderList/oco +POST /api/v3/orderList/oto +POST /api/v3/orderList/otoco +DELETE /api/v3/order +DELETE /api/v3/orderList +POST /api/v3/order/cancelReplace +WebSocket API order.place +sor.order.place +orderList.place +orderList.place.oco +orderList.place.oto +orderList.place.otoco +order.cancel +orderList.cancel +order.cancelReplace +SBE + +A new schema 2:1 spot_2_1.xml has been released. The current schema 2:0 spot_2_0.xml will thus be deprecated, and retired from the API in 6 months as per our schema deprecation policy. +Schema 2:1 is a backward compatible update of schema 2:0. You will always receive payloads in 2:1 format when you request either schema 2:0 or 2:1. +Changes in SBE schema 2:1: +New field origQuoteOrderQty in order placement/cancellation responses (Note: Decoders generated using the 2:0 schema will skip this field.): +NewOrderResultResponse +NewOrderFullResponse +CancelOrderResponse +NewOrderListResultResponse +NewOrderListFullResponse +CancelOrderListResponse +WebSocket API only: New field userDataStream in session status responses: +WebSocketSessionLogonResponse +WebSocketSessionStatusResponse +WebSocketSessionLogoutResponse +WebSocket API only: New messages for User Data Stream support: +UserDataStreamSubscribeResponse +UserDataStreamUnsubscribeResponse +BalanceUpdateEvent +EventStreamTerminatedEvent +ExecutionReportEvent +ExternalLockUpdateEvent +ListStatusEvent +OutboundAccountPositionEvent +User Data Stream + +WebSocket API only: New event eventStreamTerminated is emitted when you either logout from your websocket session or you have unsubscribed from the user data stream. +New event externalLockUpdate is sent when your spot wallet balance is locked/unlocked by an external system. +The following changes will occur between 2024-12-16 to 2024-12-20: + +Fixed a bug that prevented orders from being placed when submitting OCOs on the BUY side without providing a stopPrice. +TAKE_PROFIT and TAKE_PROFIT_LIMIT support has been added for OCOs. +Previously OCOs could only be composed by the following order types: +LIMIT_MAKER + STOP_LOSS +LIMIT_MAKER + STOP_LOSS_LIMIT +Now OCOs can be composed of the following order types: +LIMIT_MAKER + STOP_LOSS +LIMIT_MAKER + STOP_LOSS_LIMIT +TAKE_PROFIT + STOP_LOSS +TAKE_PROFIT + STOP_LOSS_LIMIT +TAKE_PROFIT_LIMIT + STOP_LOSS +TAKE_PROFIT_LIMIT + STOP_LOSS_LIMIT +This is supported by the following requests: +POST /api/v3/orderList/oco +POST /api/v3/orderList/otoco +orderList.place.oco +orderList.place.otoco +NewOrderList +Error code -1167 will be obsolete after this update and will be removed from the documentation in a later update. +2024-10-18 + +REST and WebSocket API: + +Reminder that SBE 1:0 schema will be disabled on 2024-10-25, 6 months after being deprecated, as per our SBE policy. +The SBE lifecycle for Prod has been updated to reflect this change. +2024-10-17 + +Changes to Exchange Information (i.e. GET /api/v3/exchangeInfo from REST and exchangeInfofor WebSocket API). + +A new optional parameter showPermissionSets can be used to hide the permissions from permissionsSets; This can be used for a reduced payload size. +A new optional parameter symbolStatus can now be used to only show symbols with the specified status. (e.g. TRADING, HALT, BREAK). +2024-09-02 + +Spot Unfilled Order Count Rules have been updated to explain how to decrease your unfilled order count when placing orders. +2024-08-16 + +Notice: The changes below are being rolled out gradually, and may take approximately a week to complete. + +SPOT API: * New error message have been added when quote quantity market orders (aka reverse market orders) are rejected in low-liquidity situations. + +2024-07-22 + +SPOT API + +Fixed a bug where klines had incorrect timestamps. +REST API: GET /api/v3/klines and GET /api/v3/uiKlines with timeZone parameter +WebSocket API: klines and uiKlines with timeZone parameter +WebSocket Streams: @kline_@+08:00 streams +2024-06-11 + +On June 11, 05:00 UTC, One-Triggers-the-Other (OTO) orders and One-Triggers-a-One-Cancels-The-Other (OTOCO) orders will be enabled. (Note this may take a few hours to be rolled out to all servers.) +For more information, please refer to the following pages: +OTO +OTOCO +On June 18, 05:00 UTC, Buyer order ID b and Seller order ID a will be removed from the Trade Streams (i.e. @trade). (Note that this may take a few hours to be rolled out to all servers.) +WebSocket Streams has been updated regarding this change. +To monitor if your order was part of a trade, please listen to the User Data Streams. +2024-06-06 + +This will be available by June 6, 11:59 UTC. + +SPOT API + +orderRateLimitExceededMode has been added to POST /api/v3/order/cancelReplace. +2024-06-04 + +New Copy Trading Endpoint: +GET /sapi/v1/copyTrading/futures/userStatus: get futures lead trader status +GET /sapi/v1/copyTrading/futures/leadSymbol: get futures lead trading symbol whitelist +Wallet Endpoints adjustment: for internal transfers, the txid prefix has been replaced to “Off-chain transfer”on 28 May 2024. “internal transfer” flag is no longer available in the TXID field, including historical transactions, the following endpoints are impacted: +GET /sapi/v1/capital/deposit/hisrec +GET /sapi/v1/capital/withdraw/history +GET /sapi/v1/capital/deposit/subHisrec +2024-05-30 + +WebSocket Streams + +Kline/Candlestick streams can now support a UTC+8:00 timezone offset. (e.g. btcusdt@kline_1d@+08:00) +2024-05-22 + +Update Sub Account Endpoint: +GET /sapi/v1/sub-account/transfer/subUserHistory: update response field fromAccountType and toAccountType. Return USDT_FUTURE/COIN_FUTURE in order to differentiate 2 futures wallets. +New Wallet Endpoint: +GET /sapi/v1/account/info: To fetch the “VIP Level”, “whether Margin account is enabled” and “whether Futures account is enabled” +2024-04-18 + +New Wallet Endpoint: +GET /sapi/v1/capital/withdraw/address/list: Fetch withdraw address list +2024-04-10 + +The following changes have been postponed to take effect on April 25, 05:00 UTC + +Symbol permission information in Exchange Information responses has moved from field permissions to field permissionSets. +Field permissions will be empty and will be removed in a future release. +Previously, "permissions":["SPOT","MARGIN"] meant that you could place an order on the symbol if your account had SPOT or MARGIN permissions. +The equivalent is "permissionSets":[["SPOT","MARGIN"]]. (Note the extra set of square brackets.) +Each array of permissions inside the permissionSets array is called a "permission set". +Symbol permissions can now be more complex. +"permissionSets":[["SPOT","MARGIN"],["TRD_GRP_004","TRD_GRP_005"]] means that you may place an order on the symbol if your account has SPOT or MARGIN permissions and TRD_GRP_004 or TRD_GRP_005 permissions. +There may be an arbitrary number of permission sets in a symbol's permissionSets. +otoAllowed will now appear on GET /api/v3/exchangeInfo, that indicates if One-Triggers-the-Other (OTO) orders are supported on that symbol. +SBE + +A new schema 2:0 spot_2_0.xml has been released. The current schema 1:0 spot_1_0.xml will thus be deprecated, and retired from the API in 6 months as per our schema deprecation policy. +When using schema 1:0 on REST API or WebSocket API, group "permissions" in message "ExchangeInfoResponse" will always be empty. Upgrade to schema 2:0 to find permission information in group "permissionSets". See General changes above for more details. +Deprecated OCO requests will still be supported by the latest schema. +Note that trying to use schema 2:0 before it is actually released will result in an error. +2024-04-08 + +Update Gift Card Endpoint: + +POST /sapi/v1/giftcard/createCode: add response field expiredTime +POST /sapi/v1/giftcard/buyCode: add response field expiredTime +Update Wallet Endpoint: + +GET /sapi/v1/capital/config/getall: will remove response field resetAddressStatus on 2024-05-16 +2024-04-02 + +Notice: The changes below are being rolled out gradually, and will take approximately a week to complete. + +GET /api/v3/account has a new optional parameter omitZeroBalances, which if enabled hides all zero balances. +The weight of the following requests has been increased from 10 to 25 (This will take effect on April 4, 2024): +GET /api/v3/trades +GET /api/v3/historicalTrades +The POST /api/v3/order/oco endpoint is now deprecated on the REST API. You should use the new POST /api/v3/orderList/oco endpoint instead. Note that this new endpoint uses different parameters. +User Data Stream: + +New event listenKeyExpired that will be emitted in the streams if the listenKey expired. +The following will take effect approximately a week after the release date: + +Symbol permission information in Exchange Information responses has moved from field permissions to field permissionSets. +Field permissions will be empty and will be removed in a future release. +Previously, "permissions":["SPOT","MARGIN"] meant that you could place an order on the symbol if your account had SPOT or MARGIN permissions. +The equivalent is "permissionSets":[["SPOT","MARGIN"]]. (Note the extra set of square brackets.) +Each array of permissions inside the permissionSets array is called a "permission set". +Symbol permissions can now be more complex. +"permissionSets":[["SPOT","MARGIN"],["TRD_GRP_004","TRD_GRP_005"]] means that you may place an order on the symbol if your account has SPOT or MARGIN permissions and TRD_GRP_004 or TRD_GRP_005 permissions. +There may be an arbitrary number of permission sets in a symbol's permissionSets. +otoAllowed will now appear on GET /api/v3/exchangeInfo, that indicates if One-Triggers-the-Other (OTO) orders are supported on that symbol. +SBE + +A new schema 2:0 spot_2_0.xml has been released. The current schema 1:0 spot_1_0.xml will thus be deprecated, and retired from the API in 6 months as per our schema deprecation policy. +When using schema 1:0 on REST API or WebSocket API, group "permissions" in message "ExchangeInfoResponse" will always be empty. Upgrade to schema 2:0 to find permission information in group "permissionSets". See General changes above for more details. +Deprecated OCO requests will still be supported by the latest schema. +Note that trying to use schema 2:0 before it is actually released will result in an error. +2024-02-28 + +This will take effect on March 5, 2024. + +Simple Binary Encoding (SBE) will be added to the live exchange, both for the Rest API and WebSocket API on SPOT. + +For more information on SBE, please refer to the FAQ. + +2024-02-27 + +Following the latest upgrade on Binance Loans + +Binance Loans has added the following /v2 SAPI endpoints at 2024-02-27 08:00 (UTC). Users may utilize v2 SAPI endpoints to place, repay, and manage new Binance Loans (Flexible Rate) orders created after 2024-02-27 08:00 (UTC). +POST /sapi/v2/loan/flexible/borrow +GET /sapi/v2/loan/flexible/ongoing/orders +GET /sapi/v2/loan/flexible/borrow/history +POST /sapi/v2/loan/flexible/repay +GET /sapi/v2/loan/flexible/repay/history +POST /sapi/v2/loan/flexible/adjust/ltv +GET /sapi/v2/loan/flexible/ltv/adjustment/history +GET /sapi/v2/loan/flexible/loanable/data +GET /sapi/v2/loan/flexible/collateral/data +In addition, Binance Loans will be retiring its /v1 SAPI endpoints at the following timings: +At 2024-02-27 08:00 (UTC): +POST /sapi/v1/loan/flexible/borrow +GET /sapi/v1/loan/flexible/loanable/data +GET /sapi/v1/loan/flexible/collateral/data +At 2024-04-24 03:00 (UTC): +GET /sapi/v1/loan/flexible/ongoing/orders +POST /sapi/v1/loan/flexible/repay +POST /sapi/v1/loan/flexible/adjust/ltv +Binance Loans will also continue to maintain the following /v1 SAPI endpoints for users to check their Binance Loans (Flexible Rate) order history before 2024-02-27 08:00 (UTC). +GET /sapi/v1/loan/flexible/borrow/history +GET /sapi/v1/loan/flexible/repay/history +GET /sapi/v1/loan/flexible/ltv/adjustment/history +2024-02-23 + +New Endpoints for Convert: +GET /sapi/v1/dci/product/list: Get Dual Investment product list +POST /sapi/v1/dci/product/subscribe: Subscribe Dual Investment products +GET /sapi/v1/dci/product/positions: Get Dual Investment positions (batch) +GET /sapi/v1/dci/product/accounts: Check Dual Investment accounts +POST /sapi/v1/dci/product/auto_compound/edit-status: Change Auto-Compound status +2024-02-08 + +The SPOT WebSocket API can now support SBE on SPOT Testnet. + +The SBE schema has been updated with WebSocket API metadata without incrementing either schemaId or version. + +Users using SBE only on the REST API may continue to use the SBE schema with git commit hash 128b94b2591944a536ae427626b795000100cf1d or update to the newly-published SBE schema. + +Users who want to use SBE on the WebSocket API must use the newly-published SBE schema. + +The FAQ for SBE has been updated. + +2024-01-24 + +New Endpoints for Convert: +POST /sapi/v1/convert/limit/placeOrder: Place convert limit order +POST /sapi/v1/convert/limit/cancelOrder: Cancel convert limit order +GET /sapi/v1/convert/limit/queryOpenOrders: Query convert limit open orders +2024-01-19 + +According to the announcement, Binance Earn will disable the following BSwap SAPI endpoints and websocket at 2024-01-26 04:00 (UTC): + +GET /sapi/v1/bswap/pools +GET /sapi/v1/bswap/liquidity +POST /sapi/v1/bswap/liquidityAdd +POST /sapi/v1/bswap/liquidityRemove +GET /sapi/v1/bswap/liquidityOps +GET /sapi/v1/bswap/quote +POST /sapi/v1/bswap/swap +GET /sapi/v1/bswap/swap +GET /sapi/v1/bswap/poolConfigure +GET /sapi/v1/bswap/addLiquidityPreview +GET /sapi/v1/bswap/removeLiquidityPreview +GET /sapi/v1/bswap/unclaimedRewards +POST /sapi/v1/bswap/claimRewards +GET /sapi/v1/bswap/claimedHistory +wss://api.binance.com/sapi/wss for BSwap streams earn_swapprice_ and earn_swapprice_all +According to the announcement, Binance Earn disable the following Staking SAPI endpoints at 2024-01-09 06:00 (UTC): + +GET /sapi/v1/staking/productList +POST /sapi/v1/staking/purchase +POST /sapi/v1/staking/redeem +GET /sapi/v1/staking/position +GET /sapi/v1/staking/stakingRecord +POST /sapi/v1/staking/setAutoStaking +GET /sapi/v1/staking/personalLeftQuota +2024-01-15 + +New Endpoints for Wallet: +GET /sapi/v1/spot/delist-schedule: Query spot delist schedule +Update Endpoints for Wallet: +GET /sapi/v1/asset/dribblet:add parameter accountType +POST /sapi/v1/asset/dust-btc:add parameter accountType +POST /sapi/v1/asset/dust:add parameter accountType +2024-01-09 + +According to the announcement, Binance Margin will remove the following SAPI interfaces at 4:00 on March 31, 2024 (UTC). Please switch to the corresponding alternative interfaces in time: + +POST /sapi/v1/margin/transfer will be removed, please replace with POST /sapi/v1/asset/transfer universal transfer +POST /sapi/v1/margin/isolated/transfer will be removed, please replace with POST /sapi/v1/asset/transfer universal transfer +POST /sapi/v1/margin/loan will be removed, please replace with the new POST /sapi/v1/margin/borrow-repay borrowing and repayment interface +POST /sapi/v1/margin/repay will be removed, please replace with the new POST /sapi/v1/margin/borrow-repay borrowing and repayment interface +GET /sapi/v1/margin/isolated/transfer will be removed, please replace it with GET /sapi/v1/margin/transfer to get total margin transfer history +GET /sapi/v1/margin/asset will be removed, please replace with GET /sapi/v1/margin/allAssets +GET /sapi/v1/margin/pair will be removed, please replace with GET /sapi/v1/margin/allPairs +GET /sapi/v1/margin/isolated/pair will be removed, please replace with GET /sapi/v1/margin/isolated/allPairs +GET /sapi/v1/margin/loan will be removed, please replace with GET /sapi/v1/margin/borrow-repay +GET /sapi/v1/margin/repay will be removed, please replace with GET /sapi/v1/margin/borrow-repay +GET /sapi/v1/margin/dribblet will be removed, please replace with GET /sapi/v1/asset/dribblet +GET /sapi/v1/margin/dust will be removed, please replace with POST /sapi/v1/asset/dust-btc +POST /sapi/v1/margin/dust will be removed, please replace with POST /sapi/v1/asset/dust +New Endpoints for Margin: + +POST /sapi/v1/margin/borrow-repay: Margin account borrow/repay +GET /sapi/v1/margin/borrow-repay: Query borrow/repay records in Margin account +Update Endpoints fpr Margin: + +GET /sapi/v1/margin/transfer: add parameter isolatedSymbol, add response body +GET /sapi/v1/margin/allAssets: add parameter asset, add response body +GET /sapi/v1/margin/allPairs: add parameter symbol +GET /sapi/v1/margin/isolated/allPairs: add parameter symbol +2023-12-22 + +Binance will disable the following Staking SAPI endpoints at 2024-03-31 04:00: + +GET /sapi/v1/eth-staking/eth/history/wbethRewardsHistory: add new endpoint to query WBETH income record +POST /sapi/v2/eth-staking/eth/stake: add new endpoint to stake ETH to get WBETH. Current v1 endpoint POST /sapi/v1/eth-staking/eth/stake will be deprecated in the future, with the exact timing to be determined. +GET /sapi/v2/eth-staking/account: add new endpoint to query positions and 30-day earnings of staked ETH. Current v1 endpoint GET /sapi/v1/eth-staking/account will be deprecated in the future, with the exact timing to be determined. +POST /sapi/v1/eth-staking/wbeth/unwrap: delete this endpoint, POST /sapi/v1/eth-staking/eth/redeem is able to achieve same functionality +POST /sapi/v1/eth-staking/eth/redeem: Add new parameter asset, add new response fieldsethAmount, conversionRatio +GET /sapi/v1/eth-staking/eth/history/stakingHistory: add new response fields distributeAsset, distributeAmount, conversionRatio +GET /sapi/v1/eth-staking/eth/history/redemptionHistory add new response fields asset, distributeAsset, distributeAmount, conversionRatio +POST /sapi/v1/eth-staking/wbeth/wrap: add new response fields wbethAmount, exchangeRate +New Websocket for Margin Trading: + +New Base url wss://margin-stream.binance.com for two events: Liability update event and Margin call event +2023-12-08 + +Simple Binary Encoding (SBE) has been added to SPOT Testnet. + +This will be added to the live exchange at a later date. + +For more information on what SBE is, please refer to the FAQ + +2023-12-04 + +Notice: The changes below are being rolled out gradually, and will take approximately a week to complete. + +General Changes: + +Error message Precision is over the maximum defined for this asset. has been changed to Parameter '%s' has too much precision. +This error message is returned when a parameter has more precision than allowed: e.g. if base asset precision is 6 and quantity=0.1234567 then this error message will appear. +This affects all requests with the following parameters: +quantity +quoteOrderQty +icebergQty +limitIcebergQty +stopIcebergQty +price +stopPrice +stopLimitPrice +Requests for open OCO (GET /api/v3/openOrderList) now correctly return results in ascending order. +Requests for all OCO (GET /api/v3/allOrderList) now correctly return results in ascending order when startTime or fromId are specified. +Fixed a bug where order query (GET /api/v3/order)requests would incorrectly return -2026 ORDER_ARCHIVED error for newly placed orders. +SPOT API + +New endpoint GET /api/v3/account/commission +New endpoint GET /api/v3/ticker/tradingDay +GET /api/v3/avgPrice response has a new field closeTime, indicating the last trade time. +GET /api/v3/klines and /api/v3/uiKlines have a new optional parameter timeZone. +POST /api/v3/order/test and POST /api/v3/sor/order/test have a new optional parameter computeCommissionRates. +Changes regarding invalid endpoints being sent: +Previously, if you query an non-existing endpoint (e.g. curl -X GET "https://api.binance.com/api/v3/exchangie) you would get a HTTP 404 code with the response

404 Not found

+From now on the HTML response will only appear if the Accept request header has text/html for this situation. The HTTP code will remain the same. +WebSocket Streams + +New stream @avgPrice +id now supports the same values as used for id in the WebSocket API: +64-bit signed integers (previously this was unsigned) +Alphanumeric strings, max of 36 in length +null +Fixed a bug where unsolicited pongs sent before the ping would cause disconnection. +User Data Streams + +When an event of type executionReport has an execution type (x) of TRADE_PREVENTION, fields l, L and Y will now always be 0. New fields pl, pL and pY will describe the prevented execution quantity, prevented execution price, and prevented execution notional instead. These new fields show the values of what would l, L and Y have been if the taker order didn't have self-trade prevention enabled. +The following will take effect approximately a week after the release date: + +Symbol Permissions will only affect order placement, not cancellation. +permissions still apply to Cancel-Replace orders (i.e. The cancellation won't be allowed if your account does have the permission to place an order using this request.) +2023-11-21 + +New endpoint for Wallet: +GET /sapi/v1/capital/deposit/address/list: Fetch deposit address list with network. +Update endpoints for Margin +POST /sapi/v1/margin/order:New enumerate value AUTO_BORROW_REPAY for the field of sideEffectType +POST /sapi/v1/margin/order/oco:New enumerate value AUTO_BORROW_REPAY for the field of sideEffectType +GET /sapi/v1/margin/available-inventory:New response field of updateTime which indicates the acquisition time of lending inventory. +2023-11-17 + +New endpoint for Margin to support cross margin Pro modeFAQ: +GET /sapi/v1/margin/leverageBracket: query Liability coin leverage bracket in cross margin Pro mode +Update endpoints for Margin: +POST /sapi/v1/margin/max-leverage: field maxLeverage adds value 10 for Cross Margin Pro +GET /sapi/v1/margin/account: add new response field accountType, MARGIN_2 for Cross Margin Pro +2023-11-02 + +Changes to Wallet Endpoint: +GET /sapi/v1/account/apiRestrictions: add new response field enablePortfolioMarginTrading +2023-10-19 + +Effective on 2023-10-19 00:00 UTC + +The request weights of the following requests have been increased: + +SPOT API Condition Previous Request Weight New Request Weight +GET /api/v3/trades N/A 2 10 +GET /api/v3/depth Limit 1-100 2 5 +Limit 101-500 10 25 +Limit 501-1000 20 50 +Limit 1001-5000 100 250 +2023-10-16 + +New endpoint for Margin: +GET /sapi/v1/margin/available-inventory: Query margin available inventory +POST /sapi/v1/margin/manual-liquidation: Margin manual liquidation +2023-10-11 + +New endpoint for VIP Loans: +GET /sapi/v1/loan/vip/request/interestRate: Get Borrow Interest Rate +2023-10-03 + +Order decrement feature went live at 06:15 UTC. +For more information on this feature, please refer to our FAQ +2023-09-25 + +New endpoint for Futures: + +GET /sapi/v1/futures/histDataLink: query futures ticklevel orderbook historicak data download link +Delete Futures cross collateral endpoint(offline on 2022): + +GET /sapi/v1/futures/loan/borrow/history +GET /sapi/v1/futures/loan/repay/history +GET /sapi/v2/futures/loan/wallet +GET /sapi/v1/futures/loan/adjustCollateral/history +GET /sapi/v1/futures/loan/liquidationHistory +GET /sapi/v1/futures/loan/interestHistory +2023-09-22 + +New endpoints for Wallet: + +GET /sapi/v1/asset/wallet/balance: query user wallet balance +GET /sapi/v1/asset/custody/transfer-history: query user delegation history(For Master Account) +Changes to VIP loan Endpoint: + +GET /sapi/v1/loan/vip/loanable/data: add new response fields _flexibleDailyInterestRate,_flexibleYearlyInterestRate +GET /sapi/v1/loan/vip/ongoing/orders: add new response fields loanDate,loanRate,loanTerm,expirationTime +Changes to Portfolio Margin Pro Endpoint: + +POST /sapi/v1/portfolio/repay: add paramater from +2023-09-18 + +New endpoints for Auto-Invest: + +GET /sapi/v1/lending/auto-invest/index/info: query index details +GET /sapi/v1/lending/auto-invest/index/user-summary: query index linked plan position details +POST /sapi/v1/lending/auto-invest/one-off: One Time transaction +GET /sapi/v1/lending/auto-invest/one-off/status: query one-time transaction status +POST /sapi/v1/lending/auto-invest/redeem: index linked plan redemption +GET /sapi/v1/lending/auto-invest/redeem/history:query index Linked plan Redemption history +GET /sapi/v1/lending/auto-invest/rebalance/history: query index linked plan rebalance details +Changes to Margin Endpoint GET /sapi/v1/margin/isolated/transfer: + +Add request field type +Delete request field transFrom,transTo +2023-09-14 + +New endpoint for Portfolio Margin Pro: +GET /sapi/v1/portfolio/margin-asset-leverage: Get Portfolio Margin Asset Leverage +The api key permission for the following endpoints changed from enable Enable Spot & Margin Trading to enable Permits Universal Transfer +POST /sapi/v1/portfolio/auto-collection +POST /sapi/v1/portfolio/asset-collection +POST /sapi/v1/portfolio/bnb-transfer +2023-09-04 + +Rate limit adjustment for Wallet Endpoint: +GET /sapi/v1/capital/withdraw/history: UID rate limit is adjusted to 18000, maxmium 10 requests per second. Please refer to the endpoint description for detail +2023-08-31 + +New endpoint for Margin: +/sapi/v1/margin/capital-flow: Get cross or isolated margin capital flow +2023-08-26 + +Changes to Simple Earn endpoints: +GET /sapi/v1/simple-earn/flexible/history/subscriptionRecord: new fields in response: sourceAccount,amtFromSpot,amtFromFunding +GET /sapi/v1/simple-earn/locked/history/subscriptionRecord: new fields in response: sourceAccount,amtFromSpot,amtFromFunding +GET /sapi/v1/simple-earn/flexible/history/redemptionRecord: new fields in response destAccount +POST /sapi/v1/simple-earn/flexible/subscribe: new parameter sourceAccount +POST /sapi/v1/simple-earn/locked/subscribe: new parameter sourceAccount +POST /sapi/v1/simple-earn/flexible/redeem: new parameter destAccount +New endpoint for Crypto Loans: +POST /sapi/v1/loan/flexible/borrow: flexible Loan borrow +GET /sapi/v1/loan/flexible/ongoing/orders: get flexible loan ongoing orders +GET /sapi/v1/loan/flexible/borrow/history: Get flexible loan borrow history +POST /sapi/v1/loan/flexible/repay: flexible loan repay +POST /sapi/v1/loan/flexible/repay/history: Get flexible loan repayment history +POST /sapi/v1/loan/flexible/adjust/ltv: adjust flexible Loan adjust LTV +GET /sapi/v1/loan/flexible/ltv/adjustment/history: Get Flexible loan LTV adjustment history +GET /sapi/v1/loan/flexible/loanable/data:Get flexible loan assets data +GET /sapi/v1/loan/flexible/collateral/data: Get flexible loan collateral assets data +2023-08-25 + +The following changes will be effective from 2023-08-25 at UTC 00:00. + +The REQUEST_WEIGHT rate limit for SPOT API has been adjusted to 6,000 every minute. +The RAW_REQUESTS for SPOT API has been adjusted to 61,000 every 5 minutes. +The weights to the following requests for the SPOT API have been adjusted. +Please refer to the table for more details: + +Request Previous Request Weight New Request Weight +GET /api/v3/order 2 4 +GET /api/v3/orderList 2 4 +GET /api/v3/openOrders - With symbol 3 6 +GET /api/v3/openOrders- Without symbol 40 80 +GET /api/v3/openOrderList 3 6 +GET /api/v3/allOrders 10 20 +GET /api/v3/allOrderList 10 20 +GET /api/v3/myTrades 10 20 +GET /api/v3/myAllocations 10 20 +GET /api/v3/myPreventedMatches - Using preventedMatchId 1 2 +GET /api/v3/myPreventedMatches - Using orderId 10 20 +GET /api/v3/account 10 20 +GET /api/v3/rateLimit/order 20 40 +GET /api/v3/exchangeInfo 10 20 +GET /api/v3/depth - Limit 1-100 1 2 +GET /api/v3/depth - Limit 101-500 5 10 +GET /api/v3/depth - Limit 501-1000 10 20 +GET /api/v3/depth - Limit 1001-5000 50 100 +GET /api/v3/aggTrades 1 2 +GET /api/v3/trades 1 2 +GET /api/v3/historicalTrades 5 10 +GET /api/v3/klines 1 2 +GET /api/v3/uiKlines 1 2 +GET /api/v3/ticker/bookTicker - With symbol 1 2 +GET /api/v3/ticker/bookTicker - Without symbol or With symbols 2 4 +GET /api/v3/ticker/price- With symbol 1 2 +GET /api/v3/ticker/price- Without symbol or With symbols 2 4 +GET /api/v3/ticker/24hr - With symbol or With symbols using 1-20 symbols 1 2 +GET /api/v3/ticker/24hr - With symbols using 21-100 symbols 20 40 +GET /api/v3/ticker/24hr - Without symbol or symbols using 101 or more symbols 40 80 +GET /api/v3/avgPrice 1 2 +GET /api/v3/ticker 2 4 +GET /api/v3/ticker - Maximum weight for this request 100 200 +POST /api/v3/userDataStream 1 2 +PUT /api/v3/userDataStream 1 2 +DELETE /api/v3/userDataStream 1 2 +2023-08-18 + +Update endpoints for VIP Loan: +POST /sapi/v1/loan/vip/borrow: add field isFlexibleRate to borrow using flexible rate loan +2023-08-08 + +Smart Order Routing (SOR) has been added to the APIs. For more information please refer to our FAQ. Please wait for future announcements on when the feature will be enabled. + +SPOT API + +Changes to GET /api/v3/exchangeInfo: +New field in response: sors, describing SORs enabled on the exchange. +Changes to GET /api/v3/myPreventedMatches +New field makerSymbol will appear in the response for all prevented matches. +New endpoints for order placement using SOR: +POST /api/v3/sor/order +POST /api/v3/sor/order/test +New endpoint GET /api/v3/myAllocations +USER DATA STREAM + +Changes to executionReport: +These fields are only relevant for orders placed using SOR: +New field b for matchType +New field a for allocId +New field k for workingFloor +This field is only relevant for orders expiring due to STP: +New field Cs for counterSymbol +2023-08-02 + +Effective from 21 Aug 2023, a 1% transaction fee will apply when you buy or create gift cards in Binance directly. The following endpoints are impacted: +POST /sapi/v1/giftcard/createCode +POST /sapi/v1/giftcard/buyCode +2023-07-20 + +As per the announcement, effective from 20 July 2023, creating gift cards is limited only to entity accounts which have passed KYB verification. The following endpoints are impacted: +POST /sapi/v1/giftcard/createCode +POST /sapi/v1/giftcard/buyCode +New endpoints for Porfolio Margin Pro: +POST /sapi/v1/portfolio/asset-collection: Fund Collection by Asset +2023-07-18 + +New API key type – Ed25519 – is now supported. (UI support will be released this week.) +Ed25519 API keys are an alternative to RSA API keys, using asymmetric cryptography to authenticate your requests on the API. +We recommend switching to Ed25519 for improved performance and security. +For more information, please refer to our supplemental document API Key Types. +Documentation has been updated with how to sign a payload with Ed25519 keys. +2023-07-14 + +New endpoints for Porfolio Margin Pro: +POST /sapi/v1/portfolio/repay-futures-switch: Change Auto-repay-futures Status +GET /sapi/v1/portfolio/repay-futures-switch: Get Auto-repay-futures Status +POST /sapi/v1/portfolio/repay-futures-negative-balance: Repay futures Negative Balance +New endpoints for VIP Loan: +POST /sapi/v1/loan/vip/renew: VIP Loan Renew +2023-07-11 + +Notice: The change below are being rolled out, and will take approximately a week to complete. + +SPOT API + +Changes to error messages: +Previously, when duplicate symbols were passed to requests that do not allow it, the error would be "Mandatory parameter symbols was not sent, was empty/null, or malformed." +Now, the error message is "Symbol is present multiple times in the list", with a new error code -1151 +This affects the following requests: +GET /api/v3/exchangeInfo +GET /api/v3/ticker/24hr +GET /api/v3/ticker/price +GET/api/v3/ticker/bookTicker +Fixed a bug where some non-archived orders being queried would receive the error code that their order was archived. +Changes to GET /api/v3/account: +New field preventSor will appear in the response. +New field uid that shows the User Id/Account will appear in the response. +Changes to GET /api/v3/historicalTrades: +Changed security type from MARKET_DATA to NONE. +This means that the X-MBX-APIKEY header is no longer necessary and is now ignored. +The following changes will take effect approximately a week from the release date:: + +Fixed multiple bugs with orders that use type=MARKET and quoteOrderQty, also known as “reverse market orders”: +Reverse market orders are no longer partially filled, or filled for zero or negative quantity under extreme market conditions. +MARKET_LOT_SIZE filter now correctly rejects reverse market orders that go over the symbol's maxQty. +Fixed a bug where OCO orders using trailingDelta could have an incorrect trailingTime value after either leg of the OCO is touched. +New field transactTime will appear in order cancellation responses. This affects the following requests: +DELETE /api/v3/order +POST /api/v3/order/cancelReplace +DELETE /api/v3/openOrders +DELETE /api/v3/orderList +2023-07-07 + +New endpoints for Margin: +POST /sapi/v1/margin/max-leverage: Adjust cross margin max leverage +2023-06-29 + +Added multiple new endpoints related to ETH Staking in Staking. +New endpoints for Margin: +GET /sapi/v1/margin/dust: Get Assets That Can Be Converted Into BNB +POST /sapi/v1/margin/dust: Convert dust assets to BNB. +New endpoints for VIP Loan(effective on 2023-06-30): +POST /sapi/v1/loan/vip/borrow: Borrow VIP loan +GET /sapi/v1/loan/vip/loanable/data: Get interest rate and borrow limit of loanable assets. +GET /sapi/v1/loan/vip/collateral/data: Get collateral asset data +GET /sapi/v1/loan/vip/request/data: Query application status. +2023-06-22 + +New endpoints for Sub-Account: +POST /sapi/v1/sub-account/eoptions/enable: enable Options for Sub-account +GET /sapi/v1/managed-subaccount/query-trans-log: Query Managed Sub Account Transfer Log (For Trading Team Sub Account) +Update endpoints for Margin: +POST /sapi/v1/margin/order: add fields autoRepayAtCancel and selfTradePreventionMode +POST /sapi/v1/margin/order/oco: add field selfTradePreventionMode +New endpoints for Simple Earn. +Delete endpoint for Lending: +GET /sapi/v1/lending/daily/product/list +GET /sapi/v1/lending/daily/userLeftQuota +POST /sapi/v1/lending/daily/purchase +GET /sapi/v1/lending/daily/userRedemptionQuota +POST /sapi/v1/lending/daily/redeem +GET /sapi/v1/lending/daily/token/position +GET /sapi/v1/lending/union/account +GET /sapi/v1/lending/union/purchaseRecord +GET /sapi/v1/lending/union/redemptionRecord +GET /sapi/v1/lending/union/interestHistory +2023-06-20 + +New endpoints for Auto-Investment: +GET /sapi/v1/lending/auto-invest/target-asset/list: query target asset list +GET /sapi/v1/lending/auto-invest/target-asset/roi/list: query ROI return list for target asset +GET /sapi/v1/lending/auto-invest/all/asset: query all source assets and target assets +GET /sapi/v1/lending/auto-invest/source-asset/list: query source asset to be used for investment +POST /sapi/v1/lending/auto-invest/plan/add: create an investment plan +POST/sapi/v1/lending/auto-invest/plan/edit: adjust the details of the plan +POST /sapi/v1/lending/auto-invest/plan/edit-status: change plan status +GET /sapi/v1/lending/auto-invest/plan/list: query plan lists +GET /sapi/v1/lending/auto-invest/plan/id: Get holding details of the plan +GET /sapi/v1/lending/auto-invest/history/list: query subscription transaction history of a plan +Update endpoints for Margin: +GET /sapi/v1/margin/delist-schedule: get tokens or symbols delist schedule for cross margin and isolated margin +2023-06-09 + +Below changes are applicable to the Portfolio Margin Pro Program and the new Portfolio Margin Program: these will be taken into effect on 2023-06-22: Transfers in and out of Portfolio Margin Account can only be done through Cross Margin Wallets. For POST /sapi/v1/asset/transfer, only below parameters can be supported for the Portfolio Margin Pro Program and the new Portfolio Margin Program: MAIN_PORTFOLIO_MARGIN and PORTFOLIO_MARGIN_MAIN + +Please be aware that transfer in and out from UM or CM wallets to non-PM wallets (such as spot wallet and option wallet) are not supported. For POST /sapi/v1/asset/transfer, below parameters can no longer be supported for the Portfolio Margin Pro Program and the new Portfolio Margin Program: +MAIN_UMFUTURE +MAIN_CMFUTURE +UMFUTURE_MAIN +UMFUTURE_MARGIN +CMFUTURE_MARGIN +MARGIN_UMFUTURE +MARGIN_CMFUTURE +FUNDING_UMFUTURE +UMFUTURE_FUNDING +FUNDING_CMFUTURE +CMFUTURE_FUNDING +UMFUTURE_OPTION +OPTION_UMFUTURE +POST /sapi/v1/sub-account/futures/internalTransfer will no longer be supported +POST /sapi/v1/sub-account/futures/transfer will no longer be supported +POST /sapi/v1/futures/transfer will no longer be supported +POST /sapi/v1/sub-account/universalTransfer will no longer be supported for below: +SPOT transfer to USDT_FUTURE, COIN_FUTURE (regardless of master or sub) +USDT_FUTURE, COIN_FUTURE transfer to SPOT (regardless of master or sub) +New endpoints for Portfolio Margin Pro(Effective on 06/09): + +POST /sapi/v1/portfolio/auto-collection: all transfers (excluding UM Account’s BNB) from Futures Account to Margin account +POST /sapi/v1/portfolio/bnb-transfer: BNB transfer can be between Margin Account and UM Account +2023-06-06 + +A new endpoint is now available for redundancy: https://api-gcp.binance.com/ +This is using the GCP (Google Cloud Platform) CDN and may have slower performance compared to api1-api4 endpoints. +2023-06-01 + +New WEBSOCKET for Bwap: +New Base url wss://api.binance.com/sapi/wss for BSwap streams earn_swapprice_ and earn_swapprice_all +2023-05-30 + +Update endpoints for Pay: +GET /sapi/v1/pay/transactions: add more content in response field fundsDetail +2023-05-26 + +Notice: The change below are being rolled out, and will take approximately a week to complete. + +The following base endpoints may give better performance but have less stability than https://api.binance.com: +https://api1.binance.com +https://api2.binance.com +https://api3.binance.com +https://api4.binance.com +2023-05-24 + +The previous market data URLs have been deprecated. Please update your code immediately to prevent interruption of our services. +API Market data from data.binance.com can now be accessed from data-api.binance.vision. +Websocket Market Data from data-stream.binance.com can now be accessed from data-stream.binance.vision. +GET /sapi/v1/portfolio/interest-rate has be deprecated, users can query the Portfolio Margin Pro Negative Balance Interest Rate by using GET /sapi/v1/margin/interestRateHistory. +2023-05-18 + +New endpoints for Wallet: +POST /sapi/v1/capital/deposit/credit-apply: apply deposit credit for expired address +2023-05-09 + +New endpoints for Portfolio Margin: +GET /sapi/v1/portfolio/asset-index-price: query portfolio margin asset index price +Update endpoints for Wallet: +POST /sapi/v1/asset/transfer: add enum MAIN_PORTFOLIO_MARGIN and PORTFOLIO_MARGIN_MAIN +2023-04-20 + +New endpoints for Sub-Account: +GET /sapi/v1/managed-subaccount/deposit/address: get managed sub-account deposit address +Update endpoints for VIP Loans: +GET /sapi/v1/loan/vip/ongoing/orders: add fields totalCollateralValueAfterHaircut and lockedCollateralValue +2023-04-18 + +New endpoints for Spot Algo: +POST /sapi/v1/algo/spot/newOrderTwap to support new order +DELETE /sapi/v1/algo/spot/order to support cancel Algo order +GET /sapi/v1/algo/spot/openOrders to support query Algo open orders +GET /sapi/v1/algo/spot/historicalOrders to support query Algo historical orders +GET /sapi/v1/algo/spot/subOrders to support query Algo sub orders for a specified algoId +2023-03-23 + +Update endpoints for Sub-Account: +GET /sapi/v1/managed-subaccount/queryTransLogForInvestor: Add response field tranId +GET /sapi/v1/managed-subaccount/queryTransLogForTradeParent: Add response field tranId +New endpoints for Sub-Account: +GET /sapi/v1/managed-subaccount/info: query investor's managed sub-account list +GET /sapi/v1/sub-account/transaction-statistics: Query sub-account transaction tatistics +2023-03-13 + +Notice: All changes are being rolled out gradually to all our servers, and may take a week to complete. + +GENERAL CHANGES + +The error messages for certain issues have been improved for easier troubleshooting. +Situation Old Error Message New Error Message +An account cannot place or cancel an order, due to trading ability disabled. This action is disabled on this account. This account may not place or cancel orders. +When the permissions configured on the symbol do not match the permissions on the account. This symbol is not permitted for this account. +When the account tries to place an order on a symbol it has no permissions for. This symbol is restricted for this account. +Placing an order when symbol is not TRADING. Unsupported order combination. This order type is not possible in this trading phase. +Placing an order with timeinForce=IOC or FOK on a trading phase that does not support it. Limit orders require GTC for this phase. +Fixed error message for querying archived orders: +Previously, If an archived order (i.e. order with status CANCELED or EXPIRED where executedQty == 0 that occurred more than 90 days in the past.) is queried, the error message would be: +{"code": -2013,"msg": "Order does not exist."} +Now, the error message is: +{"code": -2026,"msg": "Order was canceled or expired with no executed qty over 90 days ago and has been archived."} +Behavior for API requests with startTime and endTime: +Previously some requests failed if the startTime == endTime. +Now, all API requests that accept startTime and endTime allow the parameters to be equal. This applies to the following requests: +Rest API +GET /api/v3/aggTrades +GET /api/v3/klines +GET /api/v3/allOrderList +GET /api/v3/allOrders +GET /api/v3/myTrades +The following changes will take effect approximately a week from the release date, but the rest of the documentation has been updated to reflect the future changes: + +Changes to Filter Evaluation: +Previous behavior: LOT_SIZE and MARKET_LOT_SIZE required that (quantity - minQty) % stepSize == 0. +New behavior: This has now been changed to (quantity % stepSize) == 0. +Bug fix with reverse MARKET orders (i.e., MARKET using quoteOrderQty): +Previous behavior: Reverse market orders would always have the status FILLED even if the order did not fully fill due to low liquidity. +New behavior: If the reverse market order did not fully fill due to low liquidity the order status will be EXPIRED, and FILLED only if the order was completely filled. +SPOT API + +Changes to DELETE /api/v3/order and POST /api/v3/order/cancelReplace: +A new optional parameter cancelRestrictions that determines whether the cancel will succeed if the order status is NEW or PARTIALLY_FILLED. +If the order cancellation fails due to cancelRestrictions, the error will be: +{"code": -2011,"msg": "Order was not canceled due to cancel restrictions."} +2023-02-27 + +New endpoints for Margin: +/sapi/v1/margin/next-hourly-interest-rate: Get user the next hourly estimate interest +New endpoints for Porfolio Margin: +GET /sapi/v1/portfolio/interest-history: get user's portfolio margin interest history +GET /sapi/v1/portfolio/interest-rate: get portfolio margin interest rate +2023-02-21 + +Adjusted endpoints for Crypto Loan: +POST /sapi/v1/loan/borrow: paramater loanTerm is restricted to 7 or 30 +2023-02-17 + +The Websocket Stream now only allows 300 connections requests every 5 minutes. + +This limit is per IP address. + +Please be careful when trying to open multiple connections or reconnecting to the Websocket API. + +2023-02-13 + +New endpoints for Sub-Account: +GET /sapi/v4/sub-account/assets: Fetch sub-account assets +2023-02-02 + +New endpoints for Margin: +GET /sapi/v1/margin/exchange-small-liability: Query the coins which can be small liability exchange +POST /sapi/v1/margin/exchange-small-liability: Cross Margin Small Liability Exchange +GET /sapi/v1/margin/exchange-small-liability-history: Get Small liability Exchange History +Update endpoints for Wallet: +Universal Transfer POST /sapi/v1/asset/transfer support option transfer +2023-01-26 + +As per the announcement, Self Trade Prevention will be enabled at 2023-01-26 08:00 UTC. + +Please refer to GET /api/v3/exchangeInfo from the Rest API or exchangeInfo from the Websocket API on the default and allowed modes. + +2023-01-23 + +New API cluster has been added. Note that all endpoints are functionally equal, but may vary in performance. + +https://api4.binance.com +2023-01-19 + +ACTUAL RELEASE DATE TBD + +SPOT API + +New Feature: Self-Trade Prevention (aka STP) will be added to the system at a later date. This will prevent orders from matching with orders from the same account, or accounts under the same tradeGroupId. + +Please refer to GET /api/v3/exchangeInfo from the SPOT API or exchangeInfo from the Websocket API on the status. + +"defaultSelfTradePreventionMode": "NONE", //If selfTradePreventionMode not provided, this will be the value passed to the engine +"allowedSelfTradePreventionModes": [ //What the allowed modes of selfTradePrevention are + "NONE", + "EXPIRE_TAKER", + "EXPIRE_BOTH", + "EXPIRE_MAKER" +] +New order status: EXPIRED_IN_MATCH - This means that the order expired due to STP being triggered. +New endpoint: +GET /api/v3/myPreventedMatches - This queries the orders that expired due to STP being triggered. +New optional parameter selfTradePreventionMode has been added to the following endpoints: +POST /api/v3/order +POST /api/v3/order/oco +POST /api/v3/order/cancelReplace +New responses that will appear for all order placement endpoints if there was a prevented match (i.e. if an order could have matched with an order of the same account, or the accounts are in the same tradeGroupId): +tradeGroupId - This will only appear if account is configured to a tradeGroupId and if there was a prevented match. +preventedQuantity - Only appears if there was a prevented match. +An array preventedMatches with the following fields: +preventedMatchId +makerOrderId +price +takerPreventedQuantity - This will only appear if selfTradePreventionMode set is EXPIRE_TAKER or EXPIRE_BOTH. +makerPreventedQuantity - This will only appear if selfTradePreventionMode set is EXPIRE_MAKER or EXPIRE_BOTH. +New fields preventedMatchId and preventedQuantity that can appear in the order query endpoints if the order had expired due to an STP trigger: +GET /api/v3/order +GET /api/v3/openOrders +GET /api/v3/allOrders +USER DATA STREAM + +New execution Type: TRADE_PREVENTION +New fields for executionReport (These fields will only appear if the order has expired due to STP trigger) +u - tradeGroupId +v - preventedMatchId +U - counterOrderId +A - preventedQuantity +B - lastPreventedQuantity +2023-01-13 + +The following endpoints will be discontinued on January 13, 2023 6:00 AM UTC: +POST /sapi/v1/sub-account/subAccountApi/ipRestriction to support master account enable and disable IP restriction for a sub-account API Key +POST /sapi/v1/sub-account/subAccountApi/ipRestriction/ipList to support master account add IP list for a sub-account API Key +New endpoints for Sub-Account: +GET /sapi/v1/managed-subaccount/fetch-future-asset: Investor can use this api to query managed sub account futures asset details +GET /sapi/v1/managed-subaccount/marginAsset: Investor can use this api to query managed sub account margin asset details +New endpoin for Margin: +GET /sapi/v1/margin/crossMarginCollateralRatio: Get cross margin collateral ratio +2023-01-05 + +New endpoints for Sub-Account: +GET /sapi/v1/managed-subaccount/queryTransLogForInvestor: Investor can use this api to query managed sub account transfer log +GET /sapi/v1/managed-subaccount/queryTransLogForTradeParent: Trading team can use this api to query managed sub account transfer log +2022-12-26 + +New endpoints for wallet: +GET /sapi/v1/capital/contract/convertible-coins: Get a user's auto-conversion settings in deposit/withdrawal +POST /sapi/v1/capital/contract/convertible-coins: User can use it to turn on or turn off the BUSD auto-conversion from/to a specific stable coin. +2022-12-15 + +New RSA signature +Documentation has been updated to show how to sign a request using an RSA key. +For security reasons, we recommend to use RSA keys instead of HMAC keys when generating an API key. +We accept PKCS#8 (BEGIN PUBLIC KEY). +More details on how to upload your RSA public key will be added at a later date. +2022-12-13 + +REST API + +Some error messages on error code -1003 have changed: + +Previous error message: +Too much request weight used; current limit is %s request weight per %s %s. Please use the websocket for live updates to avoid polling the API. + +has been updated to: + +Too much request weight used; current limit is %s request weight per %s. Please use WebSocket Streams for live updates to avoid polling the API. + +Previous error message +Way too much request weight used; IP banned until %s. Please use the websocket for live updates to avoid bans. + +has been updated to: + +Way too much request weight used; IP banned until %s. Please use WebSocket Streams for live updates to avoid bans. + +2022-12-05 + +Notice: These changes are being rolled out gradually to all our servers, and will take approximately a week to complete. + +WEBSOCKET + +!bookTicker will be removed by December 7, 2022. Please use the Individual Book Ticker Streams instead. (@bookTicker). +Multiple @bookTicker streams can be subscribed to over one connection. (E.g. wss://stream.binance.com:9443/stream?streams=btcusdt@bookTicker/bnbbtc@bookTicker) +SPOT API + +New error code -1135 +This error code will occur if a parameter requiring a JSON object is invalid. +New error code -1108 +This error will occur if a value to a parameter being sent was too large, potentially causing overflow. +This error code can occur in the following endpoints: +POST /api/v3/order +POST /api/v3/order/cancelReplace +POST /api/v3/order/oco +Changes to GET /api/v3/aggTrades +Previous behavior: startTime and endTime had to be used in combination and could only be an hour apart. +New behavior: startTime and endTime can be used individually and the 1 hour limit has been removed. +When using startTime only, this will return trades from that time, up to the limit provided. +When using endTime only, this will return trades starting from the endTime including all trades before that time, up to the limit provided. +If limit not provided, regardless of used in combination or sent individually, the endpoint will use the default limit. +Changes to GET /api/v3/myTrades + +Fixed a bug where symbol + orderId combination would return all trades even if the number of trades went beyond the 500 default limit. +Previous behavior: The API would send specific error messages depending on the combination of parameters sent. E.g: + +{ "code": -1106, "msg": "Parameter X was sent when not required." } + +New behavior: If the combinations of optional parameters to the endpoint were not supported, then the endpoint will respond with the generic error: + +{ "code": -1128, "msg": "Combination of optional parameters invalid." } + +Added a new combination of supported parameters: symbol + orderId + fromId. + +The following combinations of parameters were previously supported but no longer accepted, as these combinations were only taking fromId into consideration, ignoring startTime and endTime: + +symbol + fromId + startTime +symbol + fromId + endTime +symbol + fromId + startTime + endTime +Thus, these are the supported combinations of parameters: + +symbol +symbol + orderId +symbol + startTime +symbol + endTime +symbol + fromId +symbol + startTime + endTime +symbol+ orderId + fromId +Note: These new fields will appear approximately a week from the release date. + +Changes to GET /api/v3/exchangeInfo +New fields defaultSelfTradePreventionMode and allowedSelfTradePreventionModes +Changes to the Order Placement Endpoints/Order Query/Order Cancellation Endpoints: +New field selfTradePreventionMode will appear in the response. +Affects the following endpoints: +POST /api/v3/order +POST /api/v3/order/oco +POST /api/v3/order/cancelReplace +GET /api/v3/order +DELETE /api/v3/order +DELETE /api/v3/orderList +Changes to GET /api/v3/account +New field requireSelfTradePrevention will appear in the response. +New field workingTime, indicating when the order started working on the order book, will appear in the following endpoints: +POST /api/v3/order +GET /api/v3/order +POST /api/v3/order/cancelReplace +POST /api/v3/order/oco +GET /api/v3/order +GET /api/v3/openOrders +GET /api/v3/allOrders +Field trailingTime, indicating the time when the trailing order is active and tracking price changes, will appear for the following order types (TAKE_PROFIT, TAKE_PROFIT_LIMIT, STOP_LOSS, STOP_LOSS_LIMIT if trailingDelta parameter was provided) for the following endpoints: +POST /api/v3/order +GET /api/v3/order +GET /api/v3/openOrders +GET /api/v3/allOrders +POST /api/v3/order/cancelReplace +DELETE /api/v3/order +Field commissionRates will appear in the GET /api/v3/acccount response +USER DATA STREAM + +eventType executionReport has new fields +V - selfTradePreventionMode +D - trailing_time (Appears if the trailing stop order is active) +W - workingTime (Appears if isWorking=true) +2022-12-02 + +Added a new market data base URL https://data.binance.com. +Added a new WebSocket URL wss://data-stream.binance.com. +2022-11-29 + +New endpoint for VIP Loan: +GET /sapi/v1/loan/vip/collateral/account: Check Locked Value of VIP Collateral Account +2022-11-22 + +New endpoints for Convert: +GET /sapi/v1/convert/exchangeInfo: Query for all convertible token pairs and the tokens’ respective upper/lower limits +GET /sapi/v1/convert/assetInfo: Query for supported asset’s precision information +POST /sapi/v1/convert/getQuote: Request a quote for the requested token pairs +POST /sapi/v1/convert/acceptQuote: Accept the offered quote by quote ID. +GET /sapi/v1/convert/orderStatus: Query order status by order ID. +2022-11-18 + +New endpoint for Wallet: +GET /sapi/v1/asset/ledger-transfer/cloud-mining/queryByPage: The query of Cloud-Mining payment and refund history +New endpoints for Sub-account: +POST /sapi/v2/sub-account/subAccountApi/ipRestriction: To support master account update IP Restriction for Sub-Account API key +2022-11-14 + +New endpoints for VIP Loan: +GET /sapi/v1/loan/vip/ongoing/orders: Get VIP Loan Ongoing Orders +POST /sapi/v1/loan/vip/repay: VIP Loan Repay +GET /sapi/v1/loan/vip/repay/history: Get VIP Loan Repayment History +2022-11-02 + +Update endpoints for Wallet: +POST /sapi/v1/capital/withdraw/apply: Weight changed to Weight(UID): 600 +2022-11-01 + +New endpoints for Crypto Loan: +GET /sapi/v1/loan/loanable/data: Get interest rate and borrow limit of loanable assets. The borrow limit is shown in USD value. +GET /sapi/v1/loan/collateral/data: Get LTV information and collateral limit of collateral assets. The collateral limit is shown in USD value. +GET /sapi/v1/loan/repay/collateral/rate: Get the the rate of collateral coin / loan coin when using collateral repay, the rate will be valid within 8 second. +POST /sapi/v1/loan/customize/margin_call: Customize margin call for ongoing orders only. +2022-10-28 + +Update endpoints for Wallet: +POST /sapi/v1/asset/convert-transfer: New parameter accountType +POST /sapi/v1/asset/convert-transfer/queryByPage: request method is changed to GET, new parameter clientTranId +2022-10-15 + +New endpoints for Binance Code: +POST /sapi/v1/giftcard/buyCode: For buying a fixed-value Binance Code. +GET /sapi/v1/giftcard/buyCode/token-limit: To verify which tokens are available for you to purchase fixed-value gift cards as mentioned in section 2 and its’ limitation. +2022-09-30 + +Delete endpoints for Futures Cross Collateral: +POST /sapi/v1/futures/loan/borrow +POST /sapi/v1/futures/loan/repay +GET /sapi/v1/futures/loan/configs +GET /sapi/v2/futures/loan/configs +GET /sapi/v1/futures/loan/calcAdjustLevel +GET /sapi/v2/futures/loan/calcAdjustLevel +GET /sapi/v1/futures/loan/calcMaxAdjustAmount +GET /sapi/v2/futures/loan/calcMaxAdjustAmount +POST /sapi/v1/futures/loan/adjustCollateral +POST /sapi/v2/futures/loan/adjustCollateral +GET /sapi/v1/futures/loan/collateralRepayLimit +GET /sapi/v1/futures/loan/collateralRepay +POST /sapi/v1/futures/loan/collateralRepay +GET /sapi/v1/futures/loan/collateralRepayResult +2022-09-30 + +Scheduled changes to the removal of !bookTicker around November 2022. + +The All Book Tickers stream (!bookTicker) is set to be removed in November 2022 +More details of the actual removal date will be announced at a later time. +Please use the Individual Book Ticker Streams instead. (@bookTicker). +Multiple @bookTicker streams can be subscribed to over one connection. +Example: wss://stream.binance.com:9443/stream?streams=btcusdt@bookTicker/bnbbtc@bookTicker +2022-09-29 + +New endpoints for Wallet: +POST /sapi/v1/asset/convert-transfer: Convert transfer, convert between BUSD and stablecoins. +POST /sapi/v1/asset/convert-transfer/queryByPage: Query convert transfer +2022-09-22 + +Update endpoint for Sub-Account: +POST /sapi/v1/sub-account/subAccountApi/ipRestriction: Add new param thirdParty +POST /sapi/v1/sub-account/subAccountApi/ipRestriction/ipList: Add new param thirdPartyName +DELETE /sapi/v1/sub-account/subAccountApi/ipRestriction/ipList: Add new param thirdPartyName +Add Rate Limit for following endpoints: +GET /sapi/v1/bswap/liquidity: 3/1s per account and per pool +GET /sapi/v1/bswap/quote: 3/1s per account and per pool +POST /sapi/v1/lending/daily/purchase: 1/3s per account +POST /sapi/v1/lending/customizedFixed/purchase: 1/3s per account +POST /sapi/v1/staking/purchase: 1/3s per account +2022-09-16 + +New endpoint for Margin: +GET /sapi/v1/margin/tradeCoeff: Get personal margin level information +2022-09-15 + +New endpoints for Crypto Loan +POST /sapi/v1/loan/borrow: Borrow - Crypto Loan Borrow +GET /sapi/v1/loan/borrow/history: Borrow - Get Loan Borrow History +GET/sapi/v1/loan/ongoing/orders: Borrow - Get Loan Ongoing Orders +POST/sapi/v1/loan/repay: Repay - Crypto Loan Repay +GET/sapi/v1/loan/repay/history: Repay - Get Loan Repayment History +POST/sapi/v1/loan/adjust/ltv: Adjust LTV - Crypto Loan Adjust LTV +GET/sapi/v1/loan/ltv/adjustment/history: Adjust LTV - Get Loan LTV Adjustment History +2022-09-15 + +Note that these are rolling changes, so it may take a few days for it to rollout to all our servers. + +Changes to GET /api/v3/exchangeInfo +New optional parameter permissions added to display all symbols with the permissions matching the parameter provided. (eg.SPOT, MARGIN) +If not provided, the default value will be ["SPOT","MARGIN"]. +This means the request GET /api/v3/exchangeInfo without any parameters will show all symbols that can be used for SPOT,MARGIN trading. +To search for symbols that can be traded on other permissions (e.g. TRD_GRP_004, etc), then this needs to be searched for explicitly. (e.g.permissions=TRD_GRP_004) +Cannot be combined with symbol or symbols +2022-09-12 + +Update endpoint for Sub-account: +GET /sapi/v1/sub-account/subAccountApi/ipRestriction: To support master account query Third party IP list name for a sub account API key +2022-09-05 + +Delete endpoint for Futures: +GET /sapi/v1/futures/loan/wallet +2022-08-23 + +SPOT API + +Note that these are rolling changes, so it may take a few days for it to rollout to all our servers. + +Changes to GET /api/v3/ticker and GET /api/v3/ticker/24hr +New optional parameter type added +Supported values for parameter type are FULL and MINI +FULL is the default value and the response that is currently being returned from the endpoint +MINI omits the following fields from the response: priceChangePercent, weightedAvgPrice, bidPrice, bidQty, askPrice, askQty, and lastQty +New error code -1008 +This is sent whenever the servers are overloaded with requests. +This error code only appears for the SPOT API. +New field brokered has been added to GET /api/v3/account +New endpoint: GET /api/v3/uiKlines +New kline interval: 1s +2022-08-18 + +Update endpoint for Convert: +GET /sapi/v1/convert/tradeFlow: Update weight from Weight(IP) 3000 to Weight(UID) 3000. +2022-08-08 + +SPOT API + +Changes to POST /api/v3/order and POST /api/v3/order/cancelReplace +New optional field strategyId is a parameter used to identify an order as part of a strategy. +New optional field strategyType is a parameter used to identify what strategy was running. (E.g. If all the orders are part of spot grid strategy, it can be set to strategyType=1000000) +Note: strategyType cannot be less than 1000000. +Changes to POST /api/v3/order/oco +New optional fields limitStrategyId, limitStrategyType. stopStrategyId, stopStrategyType +These are the strategy metadata parameters for both legs of the OCO orders. +limitStrategyType and stopStrategyType both cannot be less than 1000000. +Changes to GET /api/v3/order, GET /api/v3/openOrders, and GET /api/v3/allOrders +New fields strategyId and strategyType will appear in the response JSON for orders that had these fields populated upon order placement. +Changes to DELETE /api/v3/order and DELETE /api/v3/openOrders +New fields strategyId and strategyType will appear in the response JSON for cancelled orders that had these fields populated upon order placement. +USER DATA STREAM + +New fields to eventType executionReport +j for strategyId +J for strategyType +Note that these fields only appear if these were populated upon order placement. +2022-08-05 + +Update endpoint for Convert: +GET /sapi/v1/convert/tradeFlow: Update weight from Weight(IP) 100 to Weight(IP) 3000. +2022-07-21 + +New endpoint for Portfolio Margin: +GET /sapi/v1/portfolio/pmLoan Query Portfolio Margin Bankruptcy Loan Record +POST /sapi/v1/portfolio/repay Portfolio Margin Bankruptcy Loan Repay +2022-07-18 + +New endpoint for Portfolio Margin: +GET /sapi/v1/portfolio/collateralRate to get Portfolio Margin Collateral Rate. +2022-07-01 + +New endpoint for Wallet: +POST /sapi/v3/asset/getUserAsset to get user assets. +New endpoint for Margin: +GET /sapi/v1/margin/dribblet to query the historical information of user's margin account small-value asset conversion BNB. +Update endpoint for Convert: +GET /sapi/v1/convert/tradeFlow: Update weight from 3000 to 100. +Update endpoint for Margin: +GET /sapi/v1/margin/repay: Add response field rawAsset. +2022-06-20 + +SPOT API: Changes to GET /api/v3/ticker + +Weight has been reduced from 5 to 2 per symbol, regardless of windowSize. +The max number of symbols that can be processed in a request is 100. +If the number of symbols sent is more than 100, the error will be as follows: + { + "code": -1101, + "msg": "Too many values sent for parameter 'symbols', maximum allowed up to 100." + } +The max Weight(IP) for this endpoint will cap at 100. +I.e. If the request has more than 50 symbols, the Weight will still be 100, regardless of windowSize. +2022-06-15 + +Note: The update is being rolled out over the next few days, so these changes may not be visible right away. + +GET /api/v3/ticker added +Rolling window price change statistics based on windowSize provided. +Contrary to GET /api/v3/ticker/24hr the list of symbols cannot be omitted. +If windowSize not specified, the value will default to 1d. +Response is similar to GET /api/v3/ticker/24hr, minus the following fields: prevClosePrice, lastQty, bidPrice, bidQty, askPrice, askQty +POST /api/v3/order/cancelReplace added +Cancels an existing order and places a new order on the same symbol. +The filters are evaluated before the cancel order is placed. +e.g. If the MAX_NUM_ORDERS filter is 10, and the total number of open orders on the account is also 10, when using POST /api/v3/order/cancelReplace both the cancel order placement and new order will fail because of the filter. +The change is being rolled out in the next few days, thus this feature will be enabled once the upgrade is completed. +GET /api/v3/exchangeInfo returns new field cancelReplaceAllowed in symbols list. +New filter NOTIONAL has been added. +Defines the allowed notional value (price * quantity) based on a configured minNotional and maxNotional +New exchange filter EXCHANGE_MAX_NUM_ICEBERG_ORDERS has been added. +Defines the limit of open iceberg orders on an account +WEBSOCKETS + +New symbol ticker streams with 1h and 4h windows: +Individual symbol ticker streams +@ticker_ +All market ticker streams +!ticker_@arr +2022-06-02 + +Update endpoint for Subaccount: +GET /sapi/v1/sub-account/sub/transfer/history: fromEmail and toEmail can be master email. +2022-05-31 + +Update endpoint for Fiat: +GET /sapi/v1/fiat/orders: Weight changes from UID(3000) to UID(90000) +Update endpoint for Pay: +GET /sapi/v1/pay/transactions: Param names changed: startTimestamp -> startTime; endTimestamp -> endTime. +2022-05-26 + +Update endpoint for Fiat: +GET /sapi/v1/fiat/orders: Weight changes from IP(1) to UID(3000) +Update info for the following margin account endpoints: The max interval between startTime and endTime is 30 days.: +GET /sapi/v1/margin/transfer +GET /sapi/v1/margin/loan +GET /sapi/v1/margin/repay +GET /sapi/v1/margin/isolated/transfer +GET /sapi/v1/margin/interestHistory +2022-05-23 + +Changes to Order Book Depth Levels +Quantities in the Depth levels were returning negative values in situations where they were exceeding the max value, resulting in an overflow. +Going forward depth levels will not overflow, but will be capped at the max value based on the precision of the base asset. This means that the depth level is at max value or more. +E.g. If the precision is 8, then the max value for quantity will be at 92,233,720,368.54775807. +When the fix has been applied, a change in the order book at the affected price level is required for the changes to be visible. +What does this affect? + +SPOT API +GET /api/v3/depth +Websocket Streams +@depth +@depth@100ms +@depth +@depth@100ms +Updates to MAX_POSITION + +If an order's quantity can cause the position to overflow, this will now fail the MAX_POSITION filter. +2022-05-19 + +Update endpoint for Mining: +GET /sapi/v1/mining/pub/algoList and GET /sapi/v1/mining/pub/coinList: Need no paramter. +Add error codes (21xxx) for Portfolio Margin Account: -21001, -21002, -21003 +2022-05-17 + +SPOT API + +Changes to GET api/v3/aggTrades +When providing startTime and endTime, the oldest items are returned. +Changed error messaging on GET /api/v3/myTrades where parameter symbol is not provided: +{ +"code": -1102, +"msg": "Mandatory parameter 'symbol' was not sent, was empty/null, or malformed." +} +The following endpoints now support multi-symbol querying using the parameter symbols. +GET /api/v3/ticker/24hr +GET /api/v3/ticker/price +GET /api/v3/ticker/bookTicker +In the above, the request weight will depend on the number of symbols provided in symbols. + +Please refer to the table below: +Endpoint Number of Symbols Weight +GET /api/v3/ticker/price Any 2 +GET /api/v3/ticker/bookTicker Any 2 +GET /api/v3/ticker/24hr 1-20 1 +GET /api/v3/ticker/24hr 21-100 20 +GET /api/v3/ticker/24hr 101 or more 40 +2022-05-05 + +New endpoint for Binance Code: +GET /sapi/v1/giftcard/cryptography/rsa-public-key to fetch RSA public key. +Update endpoint for Binance Code: +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. +2022-04-28 + +New endpoints for Staking: +GET /sapi/v1/staking/productList to get Staking product list +POST /sapi/v1/staking/purchase to stake product +POST /sapi/v1/staking/redeem to redeem product +GET /sapi/v1/staking/position to get Staking product holding position +GET /sapi/v1/staking/stakingRecord to inquiry Staking history records +POST /sapi/v1/staking/setAutoStaking to set Auto Staking function +GET /sapi/v1/staking/personalLeftQuota to inquiry Staking left quota +2022-04-27 + +New endpoint for Futures Algo: +POST /sapi/v1/algo/futures/newOrderTwap to support Twap new order +FAQ: Time-Weighted Average Price(Twap) Introduction + +2022-04-26 + +GET /sapi/v1/margin/rateLimit/order added +The endpoint will display the user's current margin order count usage for all intervals. +2022-04-20 + +New endpoint for Portfolio Margin: +GET /sapi/v1/portfolio/account to support query portfolio margin account info +FAQ: Portfolio Margin Program + +Only Portfolio Margin Account is accessible to this endpoint. To enroll, kindly refer to: How to Enroll into the Binance Portfolio Margin Program + +2022-04-13 + +New endpoints for Futures Algo: +POST /sapi/v1/algo/futures/newOrderVp to support VP new order +DELETE /sapi/v1/algo/futures/order to support cancel Algo order +GET /sapi/v1/algo/futures/openOrders to support query Algo open orders +GET /sapi/v1/algo/futures/historicalOrders to support query Algo historical orders +GET /sapi/v1/algo/futures/subOrders to support query Algo sub orders for a specified algoId +FAQ: Volume Participation(VP) Introduction + +2022-04-13 + +Information on Trailing Stops + +SPOT API + +Trailing Stops have been enabled. +This is a type of algo order where the activation is based on a percentage of a price change in the market using the new parameter trailingDelta. +This can only used with any of the following order types: STOP_LOSS, STOP_LOSS_LIMIT, TAKE_PROFIT, TAKE_PROFIT_LIMIT. +The trailingDelta parameter will be done in Basis Points or BIPS. +For example: a STOP_LOSS SELL order with a trailingDelta of 100 will trigger after a price decrease of 1%. (100 / 10,000 => 0.01 => 1%) +When used in combination with OCO Orders, the trailingDelta will determine when the contingent leg of the OCO will trigger. +When trailingDelta is used in combination with stopPrice, once the stopPrice condition is met, the trailing stop starts tracking the price change from the stopPrice based on the trailingDelta provided. +When no stopPrice is sent, the trailing stop starts tracking the price changes from the last price based on the trailingDelta provided. +Changes to POST /api/v3/order +New optional field trailingDelta +Changes to POST /api/v3/order/test +New optional field trailingDelta +Changes to POST /api/v3/order/oco +New optional field trailingDelta +A new filter TRAILING_DELTA has been added. +This filter is defined by the minimum and maximum values for the trailingDelta value. +USER DATA STREAM + +New field in executionReport +"d" for trailingDelta +2022-04-12 + +Note: The changes are being rolled out during the next few days, so these will not appear right away. + +Error message changed on GET api/v3/allOrders where symbol is not provided: + +{ "code": -1102, "msg": "Mandatory parameter 'symbol' was not sent, was empty/null, or malformed." } +Fixed a typo with an error message when an account has disabled permissions (e.g. to withdraw, to trade, etc) + +"This action is disabled on this account." +During a market data audit, we detected some issues with the Spot aggregate trade data. +Missing aggregate trades were recovered. +Duplicated records were marked invalid with the following values: +p = '0' // price +q = '0' // qty +f = -1 // first_trade_id +l = -1 // last_trade_id +2022-3-29 + +The following updates will take effect on March 31, 2022 08:00 AM UTC + +Update endpoint for Sub-account: +GET /sapi/v1/sub-account/universalTransfer +The query time period must be less then 30 days; If startTime and endTime not sent, return records of the last 30 days by default + +2022-03-25 + +Update endpoint for Sub-Account: +New endpointGET /sapi/v1/managed-subaccount/accountSnapshot to support investor master account query asset snapshot of managed sub-account +2022-03-08 + +Update endpoint for Sub-Account: +New transfer typesMARGIN,ISOLATED_MARGIN and parametersymboladded inPOST /sapi/v1/sub-account/universalTransfer to support transfer to sub-account cross margin account and isolated margin account +2022-02-28 + +New field allowTrailingStop has been added to GET /api/v3/exchangeInfo +2022-02-22 + +SPOT API + +(price-minPrice) % tickSize == 0 rule in PRICE_FILTER has been changed to price % tickSize == 0. +A new filter PERCENT_PRICE_BY_SIDE has been added. +Changes to GET api/v3/depth +The limit value can be outside of the previous values (i.e. 5, 10, 20, 50, 100, 500, 1000,5000) and will return the correct limit. (i.e. if limit=3 then the response will be the top 3 bids and asks) +The limit still cannot exceed 5000. If the limit provided is greater than 5000, then the response will be truncated to 5000. +Due to the changes, these are the updated request weights based on the limit value provided: +Limit Request Weight +1-100 1 +101-500 5 +501-1000 10 +1001-5000 50 +Changes to GET api/v3/aggTrades +When providing startTime and endTime, the oldest items are returned. +2022-2-18 + +Update endpoint for Sub-Account: +New fields isManagedSubAccountand isAssetManagementSubAccount added inGET /sapi/v1/sub-account/listto support query whether the sub-account is a managed sub-account or a asset management sub-account +2022-2-17 + +The following updates will take effect on February 24, 2022 08:00 AM UTC + +Update endpoint for Wallet: +GET /sapi/v1/accountSnapshot +The time limit of this endpoint is shortened to only support querying the data of the latest month + +2022-2-09 + +New endpoint for Wallet: +POST /sapi/v1/asset/dust-btc to get assets that can be converted into BNB +2022-1-25 + +From January 28, 2022 4:00 AM UTC, You need to openEnable Spot & Margin Tradingpermission for the API key which requests these endpoints as following: +POST /sapi/v1/asset/dust Dust transfer +POST /sapi/v1/lending/daily/purchase Purchase Savings flexible product +POST /sapi/v1/lending/daily/redeem Redeem Savings flexible product +POST /sapi/v1/lending/customizedFixed/purchase Purchase Savings Fixed/Activity project +POST /sapi/v1/lending/positionChanged Change Savings Fixed/Activity position to Daily position +POST /sapi/v1/bswap/liquidityAdd Bswap add liquidity +POST /sapi/v1/bswap/liquidityRemove Bswap remove liquidity +POST /sapi/v1/bswap/swap Bswap swap +POST /sapi/v1/bswap/claimRewards Bswap claim rewards +2022-1-21 + +New endpoints for Binance Code: +POST /sapi/v1/giftcard/createCode to create a Binance Code. +POST /sapi/v1/giftcard/redeemCode to redeem a Binance Code. +GET /sapi/v1/giftcard/verify to verify a Binance Code. +2022-1-4 + +New endpoint for Mining: + +GET /sapi/v1/mining/payment/uid to get Mining account earning. +New endpoints for BSwap: + +GET /sapi/v1/bswap/unclaimedRewards to get unclaimed rewards record. +POST /sapi/v1/bswap/claimRewards to claim swap rewards or liquidity rewards. +GET /sapi/v1/bswap/claimedHistory to get history of claimed rewards. +2021-12-30 + +Update endpoint for Margin: + +Removed out limit fromGET /sapi/v1/margin/interestRateHistory; The max interval between startTime and endTime is 30 days. +Update endpoint for Wallet: + +As the Mining account is merged into Funding account, transfer types MAIN_MINING, MINING_MAIN, MINING_UMFUTURE, MARGIN_MINING, and MINING_MARGIN will be discontinued in Universal Transfer endpoint POST /sapi/v1/asset/transfer on January 05, 2022 08:00 AM UTC +2021-12-29 + +Removed out dated "Symbol Type" enum; added "Permissions" enum. +2021-12-24 + +Update endpoints for Sub-Account: +New parameterclientTranIdadded inPOST /sapi/v1/sub-account/universalTransfer and GET /sapi/v1/sub-account/universalTransfer to support custom transfer id +2021-12-03 + +New endpoints for Margin: + +GET /sapi/v1/margin/crossMarginData to get cross margin fee data collection +GET /sapi/v1/margin/isolatedMarginData to get isolated margin fee data collection +GET /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 history +GET /sapi/v1/nft/history/deposit to get NFT deposit history +GET /sapi/v1/nft/history/withdraw to get NFT withdraw history +GET /sapi/v1/nft/user/getAsset to get NFT asset +2021-11-30 + +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 +2021-11-19 + +New endpoint for Pay: + +GET /sapi/v1/pay/transactionsto support user query Pay trade history +Update endpoint for Wallet: + +New fieldinfoadded inGET /sapi/v1/capital/withdraw/historyto show the reason for withdrawal failure +2021-11-18 + +The following updates will take effect on November 25, 2021 08:00 AM UTC + +Update endpoint for Wallet: +GET /sapi/v1/accountSnapshot +The query time range of both endpoints are shortened to support data query within the last 6 months only, where startTime does not support selecting a timestamp beyond 6 months. If you do not specify startTime and endTime, the data of the last 7 days will be returned by default. + +2021-11-17 + +The following endpoints will be discontinued on November 17, 2021 13:00 PM UTC: +POST /sapi/v1/account/apiRestrictions/ipRestriction to support user enable and disable IP restriction for an API Key +POST /sapi/v1/account/apiRestrictions/ipRestriction/ipList to support user add IP list for an API Key +GET /sapi/v1/account/apiRestrictions/ipRestriction to support user query IP restriction for an API Key +DELETE /sapi/v1/account/apiRestrictions/ipRestriction/ipList to support user delete IP list for an API Key +2021-11-16 + +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 Key +POST /sapi/v1/sub-account/subAccountApi/ipRestriction/ipList to support master account add IP list for a sub-account API Key +GET /sapi/v1/sub-account/subAccountApi/ipRestriction to support master account query IP restriction for a sub-account API Key +DELETE /sapi/v1/sub-account/subAccountApi/ipRestriction/ipList to support master account delete IP list for a sub-account API Key +2021-11-09 + +New endpoints for Wallet: +POST /sapi/v1/account/apiRestrictions/ipRestriction to support user enable and disable IP restriction for an API Key +POST /sapi/v1/account/apiRestrictions/ipRestriction/ipList to support user add IP list for an API Key +GET /sapi/v1/account/apiRestrictions/ipRestriction to support user query IP restriction for an API Key +DELETE /sapi/v1/account/apiRestrictions/ipRestriction/ipList to support user delete IP list for an API Key +2021-11-08 + +New endpoint for Crypto Loans: +New endpointGET /sapi/v1/loan/incometo support user query crypto loans income history +2021-11-05 + +Update endpoint for Wallet: +New parameter walletTypeadded in POST /sapi/v1/capital/withdraw/apply to support user choose wallet type spot wallet and funding wallet when withdraw crypto. +2021-11-04 + +The following updates will take effect on November 11, 2021 08:00 AM UTC + +Update endpoints for Wallet and Futures: +GET /sapi/v1/asset/transfer +GET /sapi/v1/futures/transfer +The query time range of both endpoints are shortened to support data query within the last 6 months only, where startTime does not support selecting a timestamp beyond 6 months. If you do not specify startTime and endTime, the data of the last 7 days will be returned by default. + +2021-11-01 + +GET /api/v3/rateLimit/order added +The endpoint will display the user's current order count usage for all intervals. +This endpoint will have a request weight of 20. +2021-10-22 + +Update endpoint for Wallet: +New transfer types MAIN_FUNDING,FUNDING_MAIN,FUNDING_UMFUTURE,UMFUTURE_FUNDING,MARGIN_FUNDING,FUNDING_MARGIN,FUNDING_CMFUTUREand CMFUTURE_FUNDING added in Universal Transfer endpoint POST /sapi/v1/asset/transfer and GET /sapi/v1/asset/transfer to support transfer assets among funding account and other accounts +As the C2C account, Binance Payment, Binance Card and other business account are merged into a Funding account, transfer types MAIN_C2C,C2C_MAIN,C2C_UMFUTURE,C2C_MINING,UMFUTURE_C2C,MINING_C2C,MARGIN_C2C,C2C_MARGIN,MAIN_PAYand PAY_MAIN will be discontinued in Universal Transfer endpoint POST /sapi/v1/asset/transfer and GET /sapi/v1/asset/transfer on November 04, 2021 08:00 AM UTC +2021-10-14 + +Update the time range of the response data for the following margin account endpoints, startTime and endTime time span will not exceed 30 days, without time parameter sent the system will return the last 7 days of data by default, while the archived parameter is true, the system will return the last 7 days of data 6 months ago by default: +GET /sapi/v1/margin/transfer +GET /sapi/v1/margin/loan +GET /sapi/v1/margin/repay +GET /sapi/v1/margin/isolated/transfer +GET /sapi/v1/margin/interestHistory +2021-09-18 + +New endpoints for BSwap: +GET /sapi/v1/bswap/poolConfigure to get pool configure +GET /sapi/v1/bswap/addLiquidityPreview to get add liquidity preview +GET /sapi/v1/bswap/removeLiquidityPreview to get remove liquidity preview +2021-09-17 + +Add/api/*and/sapi/* limit introduction in General Info +2021-09-08 + +Add endpoints for enabled isolated margin account limit: + +DELETE /sapi/v1/margin/isolated/account to disable isolated margin account for a specific symbol +POST /sapi/v1/margin/isolated/account to enable isolated margin account for a specific symbol +GET /sapi/v1/margin/isolated/accountLimit to query enabled isolated margin account limit +New field "enabled" in response of GET /sapi/v1/margin/isolated/account to check if the isolated margin account is enabled + +2021-09-03 + +Update endpoint for Wallet: +New fields sameAddress,depositDust and specialWithdrawTipsadded in GET /sapi/v1/capital/config/getall sameAddress means if the coin needs to provide memo to withdraw depositDust means minimum creditable amount specialWithdrawTips means special tips for withdraw +New field confirmNoadded in GET /sapi/v1/capital/withdraw/history to support query confirm times for withdraw history +2021-08-27 + +Update endpoint for Wallet: +New parameter withdrawOrderIdadded in GET /sapi/v1/capital/withdraw/history to support user query withdraw history by withdrawOrderId +New field unlockConfirmadded in GET /sapi/v1/capital/deposit/hisrec to support query network confirm times for unlocking +2021-08-23 + +New endpoints for Margin Account OCO: +POST /sapi/v1/margin/order/oco +DELETE /sapi/v1/margin/orderList +GET /sapi/v1/margin/orderList +GET /sapi/v1/margin/allOrderList +GET /sapi/v1/margin/openOrderList +Same usage as spot account OCO + +2021-08-20 + +Update endpoint for Wallet: +New parametersfromSymbol,toSymboland new transfer types ISOLATEDMARGIN_MARGIN, MARGIN_ISOLATEDMARGINand ISOLATEDMARGIN_ISOLATEDMARGIN added in POST /sapi/v1/asset/transfer and GET /sapi/v1/asset/transfer to support user transfer assets between Margin(cross) account and Margin(isolated) account +2021-08-12 + +GET api/v3/myTrades has a new optional field orderId +2021-08-05 + +New endpoint for C2C: +GET /sapi/v1/c2c/orderMatch/listUserOrderHistory to query user C2C trade history +2021-08-05 + +Update endpoints for Savings: +GET /sapi/v1/lending/union/purchaseRecord +GET /sapi/v1/lending/union/redemptionRecord +GET /sapi/v1/lending/union/interestHistory +The time between startTime and endTime cannot be longer than 30 days. If startTime and endTime are both not sent, then the last 30 days' data will be returned + +2021-07-29 + +Update endpoint for Sub-Account: +GET /sapi/v1/sub-account/transfer/subUserHistory if startTimeandendTimeare not sent, the recent 30-day data will be returned by default +2021-07-27 + +New endpoint for Fiat: +GET /sapi/v1/fiat/orders to query user fiat deposit and withdraw history +GET /sapi/v1/fiat/payments to query user fiat payments history +2021-07-16 + +New endpoint for Wallet: +GET /sapi/v1/account/apiRestrictions to query user API Key permission +2021-07-09 + +New endpoint for Wallet: +POST /sapi/v1/asset/get-funding-asset to query funding wallet, includes Binance Pay, Binance Card, Binance Gift Card, Stock Token +2021-06-24 + +Update endpoints for Wallet: +GET /sapi/v1/capital/withdraw/history added default value 1000, max value 1000 for the parameterlimit +GET /sapi/v1/capital/deposit/hisrec added default value 1000, max value 1000 for the parameterlimit +2021-06-17 + +Update endpoint for Savings: +GET /sapi/v1/lending/daily/product/list to include new parameters current and size +2021-06-15 + +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) +2021-06-04 + +On August 01, 2021 02:00 AM UTC the WAPI endpoints will be discontinued: + +GET /wapi/v3/systemStatus.html +POST /wapi/v3/withdraw.html +GET /wapi/v3/depositHistory.html +GET /wapi/v3/withdrawHistory.html +GET /wapi/v3/depositAddress.html +GET /wapi/v3/accountStatus.html +GET /wapi/v3/apiTradingStatus.html +GET /wapi/v3/userAssetDribbletLog.html +GET /wapi/v3/assetDetail.html +GET /wapi/v3/tradeFee.html +GET /wapi/v3/sub-account/list.html +GET /wapi/v3/sub-account/transfer/history.html +POST /wapi/v3/sub-account/transfer.html +GET /wapi/v3/sub-account/assets.html +The WAPI endpoints have been removed from Binance API Documentation.To ensure your trading strategies are not affected, all API users are encouraged to upgrade trading bots to SAPI endpoints as soon as possible. + +2021-05-26 + +Update endpoint for Wallet: +New transfer types MAIN_PAY ,PAY_MAIN added in Universal Transfer endpoint POST /sapi/v1/asset/transfer and GET /sapi/v1/asset/transfer to support trasnfer assets between spot account and pay account +2021-05-12 + +Added Data Source in the documentation to explain where each endpoint is retrieving its data +Added field Data Source to each Spot API endpoint in the documentation +GET api/v3/exchangeInfo now supports single or multi-symbol query +2021-04-28 + +On May 15, 2021 08:00 UTC the SAPI Create Margin Account endpoint will be discontinued: + +POST /sapi/v1/margin/isolated/create +Isolated Margin account creation and trade preparation can be completed directly through Isolated Margin funds transfer POST /sapi/v1/margin/isolated/transfer + +2021-04-26 + +On April 28, 2021 00:00 UTC the weights to the following endpoints will be adjusted: + +GET /api/v3/order weight increased to 2 +GET /api/v3/openOrders weight increased to 3 +GET /api/v3/allOrders weight increased to 10 +GET /api/v3/orderList weight increased to 2 +GET /api/v3/openOrderList weight increased to 3 +GET /api/v3/account weight increased to 10 +GET /api/v3/myTrades weight increased to 10 +GET /api/v3/exchangeInfo weight increased to 10 +2021-04-08 + +Update endpoint for Sub-Account: +GET /sapi/v1/sub-account/futures/accountSummary and GET /sapi/v2/sub-account/futures/accountSummary the unit of field asset changed to USD valued summary of sub-account assets +2021-04-02 + +New endpoints for Wallet: +GET /sapi/v1/system/status to query system status +GET /sapi/v1/account/status to query account status +GET /sapi/v1/account/apiTradingStatus to query account API trading status +GET /sapi/v1/asset/dribblet to query dust log +GET /sapi/v1/asset/assetDetail to query asset detail +GET /sapi/v1/asset/tradeFee to query trade fee +New endpoint for Sub-Account: +GET /sapi/v3/sub-account/assets to query sub-account assets +2021-04-01 + +Update endpoint for Sub-Account: +GET /sapi/v1/sub-account/transfer/subUserHistory new fields fromAccountType and toAccountType added in response +2021-03-31 + +Update endpoint for Sub-Account: +GET /wapi/v3/sub-account/transfer/history.html added new parameters fromEmail and toEmail, the original parameteremail is equal tofromEmailby default +2021-03-08 + +New endpoint for Sub-Account: +POST /sapi/v1/sub-account/virtualSubAccount to support create a virtual sub-account +GET /sapi/v1/sub-account/list to support query sub-account list +2021-03-05 + +New endpoints for Margin: +GET /sapi/v1/margin/interestRateHistory to support margin interest rate history query +2021-02-08 + +New endpoints for Futures: +GET /sapi/v2/futures/loan/wallet to support BUSD loan query +GET /sapi/v2/futures/loan/configs to support BUSD loan query +GET /sapi/v2/futures/loan/calcAdjustLevel to support BUSD loan +GET /sapi/v2/futures/loan/calcMaxAdjustAmount to support adjustment of BUSD loan +POST /sapi/v2/futures/loan/adjustCollateral to support adjustment of BUSD loan +Update endpoints for Futures +GET /sapi/v1/futures/loan/adjustCollateral/history new parameter and fields in response loanCoin for BUSD loan +GET /sapi/v1/futures/loan/liquidationHistory new parameter and fields in response loanCoin for BUSD loan +2021-02-04 + +New transfer types MARGIN_MINING ,MINING_MARGIN, MARGIN_C2C ,C2C_MARGIN, MARGIN_CMFUTURE, CMFUTURE_MARGIN added in Universal Transfer endpoint POST /sapi/v1/asset/transfer and GET /sapi/v1/asset/transfer. +2021-01-15 + +New endpoint DELETE /sapi/v1/margin/openOrders for Margin Trade +This will allow a user to cancel all open orders on a single symbol for margin account. +This endpoint will cancel all open orders including OCO orders for margin account. +2021-01-10 + +New parameter pageSize for Mining endpoint GET /sapi/v1/mining/payment/list +New fields in response to Mining endpoint GET /sapi/v1/mining/payment/list: + +"type" for income type +"hashTransfer" for resale Hashrate +"transferAmount" for transferred Income +New Mining endpoints: + +GET /sapi/v1/mining/payment/other +GET /sapi/v1/mining/hash-transfer/config/details +GET /sapi/v1/mining/hash-transfer/config/details/list +GET /sapi/v1/mining/hash-transfer/profit/details +POST /sapi/v1/mining/hash-transfer/config +POST /sapi/v1/mining/hash-transfer/config/cancel +2021-01-01 + +USER DATA STREAM + +outboundAccountInfo has been removed. +2020-12-30 + +New endpoint for Wallet: +POST /sapi/v1/asset/transfer to support user universal transfer among Spot, Margin, Futures, C2C, MINING accounts. +GET /sapi/v1/asset/transfer to get user universal transfer history. +2020-12-22 + +New endpoint for Sub-Account: +GET /sapi/v1/sub-account/sub/transfer/history to get spot asset transfer history. +2020-12-11 + +Update endpoints for Futures Cross-Collateral: +GET /sapi/v1/futures/loan/wallet new fields in response interestFreeLimit for total interest free limit, interestFreeLimitUsed for interest free limit used. +GET /sapi/v1/futures/loan/interestHistory new fields in response interestFreeLimitUsed for interest free limit used. +2020-12-02 + +New endpoints for Sub-Account: +GET /sapi/v2/sub-account/futures/account to get detail on sub-account's USDT margined futures account and COIN margined futures account. +GET /sapi/v2/sub-account/futures/accountSummary to get summary of sub-account's USDT margined futures account and COIN margined futures account. +GET /sapi/v2/sub-account/futures/positionRisk to get position risk of sub-account's USDT margined futures account and COIN margined futures account. +2020-12-01 + +Update Margin Trade Endpoint: +POST /sapi/v1/margin/order new parameter quoteOrderQty allow a user to specify the total quoteOrderQty spent or received in the MARKET order. +2020-11-27 + +New API clusters have been added in order to improve performance. + +Users can access any of the following API clusters, in addition to api.binance.com + +If there are any performance issues with accessing api.binance.com please try any of the following instead: + +https://api1.binance.com/api/v3/* +https://api2.binance.com/api/v3/* +https://api3.binance.com/api/v3/* +2020-11-16 + +Updated endpoints for Margin, new parameter archived to query data from 6 months ago: +GET /sapi/v1/margin/loan +GET /sapi/v1/margin/repay +GET /sapi/v1/margin/interestHistory +2020-11-13 + +New endpoints for Sub-Account: +POST /sapi/v1/sub-account/universalTransfer to transfer spot and futures asset between master account and sub accounts. +GET /sapi/v1/sub-account/universalTransfer to search transfer records. +2020-11-10 + +New endpoint to toggle BNB Burn: +POST /sapi/v1/bnbBurn to toggle BNB Burn on spot trade and margin interest. +GET /sapi/v1/bnbBurn to get BNB Burn status. +2020-11-09 + +New field tranId is available from endpoints: +GET /sapi/v1/sub-account/futures/internalTransfer +GET /sapi/v1/sub-account/transfer/subUserHistory +2020-11-03 + +Update endpoints for Futures Cross-Collateral: + +GET /sapi/v1/futures/loan/repay/history new fields in response repayType(NORMAL for normal repayment, COLLATERAL for collateral repayment), price (collateral repayment rate), repayCollateral(collateral amount for collateral repayment). +GET /sapi/v1/futures/loan/wallet new fields in response totalInterest (total interest for cross-collateral), principalForInterest(cross-collateral principal for interest), interest(cross-collateral interest). +GET /sapi/v1/futures/loan/configs new fields in response interestRate (interest rate for cross-collateral), interestGracePeriod (interest grace period for cross-collateral). +New endpoints for Futures Cross-Collateral: + +GET /sapi/v1/futures/loan/collateralRepayLimit to check the maximum and minimum limit when repay with collateral. +GET /sapi/v1/futures/loan/collateralRepay to get quote for collateral repayment. +POST /sapi/v1/futures/loan/collateralRepay to repay with collateral. +GET /sapi/v1/futures/loan/collateralRepayResult to check collateral repayment result. +GET /sapi/v1/futures/loan/interestHistory to get cross-collateral interest history. +2020-10-14 + +Update endpoints for Futures Cross-Collateral: +POST /sapi/v1/futures/loan/borrow and GET /sapi/v1/futures/loan/borrow/history new field borrowId in response for ID of Cross-Collateral borrow operation. +POST /sapi/v1/futures/loan/repay and GET /sapi/v1/futures/loan/repay/history new field repayId in response for ID of Cross-Collateral repay operation. +2020-10-10 + +New type added in the endpoint POST /sapi/v1/sub-account/futures/transferto support transfer asset from subaccount's spot account to its COIN-margined futures account and transfer asset from subaccount's COIN-margined futures account to its spot account. +2020-09-30 + +Update endpoints for Margin Account: +GET /sapi/v1/margin/maxBorrowable new field borrowLimit in response for account borrow limit. +2020-09-28 + +New endpoints for Binance Savings: +POST /sapi/v1/lending/positionChanged to change fixed/activity position to daily position. +New parameter ACTIVITY replace REGULARin the following Binance Savings endpoints: +GET /sapi/v1/lending/project/list +POST /sapi/v1/lending/customizedFixed/purchase +GET /sapi/v1/lending/project/position/list +GET /sapi/v1/lending/union/purchaseRecord +GET /sapi/v1/lending/union/interestHistory +2020-09-23 + +New SAPI endpoints for BSwap: +GET /sapi/v1/bswap/pools to list all swap pools. +GET /sapi/v1/bswap/liquidity to get liquidity information of a pool. +POST /sapi/v1/bswap/liquidityAdd to add liquidity. +POST /sapi/v1/bswap/liquidityRemove to remove liquidity. +GET /sapi/v1/bswap/liquidityOps to get liquidity operation record. +GET /sapi/v1/bswap/quote to request quotes. +POST /sapi/v1/bswap/swap to swap. +GET /sapi/v1/bswap/swap to get swap history. +2020-09-09 + +USER DATA STREAM + +outboundAccountInfo has been deprecated. +outboundAccountInfo will be removed in the future. (Exact date unknown) Please use outboundAccountPosition instead. +outboundAccountInfo will now only show the balance of non-zero assets and assets that have been reduced to 0. +2020-09-03 + +New endpoint POST /sapi/v1/sub-account/futures/internalTransfer to transfer futures asset between master account and subaccount. +New endpointGET /sapi/v1/sub-account/futures/internalTransfer to get futures transfer history of subaccount. +2020-09-01 + +New parameter masterAccountTotalAsset added in the endpoint GET /sapi/v1/sub-account/spotSummary to get BTC valued asset summary of master account. +2020-08-27 + +New endpoint GET /sapi/v1/sub-account/spotSummary to get BTC valued asset summary of subaccout. +2020-08-26 + +New parameter symbols added in the endpoint GET /sapi/v1/margin/isolated/account. +2020-07-28 + +ISOLATED MARGIN + +New parameters "isIsolated" and "symbol" added for isolated margin in the following endpoints: + +POST /sapi/v1/margin/loan +POST /sapi/v1/margin/repay +New parameter "isIsolated" and new response field "isIsolated" added for isolated margin in the following endpoints: + +POST /sapi/v1/margin/order +DELETE /sapi/v1/margin/order +GET /sapi/v1/margin/order +GET /sapi/v1/margin/openOrders +GET /sapi/v1/margin/allOrders +GET /sapi/v1/margin/myTrades +New parameter "isolatedSymbol" and new response field "isolatedSymbol" added for isolated margin in the following endpoints: + +GET /sapi/v1/margin/loan +GET /sapi/v1/margin/repay +GET /sapi/v1/margin/interestHistory +New parameter "isolatedSymbol" and new response field "isIsolated" added for isolated margin in the following endpoint GET /sapi/v1/margin/forceLiquidationRec + +New parameter "isolatedSymbol" added for isolated margin in the following endpoints: + +GET /sapi/v1/margin/maxBorrowable +GET /sapi/v1/margin/maxTransferable +New endpoints for isolated margin: + +POST /sapi/v1/margin/isolated/create +POST /sapi/v1/margin/isolated/transfer +GET /sapi/v1/margin/isolated/transfer +GET /sapi/v1/margin/isolated/account +GET /sapi/v1/margin/isolated/pair +GET /sapi/v1/margin/isolated/allPairs +New endpoints for listenKey management of isolated margin account: + +POST /sapi/v1/userDataStream/isolated +PUT /sapi/v1/userDataStream/isolated +DELETE /sapi/v1/userDataStream/isolated +2020-07-20 + +The max value of parameter "limit" in GET /sapi/v1/margin/allOrders has been changed as 500. +2020-07-17 + +There is now a request limit specifically for the sapi/v1/margin/allOrders endpoint at 60 raw requests per minute for a single IP address. +2020-07-13 + +New SAPI Endpoints for futures Cross-Collateral: +POST /sapi/v1/futures/loan/borrow +GET /sapi/v1/futures/loan/borrow/history +POST /sapi/v1/futures/loan/repay +GET /sapi/v1/futures/loan/repay/history +GET /sapi/v1/futures/loan/wallet +GET /sapi/v1/futures/loan/configs +GET /sapi/v1/futures/loan/calcAdjustLevel +GET /sapi/v1/futures/loan/calcMaxAdjustAmount +POST /sapi/v1/futures/loan/adjustCollateral +GET /sapi/v1/futures/loan/adjustCollateral/history +GET /sapi/v1/futures/loan/liquidationHistory +2020-06-28 + +SAPI Endpoints for futures: +POST /sapi/v1/futures/transfer +GET /sapi/v1/futures/transfer +2020-05-06 + +New endpoints for Mining: +GET /sapi/v1/mining/pub/algoList +GET /sapi/v1/mining/pub/coinList +GET /sapi/v1/mining/worker/detail +GET /sapi/v1/mining/worker/list +GET /sapi/v1/mining/payment/list +GET /sapi/v1/mining/statistics/user/status +GET /sapi/v1/mining/statistics/user/list +2020-05-01 + +From 2020-05-01 UTC 00:00, all symbols will have a limit of 200 open orders using the MAX_NUM_ORDERS filter. +No existing orders will be removed or canceled. +Accounts that have 200 or more open orders on a symbol will not be able to place new orders on that symbol until the open order count is below 200. +OCO orders count as 2 open orders before the LIMIT order is touched or the STOP_LOSS (or STOP_LOSS_LIMIT) order is triggered; once this happens the other order is canceled and will no longer count as an open order. +2020-04-25 + +SPOT API + +New field permissions +Defines the trading permissions that are allowed on accounts and symbols. +permissions is an enum array; values: +SPOT +MARGIN +permissions will replace isSpotTradingAllowed and isMarginTradingAllowed on GET api/v3/exchangeInfo in future API versions (v4+). +For an account to trade on a symbol, the account and symbol must share at least 1 permission in common. +Updates to GET api/v3/exchangeInfo +New field permissions added. +New field quoteAssetPrecision added; a duplicate of the quotePrecision field. quotePrecision will be removed in future API versions (v4+). +Updates to GET api/v3/account +New field permissions added. +New endpoint DELETE api/v3/openOrders +This will allow a user to cancel all open orders on a single symbol. +This endpoint will cancel all open orders including OCO orders. +Orders can be canceled via the API on symbols in the BREAK or HALT status. +USER DATA STREAM + +OutboundAccountInfo has new field P which shows the trading permissions of the account. +2020-04-23 + +WEB SOCKET STREAM + +WebSocket connections have a limit of 5 incoming messages per second. A message is considered: +A PING frame +A PONG frame +A JSON control message (e.g. subscribe, unsubscribe) +A connection that goes beyond the limit will be disconnected; IPs that are repeatedly disconnected may be banned. +A single connection can listen to a maximum of 1024 streams. +2020-04-16 + +New fields in response to endpointGET /sapi/v1/lending/daily/token/position: + +todayPurchasedAmount for user's purchased amount today +New lending endpoints for customized fixed projects: + +GET /sapi/v1/lending/project/list +POST /sapi/v1/lending/customizedFixed/purchase +GET /sapi/v1/lending/project/position/list +2020-04-02 + +New fields in response to endpointGET /sapi/v1/capital/config/getall: +minConfirm for min number for balance confirmation +unLockConfirm for confirmation number for balance unlock +2020-03-24 + +MAX_POSITION filter added. + +This filter defines the allowed maximum position an account can have on the base asset of a symbol. An account's position defined as the sum of the account's: +free balance of the base asset +locked balance of the base asset +sum of the qty of all open BUY orders +BUY orders will be rejected if the account's position is greater than the maximum position allowed. +2020-03-13 + +New parameter transactionFeeFlag is available in endpoint: +POST /sapi/v1/capital/withdraw/apply and +POST /wapi/v3/withdraw.html +2020-02-05 + +New sub account endpoints: +POST /sapi/v1/sub-account/futures/transfer to transfer between futures and spot accout of sub-account. +POST /sapi/v1/sub-account/margin/transfer to transfer between margin and spot accout of sub-account. +POST /sapi/v1/sub-account/transfer/subToSub to transfer to another account by sub-account. +POST /sapi/v1/sub-account/transfer/subToMaster to transfer to same master by sub-account. +GET /sapi/v1/sub-account/transfer/subUserHistory to get transfer history of sub-account. +2020-01-15 + +New parameter withdrawOrderId for client customized withdraw id for endpoint POST /wapi/v3/withdraw.html. + +New field withdrawOrderId in response to GET /wapi/v3/withdrawHistory.html + +2019-12-25 + +New endpoints for Binance Savings: + +GET /sapi/v1/lending/daily/product/list +GET /sapi/v1/lending/daily/userLeftQuota +POST /sapi/v1/lending/daily/purchase +GET /sapi/v1/lending/daily/userRedemptionQuota +POST /sapi/v1/lending/daily/redeem +GET /sapi/v1/lending/daily/token/position +GET /sapi/v1/lending/union/account +GET /sapi/v1/lending/union/purchaseRecord +GET /sapi/v1/lending/union/redemptionRecord +GET /sapi/v1/lending/union/interestHistory +Added time interval limit in +GET /sapi/v1/capital/withdraw/history, +GET /wapi/v3/withdrawHistory.html, +GET /sapi/v1/capital/deposit/hisrec and +GET /wapi/v3/depositHistory.html: + +The default startTime is 90 days from current time, and the default endTime is current time. +Please notice the default startTime and endTime to make sure that time interval is within 0-90 days. +If both startTime and endTime are sent, time between startTime and endTime must be less than 90 days. +2019-12-18 + +New endpoint to get daily snapshot of account: +GET /sapi/v1/accountSnapshot +2019-11-30 + +Added parameter sideEffectType in POST /sapi/v1/margin/order (HMAC SHA256) with enums: + +NO_SIDE_EFFECT for normal trade order; +MARGIN_BUY for margin trade order; +AUTO_REPAY for making auto repayment after order filled. +New field marginBuyBorrowAmount and marginBuyBorrowAsset in FULL response to POST /sapi/v1/margin/order (HMAC SHA256) + +2019-11-28 + +New SAPI endpont to disable fast withdraw switch: +POST /sapi/v1/account/disableFastWithdrawSwitch (HMAC SHA256) +New SAPI endpont to enable fast withdraw switch: +POST /sapi/v1/account/enableFastWithdrawSwitch (HMAC SHA256) +2019-11-22 + +Quote Order Qty Market orders have been enabled on all symbols. +Quote Order Qty MARKET orders allow a user to specify the total quoteOrderQty spent or received in the MARKET order. +Quote Order Qty MARKET orders will not break LOT_SIZE filter rules; the order will execute a quantity that will have the notional value as close as possible to quoteOrderQty. +Using BNBBTC as an example: +On the BUY side, the order will buy as many BNB as quoteOrderQty BTC can. +On the SELL side, the order will sell as much BNB as needed to receive quoteOrderQty BTC. +2019-11-19 + +GET /sapi/v1/sub-account/margin/account has new field: marginTradeCoeffVo which contains +forceLiquidationBar for liquidation margin ratio +marginCallBar for margin call margin ratio +normalBar for initial margin ratio +2019-11-13 + +Rest API + +api/v3/exchangeInfo has new fields: +quoteOrderQtyMarketAllowed +baseCommissionPrecision +quoteCommissionPrecision +MARKET orders have a new optional field: quoteOrderQty used to specify the quote quantity to BUY or SELL. This cannot be used in combination with quantity. +The exact timing that quoteOrderQty MARKET orders will be enabled is TBD. There will be a separate announcement and further details at that time. +All order query endpoints will return a new field origQuoteOrderQty in the JSON payload. (e.g. GET api/v3/allOrders) + { + "code": -1128, + "msg": "Combination of optional parameters invalid. Recommendation: 'stopLimitTimeInForce' should also be sent." + } +Updated error messages for -1128 + +Sending an OCO with a stopLimitPrice but without a stopLimitTimeInForce will return the error: +Updated error messages for -1003 to specify the limit is referring to the request weight, not to the number of requests. + +Deprecation of v1 endpoints: + +By end of Q1 2020, the following endpoints will be removed from the API. The documentation has been updated to use the v3 versions of these endpoints. + +GET api/v1/depth +GET api/v1/historicalTrades +GET api/v1/aggTrades +GET api/v1/klines +GET api/v1/ticker/24hr +GET api/v1/ticker/price +GET api/v1/exchangeInfo +POST api/v1/userDataStream +PUT api/v1/userDataStream +GET api/v1/ping +GET api/v1/time +GET api/v1/ticker/bookTicker +These endpoints however, will NOT be migrated to v3. Please use the following endpoints instead moving forward. + +Old V1 Endpoints New V3 Endpoints +GET api/v1/ticker/allPrices GET api/v3/ticker/price +GET api/v1/ticker/allBookTickers GET api/v3/ticker/bookTicker +USER DATA STREAM + +Changes toexecutionReport event + +If the C field is empty, it will now properly return null, instead of "null". +New field Q which represents the quoteOrderQty. +balanceUpdate event type added + +This event occurs when funds are deposited or withdrawn from your account. +WEB SOCKET STREAM + +WSS now supports live subscribing/unsubscribing to streams. +2019-11-08 + +New sapi for subaccount management on margin and futures: +GET /sapi/v1/sub-account/status (HMAC SHA256) +POST /sapi/v1/sub-account/margin/enable (HMAC SHA256) +GET /sapi/v1/sub-account/margin/account (HMAC SHA256) +GET /sapi/v1/sub-account/margin/accountSummary (HMAC SHA256) +POST /sapi/v1/sub-account/futures/enable (HMAC SHA256) +GET /sapi/v1/sub-account/futures/account (HMAC SHA256) +GET /sapi/v1/sub-account/futures/accountSummary (HMAC SHA256) +GET /sapi/v1/sub-account/futures/positionRisk (HMAC SHA256) +2019-11-04 + +New sapi endpoints for subaccount wallet. +GET /sapi/v1/capital/deposit/subAddress (HMAC SHA256)): fetch subaccount deposit address. +GET /sapi/v1/capital/deposit/subHisrec (HMAC SHA256)): fetch subaccount deposit history. +2019-10-29 + +New sapi endpoints for wallet. +POST /sapi/v1/capital/withdraw/apply (HMAC SHA256): withdraw. +Get /sapi/v1/capital/withdraw/history (HMAC SHA256): fetch withdraw history with network. +2019-10-14 + +New sapi endpoints for wallet. +GET /sapi/v1/capital/config/getall (HMAC SHA256): get all coins' information for user. +GET /sapi/v1/capital/deposit/hisrec (HMAC SHA256): fetch deposit history with network. +GET /sapi/v1/capital/deposit/address (HMAC SHA256): fetch deposit address with network. +2019-10-11 + +Added parameter network in POST /wapi/v3/withdraw.html so that asset can be withdrawed with specific network. +2019-09-09 + +New WebSocket streams for bookTickers added: @bookTicker and !bookTicker. +2019-09-03 + +Faster order book data with 100ms updates: @depth@100ms and @depth#@100ms +Added "Update Speed:" to Websocket Market Streams +Removed deprecated v1 endpoints as per previous announcement: +GET api/v1/order +GET api/v1/openOrders +POST api/v1/order +DELETE api/v1/order +GET api/v1/allOrders +GET api/v1/account +GET api/v1/myTrades +2019-08-16 + +GET api/v1/depth limit of 10000 has been temporarily removed + +In Q4 2017, the following endpoints were deprecated and removed from the API documentation. They have been permanently removed from the API as of this version. We apologize for the omission from the original changelog: + +GET api/v1/order +GET api/v1/openOrders +POST api/v1/order +DELETE api/v1/order +GET api/v1/allOrders +GET api/v1/account +GET api/v1/myTrades +Streams, endpoints, parameters, payloads, etc. described in the documents in this repository are considered official and supported. The use of any other streams, endpoints, parameters, or payloads, etc. is not supported; use them at your own risk and with no guarantees. + +2019-09-15 + +Rest API + +New order type: OCO ("One Cancels the Other") + +An OCO has 2 orders: (also known as legs in financial terms) +STOP_LOSS or STOP_LOSS_LIMIT leg +LIMIT_MAKER leg +Price Restrictions: +SELL Orders : Limit Price > Last Price > Stop Price +BUY Orders : Limit Price < Last Price < Stop Price +As stated, the prices must "straddle" the last traded price on the symbol. EX: If the last price is 10: +A SELL OCO must have the limit price greater than 10, and the stop price less than 10. +A BUY OCO must have a limit price less than 10, and the stop price greater than 10. +Quantity Restrictions: +Both legs must have the same quantity. +ICEBERG quantities however, do not have to be the same. +Execution Order: +If the LIMIT_MAKER is touched, the limit maker leg will be executed first BEFORE canceling the Stop Loss Leg. +if the Market Price moves such that the STOP_LOSS or STOP_LOSS_LIMIT will trigger, the Limit Maker leg will be cancelled BEFORE executing the STOP_LOSS Leg. +Cancelling an OCO +Cancelling either order leg will cancel the entire OCO. +The entire OCO can be canceled via the orderListId or the listClientOrderId. +New Enums for OCO: +ListStatusType +RESPONSE - used when ListStatus is responding to a failed action. (either order list placement or cancellation) +EXEC_STARTED - used when an order list has been placed or there is an update to a list's status. +ALL_DONE - used when an order list has finished executing and is no longer active. +ListOrderStatus +EXECUTING - used when an order list has been placed or there is an update to a list's status. +ALL_DONE - used when an order list has finished executing and is no longer active. +REJECT - used when ListStatus is responding to a failed action. (either order list placement or cancellation) +ContingencyType +OCO - specifies the type of order list. +New Endpoints: +POST api/v3/order/oco +DELETE api/v3/orderList +GET api/v3/orderList +recvWindow cannot exceed 60000. + +New intervalLetter values for headers: + +SECOND => S +MINUTE => M +HOUR => H +DAY => D +New Headers X-MBX-USED-WEIGHT-(intervalNum)(intervalLetter) will give your current used request weight for the (intervalNum)(intervalLetter) rate limiter. For example, if there is a one minute request rate weight limiter set, you will get a X-MBX-USED-WEIGHT-1M header in the response. The legacy header X-MBX-USED-WEIGHT will still be returned and will represent the current used weight for the one minute request rate weight limit. + +New Header X-MBX-ORDER-COUNT-(intervalNum)(intervalLetter)that is updated on any valid order placement and tracks your current order count for the interval; rejected/unsuccessful orders are not guaranteed to have X-MBX-ORDER-COUNT-** headers in the response. + +Eg. X-MBX-ORDER-COUNT-1S for "orders per 1 second" and X-MBX-ORDER-COUNT-1D for orders per "one day" +GET api/v1/depth now supports limit 5000 and 10000; weights are 50 and 100 respectively. + +GET api/v1/exchangeInfo has a new parameter ocoAllowed. + +USER DATA STREAM + +executionReport event now contains "g" which has the orderListId; it will be set to -1 for non-OCO orders. +New Event Type listStatus; listStatus is sent on an update to any OCO order. +New Event Type outboundAccountPosition; outboundAccountPosition is sent any time an account's balance changes and contains the assets that could have changed by the event that generated the balance change (a deposit, withdrawal, trade, order placement, or cancelation). +NEW ERRORS + +-1131 BAD_RECV_WINDOW +recvWindow must be less than 60000 +-1099 Not found, authenticated, or authorized +This replaces error code -1999 +NEW -2011 ERRORS + +OCO_BAD_ORDER_PARAMS +A parameter for one of the orders is incorrect. +OCO_BAD_PRICES +The relationship of the prices for the orders is not correct. +UNSUPPORTED_ORD_OCO +OCO orders are not supported for this symbol. +2019-03-12 + +Rest API + +X-MBX-USED-WEIGHT header added to Rest API responses. +Retry-After header added to Rest API 418 and 429 responses. +When canceling the Rest API can now return errorCode -1013 OR -2011 if the symbol's status isn't TRADING. +api/v1/depth no longer has the ignored and empty []. +api/v3/myTrades now returns quoteQty; the price * qty of for the trade. +Websocket streams + +@depth and @depthX streams no longer have the ignored and empty []. +System improvements + +Matching Engine stability/reliability improvements. +Rest API performance improvements. +2018-11-13 + +Rest API + +Can now cancel orders through the Rest API during a trading ban. +New filters: PERCENT_PRICE, MARKET_LOT_SIZE, MAX_NUM_ICEBERG_ORDERS. +Added RAW_REQUESTS rate limit. Limits based on the number of requests over X minutes regardless of weight. +/api/v3/ticker/price increased to weight of 2 for a no symbol query. +/api/v3/ticker/bookTicker increased weight of 2 for a no symbol query. +DELETE /api/v3/order will now return an execution report of the final state of the order. +MIN_NOTIONAL filter has two new parameters: applyToMarket (whether or not the filter is applied to MARKET orders) and avgPriceMins (the number of minutes over which the price averaged for the notional estimation). +intervalNum added to /api/v1/exchangeInfo limits. intervalNum describes the amount of the interval. For example: intervalNum 5, with interval minute, means "every 5 minutes". +Explanation for the average price calculation: + +(qty * price) of all trades / sum of qty of all trades over previous 5 minutes. + +If there is no trade in the last 5 minutes, it takes the first trade that happened outside of the 5min window. For example if the last trade was 20 minutes ago, that trade's price is the 5 min average. + +If there is no trade on the symbol, there is no average price and market orders cannot be placed. On a new symbol with applyToMarket enabled on the MIN_NOTIONAL filter, market orders cannot be placed until there is at least 1 trade. + +The current average price can be checked here: https://api.binance.com/api/v3/avgPrice?symbol= For example: https://api.binance.com/api/v3/avgPrice?symbol=BNBUSDT + +User data stream + +Last quote asset transacted quantity (as variable Y) added to execution reports. Represents the lastPrice * lastQty (L * l). +2018-07-18 + +Rest API + +New filter: ICEBERG_PARTS +POST api/v3/order new defaults for newOrderRespType. ACK, RESULT, or FULL; MARKET and LIMIT order types default to FULL, all other orders default to ACK. +POST api/v3/order RESULT and FULL responses now have cummulativeQuoteQty +GET api/v3/openOrders with no symbol weight reduced to 40. +GET api/v3/ticker/24hr with no symbol weight reduced to 40. +Max amount of trades from GET /api/v1/trades increased to 1000. +Max amount of trades from GET /api/v1/historicalTrades increased to 1000. +Max amount of aggregate trades from GET /api/v1/aggTrades increased to 1000. +Max amount of aggregate trades from GET /api/v1/klines increased to 1000. +Rest API Order lookups now return updateTime which represents the last time the order was updated; time is the order creation time. +Order lookup endpoints will now return cummulativeQuoteQty. If cummulativeQuoteQty is < 0, it means the data isn't available for this order at this time. +REQUESTS rate limit type changed to REQUEST_WEIGHT. This limit was always logically request weight and the previous name for it caused confusion. +User data stream + +cummulativeQuoteQty field added to order responses and execution reports (as variable Z). Represents the cummulative amount of the quote that has been spent (with a BUY order) or received (with a SELL order). Historical orders will have a value < 0 in this field indicating the data is not available at this time. cummulativeQuoteQty divided by cummulativeQty will give the average price for an order. +O (order creation time) added to execution reports +2018-01-23 + +GET /api/v1/historicalTrades weight decreased to 5 +GET /api/v1/aggTrades weight decreased to 1 +GET /api/v1/klines weight decreased to 1 +GET /api/v1/ticker/24hr all symbols weight decreased to number of trading symbols / 2 +GET /api/v3/allOrders weight decreased to 5 +GET /api/v3/myTrades weight decreased to 5 +GET /api/v3/account weight decreased to 5 +GET /api/v1/depth limit=500 weight decreased to 5 +GET /api/v1/depth limit=1000 weight decreased to 10 +-1003 error message updated to direct users to websockets +2018-01-20 + +GET /api/v1/ticker/24hr single symbol weight decreased to 1 +GET /api/v3/openOrders all symbols weight decreased to number of trading symbols / 2 +GET /api/v3/allOrders weight decreased to 15 +GET /api/v3/myTrades weight decreased to 15 +GET /api/v3/order weight decreased to 1 +myTrades will now return both sides of a self-trade/wash-trade +2018-01-14 + +GET /api/v1/aggTrades weight changed to 2 +GET /api/v1/klines weight changed to 2 +GET /api/v3/order weight changed to 2 +GET /api/v3/allOrders weight changed to 20 +GET /api/v3/account weight changed to 20 +GET /api/v3/myTrades weight changed to 20 +GET /api/v3/historicalTrades weight changed to 20 +Introduction +API Key Setup +Some endpoints will require an API Key. Please refer to this page regarding API key creation. +Once API key is created, it is recommended to set IP restrictions on the key for security reasons. +Never share your API key/secret key to ANYONE. + If the API keys were accidentally shared, please delete them immediately and create a new key. +API Key Restrictions +After creating the API key, the default restrictions is Enable Reading. +To enable withdrawals via the API, the API key restriction needs to be modified through the Binance UI. +Enabling Accounts +Spot Account +A SPOT account is provided by default upon creation of a Binance Account. + +Margin Account +To enable a MARGIN account for Margin Trading, please refer to the Margin Trading Guide + +Spot Testnet +Users can use the SPOT Testnet to practice SPOT trading. + +Currently, this is only available via the API. + +Please refer to the SPOT Testnet page for more information and how to set up the Testnet API key. + +API Library +Connectors +The following are lightweight libraries that work as connectors to the Binance public API, written in different languages: + +Python https://github.com/binance/binance-connector-python +Node.js https://github.com/binance/binance-connector-node +Ruby https://github.com/binance/binance-connector-ruby +DotNET C# https://github.com/binance/binance-connector-dotnet +Java https://github.com/binance/binance-connector-java +Rust https://github.com/binance/binance-spot-connector-rust +PHP https://github.com/binance/binance-connector-php +Go https://github.com/binance/binance-connector-go +Typescript https://github.com/binance/binance-connector-typescript +Postman Collections +Postman collections are available, and they are recommended for new users seeking a quick and easy start with the API. + +https://github.com/binance/binance-api-postman + +Swagger +A YAML file with OpenAPI specification for the RESTful API is available, along with a Swagger UI page for reference. + +https://github.com/binance/binance-api-swagger + +Contact Us +Binance API Telegram Group +For any questions in sudden drop in performance with the API and/or Websockets. +For any general questions about the API not covered in the documentation. +Binance Developers +For any questions on your code implementation with the API and/or Websockets. +Binance Customer Support +For cases such as missing funds, help with 2FA, etc. +General Info +General API Information +The following base endpoints are available: +https://api.binance.com +https://api-gcp.binance.com +https://api1.binance.com +https://api2.binance.com +https://api3.binance.com +https://api4.binance.com +The last 4 endpoints in the point above (api1-api4) might give better performance but have less stability. Please use whichever works best for your setup. +All endpoints return either a JSON object or array. +Data is returned in ascending order. Oldest first, newest last. +All time and timestamp related fields in the JSON responses are in milliseconds by default. To receive the information in microseconds, please add the header X-MBX-TIME-UNIT:MICROSECOND or X-MBX-TIME-UNIT:microsecond. +The base endpoint https://data-api.binance.vision can be used to access the following API endpoints that have NONE as security type: +GET /api/v3/aggTrades +GET /api/v3/avgPrice +GET /api/v3/depth +GET /api/v3/exchangeInfo +GET /api/v3/klines +GET /api/v3/ping +GET /api/v3/ticker +GET /api/v3/ticker/24hr +GET /api/v3/ticker/bookTicker +GET /api/v3/ticker/price +GET /api/v3/time +GET /api/v3/trades +GET /api/v3/uiKlines +HTTP Return Codes +HTTP 4XX return codes are used for malformed requests; the issue is on the sender's side. +HTTP 403 return code is used when the WAF Limit (Web Application Firewall) has been violated. +HTTP 409 return code is used when a cancelReplace order partially succeeds. (e.g. if the cancellation of the order fails but the new order placement succeeds.) +HTTP 429 return code is used when breaking a request rate limit. +HTTP 418 return code is used when an IP has been auto-banned for continuing to send requests after receiving 429 codes. +HTTP 5XX return codes are used for internal errors; the issue is on Binance's side. It is important to NOT treat this as a failure operation; the execution status is UNKNOWN and could have been a success. +Error Codes and Messages +If there is an error, the API will return an error with a message of the reason. +The error payload on API and SAPI is as follows: + +{ + "code": -1121, + "msg": "Invalid symbol." +} +Specific error codes and messages defined in Error Codes. +General Information on Endpoints +For GET endpoints, parameters must be sent as a query string. +For POST, PUT, and DELETE endpoints, the parameters may be sent as a query string or in the request body with content type application/x-www-form-urlencoded. You may mix parameters between both the query string and request body if you wish to do so. +Parameters may be sent in any order. +If a parameter sent in both the query string and request body, the query string parameter will be used. +LIMITS +General Info on Limits +The following intervalLetter values for headers: +SECOND => S +MINUTE => M +HOUR => H +DAY => D +intervalNum describes the amount of the interval. For example, intervalNum 5 with intervalLetter M means "Every 5 minutes". +The /api/v3/exchangeInfo rateLimits array contains objects related to the exchange's RAW_REQUESTS, REQUEST_WEIGHT, and ORDERS rate limits. These are further defined in the ENUM definitions section under Rate limiters (rateLimitType). +A 429 will be returned when either request rate limit or order rate limit is violated. +IP Limits +Every request will contain X-MBX-USED-WEIGHT-(intervalNum)(intervalLetter) in the response headers which has the current used weight for the IP for all request rate limiters defined. +Each route has a weight which determines for the number of requests each endpoint counts for. Heavier endpoints and endpoints that do operations on multiple symbols will have a heavier weight. +When a 429 is received, it's your obligation as an API to back off and not spam the API. +Repeatedly violating rate limits and/or failing to back off after receiving 429s will result in an automated IP ban (HTTP status 418). +IP bans are tracked and scale in duration for repeat offenders, from 2 minutes to 3 days. +A Retry-After header is sent with a 418 or 429 responses and will give the number of seconds required to wait, in the case of a 429, to prevent a ban, or, in the case of a 418, until the ban is over. +The limits on the API are based on the IPs, not the API keys. + We recommend using the websocket for getting data as much as possible, as this will not count to the request rate limit. +Unfilled Order Count +Every successful order response will contain a X-MBX-ORDER-COUNT-(intervalNum)(intervalLetter) header indicating how many orders you have placed for that interval. + +To monitor this, refer to GET api/v3/rateLimit/order. +Rejected/unsuccessful orders are not guaranteed to have X-MBX-ORDER-COUNT-** headers in the response. +If you have exceeded this, you will receive a 429 error without the Retry-After header. +Please note that if your orders are consistently filled by trades, you can continuously place orders on the API. For more information, please see Spot Unfilled Order Count Rules. +The number of unfilled orders is tracked for each account. +Websocket Limits +WebSocket connections have a limit of 5 incoming messages per second. A message is considered: +A PING frame +A PONG frame +A JSON controlled message (e.g. subscribe, unsubscribe) +A connection that goes beyond the limit will be disconnected; IPs that are repeatedly disconnected may be banned. +A single connection can listen to a maximum of 1024 streams. +There is a limit of 300 connections per attempt every 5 minutes per IP. +/api/ and /sapi/ Limit Introduction +The /api/* and /sapi/* endpoints adopt either of two access limiting rules, IP limits or UID (account) limits. + +Endpoints related to /api/*: + +According to the two modes of IP and UID (account) limit, each are independent. +Endpoints share the 6,000 per minute limit based on IP. +Responses contain the header X-MBX-USED-WEIGHT-(intervalNum)(intervalLetter), defining the weight used by the current IP. +Successful order responses contain the header X-MBX-ORDER-COUNT-(intervalNum)(intervalLetter), defining the order limit used by the UID. +Endpoints related to /sapi/*: + +Endpoints are marked according to IP or UID limit and their corresponding weight value. +Each endpoint with IP limits has an independent 12000 per minute limit, or per second limit if specified explicitly +Each endpoint with UID limits has an independent 180000 per minute limit, or per second limit if specified explicitly +Responses from endpoints with IP limits contain the header X-SAPI-USED-IP-WEIGHT-1M or X-SAPI-USED-IP-WEIGHT-1S, defining the weight used by the current IP. +Responses from endpoints with UID limits contain the header X-SAPI-USED-UID-WEIGHT-1M or X-SAPI-USED-UID-WEIGHT-1S, defining the weight used by the current UID. +Data Sources +The API system is asynchronous, so some delay in the response is normal and expected. +Each endpoint has a data source indicating where the data is being retrieved, and thus which endpoints have the most up-to-date response. +These are the three sources, ordered by which is has the most up-to-date response to the one with potential delays in updates. + +Matching Engine - the data is from the matching Engine +Memory - the data is from a server's local or external memory +Database - the data is taken directly from a database + Some endpoints can have more than 1 data source. (e.g. Memory => Database) + +This means that the endpoint will check the first Data Source, and if it cannot find the value it's looking for it will check the next one. +Endpoint security type +Each endpoint has a security type that determines how you will interact with it. This is stated next to the NAME of the endpoint. +If no security type is stated, assume the security type is NONE. +API-keys are passed into the REST API via the X-MBX-APIKEY header. +API-keys and secret-keys are case sensitive. +API-keys can be configured to only access certain types of secure endpoints. For example, one API-key could be used for TRADE only, while another API-key can access everything except for TRADE routes. +By default, API-keys can access all secure routes. +Security Type Description +NONE Endpoint can be accessed freely. +TRADE Endpoint requires sending a valid API-Key and signature. +MARGIN Endpoint requires sending a valid API-Key and signature. +USER_DATA Endpoint requires sending a valid API-Key and signature. +USER_STREAM Endpoint requires sending a valid API-Key. +MARKET_DATA Endpoint requires sending a valid API-Key. +TRADE, MARGIN and USER_DATA endpoints are SIGNED endpoints. +SIGNED (TRADE, USER_DATA, AND MARGIN) Endpoint security +SIGNED endpoints require an additional parameter, signature, to be sent in the query string or request body. +The signature is not case sensitive. +Please consult the examples on how to compute the signature, depending on which API key you are using. (e.g. HMAC, RSA, Ed25519) +Timing security +A SIGNED endpoint also requires a parameter, timestamp, to be sent which should be the millisecond timestamp of when the request was created and sent. +An additional parameter, recvWindow, may be sent to specify the number of milliseconds after timestamp the request is valid for. If recvWindow is not sent, it defaults to 5000. +The logic is as follows: + + if (timestamp < (serverTime + 1000) && (serverTime - timestamp) <= recvWindow) + { + // process request + } + else + { + // reject request + } +Serious trading is about timing. Networks can be unstable and unreliable, which can lead to requests taking varying amounts of time to reach the servers. With recvWindow, you can specify that the request must be processed within a certain number of milliseconds or be rejected by the server. + + It is recommended to use a small recvWindow of 5000 or less! The max cannot go beyond 60,000! +SIGNED Endpoint Examples for POST /api/v3/order - HMAC Keys +Here is a step-by-step example of how to send a vaild signed payload from the Linux command line using echo, openssl, and curl. + +Key Value +apiKey vmPUZE6mv9SD5VNHk4HlWFsOr6aKE2zvsw0MuIgwCIPy6utIco14y7Ju91duEh8A +secretKey NhqPtmdSJYdKjVHjA7PZj4Mge3R5YNiP1e3UZjInClVN65XAbvqqM6A7H5fATj0j +Parameter Value +symbol LTCBTC +side BUY +type LIMIT +timeInForce GTC +quantity 1 +price 0.1 +recvWindow 5000 +timestamp 1499827319559 +Example 1: As a request body + +Example 1 + +HMAC SHA256 signature: + + $ echo -n "symbol=LTCBTC&side=BUY&type=LIMIT&timeInForce=GTC&quantity=1&price=0.1&recvWindow=5000×tamp=1499827319559" | openssl dgst -sha256 -hmac "NhqPtmdSJYdKjVHjA7PZj4Mge3R5YNiP1e3UZjInClVN65XAbvqqM6A7H5fATj0j" + (stdin)= c8db56825ae71d6d79447849e617115f4a920fa2acdcab2b053c4b2838bd6b71 +curl command: + + (HMAC SHA256) + $ curl -H "X-MBX-APIKEY: vmPUZE6mv9SD5VNHk4HlWFsOr6aKE2zvsw0MuIgwCIPy6utIco14y7Ju91duEh8A" -X POST 'https://api.binance.com/api/v3/order' -d 'symbol=LTCBTC&side=BUY&type=LIMIT&timeInForce=GTC&quantity=1&price=0.1&recvWindow=5000×tamp=1499827319559&signature=c8db56825ae71d6d79447849e617115f4a920fa2acdcab2b053c4b2838bd6b71' + +requestBody: +symbol=LTCBTC +&side=BUY +&type=LIMIT +&timeInForce=GTC +&quantity=1 +&price=0.1 +&recvWindow=5000 +×tamp=1499827319559 + +Example 2: As a query string + +Example 2 + +HMAC SHA256 signature: + + $ echo -n "symbol=LTCBTC&side=BUY&type=LIMIT&timeInForce=GTC&quantity=1&price=0.1&recvWindow=5000×tamp=1499827319559" | openssl dgst -sha256 -hmac "NhqPtmdSJYdKjVHjA7PZj4Mge3R5YNiP1e3UZjInClVN65XAbvqqM6A7H5fATj0j" + (stdin)= c8db56825ae71d6d79447849e617115f4a920fa2acdcab2b053c4b2838bd6b71 + +curl command: + + (HMAC SHA256) + $ curl -H "X-MBX-APIKEY: vmPUZE6mv9SD5VNHk4HlWFsOr6aKE2zvsw0MuIgwCIPy6utIco14y7Ju91duEh8A" -X POST 'https://api.binance.com/api/v3/order?symbol=LTCBTC&side=BUY&type=LIMIT&timeInForce=GTC&quantity=1&price=0.1&recvWindow=5000×tamp=1499827319559&signature=c8db56825ae71d6d79447849e617115f4a920fa2acdcab2b053c4b2838bd6b71' + +queryString: +symbol=LTCBTC +&side=BUY +&type=LIMIT +&timeInForce=GTC +&quantity=1 +&price=0.1 +&recvWindow=5000 +×tamp=1499827319559 + +Example 3: Mixed query string and request body + +Example 3 + +HMAC SHA256 signature: + + $ echo -n "symbol=LTCBTC&side=BUY&type=LIMIT&timeInForce=GTCquantity=1&price=0.1&recvWindow=5000×tamp=1499827319559" | openssl dgst -sha256 -hmac "NhqPtmdSJYdKjVHjA7PZj4Mge3R5YNiP1e3UZjInClVN65XAbvqqM6A7H5fATj0j" + (stdin)= 0fd168b8ddb4876a0358a8d14d0c9f3da0e9b20c5d52b2a00fcf7d1c602f9a77 + +curl command: + + (HMAC SHA256) + $ curl -H "X-MBX-APIKEY: vmPUZE6mv9SD5VNHk4HlWFsOr6aKE2zvsw0MuIgwCIPy6utIco14y7Ju91duEh8A" -X POST 'https://api.binance.com/api/v3/order?symbol=LTCBTC&side=BUY&type=LIMIT&timeInForce=GTC' -d 'quantity=1&price=0.1&recvWindow=5000×tamp=1499827319559&signature=0fd168b8ddb4876a0358a8d14d0c9f3da0e9b20c5d52b2a00fcf7d1c602f9a77' +queryString: +symbol=LTCBTC&side=BUY&type=LIMIT&timeInForce=GTC + +requestBody: +quantity=1&price=0.1&recvWindow=5000×tamp=1499827319559 + +Note that the signature is different in example 3. There is no & between "GTC" and "quantity=1". + +SIGNED Endpoint Example for POST /api/v3/order - RSA Keys +This will be a step by step process how to create the signature payload to send a valid signed payload. +We support PKCS#8 currently. +To get your API key, you need to upload your RSA Public Key to your account and a corresponding API key will be provided for you. +For this example, the private key will be referenced as test-prv-key.pem + +Key Value +apiKey CAvIjXy3F44yW6Pou5k8Dy1swsYDWJZLeoK2r8G4cFDnE9nosRppc2eKc1T8TRTQ +Parameter Value +symbol BTCUSDT +side SELL +type LIMIT +timeInForce GTC +quantity 1 +price 0.2 +recvWindow 5000 +timestamp 1668481559918 +Signature payload (with the listed parameters): + +symbol=BTCUSDT&side=SELL&type=LIMIT&timeInForce=GTC&quantity=1&price=0.2×tamp=1668481559918&recvWindow=5000 +Step 1: Construct the payload + +Arrange the list of parameters into a string. Separate each parameter with a &. + +Step 2: Compute the signature: + +2.1 - Encode signature payload as ASCII data. + +Step 2.2 + + $ echo -n 'symbol=BTCUSDT&side=SELL&type=LIMIT&timeInForce=GTC&quantity=1&price=0.2×tamp=1668481559918&recvWindow=5000' | openssl dgst -sha256 -sign ./test-prv-key.pem +2.2 - Sign payload using RSASSA-PKCS1-v1_5 algorithm with SHA-256 hash function. + +Step 2.3 + +$ echo -n 'symbol=BTCUSDT&side=SELL&type=LIMIT&timeInForce=GTC&quantity=1&price=0.2×tamp=1668481559918&recvWindow=5000' | openssl dgst -sha256 -sign ./test-prv-key.pem | openssl enc -base64 -A +HZ8HOjiJ1s/igS9JA+n7+7Ti/ihtkRF5BIWcPIEluJP6tlbFM/Bf44LfZka/iemtahZAZzcO9TnI5uaXh3++lrqtNonCwp6/245UFWkiW1elpgtVAmJPbogcAv6rSlokztAfWk296ZJXzRDYAtzGH0gq7CgSJKfH+XxaCmR0WcvlKjNQnp12/eKXJYO4tDap8UCBLuyxDnR7oJKLHQHJLP0r0EAVOOSIbrFang/1WOq+Jaq4Efc4XpnTgnwlBbWTmhWDR1pvS9iVEzcSYLHT/fNnMRxFc7u+j3qI//5yuGuu14KR0MuQKKCSpViieD+fIti46sxPTsjSemoUKp0oXA== +2.3 - Encode output as base64 string. + +Step 2.4 + +HZ8HOjiJ1s%2FigS9JA%2Bn7%2B7Ti%2FihtkRF5BIWcPIEluJP6tlbFM%2FBf44LfZka%2FiemtahZAZzcO9TnI5uaXh3%2B%2BlrqtNonCwp6%2F245UFWkiW1elpgtVAmJPbogcAv6rSlokztAfWk296ZJXzRDYAtzGH0gq7CgSJKfH%2BXxaCmR0WcvlKjNQnp12%2FeKXJYO4tDap8UCBLuyxDnR7oJKLHQHJLP0r0EAVOOSIbrFang%2F1WOq%2BJaq4Efc4XpnTgnwlBbWTmhWDR1pvS9iVEzcSYLHT%2FfNnMRxFc7u%2Bj3qI%2F%2F5yuGuu14KR0MuQKKCSpViieD%2BfIti46sxPTsjSemoUKp0oXA%3D%3D +2.4 - Since the signature may contain / and =, this could cause issues with sending the request. So the signature has to be URL encoded. + +Step 2.5 + + curl -H "X-MBX-APIKEY: CAvIjXy3F44yW6Pou5k8Dy1swsYDWJZLeoK2r8G4cFDnE9nosRppc2eKc1T8TRTQ" -X POST 'https://api.binance.com/api/v3/order?symbol=BTCUSDT&side=SELL&type=LIMIT&timeInForce=GTC&quantity=1&price=0.2×tamp=1668481559918recvWindow=5000&signature=HZ8HOjiJ1s%2FigS9JA%2Bn7%2B7Ti%2FihtkRF5BIWcPIEluJP6tlbFM%2FBf44LfZka%2FiemtahZAZzcO9TnI5uaXh3%2B%2BlrqtNonCwp6%2F245UFWkiW1elpgtVAmJPbogcAv6rSlokztAfWk296ZJXzRDYAtzGH0gq7CgSJKfH%2BXxaCmR0WcvlKjNQnp12%2FeKXJYO4tDap8UCBLuyxDnR7oJKLHQHJLP0r0EAVOOSIbrFang%2F1WOq%2BJaq4Efc4XpnTgnwlBbWTmhWDR1pvS9iVEzcSYLHT%2FfNnMRxFc7u%2Bj3qI%2F%2F5yuGuu14KR0MuQKKCSpViieD%2BfIti46sxPTsjSemoUKp0oXA%3D%3D' +2.5 - curl command + +Bash script + +#!/usr/bin/env bash + +# Set up authentication: +API_KEY="put your own API Key here" +PRIVATE_KEY_PATH="test-prv-key.pem" + +# Set up the request: +API_METHOD="POST" +API_CALL="api/v3/order" +API_PARAMS="symbol=BTCUSDT&side=SELL&type=LIMIT&timeInForce=GTC&quantity=1&price=0.2" + +# Sign the request: +timestamp=$(date +%s000) +api_params_with_timestamp="$API_PARAMS×tamp=$timestamp" +signature=$(echo -n "$api_params_with_timestamp" \ + | openssl dgst -sha256 -sign "$PRIVATE_KEY_PATH" \ + | openssl enc -base64 -A) + +# Send the request: +curl -H "X-MBX-APIKEY: $API_KEY" -X "$API_METHOD" \ + "https://api.binance.com/$API_CALL?$api_params_with_timestamp" \ + --data-urlencode "signature=$signature" +A sample Bash script containing similar steps is available in the right side. + +SIGNED Endpoint Examples for POST /api/v3/order - Ed25519 Keys + Note: It is highly recommended to use Ed25519 API keys as it should provide the best performance and security out of all supported key types. +Parameter Value +symbol BTCUSDT +side SELL +type LIMIT +timeInForce GTC +quantity 1 +price 0.2 +timestamp 1668481559918 +Python script + +#!/usr/bin/env python3 + +import base64 +import requests +import time +from cryptography.hazmat.primitives.serialization import load_pem_private_key + +# Set up authentication +API_KEY='put your own API Key here' +PRIVATE_KEY_PATH='test-prv-key.pem' + +# Load the private key. +# In this example the key is expected to be stored without encryption, +# but we recommend using a strong password for improved security. +with open(PRIVATE_KEY_PATH, 'rb') as f: + private_key = load_pem_private_key(data=f.read(), + password=None) + +# Set up the request parameters +params = { + 'symbol': 'BTCUSDT', + 'side': 'SELL', + 'type': 'LIMIT', + 'timeInForce': 'GTC', + 'quantity': '1.0000000', + 'price': '0.20', +} + +# Timestamp the request +timestamp = int(time.time() * 1000) # UNIX timestamp in milliseconds +params['timestamp'] = timestamp + +# Sign the request +payload = '&'.join([f'{param}={value}' for param, value in params.items()]) +signature = base64.b64encode(private_key.sign(payload.encode('ASCII'))) +params['signature'] = signature + +# Send the request +headers = { + 'X-MBX-APIKEY': API_KEY, +} +response = requests.post( + 'https://api.binance.com/api/v3/order', + headers=headers, + data=params, +) +print(response.json()) +A sample code in Python to show how to sign the payload with an Ed25519 key is available on the right side. + +Public API Definitions +Terminology +These terms will be used throughout the documentation, so it is recommended especially for new users to read to help their understanding of the API. + +base asset refers to the asset that is the quantity of a symbol. For the symbol BTCUSDT, BTC would be the base asset. +quote asset refers to the asset that is the price of a symbol. For the symbol BTCUSDT, USDT would be the quote asset. +ENUM definitions +Symbol status (status): + +PRE_TRADING +TRADING +POST_TRADING +END_OF_DAY +HALT +AUCTION_MATCH +BREAK + +Account and Symbol Permissions (permissions): + +SPOT +MARGIN +TRD_GRP_002 +TRD_GRP_003 +TRD_GRP_004 +TRD_GRP_005 +TRD_GRP_006 +TRD_GRP_007 +TRD_GRP_008 +TRD_GRP_009 +TRD_GRP_010 +TRD_GRP_011 +TRD_GRP_012 +TRD_GRP_013 +TRD_GRP_014 +TRD_GRP_015 +TRD_GRP_016 +TRD_GRP_017 +TRD_GRP_018 +TRD_GRP_019 +TRD_GRP_020 +TRD_GRP_021 +TRD_GRP_022 +TRD_GRP_023 +TRD_GRP_024 +TRD_GRP_025 +Order status (status): + +Status Description +NEW The order has been accepted by the engine. +PARTIALLY_FILLED A part of the order has been filled. +FILLED The order has been completed. +CANCELED The order has been canceled by the user. +PENDING_CANCEL Currently unused +REJECTED The order was not accepted by the engine and not processed. +EXPIRED The order was canceled according to the order type's rules (e.g. LIMIT FOK orders with no fill, LIMIT IOC or MARKET orders that partially fill) or by the exchange, (e.g. orders canceled during liquidation, orders canceled during maintenance) +EXPIRED_IN_MATCH The order was canceled by the exchange due to STP trigger. (e.g. an order with EXPIRE_TAKER will match with existing orders on the book with the same account or same tradeGroupId) +Order list Status (listStatusType): + +Status Description +RESPONSE This is used when the ListStatus is responding to a failed action. (E.g. order list placement or cancellation) +EXEC_STARTED The order list has been placed or there is an update to the order list status. +ALL_DONE The order list has finished executing and thus no longer active. +Order list Order Status (listOrderStatus): + +Status Description +EXECUTING Either an order list has been placed or there is an update to the status of the list. +ALL_DONE An order list has completed execution and thus no longer active. +REJECT The List Status is responding to a failed action either during order placement or order canceled.) +ContingencyType + +OCO +OTO +AllocationType + +SOR +WorkingFloor + +EXCHANGE +SOR +Order types (orderTypes, type): + +LIMIT +MARKET +STOP_LOSS +STOP_LOSS_LIMIT +TAKE_PROFIT +TAKE_PROFIT_LIMIT +LIMIT_MAKER +Order Response Type (newOrderRespType): + +ACK +RESULT +FULL + +Order side (side): + +BUY +SELL + +Time in force (timeInForce): + +This sets how long an order will be active before expiration. + +Status Description +GTC Good Til Canceled + +An order will be on the book unless the order is canceled. +IOC Immediate Or Cancel + +An order will try to fill the order as much as it can before the order expires. +FOK Fill or Kill + +An order will expire if the full order cannot be filled upon execution. +Kline/Candlestick chart intervals: + +s-> seconds; m -> minutes; h -> hours; d -> days; w -> weeks; M -> months + +1s +1m +3m +5m +15m +30m +1h +2h +4h +6h +8h +12h +1d +3d +1w +1M +Rate limiters (rateLimitType) + +REQUEST_WEIGHT + + { + "rateLimitType": "REQUEST_WEIGHT", + "interval": "MINUTE", + "intervalNum": 1, + "limit": 6000 + } +ORDERS + + { + "rateLimitType": "ORDERS", + "interval": "SECOND", + "intervalNum": 10, + "limit": 100 + }, + { + "rateLimitType": "ORDERS", + "interval": "DAY", + "intervalNum": 1, + "limit": 200000 + } +RAW_REQUESTS + + { + "rateLimitType": "RAW_REQUESTS", + "interval": "MINUTE", + "intervalNum": 5, + "limit": 5000 + } +REQUEST_WEIGHT + +ORDERS + +RAW_REQUESTS + +Rate limit intervals (interval) + +SECOND +MINUTE +DAY + +STP Modes + +NONE +EXPIRE_MAKER +EXPIRE_TAKER +EXPIRE_BOTH +Filters +Filters define trading rules on a symbol or an exchange. Filters come in two forms: symbol filters and exchange filters. + +Symbol Filters +PRICE_FILTER +ExchangeInfo format: + + { + "filterType": "PRICE_FILTER", + "minPrice": "0.00000100", + "maxPrice": "100000.00000000", + "tickSize": "0.00000100" + } +The PRICE_FILTER defines the price rules for a symbol. There are 3 parts: + +minPrice defines the minimum price/stopPrice allowed; disabled on minPrice == 0. +maxPrice defines the maximum price/stopPrice allowed; disabled on maxPrice == 0. +tickSize defines the intervals that a price/stopPrice can be increased/decreased by; disabled on tickSize == 0. +Any of the above variables can be set to 0, which disables that rule in the price filter. In order to pass the price filter, the following must be true for price/stopPrice of the enabled rules: + +price >= minPrice +price <= maxPrice +price % tickSize == 0 +PERCENT_PRICE +ExchangeInfo format: + + { + "filterType": "PERCENT_PRICE", + "multiplierUp": "1.3000", + "multiplierDown": "0.7000", + "avgPriceMins": 5 + } +The PERCENT_PRICE filter defines the valid range for the price based on the average of the previous trades. avgPriceMins is the number of minutes the average price is calculated over. 0 means the last price is used. + +In order to pass the percent price, the following must be true for price: + +price <= weightedAveragePrice * multiplierUp +price >= weightedAveragePrice * multiplierDown +PERCENT_PRICE_BY_SIDE +ExchangeInfo format: + + { + "filterType": "PERCENT_PRICE_BY_SIDE", + "bidMultiplierUp": "1.2", + "bidMultiplierDown": "0.2", + "askMultiplierUp": "5", + "askMultiplierDown": "0.8", + "avgPriceMins": 1 + } +The PERCENT_PRICE_BY_SIDE filter defines the valid range for the price based on the average of the previous trades. + +avgPriceMins is the number of minutes the average price is calculated over. 0 means the last price is used. + + +There is a different range depending on whether the order is placed on the BUY side or the SELL side. + +Buy orders will succeed on this filter if: + +Order price <= weightedAveragePrice * bidMultiplierUp +Order price >= weightedAveragePrice * bidMultiplierDown +Sell orders will succeed on this filter if: + +Order Price <= weightedAveragePrice * askMultiplierUp +Order Price >= weightedAveragePrice * askMultiplierDown +LOT_SIZE +ExchangeInfo format: + + { + "filterType": "LOT_SIZE", + "minQty": "0.00100000", + "maxQty": "100000.00000000", + "stepSize": "0.00100000" + } +The LOT_SIZE filter defines the quantity (aka "lots" in auction terms) rules for a symbol. There are 3 parts: + +minQty defines the minimum quantity/icebergQty allowed. +maxQty defines the maximum quantity/icebergQty allowed. +stepSize defines the intervals that a quantity/icebergQty can be increased/decreased by. +In order to pass the lot size, the following must be true for quantity/icebergQty: + +quantity >= minQty +quantity <= maxQty +quantity % stepSize == 0 +MIN_NOTIONAL +ExchangeInfo format: + + { + "filterType": "MIN_NOTIONAL", + "minNotional": "0.00100000", + "applyToMarket": true, + "avgPriceMins": 5 + } +The MIN_NOTIONAL filter defines the minimum notional value allowed for an order on a symbol. An order's notional value is the price * quantity. If the order is an Algo order (e.g. STOP_LOSS_LIMIT), then the notional value of the stopPrice * quantity will also be evaluated. If the order is an Iceberg Order, then the notional value of the price * icebergQty will also be evaluated. applyToMarket determines whether or not the MIN_NOTIONAL filter will also be applied to MARKET orders. Since MARKET orders have no price, the average price is used over the last avgPriceMins minutes. avgPriceMins is the number of minutes the average price is calculated over. 0 means the last price is used. + +NOTIONAL +ExchangeInfo format: + +{ + "filterType": "NOTIONAL", + "minNotional": "10.00000000", + "applyMinToMarket": false, + "maxNotional": "10000.00000000", + "applyMaxToMarket": false, + "avgPriceMins": 5 +} +The NOTIONAL filter defines the acceptable notional range allowed for an order on a symbol. + + + +applyMinToMarket determines whether the minNotional will be applied to MARKET orders. + +applyMaxToMarket determines whether the maxNotional will be applied to MARKET orders. + +In order to pass this filter, the notional (price * quantity) has to pass the following conditions: + +price * quantity <= maxNotional +price * quantity >= minNotional +For MARKET orders, the average price used over the last avgPriceMins minutes will be used for calculation. + +If the avgPriceMins is 0, then the last price will be used. + +ICEBERG_PARTS +ExchangeInfo format: + + { + "filterType": "ICEBERG_PARTS", + "limit": 10 + } +The ICEBERG_PARTS filter defines the maximum parts an iceberg order can have. The number of ICEBERG_PARTS is defined as CEIL(qty / icebergQty). + +MARKET_LOT_SIZE +ExchangeInfo format: + + { + "filterType": "MARKET_LOT_SIZE", + "minQty": "0.00100000", + "maxQty": "100000.00000000", + "stepSize": "0.00100000" + } +The MARKET_LOT_SIZE filter defines the quantity (aka "lots" in auction terms) rules for MARKET orders on a symbol. There are 3 parts: + +minQty defines the minimum quantity allowed. +maxQty defines the maximum quantity allowed. +stepSize defines the intervals that a quantity can be increased/decreased by. +In order to pass the market lot size, the following must be true for quantity: + +quantity >= minQty +quantity <= maxQty +quantity % stepSize == 0 +MAX_NUM_ORDERS +ExchangeInfo format: + + { + "filterType": "MAX_NUM_ORDERS", + "maxNumOrders": 25 + } +The MAX_NUM_ORDERS filter defines the maximum number of orders an account is allowed to have open on a symbol. Note that both "algo" orders and normal orders are counted for this filter. + +MAX_NUM_ALGO_ORDERS +ExchangeInfo format: + + { + "filterType": "MAX_NUM_ALGO_ORDERS", + "maxNumAlgoOrders": 5 + } +The MAX_NUM_ALGO_ORDERS filter defines the maximum number of "algo" orders an account is allowed to have open on a symbol. "Algo" orders are STOP_LOSS, STOP_LOSS_LIMIT, TAKE_PROFIT, and TAKE_PROFIT_LIMIT orders. + +MAX_NUM_ICEBERG_ORDERS +The MAX_NUM_ICEBERG_ORDERS filter defines the maximum number of ICEBERG orders an account is allowed to have open on a symbol. An ICEBERG order is any order where the icebergQty is > 0. + +ExchangeInfo format: + + { + "filterType": "MAX_NUM_ICEBERG_ORDERS", + "maxNumIcebergOrders": 5 + } +MAX_POSITION +The MAX_POSITION filter defines the allowed maximum position an account can have on the base asset of a symbol. An account's position defined as the sum of the account's: + +free balance of the base asset +locked balance of the base asset +sum of the qty of all open BUY orders +BUY orders will be rejected if the account's position is greater than the maximum position allowed. + +If an order's quantity can cause the position to overflow, this will also fail the MAX_POSITION filter. + +ExchangeInfo format: + +{ + "filterType":"MAX_POSITION", + "maxPosition":"10.00000000" +} +TRAILING_DELTA +ExchangeInfo format: + + { + "filterType": "TRAILING_DELTA", + "minTrailingAboveDelta": 10, + "maxTrailingAboveDelta": 2000, + "minTrailingBelowDelta": 10, + "maxTrailingBelowDelta": 2000 + } +The TRAILING_DELTA filter defines the minimum and maximum value for the parameter trailingDelta. + +In order for a trailing stop order to pass this filter, the following must be true: + +For STOP_LOSS BUY, STOP_LOSS_LIMIT_BUY,TAKE_PROFIT SELL and TAKE_PROFIT_LIMIT SELL orders: + +trailingDelta >= minTrailingAboveDelta +trailingDelta <= maxTrailingAboveDelta +For STOP_LOSS SELL, STOP_LOSS_LIMIT SELL, TAKE_PROFIT BUY, and TAKE_PROFIT_LIMIT BUY orders: + +trailingDelta >= minTrailingBelowDelta +trailingDelta <= maxTrailingBelowDelta +Exchange Filters +EXCHANGE_MAX_NUM_ORDERS +ExchangeInfo format: + + { + "filterType": "EXCHANGE_MAX_NUM_ORDERS", + "maxNumOrders": 1000 + } +The EXCHANGE_MAX_NUM_ORDERS filter defines the maximum number of orders an account is allowed to have open on the exchange. Note that both "algo" orders and normal orders are counted for this filter. + +EXCHANGE_MAX_NUM_ALGO_ORDERS +ExchangeInfo format: + + { + "filterType": "EXCHANGE_MAX_NUM_ALGO_ORDERS", + "maxNumAlgoOrders": 200 + } +The EXCHANGE_MAX_NUM_ALGO_ORDERS filter defines the maximum number of "algo" orders an account is allowed to have open on the exchange. "Algo" orders are STOP_LOSS, STOP_LOSS_LIMIT, TAKE_PROFIT, and TAKE_PROFIT_LIMIT orders. + +EXCHANGE_MAX_NUM_ICEBERG_ORDERS +The EXCHANGE_MAX_NUM_ICEBERG_ORDERS filter defines the maximum number of iceberg orders an account is allowed to have open on the exchange. + +ExchangeInfo format: + +{ + "filterType": "EXCHANGE_MAX_NUM_ICEBERG_ORDERS", + "maxNumIcebergOrders": 10000 +} +Wallet Endpoints +System Status (System) +Response + +{ + "status": 0, // 0: normal,1:system maintenance + "msg": "normal" // "normal", "system_maintenance" +} +GET /sapi/v1/system/status + +Fetch system status. + +Weight(IP): 1 + +All Coins' Information (USER_DATA) +Get information of coins (available for deposit and withdraw) for user. + +Response: + +[ + { + "coin": "BTC", + "depositAllEnable": true, + "free": "0.08074558", + "freeze": "0.00000000", + "ipoable": "0.00000000", + "ipoing": "0.00000000", + "isLegalMoney": false, + "locked": "0.00000000", + "name": "Bitcoin", + "networkList": [ + { + "addressRegex": "^(bnb1)[0-9a-z]{38}$", + "coin": "BTC", + "depositDesc": "Wallet Maintenance, Deposit Suspended", // shown only when "depositEnable" is false. + "depositEnable": false, + "isDefault": false, + "memoRegex": "^[0-9A-Za-z\\-_]{1,120}$", + "minConfirm": 1, // min number for balance confirmation + "name": "BEP2", + "network": "BNB", + "specialTips": "Both a MEMO and an Address are required to successfully deposit your BEP2-BTCB tokens to Binance.", + "unLockConfirm": 0, // confirmation number for balance unlock + "withdrawDesc": "Wallet Maintenance, Withdrawal Suspended", // shown only when "withdrawEnable" is false. + "withdrawEnable": false, + "withdrawFee": "0.00000220", + "withdrawIntegerMultiple": "0.00000001", + "withdrawMax": "9999999999.99999999", + "withdrawMin": "0.00000440", + "sameAddress": true, // If the coin needs to provide memo to withdraw + "estimatedArrivalTime": 25, + "busy": false, + "contractAddressUrl": "https://bscscan.com/token/", + "contractAddress": "0x7130d2a12b9bcbfae4f2634d864a1ee1ce3ead9c" + }, + { + "addressRegex": "^[13][a-km-zA-HJ-NP-Z1-9]{25,34}$|^(bc1)[0-9A-Za-z]{39,59}$", + "coin": "BTC", + "depositEnable": true, + "isDefault": true, + "memoRegex": "", + "minConfirm": 1, + "name": "BTC", + "network": "BTC", + "specialTips": "", + "unLockConfirm": 2, + "withdrawEnable": true, + "withdrawFee": "0.00050000", + "withdrawIntegerMultiple": "0.00000001", + "withdrawMax": "750", + "withdrawMin": "0.00100000", + "sameAddress": false, + "estimatedArrivalTime": 25, + "busy": false, + "contractAddressUrl": "", + "contractAddress": "" + } + ], + "storage": "0.00000000", + "trading": true, + "withdrawAllEnable": true, + "withdrawing": "0.00000000" + } +] +GET /sapi/v1/capital/config/getall + +Weight(IP): 10 + +Parameters: + +Name Type Mandatory Description +recvWindow LONG NO +timestamp LONG YES +Daily Account Snapshot (USER_DATA) +Response: + +{ + "code":200, // 200 for success; others are error codes + "msg":"", // error message + "snapshotVos":[ + { + "data":{ + "balances":[ + { + "asset":"BTC", + "free":"0.09905021", + "locked":"0.00000000" + }, + { + "asset":"USDT", + "free":"1.89109409", + "locked":"0.00000000" + } + ], + "totalAssetOfBtc":"0.09942700" + }, + "type":"spot", + "updateTime":1576281599000 + } + ] +} + +OR + +{ + "code":200, // 200 for success; others are error codes + "msg":"", // error message + "snapshotVos":[ + { + "data":{ + "marginLevel":"2748.02909813", + "totalAssetOfBtc":"0.00274803", + "totalLiabilityOfBtc":"0.00000100", + "totalNetAssetOfBtc":"0.00274750", + "userAssets":[ + { + "asset":"XRP", + "borrowed":"0.00000000", + "free":"1.00000000", + "interest":"0.00000000", + "locked":"0.00000000", + "netAsset":"1.00000000" + } + ] + }, + "type":"margin", + "updateTime":1576281599000 + } + ] +} +OR + +{ + "code":200, // 200 for success; others are error codes + "msg":"", // error message + "snapshotVos":[ + { + "data":{ + "assets":[ + { + "asset":"USDT", + "marginBalance":"118.99782335", // Not real-time data, can ignore + "walletBalance":"120.23811389" + } + ], + "position":[ + { + "entryPrice":"7130.41000000", + "markPrice":"7257.66239673", + "positionAmt":"0.01000000", + "symbol":"BTCUSDT", + "unRealizedProfit":"1.24029054" // Only show the value at the time of opening the position + } + ] + }, + "type":"futures", + "updateTime":1576281599000 + } + ] +} +GET /sapi/v1/accountSnapshot + +Weight(IP): 2400 + +Parameters: + +Name Type Mandatory Description +type STRING YES "SPOT", "MARGIN", "FUTURES" +startTime LONG NO +endTime LONG NO +limit INT NO min 7, max 30, default 7 +recvWindow LONG NO +timestamp LONG YES +The query time period must be less then 30 days +Support query within the last one month only +If startTimeand endTime not sent, return records of the last 7 days by default +Disable Fast Withdraw Switch (USER_DATA) +Response: + +{} +POST /sapi/v1/account/disableFastWithdrawSwitch + +Weight(IP): 1 + +Parameters: + +Name Type Mandatory Description +recvWindow LONG NO +timestamp LONG YES +Caution: + +This request will disable fastwithdraw switch under your account. + +You need to enable "trade" option for the api key which requests this endpoint. + +Enable Fast Withdraw Switch (USER_DATA) +Response: + +{} +POST /sapi/v1/account/enableFastWithdrawSwitch + +Weight(IP): 1 + +Parameters: + +Name Type Mandatory Description +recvWindow LONG NO +timestamp LONG YES +This request will enable fastwithdraw switch under your account. + +You need to enable "trade" option for the api key which requests this endpoint. +When Fast Withdraw Switch is on, transferring funds to a Binance account will be done instantly. There is no on-chain transaction, no transaction ID and no withdrawal fee. +Withdraw(USER_DATA) +Response: + +{ + "id":"7213fea8e94b4a5593d507237e5a555b" +} +POST /sapi/v1/capital/withdraw/apply + +Submit a withdraw request. + +Weight(UID): 600 + +Parameters: + +Name Type Mandatory Description +coin STRING YES +withdrawOrderId STRING NO client id for withdraw +network STRING NO +address STRING YES +addressTag STRING NO Secondary address identifier for coins like XRP,XMR etc. +amount DECIMAL YES +transactionFeeFlag BOOLEAN NO 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 STRING NO Description of the address. The upper limit of the address book is 200. Exceeding the limit will cause withdrawal failure. Space in name should be encoded into %20. +walletType INTEGER NO The wallet type for withdraw,0-spot wallet ,1-funding wallet. Default walletType is the current "selected wallet" under wallet->Fiat and Spot/Funding->Deposit +recvWindow LONG NO +timestamp LONG YES +If network not send, return with default network of the coin. +You can get network and isDefault in networkList of a coin in the response of Get /sapi/v1/capital/config/getall. +Deposit History (supporting network) (USER_DATA) +Response: + +[ + { + "id": "769800519366885376", + "amount": "0.001", + "coin": "BNB", + "network": "BNB", + "status": 0, + "address": "bnb136ns6lfw4zs5hg4n85vdthaad7hq5m4gtkgf23", + "addressTag": "101764890", + "txId": "98A3EA560C6B3336D348B6C83F0F95ECE4F1F5919E94BD006E5BF3BF264FACFC", + "insertTime": 1661493146000, + "transferType": 0, + "confirmTimes": "1/1", + "unlockConfirm": 0, + "walletType": 0 + }, + { + "id": "769754833590042625", + "amount":"0.50000000", + "coin":"IOTA", + "network":"IOTA", + "status":1, + "address":"SIZ9VLMHWATXKV99LH99CIGFJFUMLEHGWVZVNNZXRJJVWBPHYWPPBOSDORZ9EQSHCZAMPVAPGFYQAUUV9DROOXJLNW", + "addressTag":"", + "txId":"ESBFVQUTPIWQNJSPXFNHNYHSQNTGKRVKPRABQWTAXCDWOAKDKYWPTVG9BGXNVNKTLEJGESAVXIKIZ9999", + "insertTime":1599620082000, + "transferType":0, + "confirmTimes": "1/1", + "unlockConfirm": 0, + "walletType": 0 + } +] +GET /sapi/v1/capital/deposit/hisrec + +Fetch deposit history. + +Weight(IP): 1 + +Parameters: + +Name Type Mandatory Description +includeSource Boolean NO default false, if true source address for the transaction will be returned +coin STRING NO +status INT NO 0(0:pending,6: credited but cannot withdraw, 7=Wrong Deposit,8=Waiting User confirm, 1:success) +startTime LONG NO Default: 90 days from current timestamp +endTime LONG NO Default: present timestamp +offset INT NO Default:0 +limit INT NO Default:1000, Max:1000 +recvWindow LONG NO +timestamp LONG YES +txId STRING NO +Please notice the default startTime and endTime to make sure that time interval is within 0-90 days. +If both startTime and endTime are sent, time between startTime and endTime must be less than 90 days. +Please note that the source address returned may not be accurate due to network-specific characteristics. If multiple source addresses found, only the first address will be returned +Withdraw History (supporting network) (USER_DATA) +Response: + +[ + { + "id": "b6ae22b3aa844210a7041aee7589627c", // Withdrawal id in Binance + "amount": "8.91000000", // withdrawal amount + "transactionFee": "0.004", // transaction fee + "coin": "USDT", + "status": 6, + "address": "0x94df8b352de7f46f64b01d3666bf6e936e44ce60", + "txId": "0xb5ef8c13b968a406cc62a93a8bd80f9e9a906ef1b3fcf20a2e48573c17659268" // withdrawal transaction id + "applyTime": "2019-10-12 11:12:02", // UTC time + "network": "ETH", + "transferType": 0 // 1 for internal transfer, 0 for external transfer + "withdrawOrderId": "WITHDRAWtest123", // // will not be returned if there's no withdrawOrderId for this withdraw. + "info": "The address is not valid. Please confirm with the recipient", // reason for withdrawal failure + "confirmNo":3, // confirm times for withdraw + "walletType": 1, //1: Funding Wallet 0:Spot Wallet + "txKey": "", + "completeTime": "2023-03-23 16:52:41" // complete UTC time when user's asset is deduct from withdrawing, only if status = 6(success) + }, + { + "id": "156ec387f49b41df8724fa744fa82719", + "amount": "0.00150000", + "transactionFee": "0.004", + "coin": "BTC", + "status": 6, + "address": "1FZdVHtiBqMrWdjPyRPULCUceZPJ2WLCsB", + "txId": "60fd9007ebfddc753455f95fafa808c4302c836e4d1eebc5a132c36c1d8ac354" + "applyTime": "2019-09-24 12:43:45", + "network": "BTC", + "transferType": 0, + "info": "", + "confirmNo": 2, + "walletType": 1, + "txKey": "", + "completeTime": "2023-03-23 16:52:41" + } +] +GET /sapi/v1/capital/withdraw/history + +Fetch withdraw history. + +Weight(UID): 18000 + +Request Limit: 10 requests per second + +This endpoint specifically uses per second UID rate limit, user's total second level UID rate limit is 180000/second. Response from the endpoint contains header key X-SAPI-USED-UID-WEIGHT-1S, which defines weight used by the current UID. +Parameters: + +Name Type Mandatory Description +coin STRING NO +withdrawOrderId STRING NO +status INT NO 0(0:Email Sent,1:Cancelled 2:Awaiting Approval 3:Rejected 4:Processing 5:Failure 6:Completed) +offset INT NO +limit INT NO Default: 1000, Max: 1000 +startTime LONG NO Default: 90 days from current timestamp +endTime LONG NO Default: present timestamp +recvWindow LONG NO +timestamp LONG YES +network may not be in the response for old withdraw. +Please notice the default startTime and endTime to make sure that time interval is within 0-90 days. +If both startTime and endTimeare sent, time between startTimeand endTimemust be less than 90 days. +If withdrawOrderId is sent, time between startTime and endTime must be less than 7 days. +If withdrawOrderId is sent, startTime and endTime are not sent, will return last 7 days records by default. +Deposit Address (supporting network) (USER_DATA) +Response: + +{ + "address": "1HPn8Rx2y6nNSfagQBKy27GB99Vbzg89wv", + "coin": "BTC", + "tag": "", + "url": "https://btc.com/1HPn8Rx2y6nNSfagQBKy27GB99Vbzg89wv" +} +GET /sapi/v1/capital/deposit/address + +Fetch deposit address with network. + +Weight(IP): 10 + +Parameters: + +Name Type Mandatory Description +coin STRING YES +network STRING NO +amount DECIMAL NO +recvWindow LONG NO +timestamp LONG YES +If network is not send, return with default network of the coin. +You can get network and isDefault in networkList in the response of Get /sapi/v1/capital/config/getall (HMAC SHA256). +amount needs to be sent if using LIGHTNING network +Account Status (USER_DATA) +Response: + +{ + "data": "Normal" +} +GET /sapi/v1/account/status + +Fetch account status detail. + +Weight(IP): 1 + +Parameters: + +Name Type Mandatory Description +recvWindow LONG NO +timestamp LONG YES +Account API Trading Status (USER_DATA) +Response: + +{ + "data": { // API trading status detail + "isLocked": false, // API trading function is locked or not + "plannedRecoverTime": 0, // If API trading function is locked, this is the planned recover time + "triggerCondition": { + "GCR": 150, // Number of GTC orders + "IFER": 150, // Number of FOK/IOC orders + "UFR": 300 // Number of orders + }, + "updateTime": 1547630471725 + } +} +GET /sapi/v1/account/apiTradingStatus + +Fetch account api trading status detail. + +Weight(IP): 1 + +Parameters: + +Name Type Mandatory Description +recvWindow LONG NO +timestamp LONG YES +DustLog(USER_DATA) +Response + +{ + "total": 8, //Total counts of exchange + "userAssetDribblets": [ + { + "operateTime": 1615985535000, + "totalTransferedAmount": "0.00132256", // Total transfered BNB amount for this exchange. + "totalServiceChargeAmount": "0.00002699", //Total service charge amount for this exchange. + "transId": 45178372831, + "userAssetDribbletDetails": [ //Details of this exchange. + { + "transId": 4359321, + "serviceChargeAmount": "0.000009", + "amount": "0.0009", + "operateTime": 1615985535000, + "transferedAmount": "0.000441", + "fromAsset": "USDT" + }, + { + "transId": 4359321, + "serviceChargeAmount": "0.00001799", + "amount": "0.0009", + "operateTime": 1615985535000, + "transferedAmount": "0.00088156", + "fromAsset": "ETH" + } + ] + }, + { + "operateTime":1616203180000, + "totalTransferedAmount": "0.00058795", + "totalServiceChargeAmount": "0.000012", + "transId": 4357015, + "userAssetDribbletDetails": [ + { + "transId": 4357015, + "serviceChargeAmount": "0.00001", + "amount": "0.001", + "operateTime": 1616203180000, + "transferedAmount": "0.00049", + "fromAsset": "USDT" + }, + { + "transId": 4357015, + "serviceChargeAmount": "0.000002", + "amount": "0.0001", + "operateTime": 1616203180000, + "transferedAmount": "0.00009795", + "fromAsset": "ETH" + } + ] + } + ] + } +} +GET /sapi/v1/asset/dribblet + +Weight(IP): 1 + +Parameters: + +Name Type Mandatory Description +accountType STRING NO SPOTor MARGIN,default SPOT +startTime LONG NO +endTime LONG NO +recvWindow LONG NO +timestamp LONG YES +Only return last 100 records +Only return records after 2020/12/01 +Get Assets That Can Be Converted Into BNB (USER_DATA) +Response + +{ + "details": [ + { + "asset": "ADA", + "assetFullName": "ADA", + "amountFree": "6.21", //Convertible amount + "toBTC": "0.00016848", //BTC amount + "toBNB": "0.01777302", //BNB amount(Not deducted commission fee) + "toBNBOffExchange": "0.01741756", //BNB amount(Deducted commission fee) + "exchange": "0.00035546" //Commission fee + } + ], + "totalTransferBtc": "0.00016848", + "totalTransferBNB": "0.01777302", + "dribbletPercentage": "0.02" //Commission fee +} +POST /sapi/v1/asset/dust-btc + +Weight(IP): 1 + +Parameters: + +Name Type Mandatory Description +accountType STRING NO SPOTor MARGIN,default SPOT +recvWindow LONG NO +timestamp LONG YES +Dust Transfer (USER_DATA) +Response: + +{ + "totalServiceCharge":"0.02102542", + "totalTransfered":"1.05127099", + "transferResult":[ + { + "amount":"0.03000000", + "fromAsset":"ETH", + "operateTime":1563368549307, + "serviceChargeAmount":"0.00500000", + "tranId":2970932918, + "transferedAmount":"0.25000000" + }, + { + "amount":"0.09000000", + "fromAsset":"LTC", + "operateTime":1563368549404, + "serviceChargeAmount":"0.01548000", + "tranId":2970932918, + "transferedAmount":"0.77400000" + }, + { + "amount":"248.61878453", + "fromAsset":"TRX", + "operateTime":1563368549489, + "serviceChargeAmount":"0.00054542", + "tranId":2970932918, + "transferedAmount":"0.02727099" + } + ] +} +POST /sapi/v1/asset/dust + +Convert dust assets to BNB. + +Weight(UID): 10 + +Parameters: + +Name Type Mandatory Description +asset ARRAY YES The asset being converted. For example: asset=BTC,USDT +accountType STRING NO SPOTor MARGIN,default SPOT +recvWindow LONG NO +timestamp LONG YES +You need to openEnable Spot & Margin Trading permission for the API Key which requests this endpoint. +Asset Dividend Record (USER_DATA) +Response: + +{ + "rows":[ + { + "id":1637366104, + "amount":"10.00000000", + "asset":"BHFT", + "divTime":1563189166000, + "enInfo":"BHFT distribution", + "tranId":2968885920 + }, + { + "id":1631750237, + "amount":"10.00000000", + "asset":"BHFT", + "divTime":1563189165000, + "enInfo":"BHFT distribution", + "tranId":2968885920 + } + ], + "total":2 +} +GET /sapi/v1/asset/assetDividend + +Query asset dividend record. + +Weight(IP): 10 + +Parameters: + +Name Type Mandatory Description +asset STRING NO +startTime LONG NO +endTime LONG NO +limit INT NO Default 20, max 500 +recvWindow LONG NO +timestamp LONG YES +There cannot be more than 180 days between parameter startTime and endTime. +Asset Detail (USER_DATA) +Response: + +{ + "CTR": { + "minWithdrawAmount": "70.00000000", //min withdraw amount + "depositStatus": false,//deposit status (false if ALL of networks' are false) + "withdrawFee": 35, // withdraw fee + "withdrawStatus": true, //withdraw status (false if ALL of networks' are false) + "depositTip": "Delisted, Deposit Suspended" //reason + }, + "SKY": { + "minWithdrawAmount": "0.02000000", + "depositStatus": true, + "withdrawFee": 0.01, + "withdrawStatus": true + } +} +GET /sapi/v1/asset/assetDetail + +Fetch details of assets supported on Binance. + +Weight(IP): 1 + +Parameters: + +Name Type Mandatory Description +asset STRING NO +recvWindow LONG NO +timestamp LONG YES +Please get network and other deposit or withdraw details from GET /sapi/v1/capital/config/getall. +Trade Fee (USER_DATA) +Response: + +[ + { + "symbol": "ADABNB", + "makerCommission": "0.001", + "takerCommission": "0.001" + }, + { + "symbol": "BNBBTC", + "makerCommission": "0.001", + "takerCommission": "0.001" + } +] +GET /sapi/v1/asset/tradeFee + +Fetch trade fee + +Weight(IP): 1 + +Parameters: + +Name Type Mandatory Description +symbol STRING NO +recvWindow LONG NO +timestamp LONG YES +User Universal Transfer (USER_DATA) +Response: + +{ + "tranId":13526853623 +} + +POST /sapi/v1/asset/transfer + +You need to enable Permits Universal Transfer option for the API Key which requests this endpoint. + +Weight(UID): 900 + +Parameters: + +Name Type Mandatory Description +type ENUM YES +asset STRING YES +amount DECIMAL YES +fromSymbol STRING NO +toSymbol STRING NO +recvWindow LONG NO +timestamp LONG YES +fromSymbol must be sent when type are ISOLATEDMARGIN_MARGIN and ISOLATEDMARGIN_ISOLATEDMARGIN +toSymbol must be sent when type are MARGIN_ISOLATEDMARGIN and ISOLATEDMARGIN_ISOLATEDMARGIN + +ENUM of transfer types: + +MAIN_UMFUTURE Spot account transfer to USDⓈ-M Futures account +MAIN_CMFUTURE Spot account transfer to COIN-M Futures account +MAIN_MARGIN Spot account transfer to Margin(cross)account +UMFUTURE_MAIN USDⓈ-M Futures account transfer to Spot account +UMFUTURE_MARGIN USDⓈ-M Futures account transfer to Margin(cross)account +CMFUTURE_MAIN COIN-M Futures account transfer to Spot account +CMFUTURE_MARGIN COIN-M Futures account transfer to Margin(cross) account +MARGIN_MAIN Margin(cross)account transfer to Spot account +MARGIN_UMFUTURE Margin(cross)account transfer to USDⓈ-M Futures +MARGIN_CMFUTURE Margin(cross)account transfer to COIN-M Futures +ISOLATEDMARGIN_MARGIN Isolated margin account transfer to Margin(cross) account +MARGIN_ISOLATEDMARGIN Margin(cross) account transfer to Isolated margin account +ISOLATEDMARGIN_ISOLATEDMARGIN Isolated margin account transfer to Isolated margin account +MAIN_FUNDING Spot account transfer to Funding account +FUNDING_MAIN Funding account transfer to Spot account +FUNDING_UMFUTURE Funding account transfer to UMFUTURE account +UMFUTURE_FUNDING UMFUTURE account transfer to Funding account +MARGIN_FUNDING MARGIN account transfer to Funding account +FUNDING_MARGIN Funding account transfer to Margin account +FUNDING_CMFUTURE Funding account transfer to CMFUTURE account +CMFUTURE_FUNDING CMFUTURE account transfer to Funding account +MAIN_OPTION Spot account transfer to Options account +OPTION_MAIN Options account transfer to Spot account +UMFUTURE_OPTION USDⓈ-M Futures account transfer to Options account +OPTION_UMFUTURE Options account transfer to USDⓈ-M Futures account +MARGIN_OPTION Margin(cross)account transfer to Options account +OPTION_MARGIN Options account transfer to Margin(cross)account +FUNDING_OPTION Funding account transfer to Options account +OPTION_FUNDING Options account transfer to Funding account +MAIN_PORTFOLIO_MARGIN Spot account transfer to Portfolio Margin account +PORTFOLIO_MARGIN_MAIN Portfolio Margin account transfer to Spot account +MAIN_ISOLATED_MARGIN Spot account transfer to Isolated margin account +ISOLATED_MARGIN_MAIN Isolated margin account transfer to Spot account +Query User Universal Transfer History (USER_DATA) +Response: + +{ + "total":2, + "rows":[ + { + "asset":"USDT", + "amount":"1", + "type":"MAIN_UMFUTURE", + "status": "CONFIRMED", // status: CONFIRMED / FAILED / PENDING + "tranId": 11415955596, + "timestamp":1544433328000 + }, + { + "asset":"USDT", + "amount":"2", + "type":"MAIN_UMFUTURE", + "status": "CONFIRMED", + "tranId": 11366865406, + "timestamp":1544433328000 + } + ] +} +GET /sapi/v1/asset/transfer + +Weight(IP): 1 + +Parameters: + +Name Type Mandatory Description +type ENUM YES +startTime LONG NO +endTime LONG NO +current INT NO Default 1 +size INT NO Default 10, Max 100 +fromSymbol STRING NO +toSymbol STRING NO +recvWindow LONG NO +timestamp LONG YES +fromSymbol must be sent when type are ISOLATEDMARGIN_MARGIN and ISOLATEDMARGIN_ISOLATEDMARGIN +toSymbol must be sent when type are MARGIN_ISOLATEDMARGIN and ISOLATEDMARGIN_ISOLATEDMARGIN +Support query within the last 6 months only +If startTimeand endTime not sent, return records of the last 7 days by default +Funding Wallet (USER_DATA) +Response + +[ + { + "asset": "USDT", + "free": "1", // avalible balance + "locked": "0", // locked asset + "freeze": "0", // freeze asset + "withdrawing": "0", + "btcValuation": "0.00000091" + } +] +POST /sapi/v1/asset/get-funding-asset + +Weight(IP): 1 + +Parameters: + +Name Type Mandatory Description +asset STRING NO +needBtcValuation STRING NO true or false +recvWindow LONG NO +timestamp LONG YES +Currently supports querying the following business assets:Binance Pay, Binance Card, Binance Gift Card, Stock Token +User Asset (USER_DATA) +Response + +[ + { + "asset": "AVAX", + "free": "1", + "locked": "0", + "freeze": "0", + "withdrawing": "0", + "ipoable": "0", + "btcValuation": "0" + }, + { + "asset": "BCH", + "free": "0.9", + "locked": "0", + "freeze": "0", + "withdrawing": "0", + "ipoable": "0", + "btcValuation": "0" + }, + { + "asset": "BNB", + "free": "887.47061626", + "locked": "0", + "freeze": "10.52", + "withdrawing": "0.1", + "ipoable": "0", + "btcValuation": "0" + }, + { + "asset": "BUSD", + "free": "9999.7", + "locked": "0", + "freeze": "0", + "withdrawing": "0", + "ipoable": "0", + "btcValuation": "0" + }, + { + "asset": "SHIB", + "free": "532.32", + "locked": "0", + "freeze": "0", + "withdrawing": "0", + "ipoable": "0", + "btcValuation": "0" + }, + { + "asset": "USDT", + "free": "50300000001.44911105", + "locked": "0", + "freeze": "0", + "withdrawing": "0", + "ipoable": "0", + "btcValuation": "0" + }, + { + "asset": "WRZ", + "free": "1", + "locked": "0", + "freeze": "0", + "withdrawing": "0", + "ipoable": "0", + "btcValuation": "0" + } +] +POST /sapi/v3/asset/getUserAsset + +Get user assets, just for positive data. + +Weight(IP): 5 + +Parameters: + +Name Type Mandatory Description +asset STRING NO If asset is blank, then query all positive assets user have. +needBtcValuation BOOLEAN NO Whether need btc valuation or not. +recvWindow LONG NO +timestamp LONG YES +If asset is set, then return this asset, otherwise return all assets positive. +If needBtcValuation is set, then return btcValudation. +BUSD Convert (TRADE) +Response + +{ + "tranId": 118263407119, + "status": "S" +} +POST /sapi/v1/asset/convert-transfer + +Convert transfer, convert between BUSD and stablecoins. + +Weight(UID): 5 + +Parameters: + +Name Type Mandatory Description +clientTranId STRING YES The unique user-defined transaction id, min length 20 +asset STRING YES The current asset +amount BigDecimal YES The amount must be positive number +targetAsset String YES Target asset you want to convert +accountType String NO Only MAIN and CARD, default MAIN +If the clientTranId has been used before, will not do the convert transfer, the original transfer will be returned. +BUSD Convert History (USER_DATA) +Response + +{ + "total":3, + "rows": + [ + { + "tranId":118263615991, + "type":244, + "time":1664442078000, + "deductedAsset":"BUSD", + "deductedAmount":"1", + "targetAsset":"USDC", + "targetAmount":"1", + "status":"S", + "accountType":"MAIN" + },{ + "tranId":118263598801, + "type":244, + "time":1664442061000, + "deductedAsset":"BUSD", + "deductedAmount":"1", + "targetAsset":"USDC", + "targetAmount":"1", + "status":"S", + "accountType":"MAIN" + },{ + "tranId":118263407119, + "type":244, + "time":1664441820000, + "deductedAsset":"BUSD", + "deductedAmount":"1", + "targetAsset":"USDC", + "targetAmount":"1", + "status":"S", + "accountType":"MAIN" + } + ] +} +GET /sapi/v1/asset/convert-transfer/queryByPage + +Weight(UID): 5 + +Parameters: + +Name Type Mandatory Description +tranId LONG NO The transaction id +clientTranId STRING NO The user-defined transaction id +asset STRING NO If it is blank, we will match deducted asset and target asset. +startTime LONG YES inclusive, unit: ms +endTime LONG YES exclusive, unit: ms +accountType STRING NO MAIN: main account. CARD: funding account. If it is blank, we will query spot and card wallet, otherwise, we just query the corresponding wallet +current INTEGER NO current page, default 1, the min value is 1 +size INTEGER NO page size, default 10, the max value is 100 +ENUM of types: +244 convert via sapi call +11 auto convert when deposit +32 auto convert when withdraw +34 in case withdraw failed +254 busd auto convert job +Get Cloud-Mining payment and refund history (USER_DATA) +Response + +{ + "total":5, + "rows":[ + {"createTime":1667880112000,"tranId":121230610120,"type":248,"asset":"USDT","amount":"25.0068","status":"S"}, + {"createTime":1666776366000,"tranId":119991507468,"type":249,"asset":"USDT","amount":"0.027","status":"S"}, + {"createTime":1666764505000,"tranId":119977966327,"type":248,"asset":"USDT","amount":"0.027","status":"S"}, + {"createTime":1666758189000,"tranId":119973601721,"type":248,"asset":"USDT","amount":"0.018","status":"S"}, + {"createTime":1666757278000,"tranId":119973028551,"type":248,"asset":"USDT","amount":"0.018","status":"S"} + ] +} +GET /sapi/v1/asset/ledger-transfer/cloud-mining/queryByPage + +The query of Cloud-Mining payment and refund history + +Weight(UID): 600 + +Parameters: + +Name Type Mandatory Description +tranId LONG NO The transaction id +clientTranId STRING NO The unique flag +asset STRING NO If it is blank, we will query all assets +startTime LONG YES inclusive, unit: ms +endTime LONG YES exclusive, unit: ms +current INTEGER NO current page, default 1, the min value is 1 +size INTEGER NO page size, default 10, the max value is 100 +Just return the SUCCESS records of payment and refund. +For response, type = 248 means payment, type = 249 means refund, status =S means SUCCESS. +Get API Key Permission (USER_DATA) +Response + +{ + "ipRestrict":false, + "createTime":1698645219000, + "enableInternalTransfer":false, // This option authorizes this key to transfer funds between your master account and your sub account instantly + "enableFutures":false, // The Futures API cannot be used if the API key was created before the Futures account was opened, or if you have enabled portfolio margin. + "enablePortfolioMarginTrading":true, // API Key created before your activate portfolio margin does not support portfolio margin API service + "enableVanillaOptions":false, // Authorizes this key to Vanilla options trading + "permitsUniversalTransfer":false, // Authorizes this key to be used for a dedicated universal transfer API to transfer multiple supported currencies. Each business's own transfer API rights are not affected by this authorization + "enableReading":true, + "enableSpotAndMarginTrading":false, // Spot and margin trading + "enableWithdrawals":false, // This option allows you to withdraw via API. You must apply the IP Access Restriction filter in order to enable withdrawals + "enableMargin":false // This option can be adjusted after the Cross Margin account transfer is completed +} +GET /sapi/v1/account/apiRestrictions + +Weight(IP): 1 + +Parameters: + +Name Type Mandatory Description +recvWindow LONG NO +timestamp LONG YES +Query auto-converting stable coins (USER_DATA) +Response: + +{ + "convertEnabled": true, + "coins": [ + "USDC", + "USDP", + "TUSD" + ], + "exchangeRates": { + "USDC": "1", + "TUSD": "1", + "USDP": "1" + } +} +GET /sapi/v1/capital/contract/convertible-coins + +Get a user's auto-conversion settings in deposit/withdrawal + +Weight(UID): 600 + +Parameters: None + +Switch on/off BUSD and stable coins conversion (USER_DATA) +Response: Returns code 200 on success without body. + +POST /sapi/v1/capital/contract/convertible-coins + +User can use it to turn on or turn off the BUSD auto-conversion from/to a specific stable coin. + +Weight(UID): 600 + +Parameters: + +Name Type Mandatory Description +coin STRING YES Must be USDC, USDP or TUSD +enable BOOLEAN YES true: turn on the auto-conversion. false: turn off the auto-conversion +Params need to be in the POST body +One click arrival deposit apply (for expired address deposit) (USER_DATA) +Response: + +{ + "code": "000000", + "message": "success", + "data":true, + "success": true +} +POST /sapi/v1/capital/deposit/credit-apply + +Apply deposit credit for expired address (One click arrival) + +Weight(IP): 1 + +Parameters: + +Name Type Mandatory Description +depositId LONG NO Deposit record Id, priority use +txId STRING NO Deposit txId, used when depositId is not specified +subAccountId LONG NO Sub-accountId of Cloud user +subUserId LONG NO Sub-userId of parent user +Params need to be in the POST body +Fetch deposit address list with network(USER_DATA) +Response: + +[ + { + "coin": "ETH", + "address": "0xD316E95Fd9E8E237Cb11f8200Babbc5D8D177BA4", + "tag":"", + "isDefault": 0 + }, + { + "coin": "ETH", + "address": "0xD316E95Fd9E8E237Cb11f8200Babbc5D8D177BA4", + "tag":"", + "isDefault": 0 + }, + { + "coin": "ETH", + "address": "0x00003ada75e7da97ba0db2fcde72131f712455e2", + "tag":"", + "isDefault": 1 //'isDefault' is 1 means the address is default, same as shown in the app. + } +] +GET /sapi/v1/capital/deposit/address/list + +Fetch deposit address list with network. + +Weight(IP): 10 + +Parameters: + +Name Type Mandatory Description +coin STRING YES coin refers to the parent network address format that the address is using +network STRING NO +timestamp LONG YES +If network is not send, return with default network of the coin. +You can get network and isDefault in networkList in the response of Get /sapi/v1/capital/config/getall. +Query User Wallet Balance (USER_DATA) +Response: + +[ + { + "activate": true, + "balance": "0", + "walletName": "Spot" + }, + { + "activate": true, + "balance": "0", + "walletName": "Funding" + }, + { + "activate": true, + "balance": "0", + "walletName": "Cross Margin" + }, + { + "activate": true, + "balance": "0", + "walletName": "Isolated Margin" + }, + { + "activate": true, + "balance": "0.71842752", + "walletName": "USDⓈ-M Futures" + }, + { + "activate": true, + "balance": "0", + "walletName": "COIN-M Futures" + }, + { + "activate": true, + "balance": "0", + "walletName": "Earn" + }, + { + "activate": false, + "balance": "0", + "walletName": "Options" + } +] +GET /sapi/v1/asset/wallet/balance + +Query User Wallet Balance + +Weight(IP): 60 + +Parameters: + +Name Type Mandatory Description +recvWindow LONG NO +timestamp LONG YES +You need to open Permits Universal Transfer permission for the API Key which requests this endpoint. +Query User Delegation History(For Master Account)(USER_DATA) +Response: + +{ + "total": 3316, + "rows": [ + { + "clientTranId": "293915932290879488", + "transferType": "Undelegate", + "asset": "ETH", + "amount": "1", + "time": 1695205406000 + }, + { + "clientTranId": "293915892281413632", + "transferType": "Delegate", + "asset": "ETH", + "amount": "1", + "time": 1695205396000 + } + ] +} +GET /sapi/v1/asset/custody/transfer-history + +Query User Delegation History + +Weight(IP): 60 + +Parameters: + +Name Type Mandatory Description +email STRING YES +startTime LONG YES +endTime LONG YES +type ENUM NO Delegate/Undelegate +asset STRING NO +current INTEGER NO default 1 +size INTEGER NO default 10, max 100 +recvWindow LONG NO +timestamp LONG YES +You need to open Enable Spot & Margin Trading permission for the API Key which requests this endpoint +Get symbols delist schedule for spot (MARKET_DATA) +GET /sapi/v1/spot/delist-schedule + +Get symbols delist schedule for spot + +Response: + +[ + { + "delistTime": 1686161202000, + "symbols": [ + "ADAUSDT", + "BNBUSDT" + ] + }, + { + "delistTime": 1686222232000, + "symbols": [ + "ETHUSDT" + ] + } +] +Weight(IP): 100 + +Parameters: + +Name Type Mandatory Description +recvWindow LONG NO +timestamp LONG YES +Fetch withdraw address list (USER_DATA) +GET /sapi/v1/capital/withdraw/address/list + +Fetch withdraw address list + +Response: + +[ + { + "address": "string", + "addressTag": "string", + "coin": "string", + "name": "string", //is a user-defined name + "network": "string", + "origin": "string", //if originType=='others', the address source manually filled in by the user + "originType": "string", //Address source type + "whiteStatus": true //Is it whitelisted + } +] +Weight(IP): 10 + +Account info (USER_DATA) +GET /sapi/v1/account/info + +Fetch account info detail. + +Response: + +{ + "vipLevel": 0, + "isMarginEnabled": true, // true or false for margin + "isFutureEnabled": true // true or false for futures. +} +Weight(IP): 1 + +Parameters: + +Name Type Mandatory Description +recvWindow LONG NO +timestamp LONG YES +Sub-Account Endpoints +The endpoints documented in this section are for Corporate Accounts. +To become a corporate account, please refer to this document: Corporate Account Application +Create a Virtual Sub-account(For Master Account) +Response: + +{ + "email":"addsdd_virtual@aasaixwqnoemail.com" +} +POST /sapi/v1/sub-account/virtualSubAccount + +Weight(IP): 1 + +Parameters: + +Name Type Mandatory Description +subAccountString STRING YES Please input a string. We will create a virtual email using that string for you to register +recvWindow LONG NO +timestamp LONG YES +This request will generate a virtual sub account under your master account. +You need to enable "trade" option for the API Key which requests this endpoint. +Query Sub-account List (For Master Account) +Response: + +{ + "subAccounts":[ + { + "email":"testsub@gmail.com", + "isFreeze":false, + "createTime":1544433328000, + "isManagedSubAccount": false, + "isAssetManagementSubAccount": false + }, + { + "email":"virtual@oxebmvfonoemail.com", + "isFreeze":false, + "createTime":1544433328000, + "isManagedSubAccount": false, + "isAssetManagementSubAccount": false + } + ] +} +GET /sapi/v1/sub-account/list + +Weight(IP): 1 + +Parameters: + +Name Type Mandatory Description +email STRING NO Sub-account email +isFreeze STRING NO true or false +page INT NO Default value: 1 +limit INT NO Default value: 1, Max value: 200 +recvWindow LONG NO +timestamp LONG YES +Query Sub-account Spot Asset Transfer History (For Master Account) +Response: + +[ + { + "from":"aaa@test.com", + "to":"bbb@test.com", + "asset":"BTC", + "qty":"10", + "status": "SUCCESS", + "tranId": 6489943656, + "time":1544433328000 + }, + { + "from":"bbb@test.com", + "to":"ccc@test.com", + "asset":"ETH", + "qty":"2", + "status": "SUCCESS", + "tranId": 6489938713, + "time":1544433328000 + } +] +GET /sapi/v1/sub-account/sub/transfer/history + +Weight(IP): 1 + +Parameters: + +Name Type Mandatory Description +fromEmail STRING NO +toEmail STRING NO +startTime LONG NO +endTime LONG NO +page INT NO Default value: 1 +limit INT NO Default value: 500 +recvWindow LONG NO +timestamp LONG YES +fromEmail and toEmail cannot be sent at the same time. +Return fromEmail equal master account email by default. +Query Sub-account Futures Asset Transfer History (For Master Account) +Response + +{ + "success":true, + "futuresType": 2, + "transfers":[ + { + "from":"aaa@test.com", + "to":"bbb@test.com", + "asset":"BTC", + "qty":"1", + "tranId":11897001102, + "time":1544433328000 + }, + { + "from":"bbb@test.com", + "to":"ccc@test.com", + "asset":"ETH", + "qty":"2", + "tranId":11631474902, + "time":1544433328000 + } + ] +} +GET /sapi/v1/sub-account/futures/internalTransfer + +Weight(IP): 1 + +Parameters: + +Name Type Mandatory Description +email STRING YES Sub-account email +futuresType LONG YES 1:USDT-margined Futures,2: Coin-margined Futures +startTime LONG NO Default return the history with in 100 days +endTime LONG NO Default return the history with in 100 days +page INT NO Default value: 1 +limit INT NO Default value: 50, Max value: 500 +recvWindow LONG NO +timestamp LONG YES +Sub-account Futures Asset Transfer (For Master Account) +Response + +{ + "success":true, + "txnId":"2934662589" +} + +POST /sapi/v1/sub-account/futures/internalTransfer + +Weight(IP): 1 + +Parameters: + +Name Type Mandatory Description +fromEmail STRING YES Sender email +toEmail STRING YES Recipient email +futuresType LONG YES 1:USDT-margined Futures,2: Coin-margined Futures +asset STRING YES +amount DECIMAL YES +recvWindow LONG NO +timestamp LONG YES +Master account can transfer max 2000 times a minute +There must be sufficient margin balance in futures wallet to execute transferring. +Query Sub-account Assets (For Master Account) +Response: + +{ + "balances":[ + { + "asset":"ADA", + "free":10000, + "locked":0 + }, + { + "asset":"BNB", + "free":10003, + "locked":0 + }, + { + "asset":"BTC", + "free":11467.6399, + "locked":0 + }, + { + "asset":"ETH", + "free":10004.995, + "locked":0 + }, + { + "asset":"USDT", + "free":11652.14213, + "locked":0 + } + ] +} +GET /sapi/v3/sub-account/assets + +Fetch sub-account assets + +Weight(UID): 60 + +Parameters: + +Name Type Mandatory Description +email STRING YES Sub account email +recvWindow LONG NO +timestamp LONG YES +Query Sub-account Spot Assets Summary (For Master Account) +Response: + +{ + "totalCount":2, + "masterAccountTotalAsset": "0.23231201", + "spotSubUserAssetBtcVoList":[ + { + "email":"sub123@test.com", + "totalAsset":"9999.00000000" + }, + { + "email":"test456@test.com", + "totalAsset":"0.00000000" + } + ] +} +Get BTC valued asset summary of subaccounts. + +GET /sapi/v1/sub-account/spotSummary + +Weight(IP): 1 + +Parameters: + +Name Type Mandatory Description +email STRING NO Sub account email +page LONG NO default 1 +size LONG NO default 10, max 20 +recvWindow LONG NO +timestamp LONG YES +Get Sub-account Deposit Address (For Master Account) +Response: + +{ + "address":"TDunhSa7jkTNuKrusUTU1MUHtqXoBPKETV", + "coin":"USDT", + "tag":"", + "url":"https://tronscan.org/#/address/TDunhSa7jkTNuKrusUTU1MUHtqXoBPKETV" +} +GET /sapi/v1/capital/deposit/subAddress + +Fetch sub-account deposit address + +Weight(IP): 1 + +Parameters: + +Name Type Mandatory Description +email STRING YES Sub account email +coin STRING YES +network STRING NO +amount DECIMAL NO +recvWindow LONG NO +timestamp LONG YES +amount needs to be sent if using LIGHTNING network +Get Sub-account Deposit History (For Master Account) +Response: + +[ + { + "id": "769800519366885376", + "amount": "0.001", + "coin": "BNB", + "network": "BNB", + "status": 0, + "address": "bnb136ns6lfw4zs5hg4n85vdthaad7hq5m4gtkgf23", + "addressTag": "101764890", + "txId": "98A3EA560C6B3336D348B6C83F0F95ECE4F1F5919E94BD006E5BF3BF264FACFC", + "insertTime": 1661493146000, + "transferType": 0, + "confirmTimes": "1/1", + "unlockConfirm": 0, + "walletType": 0 + }, + { + "id": "769754833590042625", + "amount":"0.50000000", + "coin":"IOTA", + "network":"IOTA", + "status":1, + "address":"SIZ9VLMHWATXKV99LH99CIGFJFUMLEHGWVZVNNZXRJJVWBPHYWPPBOSDORZ9EQSHCZAMPVAPGFYQAUUV9DROOXJLNW", + "addressTag":"", + "txId":"ESBFVQUTPIWQNJSPXFNHNYHSQNTGKRVKPRABQWTAXCDWOAKDKYWPTVG9BGXNVNKTLEJGESAVXIKIZ9999", + "insertTime":1599620082000, + "transferType":0, + "confirmTimes": "1/1", + "unlockConfirm": 0, + "walletType": 0 + } +] +GET /sapi/v1/capital/deposit/subHisrec + +Fetch sub-account deposit history + +Weight(IP): 1 + +Parameters: + +Name Type Mandatory Description +email STRING YES Sub account email +coin STRING NO +status INT NO 0(0:pending,6: credited but cannot withdraw,7:Wrong Deposit,8:Waiting User confirm,1:success) +startTime LONG NO +endTime LONG NO +limit INT NO +offset INT NO default:0 +recvWindow LONG NO +timestamp LONG YES +txId STRING NO +Get Sub-account's Status on Margin/Futures (For Master Account) +Response + +[ + { + "email":"123@test.com", // user email + "isSubUserEnabled": true, // true or false + "isUserActive": true, // true or false + "insertTime": 1570791523523, // sub account create time + "isMarginEnabled": true, // true or false for margin + "isFutureEnabled": true, // true or false for futures. + "mobile": 1570791523523 // user mobile number + } +] +GET /sapi/v1/sub-account/status + +Weight(IP): 10 + +Parameters: + +Name Type Mandatory Description +email STRING NO Sub-account email +recvWindow LONG NO +timestamp LONG YES +If no email sent, all sub-accounts' information will be returned. +Enable Margin for Sub-account (For Master Account) +Response + +{ + + "email":"123@test.com", + "isMarginEnabled": true + +} +POST /sapi/v1/sub-account/margin/enable + +Weight(IP): 1 + +Parameters: + +Name Type Mandatory Description +email STRING YES Sub-account email +recvWindow LONG NO +timestamp LONG YES +Get Detail on Sub-account's Margin Account (For Master Account) +Response + +{ + "email":"123@test.com", + "marginLevel": "11.64405625", + "totalAssetOfBtc": "6.82728457", + "totalLiabilityOfBtc": "0.58633215", + "totalNetAssetOfBtc": "6.24095242", + "marginTradeCoeffVo": + { + "forceLiquidationBar": "1.10000000", // Liquidation margin ratio + "marginCallBar": "1.50000000", // Margin call margin ratio + "normalBar": "2.00000000" // Initial margin ratio + }, + "marginUserAssetVoList": [ + { + "asset": "BTC", + "borrowed": "0.00000000", + "free": "0.00499500", + "interest": "0.00000000", + "locked": "0.00000000", + "netAsset": "0.00499500" + }, + { + "asset": "BNB", + "borrowed": "201.66666672", + "free": "2346.50000000", + "interest": "0.00000000", + "locked": "0.00000000", + "netAsset": "2144.83333328" + }, + { + "asset": "ETH", + "borrowed": "0.00000000", + "free": "0.00000000", + "interest": "0.00000000", + "locked": "0.00000000", + "netAsset": "0.00000000" + }, + { + "asset": "USDT", + "borrowed": "0.00000000", + "free": "0.00000000", + "interest": "0.00000000", + "locked": "0.00000000", + "netAsset": "0.00000000" + } + ] +} +GET /sapi/v1/sub-account/margin/account + +Weight(IP): 10 + +Parameters: + +Name Type Mandatory Description +email STRING YES Sub-account email +recvWindow LONG NO +timestamp LONG YES +Get Summary of Sub-account's Margin Account (For Master Account) +Response + +{ + "totalAssetOfBtc": "4.33333333", + "totalLiabilityOfBtc": "2.11111112", + "totalNetAssetOfBtc": "2.22222221", + "subAccountList":[ + { + "email":"123@test.com", + "totalAssetOfBtc": "2.11111111", + "totalLiabilityOfBtc": "1.11111111", + "totalNetAssetOfBtc": "1.00000000" + }, + { + "email":"345@test.com", + "totalAssetOfBtc": "2.22222222", + "totalLiabilityOfBtc": "1.00000001", + "totalNetAssetOfBtc": "1.22222221" + } + ] +} +GET /sapi/v1/sub-account/margin/accountSummary + +Weight(IP): 10 + +Parameters: + +Name Type Mandatory Description +recvWindow LONG NO +timestamp LONG YES +Enable Futures for Sub-account (For Master Account) +Response + +{ + + "email":"123@test.com", + "isFuturesEnabled": true // true or false + +} +POST /sapi/v1/sub-account/futures/enable + +Weight(IP): 1 + +Parameters: + +Name Type Mandatory Description +email STRING YES Sub-account email +recvWindow LONG NO +timestamp LONG YES +Get Detail on Sub-account's Futures Account (For Master Account) +Response + + +{ + "email": "abc@test.com", + "asset": "USDT", + "assets":[ + { + "asset": "USDT", + "initialMargin": "0.00000000", + "maintenanceMargin": "0.00000000", + "marginBalance": "0.88308000", + "maxWithdrawAmount": "0.88308000", + "openOrderInitialMargin": "0.00000000", + "positionInitialMargin": "0.00000000", + "unrealizedProfit": "0.00000000", + "walletBalance": "0.88308000" + } + ], + "canDeposit": true, + "canTrade": true, + "canWithdraw": true, + "feeTier": 2, + "maxWithdrawAmount": "0.88308000", + "totalInitialMargin": "0.00000000", + "totalMaintenanceMargin": "0.00000000", + "totalMarginBalance": "0.88308000", + "totalOpenOrderInitialMargin": "0.00000000", + "totalPositionInitialMargin": "0.00000000", + "totalUnrealizedProfit": "0.00000000", + "totalWalletBalance": "0.88308000", + "updateTime": 1576756674610 + } + +GET /sapi/v1/sub-account/futures/account + +Weight(IP): 10 + +Parameters: + +Name Type Mandatory Description +email STRING YES Sub-account email +recvWindow LONG NO +timestamp LONG YES +Get Summary of Sub-account's Futures Account (For Master Account) +Response + +{ + "totalInitialMargin": "9.83137400", + "totalMaintenanceMargin": "0.41568700", + "totalMarginBalance": "23.03235621", + "totalOpenOrderInitialMargin": "9.00000000", + "totalPositionInitialMargin": "0.83137400", + "totalUnrealizedProfit": "0.03219710", + "totalWalletBalance": "22.15879444", + "asset": "USD", + "subAccountList":[ + { + "email": "123@test.com", + "totalInitialMargin": "9.00000000", + "totalMaintenanceMargin": "0.00000000", + "totalMarginBalance": "22.12659734", + "totalOpenOrderInitialMargin": "9.00000000", + "totalPositionInitialMargin": "0.00000000", + "totalUnrealizedProfit": "0.00000000", + "totalWalletBalance": "22.12659734", + "asset": "USD" + }, + { + "email": "345@test.com", + "totalInitialMargin": "0.83137400", + "totalMaintenanceMargin": "0.41568700", + "totalMarginBalance": "0.90575887", + "totalOpenOrderInitialMargin": "0.00000000", + "totalPositionInitialMargin": "0.83137400", + "totalUnrealizedProfit": "0.03219710", + "totalWalletBalance": "0.87356177", + "asset": "USD" + } + ] +} + +GET /sapi/v1/sub-account/futures/accountSummary + +Weight(IP): 1 + +Parameters: + +Name Type Mandatory Description +recvWindow LONG NO +timestamp LONG YES +Get Futures Position-Risk of Sub-account (For Master Account) +Response + +[ + { + "entryPrice": "9975.12000", + "leverage": "50", // current initial leverage + "maxNotional": "1000000", // notional value limit of current initial leverage + "liquidationPrice": "7963.54", + "markPrice": "9973.50770517", + "positionAmount": "0.010", + "symbol": "BTCUSDT", + "unrealizedProfit": "-0.01612295" + } +] +GET /sapi/v1/sub-account/futures/positionRisk + +Weight(IP): 10 + +Parameters: + +Name Type Mandatory Description +email STRING YES Sub-account email +recvWindow LONG NO +timestamp LONG YES +Futures Transfer for Sub-account (For Master Account) +Response + +{ + "txnId":"2966662589" +} +POST /sapi/v1/sub-account/futures/transfer + +Weight(IP): 1 + +Parameters: + +Name Type Mandatory Description +email STRING YES Sub-account email +asset STRING YES The asset being transferred, e.g., USDT +amount DECIMAL YES The amount to be transferred +type INT YES 1: transfer from subaccount's spot account to its USDT-margined futures account 2: transfer from subaccount's USDT-margined futures account to its spot account 3: transfer from subaccount's spot account to its COIN-margined futures account 4:transfer from subaccount's COIN-margined futures account to its spot account +recvWindow LONG NO +timestamp LONG YES +You need to open Enable Spot & Margin Trading permission for the API Key which requests this endpoint. +Margin Transfer for Sub-account (For Master Account) +Response + +{ + "txnId":"2966662589" +} +POST /sapi/v1/sub-account/margin/transfer + +Weight(IP): 1 + +Parameters: + +Name Type Mandatory Description +email STRING YES Sub-account email +asset STRING YES The asset being transferred, e.g., BTC +amount DECIMAL YES The amount to be transferred +type INT YES 1: transfer from subaccount's spot account to margin account 2: transfer from subaccount's margin account to its spot account +recvWindow LONG NO +timestamp LONG YES +You need to open Enable Spot & Margin Trading permission for the API Key which requests this endpoint. +Transfer to Sub-account of Same Master (For Sub-account) +Response + +{ + "txnId":"2966662589" +} +POST /sapi/v1/sub-account/transfer/subToSub + +Weight(IP): 1 + +Parameters: + +Name Type Mandatory Description +toEmail STRING YES Sub-account email +asset STRING YES +amount DECIMAL YES +recvWindow LONG NO +timestamp LONG YES +You need to open Enable Spot & Margin Trading permission for the API Key which requests this endpoint. +Transfer to Master (For Sub-account) +Response + +{ + "txnId":"2966662589" +} +POST /sapi/v1/sub-account/transfer/subToMaster + +Weight(IP): 1 + +Parameters: + +Name Type Mandatory Description +asset STRING YES +amount DECIMAL YES +recvWindow LONG NO +timestamp LONG YES +You need to open Enable Spot & Margin Trading permission for the API Key which requests this endpoint. +Sub-account Transfer History (For Sub-account) +Response + +[ + { + "counterParty":"master", + "email":"master@test.com", + "type":1, // 1 for transfer in, 2 for transfer out + "asset":"BTC", + "qty":"1", + "fromAccountType":"SPOT", + "toAccountType":"SPOT", + "status":"SUCCESS", // status: PROCESS / SUCCESS / FAILURE + "tranId":11798835829, + "time":1544433325000 + }, + { + "counterParty":"subAccount", + "email":"sub2@test.com", + "type":1, + "asset":"ETH", + "qty":"2", + "fromAccountType":"SPOT", + "toAccountType":"COIN_FUTURE", + "status":"SUCCESS", + "tranId":11798829519, + "time":1544433326000 + } +] +GET /sapi/v1/sub-account/transfer/subUserHistory + +Weight(IP): 1 + +Parameters: + +Name Type Mandatory Description +asset STRING NO If not sent, result of all assets will be returned +type INT NO 1: transfer in, 2: transfer out +startTime LONG NO +endTime LONG NO +limit INT NO Default 500 +returnFailHistory BOOLEAN NO Default False, return PROCESS and SUCCESS status history; If True,return PROCESS and SUCCESS and FAILURE status history +recvWindow LONG NO +timestamp LONG YES +If type is not sent, the records of type 2: transfer out will be returned by default. +If startTime and endTime are not sent, the recent 30-day data will be returned. +Universal Transfer (For Master Account) +Response + +{ + "tranId":11945860693, + "clientTranId":"test" +} +POST /sapi/v1/sub-account/universalTransfer + +Weight(IP): 1 + +Parameters: + +Name Type Mandatory Description +fromEmail STRING NO +toEmail STRING NO +fromAccountType STRING YES "SPOT","USDT_FUTURE","COIN_FUTURE","MARGIN"(Cross),"ISOLATED_MARGIN" +toAccountType STRING YES "SPOT","USDT_FUTURE","COIN_FUTURE","MARGIN"(Cross),"ISOLATED_MARGIN" +clientTranId STRING NO Must be unique +symbol STRING NO Only supported under ISOLATED_MARGIN type +asset STRING YES +amount DECIMAL YES +recvWindow LONG NO +timestamp LONG YES +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. +At least either fromEmail or toEmail need to be sent when the fromAccountType and the toAccountType are the same. +Supported transfer scenarios: +SPOT transfer to SPOT, USDT_FUTURE, COIN_FUTURE (regardless of master or sub) +SPOT, USDT_FUTURE, COIN_FUTURE transfer to SPOT (regardless of master or sub) +Master account SPOT transfer to sub-account MARGIN(Cross), ISOLATED_MARGIN +Sub-account MARGIN(Cross), ISOLATED_MARGIN transfer to master account SPOT +Sub-account MARGIN(Cross) transfer to Sub-account MARGIN(Cross) +Query Universal Transfer History (For Master Account) +Response + +{ + "result": [ + { + "tranId": 92275823339, + "fromEmail": "abctest@gmail.com", + "toEmail": "deftest@gmail.com", + "asset": "BNB", + "amount": "0.01", + "createTimeStamp": 1640317374000, + "fromAccountType": "USDT_FUTURE", + "toAccountType": "SPOT", + "status": "SUCCESS", + "clientTranId": "test" + } + ], + "totalCount": 1 +} +GET /sapi/v1/sub-account/universalTransfer + +Weight(IP): 1 + +Parameters: + +Name Type Mandatory Description +fromEmail STRING NO +toEmail STRING NO +clientTranId STRING NO +startTime LONG NO +endTime LONG NO +page INT NO Default 1 +limit INT NO Default 500, Max 500 +recvWindow LONG NO +timestamp LONG YES +fromEmail and toEmail cannot be sent at the same time. +Return fromEmail equal master account email by default. +The query time period must be less then 30 days. +If startTime and endTime not sent, return records of the last 30 days by default. +Get Detail on Sub-account's Futures Account V2 (For Master Account) +Response + +USDT Margined Futures: + + +{ + "futureAccountResp": { + "email": "abc@test.com", + "assets":[ + { + "asset": "USDT", + "initialMargin": "0.00000000", + "maintenanceMargin": "0.00000000", + "marginBalance": "0.88308000", + "maxWithdrawAmount": "0.88308000", + "openOrderInitialMargin": "0.00000000", + "positionInitialMargin": "0.00000000", + "unrealizedProfit": "0.00000000", + "walletBalance": "0.88308000" + } + ], + "canDeposit": true, + "canTrade": true, + "canWithdraw": true, + "feeTier": 2, + "maxWithdrawAmount": "0.88308000", + "totalInitialMargin": "0.00000000", + "totalMaintenanceMargin": "0.00000000", + "totalMarginBalance": "0.88308000", + "totalOpenOrderInitialMargin": "0.00000000", + "totalPositionInitialMargin": "0.00000000", + "totalUnrealizedProfit": "0.00000000", + "totalWalletBalance": "0.88308000", + "updateTime": 1576756674610 + } +} +COIN Margined Futures: + + +{ + "deliveryAccountResp": { + "email": "abc@test.com", + "assets":[ + { + "asset": "BTC", + "initialMargin": "0.00000000", + "maintenanceMargin": "0.00000000", + "marginBalance": "0.88308000", + "maxWithdrawAmount": "0.88308000", + "openOrderInitialMargin": "0.00000000", + "positionInitialMargin": "0.00000000", + "unrealizedProfit": "0.00000000", + "walletBalance": "0.88308000" + } + ], + "canDeposit": true, + "canTrade": true, + "canWithdraw": true, + "feeTier": 2, + "updateTime": 1598959682001 + } + } + +GET /sapi/v2/sub-account/futures/account + +Weight(IP): 1 + +Parameters: + +Name Type Mandatory Description +email STRING YES Sub-account email +futuresType INT YES 1:USDT Margined Futures, 2:COIN Margined Futures +recvWindow LONG NO +timestamp LONG YES +Get Summary of Sub-account's Futures Account V2 (For Master Account) +Response + +USDT Margined Futures: + +{ + "futureAccountSummaryResp": { + "totalInitialMargin": "9.83137400", + "totalMaintenanceMargin": "0.41568700", + "totalMarginBalance": "23.03235621", + "totalOpenOrderInitialMargin": "9.00000000", + "totalPositionInitialMargin": "0.83137400", + "totalUnrealizedProfit": "0.03219710", + "totalWalletBalance": "22.15879444", + "asset": "USD", + "subAccountList":[ + { + "email": "123@test.com", + "totalInitialMargin": "9.00000000", + "totalMaintenanceMargin": "0.00000000", + "totalMarginBalance": "22.12659734", + "totalOpenOrderInitialMargin": "9.00000000", + "totalPositionInitialMargin": "0.00000000", + "totalUnrealizedProfit": "0.00000000", + "totalWalletBalance": "22.12659734", + "asset": "USD" + }, + { + "email": "345@test.com", + "totalInitialMargin": "0.83137400", + "totalMaintenanceMargin": "0.41568700", + "totalMarginBalance": "0.90575887", + "totalOpenOrderInitialMargin": "0.00000000", + "totalPositionInitialMargin": "0.83137400", + "totalUnrealizedProfit": "0.03219710", + "totalWalletBalance": "0.87356177", + "asset": "USD" + } + ] + } +} +COIN Margined Futures: + +{ + "deliveryAccountSummaryResp": { + "totalMarginBalanceOfBTC": "25.03221121", + "totalUnrealizedProfitOfBTC": "0.12233410", + "totalWalletBalanceOfBTC": "22.15879444", + "asset": "BTC", + "subAccountList":[ + { + "email": "123@test.com", + "totalMarginBalance": "22.12659734", + "totalUnrealizedProfit": "0.00000000", + "totalWalletBalance": "22.12659734", + "asset": "BTC" + }, + { + "email": "345@test.com", + "totalMarginBalance": "0.90575887", + "totalUnrealizedProfit": "0.03219710", + "totalWalletBalance": "0.87356177", + "asset": "BTC" + } + ] + } +} +GET /sapi/v2/sub-account/futures/accountSummary + +Weight(IP): 10 + +Parameters: + +Name Type Mandatory Description +futuresType INT YES 1:USDT Margined Futures, 2:COIN Margined Futures +page INT NO default:1 +limit INT NO default:10, max:20 +recvWindow LONG NO +timestamp LONG YES +Get Futures Position-Risk of Sub-account V2 (For Master Account) +Response + +USDT Margined Futures: + +{ + "futurePositionRiskVos": [ + { + "entryPrice": "9975.12000", + "leverage": "50", // current initial leverage + "maxNotional": "1000000", // notional value limit of current initial leverage + "liquidationPrice": "7963.54", + "markPrice": "9973.50770517", + "positionAmount": "0.010", + "symbol": "BTCUSDT", + "unrealizedProfit": "-0.01612295" + } + ] +} +COIN Margined Futures: + +{ + "deliveryPositionRiskVos": [ + { + "entryPrice": "9975.12000", + "markPrice": "9973.50770517", + "leverage": "20", + "isolated": "false", + "isolatedWallet": "9973.50770517", + "isolatedMargin": "0.00000000", + "isAutoAddMargin": "false", + "positionSide": "BOTH", + "positionAmount": "1.230", + "symbol": "BTCUSD_201225", + "unrealizedProfit": "-0.01612295" + } + ] +} +GET /sapi/v2/sub-account/futures/positionRisk + +Weight(IP): 1 + +Parameters: + +Name Type Mandatory Description +email STRING YES Sub-account email +futuresType INT YES 1:USDT Margined Futures, 2:COIN Margined Futures +recvWindow LONG NO +timestamp LONG YES +Get IP Restriction for a Sub-account API Key (For Master Account) +Response: + +{ + "ipRestrict": "true", + "ipList": [ + "69.210.67.14", + "8.34.21.10" + ], + "updateTime": 1636371437000, + "apiKey": "k5V49ldtn4tszj6W3hystegdfvmGbqDzjmkCtpTvC0G74WhK7yd4rfCTo4lShf" +} +GET /sapi/v1/sub-account/subAccountApi/ipRestriction + +Weight(UID): 3000 + +Parameters: + +Name Type Mandatory Description +email STRING YES Sub-account email +subAccountApiKey STRING YES +recvWindow LONG NO +timestamp LONG YES +Delete IP List For a Sub-account API Key (For Master Account) +Response: + +{ + "ipRestrict": "true", + "ipList": [ + "69.210.67.14", + "8.34.21.10" + ], + "updateTime": 1636371437000, + "apiKey": "k5V49ldtn4tszj6W3hystegdfvmGbqDzjmkCtpTvC0G74WhK7yd4rfCTo4lShf" +} +DELETE /sapi/v1/sub-account/subAccountApi/ipRestriction/ipList + +Weight(UID): 3000 + +Parameters: + +Name Type Mandatory Description +email STRING YES Sub-account email +subAccountApiKey STRING YES +ipAddress STRING NO Can be added in batches, separated by commas +recvWindow LONG NO +timestamp LONG YES +You need to enable Enable Spot & Margin Trading option for the api key which requests this endpoint +Add IP Restriction for Sub-Account API key (For Master Account) +Response: + +{ + "status": "2", + "ipList": [ + "69.210.67.14", + "8.34.21.10", //only return if you open IP restriction and input IP address. + ], + "updateTime": 1636371437000, + "apiKey": "k5V49ldtn4tszj6W3hystegdfvmGbqDzjmkCtpTvC0G74WhK7yd4rfCTo4lShf" +} +POST /sapi/v2/sub-account/subAccountApi/ipRestriction + +Weight(UID): 3000 + +Parameters: + +Name Type Mandatory Description +email STRING YES Sub-account email +subAccountApiKey STRING YES +status STRING YES IP Restriction status. 1 = IP Unrestricted. 2 = Restrict access to trusted IPs only. +ipAddress STRING NO Insert static IP in batch, separated by commas. +recvWindow LONG NO +timestamp LONG YES +You need to enable Enable Spot & Margin Trading option for the api key which requests this endpoint +Deposit Assets Into The Managed Sub-account(For Investor Master Account) +Response + +{ + "tranId":66157362489 +} +POST /sapi/v1/managed-subaccount/deposit + +Weight(IP): 1 + +Parameters: + +Name Type Mandatory Description +toEmail STRING YES +asset STRING YES +amount DECIMAL YES +recvWindow LONG NO +timestamp LONG YES +You need to enable Enable Spot & Margin Trading option for the api key which requests this endpoint +Query Managed Sub-account Asset Details(For Investor Master Account) +Response + +[ + { + "coin": "INJ", + "name": "Injective Protocol", + "totalBalance": "0", + "availableBalance": "0", + "inOrder": "0", + "btcValue": "0" + }, + { + "coin": "FILDOWN", + "name": "FILDOWN", + "totalBalance": "0", + "availableBalance": "0", + "inOrder": "0", + "btcValue": "0" + } +] +GET /sapi/v1/managed-subaccount/asset + +Weight(IP): 1 + +Parameters: + +Name Type Mandatory Description +email STRING YES +recvWindow LONG NO +timestamp LONG YES +Withdrawl Assets From The Managed Sub-account(For Investor Master Account) +Response + +{ + "tranId":66157362489 +} +POST /sapi/v1/managed-subaccount/withdraw + +Weight(IP): 1 + +Parameters: + +Name Type Mandatory Description +fromEmail STRING YES +asset STRING YES +amount DECIMAL YES +transferDate LONG NO Withdrawals is automatically occur on the transfer date(UTC0). If a date is not selected, the withdrawal occurs right now +recvWindow LONG NO +timestamp LONG YES +You need to enable Enable Spot & Margin Trading option for the api key which requests this endpoint +Query Managed Sub-account Snapshot(For Investor Master Account) +Response: + +{ + "code":200, // 200 for success; others are error codes + "msg":"", // error message + "snapshotVos":[ + { + "data":{ + "balances":[ + { + "asset":"BTC", + "free":"0.09905021", + "locked":"0.00000000" + }, + { + "asset":"USDT", + "free":"1.89109409", + "locked":"0.00000000" + } + ], + "totalAssetOfBtc":"0.09942700" + }, + "type":"spot", + "updateTime":1576281599000 + } + ] +} + +OR + +{ + "code":200, // 200 for success; others are error codes + "msg":"", // error message + "snapshotVos":[ + { + "data":{ + "marginLevel":"2748.02909813", + "totalAssetOfBtc":"0.00274803", + "totalLiabilityOfBtc":"0.00000100", + "totalNetAssetOfBtc":"0.00274750", + "userAssets":[ + { + "asset":"XRP", + "borrowed":"0.00000000", + "free":"1.00000000", + "interest":"0.00000000", + "locked":"0.00000000", + "netAsset":"1.00000000" + } + ] + }, + "type":"margin", + "updateTime":1576281599000 + } + ] +} +OR + +{ + "code":200, // 200 for success; others are error codes + "msg":"", // error message + "snapshotVos":[ + { + "data":{ + "assets":[ + { + "asset":"USDT", + "marginBalance":"118.99782335", + "walletBalance":"120.23811389" + } + ], + "position":[ + { + "entryPrice":"7130.41000000", + "markPrice":"7257.66239673", + "positionAmt":"0.01000000", + "symbol":"BTCUSDT", + "unRealizedProfit":"1.24029054" // Only show the value at the time of opening the position + } + ] + }, + "type":"futures", + "updateTime":1576281599000 + } + ] +} +GET /sapi/v1/managed-subaccount/accountSnapshot + +Weight(IP): 2400 + +Parameters: + +Name Type Mandatory Description +email STRING YES +type STRING YES "SPOT", "MARGIN"(cross), "FUTURES"(UM) +startTime LONG NO +endTime LONG NO +limit INT NO min 7, max 30, default 7 +recvWindow LONG NO +timestamp LONG YES +The query time period must be less then 30 days +Support query within the last one month only +If startTimeand endTime not sent, return records of the last 7 days by default +Query Managed Sub Account Transfer Log (For Investor Master Account) (USER_DATA) +Response + +{ + managerSubTransferHistoryVos: [ + { + fromEmail: "test_0_virtual@kq3kno9imanagedsub.com" + fromAccountType: "SPOT" + toEmail: "wdywl0lddakh@test.com" + toAccountType: "SPOT" + asset: "BNB" + amount: "0.01" + scheduledData: 1679416673000 + createTime: 1679416673000 + status: "SUCCESS" + tranId: 91077779 + }, + { + fromEmail: "wdywl0lddakh@test.com" + fromAccountType: "SPOT" + toEmail: "test_0_virtual@kq3kno9imanagedsub.com" + toAccountType: "SPOT" + asset: "BNB" + amount: "1" + scheduledData: 1679416616000 + createTime: 1679416616000 + status: "SUCCESS" + tranId: 91077676 + } + ] + count: 2 +} +GET /sapi/v1/managed-subaccount/queryTransLogForInvestor + +Investor can use this api to query managed sub account transfer log. This endpoint is available for investor of Managed Sub-Account. A Managed Sub-Account is an account type for investors who value flexibility in asset allocation and account application, while delegating trades to a professional trading team. Please refer to link + +Weight(IP): 1 + +Parameters: + +Name Type Mandatory Description +email STRING YES Managed Sub Account Email +startTime LONG YES Start Time +endTime LONG YES End Time (The start time and end time interval cannot exceed half a year) +page INT YES Page +limit INT YES Limit (Max: 500) +transfers STRING NO Transfer Direction (from/to) +transferFunctionAccountType STRING NO Transfer function account type (SPOT/MARGIN/ISOLATED_MARGIN/USDT_FUTURE/COIN_FUTURE) +Query Managed Sub Account Transfer Log (For Trading Team Master Account) (USER_DATA) +Response + +{ + managerSubTransferHistoryVos: [ + { + fromEmail: "test_0_virtual@kq3kno9imanagedsub.com" + fromAccountType: "SPOT" + toEmail: "wdywl0lddakh@test.com" + toAccountType: "SPOT" + asset: "BNB" + amount: "0.01" + scheduledData: 1679416673000 + createTime: 1679416673000 + status: "SUCCESS" + tranId: 91077779 + }, + { + fromEmail: "wdywl0lddakh@test.com" + fromAccountType: "SPOT" + toEmail: "test_0_virtual@kq3kno9imanagedsub.com" + toAccountType: "SPOT" + asset: "BNB" + amount: "1" + scheduledData: 1679416616000 + createTime: 1679416616000 + status: "SUCCESS" + tranId: 91077676 + } + ] + count: 2 +} +GET /sapi/v1/managed-subaccount/queryTransLogForTradeParent + +Trading team can use this api to query managed sub account transfer log. This endpoint is available for trading team of Managed Sub-Account. A Managed Sub-Account is an account type for investors who value flexibility in asset allocation and account application, while delegating trades to a professional trading team. Please refer to link + +Weight(UID): 60 + +Parameters: + +Name Type Mandatory Description +email STRING YES Managed Sub Account Email +startTime LONG YES Start Time +endTime LONG YES End Time (The start time and end time interval cannot exceed half a year) +page INT YES Page +limit INT YES Limit (Max: 500) +transfers STRING NO Transfer Direction (FROM/TO) +transferFunctionAccountType STRING NO Transfer function account type (SPOT/MARGIN/ISOLATED_MARGIN/USDT_FUTURE/COIN_FUTURE) +Query Managed Sub-account Futures Asset Details(For Investor Master Account)(USER_DATA) +Response + +{ + "code": "200", + "message": "OK", + "snapshotVos": [ + { + "type": "FUTURES", + "updateTime": 1672893855394, + "data": { + "assets": [ + { + "asset": "USDT", + "marginBalance": 100, + "walletBalance": 120 + } + ], + "position": [ + { + "symbol": "BTCUSDT", + "entryPrice": 17000, + "markPrice": 17000, + "positionAmt": 0.0001 + } + ] + } + } + ] +} +GET /sapi/v1/managed-subaccount/fetch-future-asset + +Investor can use this api to query managed sub account futures asset details + +Weight(UID): 60 + +Parameters: + +Name Type Mandatory Description +email STRING YES Managed Sub Account Email +Query Managed Sub-account Margin Asset Details (For Investor Master Account) (USER_DATA) +Response + +{ + marginLevel:"999" + totalAssetOfBtc:"0" + totalLiabilityOfBtc:"0" + totalNetAssetOfBtc:"0" + userAssets:[ + 0:{ + asset:"MATIC" + borrowed:"0" + free:"0" + interest:"0" + locked:"0" + netAsset:"0" + } + 1:{ + asset:"VET" + borrowed:"0" + free:"0" + interest:"0" + locked:"0" + netAsset:"0" + } + 2:{ + asset:"BAKE" + borrowed:"0" + free:"0" + interest:"0" + locked:"0" + netAsset:"0" + } + 3:{ + asset:"SHIB" + borrowed:"0" + free:"0" + interest:"0" + locked:"0" + netAsset:"0" + } + 4:{ + asset:"USDT" + borrowed:"0" + free:"0" + interest:"0" + locked:"0" + netAsset:"0" + } + 5:{ + asset:"DOGE" + borrowed:"0" + free:"0" + interest:"0" + locked:"0" + netAsset:"0" + } + 6:{ + asset:"AAVE" + borrowed:"0" + free:"0" + interest:"0" + locked:"0" + netAsset:"0" + } + 7:{ + asset:"ONT" + borrowed:"0" + free:"0" + interest:"0" + locked:"0" + netAsset:"0" + } + 8:{ + asset:"XRP" + borrowed:"0" + free:"0" + interest:"0" + locked:"0" + netAsset:"0" + } + 9:{ + asset:"XLM" + borrowed:"0" + free:"0" + interest:"0" + locked:"0" + netAsset:"0" + } + 10:{ + asset:"LINK" + borrowed:"0" + free:"0" + interest:"0" + locked:"0" + netAsset:"0" + } + 11:{ + asset:"QTUM" + borrowed:"0" + free:"0" + interest:"0" + locked:"0" + netAsset:"0" + } + 12:{ + asset:"ETHW" + borrowed:"0" + free:"0" + interest:"0" + locked:"0" + netAsset:"0" + } + 13:{ + asset:"XTZ" + borrowed:"0" + free:"0" + interest:"0" + locked:"0" + netAsset:"0" + } + 14:{ + asset:"LUNA" + borrowed:"0" + free:"0" + interest:"0" + locked:"0" + netAsset:"0" + } + 15:{ + asset:"EUR" + borrowed:"0" + free:"0" + interest:"0" + locked:"0" + netAsset:"0" + } + 16:{ + asset:"IOST" + borrowed:"0" + free:"0" + interest:"0" + locked:"0" + netAsset:"0" + } + 17:{ + asset:"BCH" + borrowed:"0" + free:"0" + interest:"0" + locked:"0" + netAsset:"0" + } + 18:{ + asset:"BTC" + borrowed:"0" + free:"0" + interest:"0" + locked:"0" + netAsset:"0" + } + 19:{ + asset:"IOTA" + borrowed:"0" + free:"0" + interest:"0" + locked:"0" + netAsset:"0" + } + 20:{ + asset:"CREAM" + borrowed:"0" + free:"0" + interest:"0" + locked:"0" + netAsset:"0" + } + 21:{ + asset:"BAT" + borrowed:"0" + free:"0" + interest:"0" + locked:"0" + netAsset:"0" + } + 22:{ + asset:"BNB" + borrowed:"0" + free:"0" + interest:"0" + locked:"0" + netAsset:"0" + } + 23:{ + asset:"ETH" + borrowed:"0" + free:"0" + interest:"0" + locked:"0" + netAsset:"0" + } + 24:{ + asset:"ZEC" + borrowed:"0" + free:"0" + interest:"0" + locked:"0" + netAsset:"0" + } + 25:{ + asset:"USDC" + borrowed:"0" + free:"0" + interest:"0" + locked:"0" + netAsset:"0" + } + 26:{ + asset:"LTC" + borrowed:"0" + free:"0" + interest:"0" + locked:"0" + netAsset:"0" + } + 27:{ + asset:"BUSD" + borrowed:"0" + free:"0" + interest:"0" + locked:"0" + netAsset:"0" + } + 28:{ + asset:"ZIL" + borrowed:"0" + free:"0" + interest:"0" + locked:"0" + netAsset:"0" + } + 29:{ + asset:"THETA" + borrowed:"0" + free:"0" + interest:"0" + locked:"0" + netAsset:"0" + } + ] +} +GET /sapi/v1/managed-subaccount/marginAsset + +Investor can use this api to query managed sub account margin asset details + +Weight(IP): 1 + +Parameters: + +Name Type Mandatory Description +email STRING YES Managed Sub Account Email +Query Sub-account Assets (For Master Account)(USER_DATA) +Response + +{ + "balances":[ + { + "asset":"ADA", + "free":"10000", + "locked":"0" + }, + { + "asset":"BNB", + "free":"10003", + "locked":"0" + }, + { + "asset":"BTC", + "free":"11467.6399", + "locked":"0" + } + ] +} +GET /sapi/v4/sub-account/assets + +Fetch sub-account assets + +Weight(UID): 60 + +Parameters: + +Name Type Mandatory Description +email STRING YES Managed Sub Account Email +recvWindow LONG NO +timestamp LONG YES +Query Managed Sub-account List (For Investor)(USER_DATA) +Response + +{ + total: 3 + managerSubUserInfoVoList: [ + 0: { + rootUserId: 1000138475670 + managersubUserId: 1000137842513 + bindParentUserId: 1000138475669 + email: "test_0_virtual@kq3kno9imanagedsub.com" + insertTimeStamp: 1678435149000 + bindParentEmail: "wdyw8xsh8pey@test.com" + isSubUserEnabled: true + isUserActive: true + isMarginEnabled: false + isFutureEnabled: false + isSignedLVTRiskAgreement: false + } + 1: { + rootUserId: 1000138475670 + managersubUserId: 1000137842514 + bindParentUserId: 1000138475669 + email: "test_1_virtual@4qd2u7zxmanagedsub.com" + insertTimeStamp: 1678435152000 + bindParentEmail: "wdyw8xsh8pey@test.com" + isSubUserEnabled: true + isUserActive: true + isMarginEnabled: false + isFutureEnabled: false + isSignedLVTRiskAgreement: false + } + 2: { + rootUserId: 1000138475670 + managersubUserId: 1000137842515 + bindParentUserId: 1000138475669 + email: "test_2_virtual@akc05o8hmanagedsub.com" + insertTimeStamp: 1678435153000 + bindParentEmail: "wdyw8xsh8pey@test.com" + isSubUserEnabled: true + isUserActive: true + isMarginEnabled: false + isFutureEnabled: false + isSignedLVTRiskAgreement: false + } + ] +} +GET /sapi/v1/managed-subaccount/info + +Get investor's managed sub-account list. + +Weight(UID): 60 + +Parameters: + +Name Type Mandatory Description +email STRING NO Managed sub-account email +page INT NO Default value: 1 +limit INT NO Default value: 20, Max value: 20 +recvWindow LONG NO +timestamp LONG YES +Query Sub-account Transaction Statistics (For Master Account) (USER_DATA) +Response example: + +{ + "recent30BtcTotal": "0", + "recent30BtcFuturesTotal": "0", + "recent30BtcMarginTotal": "0", + "recent30BusdTotal": "0", + "recent30BusdFuturesTotal": "0", + "recent30BusdMarginTotal": "0", + "tradeInfoVos": [] +} +OR + +{ + "recent30BtcTotal": "0", + "recent30BtcFuturesTotal": "0", + "recent30BtcMarginTotal": "0", + "recent30BusdTotal": "0", + "recent30BusdFuturesTotal": "0", + "recent30BusdMarginTotal": "0", + "tradeInfoVos": [ + { + "userId": 1000138138384, + "btc": 0, + "btcFutures": 0, + "btcMargin": 0, + "busd": 0, + "busdFutures": 0, + "busdMargin": 0, + "date": 1676851200000 + }, + { + "userId": 1000138138384, + "btc": 0, + "btcFutures": 0, + "btcMargin": 0, + "busd": 0, + "busdFutures": 0, + "busdMargin": 0, + "date": 1677110400000 + }, + { + "userId": 1000138138384, + "btc": 0, + "btcFutures": 0, + "btcMargin": 0, + "busd": 0, + "busdFutures": 0, + "busdMargin": 0, + "date": 1677369600000 + } + ] +} +GET /sapi/v1/sub-account/transaction-statistics + +Query Sub-account Transaction statistics (For Master Account). + +Weight(UID): 60 + +Parameters: + +Name Type Mandatory Description +email STRING YES Sub user email +recvWindow LONG NO +timestamp LONG YES +Get Managed Sub-account Deposit Address (For Investor Master Account) (USER_DATA) +Response: + +{ + "coin": "USDT", + "address": "0x206c22d833bb0bb2102da6b7c7d4c3eb14bcf73d", + "tag": "", + "url": "https://etherscan.io/address/0x206c22d833bb0bb2102da6b7c7d4c3eb14bcf73d" +} +GET /sapi/v1/managed-subaccount/deposit/address + +Get investor's managed sub-account deposit address. + +Weight(UID): 1 + +Parameters: + +Name Type Mandatory Description +email STRING YES Sub user email +coin STRING YES +network STRING NO networks can be found in GET /sapi/v1/capital/deposit/address +recvWindow LONG NO +timestamp LONG YES +If network is not send, return with default network of the coin. +Enable Options for Sub-account (For Master Account)(USER_DATA) +Response: + +{ + + "email":"123@test.com", + "isEOptionsEnabled": true // true or false +} +POST /sapi/v1/sub-account/eoptions/enable + +Enable Options for Sub-account (For Master Account). + +Weight(IP): 1 + +Parameters: + +Name Type Mandatory Description +email STRING YES Sub user email +recvWindow LONG NO +timestamp LONG YES +Query Managed Sub Account Transfer Log (For Trading Team Sub Account)(USER_DATA) +Response: + +{ + "managerSubTransferHistoryVos": [ + { + "fromEmail": "test_0_virtual@kq3kno9imanagedsub.com", + "fromAccountType": "SPOT", + "toEmail": "wdywl0lddakh@test.com", + "toAccountType": "SPOT", + "asset": "BNB", + "amount": "0.01", + "scheduledData": 1679416673000, + "createTime": 1679416673000, + "status": "SUCCESS", + "tranId": 91077779 + }, + { + "fromEmail": "wdywl0lddakh@test.com", + "fromAccountType": "SPOT", + "toEmail": "test_0_virtual@kq3kno9imanagedsub.com", + "toAccountType": "SPOT", + "asset": "BNB", + "amount": "1", + "scheduledData": 1679416616000, + "createTime": 1679416616000, + "status": "SUCCESS", + "tranId": 91077676 + } + ], + "count": 2 +} +GET /sapi/v1/managed-subaccount/query-trans-log + +Query Managed Sub Account Transfer Log (For Trading Team Sub Account) + +Weight(UID): 60 + +Parameters: + +Name Type Mandatory Description +startTime LONG YES Start Time +endTime LONG YES End Time (The start time and end time interval cannot exceed half a year) +page INT YES Page +limit INT YES Limit (Max: 500) +transfers STRING NO Transfer Direction (FROM/TO) +transferFunctionAccountType STRING NO Transfer function account type (SPOT/MARGIN/ISOLATED_MARGIN/USDT_FUTURE/COIN_FUTURE) +recvWindow LONG NO +timestamp LONG YES +Market Data Endpoints +Test Connectivity +Response: + +{} +GET /api/v3/ping + +Test connectivity to the Rest API. + +Weight(IP): 1 + +Parameters: + +NONE + +Data Source: Memory + +Check Server Time +Response: + +{ + "serverTime": 1499827319559 +} +GET /api/v3/time + +Test connectivity to the Rest API and get the current server time. + +Weight(IP): 1 + +Parameters: + +NONE + +Data Source: Memory + +Exchange Information +Response: + +{ + "timezone": "UTC", + "serverTime": 1565246363776, + "rateLimits": [ + { + //These are defined in the `ENUM definitions` section under `Rate Limiters (rateLimitType)`. + //All limits are optional + } + ], + "exchangeFilters": [ + //These are the defined filters in the `Filters` section. + //All filters are optional. + ], + "symbols": [ + { + "symbol": "ETHBTC", + "status": "TRADING", + "baseAsset": "ETH", + "baseAssetPrecision": 8, + "quoteAsset": "BTC", + "quotePrecision": 8, + "quoteAssetPrecision": 8, + "orderTypes": [ + "LIMIT", + "LIMIT_MAKER", + "MARKET", + "STOP_LOSS", + "STOP_LOSS_LIMIT", + "TAKE_PROFIT", + "TAKE_PROFIT_LIMIT" + ], + "icebergAllowed": true, + "ocoAllowed": true, + "quoteOrderQtyMarketAllowed": true, + "allowTrailingStop": false, + "cancelReplaceAllowed": false, + "isSpotTradingAllowed": true, + "isMarginTradingAllowed": true, + "filters": [ + //These are defined in the Filters section. + //All filters are optional + ], + "permissions": [], + "permissionSets": [ + [ + "SPOT", + "MARGIN" + ] + ], + "defaultSelfTradePreventionMode": "NONE", + "allowedSelfTradePreventionModes": [ + "NONE" + ] + } + ] +} +GET /api/v3/exchangeInfo + +Current exchange trading rules and symbol information + +Weight(IP): 20 + +Parameters: + +Name Type Mandatory Description +symbol STRING No Example: curl -X GET "https://api.binance.com/api/v3/exchangeInfo?symbol=BNBBTC" +symbols ARRAY OF STRING No Examples: curl -X GET "https://api.binance.com/api/v3/exchangeInfo?symbols=%5B%22BNBBTC%22,%22BTCUSDT%22%5D" +or +curl -g -X GET 'https://api.binance.com/api/v3/exchangeInfo?symbols=["BTCUSDT","BNBBTC"]' +permissions ENUM No Examples: curl -X GET "https://api.binance.com/api/v3/exchangeInfo?permissions=SPOT" +or +curl -X GET "https://api.binance.com/api/v3/exchangeInfo?permissions=%5B%22MARGIN%22%2C%22LEVERAGED%22%5D" +or +curl -g -X GET 'https://api.binance.com/api/v3/exchangeInfo?permissions=["MARGIN","LEVERAGED"]' +showPermissionSets BOOLEAN No Controls whether the content of the permissionSets field is populated or not. Defaults to true. +symbolStatus ENUM No Filters symbols that have this tradingStatus. Valid values: TRADING, HALT, BREAK +Cannot be used in combination with symbols or symbol. +Notes: + +If the value provided to symbol or symbols do not exist, the endpoint will throw an error saying the symbol is invalid. +All parameters are optional. +permissions can support single or multiple values (e.g. SPOT, ["MARGIN","LEVERAGED"]). This cannot be used in combination with symbol or symbols. +If permissions parameter not provided, all symbols that have either SPOT, MARGIN, or LEVERAGED permission will be exposed. +To display symbols with any permission you need to specify them explicitly in permissions: (e.g. ["SPOT","MARGIN",...].). See Account and Symbol Permissions for the full list. +Examples of Symbol Permissions Interpretation from the Response: +[["A","B"]] means you may place an order if your account has either permission "A" or permission "B". +[["A"],["B"]] means you can place an order if your account has permission "A" and permission "B". +[["A"],["B","C"]] means you can place an order if your account has permission "A" and permission "B" or permission "C". (Inclusive or is applied here, not exclusive or, so your account may have both permission "B" and permission "C".) +Data Source: Memory + +Order Book +Response: + +{ + "lastUpdateId": 1027024, + "bids": [ + [ + "4.00000000", // PRICE + "431.00000000" // QTY + ] + ], + "asks": [ + [ + "4.00000200", + "12.00000000" + ] + ] +} +GET /api/v3/depth + +Weight(IP): + +Adjusted based on the limit: + +Limit Weight +1-100 5 +101-500 25 +501-1000 50 +1001-5000 250 +Parameters: + +Name Type Mandatory Description +symbol STRING YES +limit INT NO Default 100; max 5000. + +If limit > 5000, then the response will truncate to 5000. +Data Source: Memory + +Recent Trades List +Response: + +[ + { + "id": 28457, + "price": "4.00000100", + "qty": "12.00000000", + "quoteQty": "48.000012", + "time": 1499865549590, + "isBuyerMaker": true, + "isBestMatch": true + } +] +GET /api/v3/trades + +Get recent trades. + +Weight(IP): 25 + +Parameters: + +Name Type Mandatory Description +symbol STRING YES +limit INT NO Default 500; max 1000. +Data Source: Memory + +Old Trade Lookup +Response: + +[ + { + "id": 28457, + "price": "4.00000100", + "qty": "12.00000000", + "quoteQty": "48.000012", + "time": 1499865549590, // Trade executed timestamp, as same as `T` in the stream + "isBuyerMaker": true, + "isBestMatch": true + } +] +GET /api/v3/historicalTrades + +Get older market trades. + +Weight(IP): 25 + +Parameters: + +Name Type Mandatory Description +symbol STRING YES +limit INT NO Default 500; max 1000. +fromId LONG NO Trade id to fetch from. Default gets most recent trades. +Data Source: Database + +Compressed/Aggregate Trades List +Response: + +[ + { + "a": 26129, // Aggregate tradeId + "p": "0.01633102", // Price + "q": "4.70443515", // Quantity + "f": 27781, // First tradeId + "l": 27781, // Last tradeId + "T": 1498793709153, // Timestamp + "m": true, // Was the buyer the maker? + "M": true // Was the trade the best price match? + } +] +GET /api/v3/aggTrades + +Get compressed, aggregate trades. Trades that fill at the time, from the same order, with the same price will have the quantity aggregated. + +Weight(IP): 2 + +Parameters: + +Name Type Mandatory Description +symbol STRING YES +fromId LONG NO id to get aggregate trades from INCLUSIVE. +startTime LONG NO Timestamp in ms to get aggregate trades from INCLUSIVE. +endTime LONG NO Timestamp in ms to get aggregate trades until INCLUSIVE. +limit INT NO Default 500; max 1000. +If fromId, startTime, and endTime are not sent, the most recent aggregate trades will be returned. +Note that if a trade has the following values, this was a duplicate aggregate trade and marked as invalid: +p = '0' // price +q = '0' // qty +f = -1 // first_trade_id +l = -1 // last_trade_id +Data Source: Database + +Kline/Candlestick Data +Response: + +[ + [ + 1499040000000, // Kline open time + "0.01634790", // Open price + "0.80000000", // High price + "0.01575800", // Low price + "0.01577100", // Close price + "148976.11427815", // Volume + 1499644799999, // Kline Close time + "2434.19055334", // Quote asset volume + 308, // Number of trades + "1756.87402397", // Taker buy base asset volume + "28.46694368", // Taker buy quote asset volume + "0" // Unused field, ignore. + ] +] +GET /api/v3/klines + +Kline/candlestick bars for a symbol. +Klines are uniquely identified by their open time. + +Weight(IP): 2 + +Parameters: + +Name Type Mandatory Description +symbol STRING YES +interval ENUM YES +startTime LONG NO +endTime LONG NO +timeZone STRING NO Default: 0 (UTC) +limit INT NO Default 500; max 1000. +If startTime and endTime are not sent, the most recent klines are returned. +Supported values for timeZone: +Hours and minutes (e.g. -1:00, 05:45) +Only hours (e.g. 0, 8, 4) +Accepted range is strictly [-12:00 to +14:00] inclusive +If timeZone provided, kline intervals are interpreted in that timezone instead of UTC. +Note that startTime and endTime are always interpreted in UTC, regardless of timeZone. +Data Source: Database + +UIKlines +Response: + +[ + [ + 1499040000000, // Kline open time + "0.01634790", // Open price + "0.80000000", // High price + "0.01575800", // Low price + "0.01577100", // Close price + "148976.11427815", // Volume + 1499644799999, // Kline close time + "2434.19055334", // Quote asset volume + 308, // Number of trades + "1756.87402397", // Taker buy base asset volume + "28.46694368", // Taker buy quote asset volume + "0" // Unused field. Ignore. + ] +] +GET /api/v3/uiKlines + +The request is similar to klines having the same parameters and response. + +uiKlines return modified kline data, optimized for presentation of candlestick charts. + +Weight: 2 + +Parameters: + +Name Type Mandatory Description +symbol STRING YES +interval ENUM YES +startTime LONG NO +endTime LONG NO +timeZone STRING NO Default: 0 (UTC) +limit INT NO Default 500; max 1000. +If startTime and endTime are not sent, the most recent klines are returned. +Supported values for timeZone: +Hours and minutes (e.g. -1:00, 05:45) +Only hours (e.g. 0, 8, 4) +Accepted range is strictly [-12:00 to +14:00] inclusive +If timeZone provided, kline intervals are interpreted in that timezone instead of UTC. +Note that startTime and endTime are always interpreted in UTC, regardless of timeZone. +Data Source: Database + +Current Average Price +Response: + +{ + "mins": 5, // Average price interval (in minutes) + "price": "9.35751834", // Average price + "closeTime": 1694061154503 // Last trade time +} +GET /api/v3/avgPrice + +Current average price for a symbol. + +Weight(IP): 2 + +Parameters: + +Name Type Mandatory Description +symbol STRING YES +Data Source: Memory + +24hr Ticker Price Change Statistics +Response: - FULL + +{ + "symbol": "BNBBTC", + "priceChange": "-94.99999800", + "priceChangePercent": "-95.960", + "weightedAvgPrice": "0.29628482", + "prevClosePrice": "0.10002000", + "lastPrice": "4.00000200", + "lastQty": "200.00000000", + "bidPrice": "4.00000000", + "bidQty": "100.00000000", + "askPrice": "4.00000200", + "askQty": "100.00000000", + "openPrice": "99.00000000", + "highPrice": "100.00000000", + "lowPrice": "0.10000000", + "volume": "8913.30000000", + "quoteVolume": "15.30000000", + "openTime": 1499783499040, + "closeTime": 1499869899040, + "firstId": 28385, // First tradeId + "lastId": 28460, // Last tradeId + "count": 76 // Trade count +} +OR + +[ + { + "symbol": "BNBBTC", + "priceChange": "-94.99999800", + "priceChangePercent": "-95.960", + "weightedAvgPrice": "0.29628482", + "prevClosePrice": "0.10002000", + "lastPrice": "4.00000200", + "lastQty": "200.00000000", + "bidPrice": "4.00000000", + "bidQty": "100.00000000", + "askPrice": "4.00000200", + "askQty": "100.00000000", + "openPrice": "99.00000000", + "highPrice": "100.00000000", + "lowPrice": "0.10000000", + "volume": "8913.30000000", + "quoteVolume": "15.30000000", + "openTime": 1499783499040, + "closeTime": 1499869899040, + "firstId": 28385, // First tradeId + "lastId": 28460, // Last tradeId + "count": 76 // Trade count + } +] +Response - MINI + +{ + "symbol": "BNBBTC", // Symbol Name + "openPrice": "99.00000000", // Opening price of the Interval + "highPrice": "100.00000000", // Highest price in the interval + "lowPrice": "0.10000000", // Lowest price in the interval + "lastPrice": "4.00000200", // Closing price of the interval + "volume": "8913.30000000", // Total trade volume (in base asset) + "quoteVolume": "15.30000000", // Total trade volume (in quote asset) + "openTime": 1499783499040, // Start of the ticker interval + "closeTime": 1499869899040, // End of the ticker interval + "firstId": 28385, // First tradeId considered + "lastId": 28460, // Last tradeId considered + "count": 76 // Total trade count +} +OR + +[ + { + "symbol": "BNBBTC", + "openPrice": "99.00000000", + "highPrice": "100.00000000", + "lowPrice": "0.10000000", + "lastPrice": "4.00000200", + "volume": "8913.30000000", + "quoteVolume": "15.30000000", + "openTime": 1499783499040, + "closeTime": 1499869899040, + "firstId": 28385, + "lastId": 28460, + "count": 76 + }, + { + "symbol": "LTCBTC", + "openPrice": "0.07000000", + "highPrice": "0.07000000", + "lowPrice": "0.07000000", + "lastPrice": "0.07000000", + "volume": "11.00000000", + "quoteVolume": "0.77000000", + "openTime": 1656908192899, + "closeTime": 1656994592899, + "firstId": 0, + "lastId": 10, + "count": 11 + } +] +GET /api/v3/ticker/24hr + +24 hour rolling window price change statistics. Careful when accessing this with no symbol. + +Weight(IP): + +Parameter Symbols Provided Weight +symbol 1 2 +symbol parameter is omitted 80 +symbols 1-20 2 +21-100 40 +101 or more 80 +symbols parameter is omitted 80 +Parameters: + +Name Type Mandatory Description +symbol STRING NO Parameter symbol and symbols cannot be used in combination. + +If neither parameter is sent, tickers for all symbols will be returned in an array. + + + +Examples of accepted format for the symbols parameter: ["BTCUSDT","BNBUSDT"] + +or + +%5B%22BTCUSDT%22,%22BNBUSDT%22%5D +symbols STRING NO +type ENUM NO Supported values: FULL or MINI. + +If none provided, the default is FULL +Data Source: Memory + +Trading Day Ticker +Response: - FULL + +{ + "symbol": "BTCUSDT", + "priceChange": "-83.13000000", // Absolute price change + "priceChangePercent": "-0.317", // Relative price change in percent + "weightedAvgPrice": "26234.58803036", // quoteVolume / volume + "openPrice": "26304.80000000", + "highPrice": "26397.46000000", + "lowPrice": "26088.34000000", + "lastPrice": "26221.67000000", + "volume": "18495.35066000", // Volume in base asset + "quoteVolume": "485217905.04210480", // Volume in quote asset + "openTime": 1695686400000, + "closeTime": 1695772799999, + "firstId": 3220151555, // Trade ID of the first trade in the interval + "lastId": 3220849281, // Trade ID of the last trade in the interval + "count": 697727 // Number of trades in the interval +} +OR + +[ + { + "symbol": "BTCUSDT", + "priceChange": "-83.13000000", + "priceChangePercent": "-0.317", + "weightedAvgPrice": "26234.58803036", + "openPrice": "26304.80000000", + "highPrice": "26397.46000000", + "lowPrice": "26088.34000000", + "lastPrice": "26221.67000000", + "volume": "18495.35066000", + "quoteVolume": "485217905.04210480", + "openTime": 1695686400000, + "closeTime": 1695772799999, + "firstId": 3220151555, + "lastId": 3220849281, + "count": 697727 + }, + { + "symbol": "BNBUSDT", + "priceChange": "2.60000000", + "priceChangePercent": "1.238", + "weightedAvgPrice": "211.92276958", + "openPrice": "210.00000000", + "highPrice": "213.70000000", + "lowPrice": "209.70000000", + "lastPrice": "212.60000000", + "volume": "280709.58900000", + "quoteVolume": "59488753.54750000", + "openTime": 1695686400000, + "closeTime": 1695772799999, + "firstId": 672397461, + "lastId": 672496158, + "count": 98698 + } +] +Response: - MINI + +{ + "symbol": "BTCUSDT", + "openPrice": "26304.80000000", + "highPrice": "26397.46000000", + "lowPrice": "26088.34000000", + "lastPrice": "26221.67000000", + "volume": "18495.35066000", // Volume in base asset + "quoteVolume": "485217905.04210480", // Volume in quote asset + "openTime": 1695686400000, + "closeTime": 1695772799999, + "firstId": 3220151555, // Trade ID of the first trade in the interval + "lastId": 3220849281, // Trade ID of the last trade in the interval + "count": 697727 // Number of trades in the interval +} +OR + +[ + { + "symbol": "BTCUSDT", + "openPrice": "26304.80000000", + "highPrice": "26397.46000000", + "lowPrice": "26088.34000000", + "lastPrice": "26221.67000000", + "volume": "18495.35066000", + "quoteVolume": "485217905.04210480", + "openTime": 1695686400000, + "closeTime": 1695772799999, + "firstId": 3220151555, + "lastId": 3220849281, + "count": 697727 + }, + { + "symbol": "BNBUSDT", + "openPrice": "210.00000000", + "highPrice": "213.70000000", + "lowPrice": "209.70000000", + "lastPrice": "212.60000000", + "volume": "280709.58900000", + "quoteVolume": "59488753.54750000", + "openTime": 1695686400000, + "closeTime": 1695772799999, + "firstId": 672397461, + "lastId": 672496158, + "count": 98698 + } +] +GET /api/v3/ticker/tradingDay + +Price change statistics for a trading day. + +Weight: + +4 for each requested symbol. + +The weight for this request will cap at 200 once the number of symbols in the request is more than 50. + +Parameters: + +Name Type Mandatory Description +symbol STRING YES Either symbol or symbols must be provided. + +Examples of accepted format for the symbols parameter: +["BTCUSDT","BNBUSDT"] +or +%5B%22BTCUSDT%22,%22BNBUSDT%22%5D + +The maximum number of symbols allowed in a request is 100. +symbols +timeZone STRING NO Default: 0 (UTC) +type ENUM NO Supported values: FULL or MINI. + +If none provided, the default is FULL. +Notes: + +Supported values for timeZone: +Hours and minutes (e.g. -1:00, 05:45) +Only hours (e.g. 0, 8, 4) +Data Source: Database + +Symbol Price Ticker +Response: + +{ + "symbol": "LTCBTC", + "price": "4.00000200" +} +OR + +[ + { + "symbol": "LTCBTC", + "price": "4.00000200" + }, + { + "symbol": "ETHBTC", + "price": "0.07946600" + } +] +GET /api/v3/ticker/price + +Latest price for a symbol or symbols. + +Weight(IP): + +Parameter Symbols Provided Weight +symbol 1 2 +symbol parameter is omitted 4 +symbols Any 4 +Parameters: + +Name Type Mandatory Description +symbol STRING NO Parameter symbol and symbols cannot be used in combination. + +If neither parameter is sent, prices for all symbols will be returned in an array. + + + +Examples of accepted format for the symbols parameter: ["BTCUSDT","BNBUSDT"] + +or + +%5B%22BTCUSDT%22,%22BNBUSDT%22%5D +symbols STRING NO +Data Source: Memory + +Symbol Order Book Ticker +Response: + +{ + "symbol": "LTCBTC", + "bidPrice": "4.00000000", + "bidQty": "431.00000000", + "askPrice": "4.00000200", + "askQty": "9.00000000" +} +OR + +[ + { + "symbol": "LTCBTC", + "bidPrice": "4.00000000", + "bidQty": "431.00000000", + "askPrice": "4.00000200", + "askQty": "9.00000000" + }, + { + "symbol": "ETHBTC", + "bidPrice": "0.07946700", + "bidQty": "9.00000000", + "askPrice": "100000.00000000", + "askQty": "1000.00000000" + } +] +GET /api/v3/ticker/bookTicker + +Best price/qty on the order book for a symbol or symbols. + +Weight(IP): + +Parameter Symbols Provided Weight +symbol 1 2 +symbol parameter is omitted 4 +symbols Any 4 +Parameters: + +Name Type Mandatory Description +symbol STRING NO Parameter symbol and symbols cannot be used in combination. + +If neither parameter is sent, bookTickers for all symbols will be returned in an array. + + + +Examples of accepted format for the symbols parameter: ["BTCUSDT","BNBUSDT"] + +or + +%5B%22BTCUSDT%22,%22BNBUSDT%22%5D +symbols STRING NO +Data Source: Memory + +Rolling window price change statistics +Response: - FULL + +{ + "symbol": "BNBBTC", + "priceChange": "-8.00000000", // Absolute price change + "priceChangePercent": "-88.889", // Relative price change in percent + "weightedAvgPrice": "2.60427807", // QuoteVolume / Volume + "openPrice": "9.00000000", + "highPrice": "9.00000000", + "lowPrice": "1.00000000", + "lastPrice": "1.00000000", + "volume": "187.00000000", + "quoteVolume": "487.00000000", // Sum of (price * volume) for all trades + "openTime": 1641859200000, // Open time for ticker window + "closeTime": 1642031999999, // Current Time of the Request + "firstId": 0, // Trade IDs + "lastId": 60, + "count": 61 // Number of trades in the interval +} + +OR + +[ + { + "symbol": "BTCUSDT", + "priceChange": "-154.13000000", // Absolute price change + "priceChangePercent": "-0.740", // Relative price change in percent + "weightedAvgPrice": "20677.46305250", // QuoteVolume / Volume + "openPrice": "20825.27000000", + "highPrice": "20972.46000000", + "lowPrice": "20327.92000000", + "lastPrice": "20671.14000000", + "volume": "72.65112300", + "quoteVolume": "1502240.91155513", // Sum of (price * volume) for all trades + "openTime": 1655432400000, // Open time for ticker window + "closeTime": 1655446835460, // Close time for ticker window + "firstId": 11147809, // Trade IDs + "lastId": 11149775, + "count": 1967 // Number of trades in the interval + }, + { + "symbol": "BNBBTC", + "priceChange": "0.00008530", + "priceChangePercent": "0.823", + "weightedAvgPrice": "0.01043129", + "openPrice": "0.01036170", + "highPrice": "0.01049850", + "lowPrice": "0.01033870", + "lastPrice": "0.01044700", + "volume": "166.67000000", + "quoteVolume": "1.73858301", + "openTime": 1655432400000, + "closeTime": 1655446835460, + "firstId": 2351674, + "lastId": 2352034, + "count": 361 + } +] +Response - MINI + +{ + "symbol": "LTCBTC", + "openPrice": "0.10000000", + "highPrice": "2.00000000", + "lowPrice": "0.10000000", + "lastPrice": "2.00000000", + "volume": "39.00000000", + "quoteVolume": "13.40000000", // Sum of (price * volume) for all trades + "openTime": 1656986580000, // Open time for ticker window + "closeTime": 1657001016795, // Close time for ticker window + "firstId": 0, // Trade IDs + "lastId": 34, + "count": 35 // Number of trades in the interval +} +OR + +[ + { + "symbol": "BNBBTC", + "openPrice": "0.10000000", + "highPrice": "2.00000000", + "lowPrice": "0.10000000", + "lastPrice": "2.00000000", + "volume": "39.00000000", + "quoteVolume": "13.40000000", // Sum of (price * volume) for all trades + "openTime": 1656986880000, // Open time for ticker window + "closeTime": 1657001297799, // Close time for ticker window + "firstId": 0, // Trade IDs + "lastId": 34, + "count": 35 // Number of trades in the interval + }, + { + "symbol": "LTCBTC", + "openPrice": "0.07000000", + "highPrice": "0.07000000", + "lowPrice": "0.07000000", + "lastPrice": "0.07000000", + "volume": "33.00000000", + "quoteVolume": "2.31000000", + "openTime": 1656986880000, + "closeTime": 1657001297799, + "firstId": 0, + "lastId": 32, + "count": 33 + } +] +GET /api/v3/ticker + +Note: This endpoint is different from the GET /api/v3/ticker/24hr endpoint. + +The window used to compute statistics will be no more than 59999ms from the requested windowSize. + +openTime for /api/v3/ticker always starts on a minute, while the closeTime is the current time of the request. As such, the effective window will be up to 59999ms wider than windowSize. + +E.g. If the closeTime is 1641287867099 (January 04, 2022 09:17:47:099 UTC) , and the windowSize is 1d. the openTime will be: 1641201420000 (January 3, 2022, 09:17:00 UTC) + +Weight:(IP) + +4 for each requested symbol regardless of windowSize + +The weight for this request will cap at 200 once the number of symbols in the request is more than 50. + +Parameters + +Name Type Mandatory Description +symbol STRING YES Either symbol or symbols must be provided. + +Examples of accepted format for the symbols parameter: +["BTCUSDT","BNBUSDT"] +or +%5B%22BTCUSDT%22,%22BNBUSDT%22%5D + +The maximum number of symbols allowed in a request is 100. +symbols +windowSize ENUM NO Defaults to 1d if no parameter provided. + +Supported windowSize values: +1m,2m....59m for minutes +1h, 2h....23h - for hours +1d...7d - for days + +Units cannot be combined (e.g. 1d2h is not allowed). +type ENUM NO Supported values: FULL or MINI. + +If none provided, the default is FULL. +Data Source: Database + +Websocket Market Streams +The base endpoint is: wss://stream.binance.com:9443 or wss://stream.binance.com:443 +Streams can be accessed either in a single raw stream or in a combined stream. +Users can listen to multiple streams. +Raw streams are accessed at /ws/ +Combined streams are accessed at /stream?streams=// +Combined stream events are wrapped as follows: {"stream":"","data":} +All symbols for streams are lowercase +A single connection to stream.binance.com is only valid for 24 hours; expect to be disconnected at the 24 hour mark +Websocket server will send a ping frame every 3 minutes. +If the websocket server does not receive a pong frame back from the connection within a 10 minute period, the connection will be disconnected. +When you receive a ping, you must send a pong with a copy of ping's payload as soon as possible. +Unsolicited pong frames are allowed, but will not prevent disconnection. It is recommended that the payload for these pong frames are empty. +The base endpoint wss://data-stream.binance.vision can be subscribed to receive market data messages. User data stream is NOT available from this URL. +All time and timestamp related fields are milliseconds by default. To receive the information in microseconds, please add the parameter timeUnit=MICROSECOND or timeUnit=microsecond in the URL. +For example: /stream?streams=btcusdt@trade&timeUnit=MICROSECOND +Live Subscribing/Unsubscribing to streams +The following data can be sent through the websocket instance in order to subscribe/unsubscribe from streams. Examples can be seen below. +The id is used as an identifier to uniquely identify the messages going back and forth. The following formats are accepted: +64-bit signed integer +alphanumeric strings; max length 36 +null +In the response, if the result received is null this means the request sent was a success. +Subscribe to a stream +Response + + { + "result": null, + "id": 1 + } +Request + +{ +"method": "SUBSCRIBE", +"params": +[ +"btcusdt@aggTrade", +"btcusdt@depth" +], +"id": 1 +} + +Unsubscribe to a stream +Response + + { + "result": null, + "id": 312 + } +Request +{ +"method": "UNSUBSCRIBE", +"params": +[ +"btcusdt@depth" +], +"id": 312 +} + +Listing Subscriptions +Response + + { + "result": [ + "btcusdt@aggTrade" + ], + "id": 3 + } +Request +{ +"method": "LIST_SUBSCRIPTIONS", +"id": 3 +} + +Setting Properties +Currently, the only property can be set is to set whether combined stream payloads are enabled or not. The combined property is set to false when connecting using /ws/ ("raw streams") and true when connecting using /stream/. + +Response + +{ + "result": null, + "id": 5 +} +Request +{ +"method": "SET_PROPERTY", +"params": +[ +"combined", +true +], +"id": 5 +} + +Retrieving Properties +Response + + { + "result": true, // Indicates that combined is set to true. + "id": 2 + } +Request +{ +"method": "GET_PROPERTY", +"params": +[ +"combined" +], +"id": 2 +} + +Error Messages +Error Message Description +{"code": 0, "msg": "Unknown property", "id": '%s'} Parameter used in the SET_PROPERTY or GET_PROPERTY was invalid +{"code": 1, "msg": "Invalid value type: expected Boolean", "id": '%s'} Value should only be true or false +{"code": 2, "msg": "Invalid request: property name must be a string"} Property name provided was invalid +{"code": 2, "msg": "Invalid request: request ID must be an unsigned integer"} Parameter id had to be provided or the value provided in the id parameter is an unsupported type +{"code": 2, "msg": "Invalid request: unknown variant %s, expected one of SUBSCRIBE, UNSUBSCRIBE, LIST_SUBSCRIPTIONS, SET_PROPERTY, GET_PROPERTY at line 1 column 28"} Possible typo in the provided method or provided method was neither of the expected values +{"code": 2, "msg": "Invalid request: too many parameters"} Unnecessary parameters provided in the data +{"code": 2, "msg": "Invalid request: property name must be a string"} Property name was not provided +{"code": 2, "msg": "Invalid request: missing field method at line 1 column 73"} method was not provided in the data +{"code":3,"msg":"Invalid JSON: expected value at line %s column %s"} JSON data sent has incorrect syntax. +Aggregate Trade Streams +Payload: + +{ + "e": "aggTrade", // Event type + "E": 1672515782136, // Event time + "s": "BNBBTC", // Symbol + "a": 12345, // Aggregate trade ID + "p": "0.001", // Price + "q": "100", // Quantity + "f": 100, // First trade ID + "l": 105, // Last trade ID + "T": 1672515782136, // Trade time + "m": true, // Is the buyer the market maker? + "M": true // Ignore +} +The Aggregate Trade Streams push trade information that is aggregated for a single taker order. + +Stream Name: @aggTrade + +Update Speed: Real-time + +Trade Streams +Payload: + +{ + "e": "trade", // Event type + "E": 1672515782136, // Event time + "s": "BNBBTC", // Symbol + "t": 12345, // Trade ID + "p": "0.001", // Price + "q": "100", // Quantity + "T": 1672515782136, // Trade time + "m": true, // Is the buyer the market maker? + "M": true // Ignore +} +The Trade Streams push raw trade information; each trade has a unique buyer and seller. + +Stream Name: @trade + +Update Speed: Real-time + +Kline/Candlestick Streams for UTC +Payload: + +{ + "e": "kline", // Event type + "E": 1672515782136, // Event time + "s": "BNBBTC", // Symbol + "k": { + "t": 123400000, // Kline start time + "T": 123460000, // Kline close time + "s": "BNBBTC", // Symbol + "i": "1m", // Interval + "f": 100, // First trade ID + "L": 200, // Last trade ID + "o": "0.0010", // Open price + "c": "0.0020", // Close price + "h": "0.0025", // High price + "l": "0.0015", // Low price + "v": "1000", // Base asset volume + "n": 100, // Number of trades + "x": false, // Is this kline closed? + "q": "1.0000", // Quote asset volume + "V": "500", // Taker buy base asset volume + "Q": "0.500", // Taker buy quote asset volume + "B": "123456" // Ignore + } +} +The Kline/Candlestick Stream push updates to the current klines/candlestick every secondin UTC+0 timezone. + +Stream Name: @kline_ + +Update Speed: 1000ms for 1s, 2000ms for the other intervals Kline/Candlestick chart intervals: + +s-> seconds; m -> minutes; h -> hours; d -> days; w -> weeks; M -> months + +1s +1m +3m +5m +15m +30m +1h +2h +4h +6h +8h +12h +1d +3d +1w +1M +Kline/Candlestick Streams with timezone offset +Payload: + +{ + "e": "kline", // Event type + "E": 1672515782136, // Event time + "s": "BNBBTC", // Symbol + "k": { + "t": 1672515780000, // Kline start time + "T": 1672515839999, // Kline close time + "s": "BNBBTC", // Symbol + "i": "1m", // Interval + "f": 100, // First trade ID + "L": 200, // Last trade ID + "o": "0.0010", // Open price + "c": "0.0020", // Close price + "h": "0.0025", // High price + "l": "0.0015", // Low price + "v": "1000", // Base asset volume + "n": 100, // Number of trades + "x": false, // Is this kline closed? + "q": "1.0000", // Quote asset volume + "V": "500", // Taker buy base asset volume + "Q": "0.500", // Taker buy quote asset volume + "B": "123456" // Ignore + } +} +The Kline/Candlestick Stream push updates to the current klines/candlestick every second in UTC+8 timezone. + +UTC+8 timezone offset: + +Kline intervals open and close in the UTC+8 timezone. For example the 1d klines will open at the beginning of the UTC+8 day, and close at the end of the UTC+8 day. +Note that E (event time), t (start time) and T (close time) in the payload are Unix timestamps, which are always interpreted in UTC. +Stream Name: @kline_@+08:00 + +Update Speed: 1000ms for 1s, 2000ms for the other intervals + +Supported intervals: See Kline/Candlestick chart intervals + +Individual Symbol Mini Ticker Stream +Payload: + + { + "e": "24hrMiniTicker", // Event type + "E": 1672515782136, // Event time + "s": "BNBBTC", // Symbol + "c": "0.0025", // Close price + "o": "0.0010", // Open price + "h": "0.0025", // High price + "l": "0.0010", // Low price + "v": "10000", // Total traded base asset volume + "q": "18" // Total traded quote asset volume + } +24hr rolling window mini-ticker statistics. These are NOT the statistics of the UTC day, but a 24hr rolling window for the previous 24hrs. + +Stream Name: @miniTicker + +Update Speed: 1000ms + +All Market Mini Tickers Stream +Payload: + +[ + { + // Same as @miniTicker payload + } +] +24hr rolling window mini-ticker statistics for all symbols that changed in an array. These are NOT the statistics of the UTC day, but a 24hr rolling window for the previous 24hrs. Note that only tickers that have changed will be present in the array. + +Stream Name: !miniTicker@arr + +Update Speed: 1000ms + +Individual Symbol Ticker Streams +Payload: + +{ + "e": "24hrTicker", // Event type + "E": 1672515782136, // Event time + "s": "BNBBTC", // Symbol + "p": "0.0015", // Price change + "P": "250.00", // Price change percent + "w": "0.0018", // Weighted average price + "x": "0.0009", // First trade(F)-1 price (first trade before the 24hr rolling window) + "c": "0.0025", // Last price + "Q": "10", // Last quantity + "b": "0.0024", // Best bid price + "B": "10", // Best bid quantity + "a": "0.0026", // Best ask price + "A": "100", // Best ask quantity + "o": "0.0010", // Open price + "h": "0.0025", // High price + "l": "0.0010", // Low price + "v": "10000", // Total traded base asset volume + "q": "18", // Total traded quote asset volume + "O": 0, // Statistics open time + "C": 86400000, // Statistics close time + "F": 0, // First trade ID + "L": 18150, // Last trade Id + "n": 18151 // Total number of trades +} +24hr rolling window ticker statistics for a single symbol. These are NOT the statistics of the UTC day, but a 24hr rolling window for the previous 24hrs. + +Stream Name: @ticker + +Update Speed: 1000ms + +Average Price +Payload: + +{ + "e": "avgPrice", // Event type + "E": 1693907033000, // Event time + "s": "BTCUSDT", // Symbol + "i": "5m", // Average price interval + "w": "25776.86000000", // Average price + "T": 1693907032213 // Last trade time +} +Average price streams push changes in the average price over a fixed time interval. + +Stream Name: @avgPrice + +Update Speed: 1000ms + +All Market Tickers Stream +Payload: + +[ + { + // Same as @ticker payload + } +] +24hr rolling window ticker statistics for all symbols that changed in an array. These are NOT the statistics of the UTC day, but a 24hr rolling window for the previous 24hrs. Note that only tickers that have changed will be present in the array. + +Stream Name: !ticker@arr + +Update Speed: 1000ms + +Individual Symbol Rolling Window Statistics Streams +Payload: + +{ + "e": "1hTicker", // Event type + "E": 1672515782136, // Event time + "s": "BNBBTC", // Symbol + "p": "0.0015", // Price change + "P": "250.00", // Price change percent + "o": "0.0010", // Open price + "h": "0.0025", // High price + "l": "0.0010", // Low price + "c": "0.0025", // Last price + "w": "0.0018", // Weighted average price + "v": "10000", // Total traded base asset volume + "q": "18", // Total traded quote asset volume + "O": 0, // Statistics open time + "C": 86400000, // Statistics close time + "F": 0, // First trade ID + "L": 18150, // Last trade Id + "n": 18151 // Total number of trades +} +Rolling window ticker statistics for a single symbol, computed over multiple windows. + +Stream Name: @ticker_ + +Window Sizes: 1h,4h,1d + +Update Speed: 1000ms + +Note: This stream is different from the @ticker stream. The open time O always starts on a minute, while the closing time C is the current time of the update. + +As such, the effective window might be up to 59999ms wider that . + +All Market Rolling Window Statistics Streams +Payload: + +[ + { + // Same as @ticker_ payload, + // one for each symbol updated within the interval. + } +] +Rolling window ticker statistics for all market symbols, computed over multiple windows. Note that only tickers that have changed will be present in the array. + +Stream Name: !ticker_@arr + +Window Size: 1h,4h,1d + +Update Speed: 1000ms + +Individual Symbol Book Ticker Streams +Payload: + +{ + "u":400900217, // order book updateId + "s":"BNBUSDT", // symbol + "b":"25.35190000", // best bid price + "B":"31.21000000", // best bid qty + "a":"25.36520000", // best ask price + "A":"40.66000000" // best ask qty +} +Pushes any update to the best bid or ask's price or quantity in real-time for a specified symbol. + +Multiple @bookTicker streams can be subscribed to over one connection. + +Stream Name: @bookTicker + +Update Speed: Real-time + +Partial Book Depth Streams +Payload: + +{ + "lastUpdateId": 160, // Last update ID + "bids": [ // Bids to be updated + [ + "0.0024", // Price level to be updated + "10" // Quantity + ] + ], + "asks": [ // Asks to be updated + [ + "0.0026", // Price level to be updated + "100" // Quantity + ] + ] +} +Top bids and asks, Valid are 5, 10, or 20. + +Stream Names: @depth OR @depth@100ms. + +Update Speed: 1000ms or 100ms + +Diff. Depth Stream +Payload: + +{ + "e": "depthUpdate", // Event type + "E": 1672515782136, // Event time + "s": "BNBBTC", // Symbol + "U": 157, // First update ID in event + "u": 160, // Final update ID in event + "b": [ // Bids to be updated + [ + "0.0024", // Price level to be updated + "10" // Quantity + ] + ], + "a": [ // Asks to be updated + [ + "0.0026", // Price level to be updated + "100" // Quantity + ] + ] +} +Stream Name: @depth OR @depth@100ms + +Update Speed: 1000ms or 100ms + +Order book price and quantity depth updates used to locally manage an order book. + +How to manage a local order book correctly +Open a WebSocket connection to wss://stream.binance.com:9443/ws/bnbbtc@depth. +Buffer the events received from the stream. Note the U of the first event you received. +Get a depth snapshot from https://api.binance.com/api/v3/depth?symbol=BNBBTC&limit=5000. +If the lastUpdateId from the snapshot is strictly less than the U from step 2, go back to step 3. +In the buffered events, discard any event where u is <= lastUpdateId of the snapshot. The first buffered event should now have lastUpdateId within its [U;u] range. +Set your local order book to the snapshot. Its update ID is lastUpdateId. +Apply the update procedure below to all buffered events, and then to all subsequent events received. +To apply an event to your local order book, follow this update procedure: 1. If the event u (last update ID) is < the update ID of your local order book, ignore the event. 1. If the event U (first update ID) is > the update ID of your local order book, something went wrong. Discard your local order book and restart the process from the beginning. 1. For each price level in bids (b) and asks (a), set the new quantity in the order book: * If the price level does not exist in the order book, insert it with new quantity. * If the quantity is zero, remove the price level from the order book. 1. Set the order book update ID to the last update ID (u) in the processed event. + +Note: Due to depth snapshots having a limit on the number of price levels, a price level outside of the initial snapshot that doesn't have a quantity change won't have an update in the Diff. Depth Stream. Consequently, those price levels will not be visible in the local order book even when applying all updates from the Diff. Depth Stream correctly and cause the local order book to have some slight differences with the real order book. However, for most use cases the depth limit of 5000 is enough to understand the market and trade effectively. + +Spot Trading Endpoints +Test New Order (TRADE) +Response: + +{} +OR + +{ + "standardCommissionForOrder": { //Standard commission rates on trades from the order. + "maker": "0.00000112", + "taker": "0.00000114", + }, + "taxCommissionForOrder": { //Tax commission rates for trades from the order. + "maker": "0.00000112", + "taker": "0.00000114", + }, + "discount": { //Discount on standard commissions when paying in BNB. + "enabledForAccount": true, + "enabledForSymbol": true, + "discountAsset": "BNB", + "discount": "0.25000000" //Standard commission is reduced by this rate when paying commission in BNB. + } +} +POST /api/v3/order/test + +Test new order creation and signature/recvWindow long. Creates and validates a new order but does not send it into the matching engine. + +Weight: + +Condition Request Weight +Without computeCommissionRates 1 +With computeCommissionRates 20 +Parameters: + +In addition to all parameters accepted by POST /api/v3/order, the following optional parameters are also accepted: + +Name Type Mandatory Description +computeCommissionRates BOOLEAN NO Default: false +Data Source: Memory + +New Order (TRADE) +Response ACK: + +{ + "symbol": "BTCUSDT", + "orderId": 28, + "orderListId": -1, //Unless an order list, value will be -1 + "clientOrderId": "6gCrw2kRUAF9CvJDGP16IP", + "transactTime": 1507725176595 +} +Response RESULT: + +{ + "symbol": "BTCUSDT", + "orderId": 28, + "orderListId": -1, //Unless an order list, value will be -1 + "clientOrderId": "6gCrw2kRUAF9CvJDGP16IP", + "transactTime": 1507725176595, + "price": "0.00000000", + "origQty": "10.00000000", + "executedQty": "10.00000000", + "origQuoteOrderQty": "0.000000", + "cummulativeQuoteQty": "10.00000000", + "status": "FILLED", + "timeInForce": "GTC", + "type": "MARKET", + "side": "SELL", + "workingTime": 1507725176595, + "selfTradePreventionMode": "NONE" +} +Response FULL: + +{ + "symbol": "BTCUSDT", + "orderId": 28, + "orderListId": -1, //Unless an order list, value will be -1 + "clientOrderId": "6gCrw2kRUAF9CvJDGP16IP", + "transactTime": 1507725176595, + "price": "0.00000000", + "origQty": "10.00000000", + "executedQty": "10.00000000", + "origQuoteOrderQty": "0.000000", + "cummulativeQuoteQty": "10.00000000", + "status": "FILLED", + "timeInForce": "GTC", + "type": "MARKET", + "side": "SELL", + "workingTime": 1507725176595, + "selfTradePreventionMode": "NONE", + "fills": [ + { + "price": "4000.00000000", + "qty": "1.00000000", + "commission": "4.00000000", + "commissionAsset": "USDT", + "tradeId": 56 + }, + { + "price": "3999.00000000", + "qty": "5.00000000", + "commission": "19.99500000", + "commissionAsset": "USDT", + "tradeId": 57 + }, + { + "price": "3998.00000000", + "qty": "2.00000000", + "commission": "7.99600000", + "commissionAsset": "USDT", + "tradeId": 58 + }, + { + "price": "3997.00000000", + "qty": "1.00000000", + "commission": "3.99700000", + "commissionAsset": "USDT", + "tradeId": 59 + }, + { + "price": "3995.00000000", + "qty": "1.00000000", + "commission": "3.99500000", + "commissionAsset": "USDT", + "tradeId": 60 + } + ] +} +POST /api/v3/order + +Send in a new order. + +Weight(UID): 1 Weight(IP): 1 + +Parameters: + +Name Type Mandatory Description +symbol STRING YES +side ENUM YES +type ENUM YES +timeInForce ENUM NO +quantity DECIMAL NO +quoteOrderQty DECIMAL NO +price DECIMAL NO +newClientOrderId STRING NO A unique id among open orders. Automatically generated if not sent. +strategyId INT NO +strategyType INT NO The value cannot be less than 1000000. +stopPrice DECIMAL NO Used with STOP_LOSS, STOP_LOSS_LIMIT, TAKE_PROFIT, and TAKE_PROFIT_LIMIT orders. +trailingDelta LONG NO Used with STOP_LOSS, STOP_LOSS_LIMIT, TAKE_PROFIT, and TAKE_PROFIT_LIMIT orders. For more details on SPOT implementation on trailing stops, please refer to Trailing Stop FAQ +icebergQty DECIMAL NO Used with LIMIT, STOP_LOSS_LIMIT, and TAKE_PROFIT_LIMIT to create an iceberg order. +newOrderRespType ENUM NO Set the response JSON. ACK, RESULT, or FULL; MARKET and LIMIT order types default to FULL, all other orders default to ACK. +selfTradePreventionMode ENUM NO The allowed enums is dependent on what is configured on the symbol. The possible supported values are EXPIRE_TAKER, EXPIRE_MAKER, EXPIRE_BOTH, NONE. +recvWindow LONG NO The value cannot be greater than 60000 +timestamp LONG YES +Additional mandatory parameters based on type: + +Type Additional mandatory parameters +LIMIT timeInForce, quantity, price +MARKET quantity or quoteOrderQty +STOP_LOSS quantity, stopPrice or trailingDelta +STOP_LOSS_LIMIT timeInForce, quantity, price, stopPrice or trailingDelta +TAKE_PROFIT quantity, stopPrice or trailingDelta +TAKE_PROFIT_LIMIT timeInForce, quantity, price, stopPrice or trailingDelta +LIMIT_MAKER quantity, price +Other info: + +LIMIT_MAKER are LIMIT orders that will be rejected if they would immediately match and trade as a taker. +STOP_LOSS and TAKE_PROFIT will execute a MARKET order when the stopPrice is reached. +Any LIMIT or LIMIT_MAKER type order can be made an iceberg order by sending an icebergQty. +Any order with an icebergQty MUST have timeInForce set to GTC. +MARKET orders using the quantity field specifies the amount of the base asset the user wants to buy or sell at the market price. +For example, sending a MARKET order on BTCUSDT will specify how much BTC the user is buying or selling. +MARKET orders using quoteOrderQty specifies the amount the user wants to spend (when buying) or receive (when selling) the quote asset; the correct quantity will be determined based on the market liquidity and quoteOrderQty. +Using BTCUSDT as an example: +On the BUY side, the order will buy as many BTC as quoteOrderQty USDT can. +On the SELL side, the order will sell as much BTC needed to receive quoteOrderQty USDT. +MARKET orders using quoteOrderQty will not break LOT_SIZE filter rules; the order will execute a quantity that will have the notional value as close as possible to quoteOrderQty. +same newClientOrderId can be accepted only when the previous one is filled, otherwise the order will be rejected. +For STOP_LOSS, STOP_LOSS_LIMIT, TAKE_PROFIT_LIMIT and TAKE_PROFIT orders, trailingDelta can be combined with stopPrice. +Trigger order price rules against market price for both MARKET and LIMIT versions: + +Price above market price: STOP_LOSS BUY, TAKE_PROFIT SELL +Price below market price: STOP_LOSS SELL, TAKE_PROFIT BUY +Data Source: Matching Engine + +Conditional fields in Order Responses +There are fields in the order responses (e.g. order placement, order query, order cancellation) that appear only if certain conditions are met. + +These fields can apply to Order lists. + +The fields are listed below: + +Field Description Visibility conditions Examples +icebergQty Quantity for the iceberg order Appears only if the parameter icebergQty was sent in the request. "icebergQty": "0.00000000" +preventedMatchId When used in combination with symbol, can be used to query a prevented match. Appears only if the order expired due to STP. "preventedMatchId": 0 +preventedQuantity Order quantity that expired due to STP Appears only if the order expired due to STP. "preventedQuantity": "1.200000" +stopPrice Price when the algorithmic order will be triggered Appears for STOP_LOSS. TAKE_PROFIT, STOP_LOSS_LIMIT and TAKE_PROFIT_LIMIT orders. "stopPrice": "23500.00000000" +strategyId Can be used to label an order that's part of an order strategy. Appears if the parameter was populated in the request. "strategyId": 37463720 +strategyType Can be used to label an order that is using an order strategy. Appears if the parameter was populated in the request. "strategyType": 1000000 +trailingDelta Delta price change required before order activation Appears for Trailing Stop Orders. "trailingDelta": 10 +trailingTime Time when the trailing order is now active and tracking price changes Appears only for Trailing Stop Orders. "trailingTime": -1 +Cancel Order (TRADE) +Response: + +{ + "symbol": "LTCBTC", + "origClientOrderId": "myOrder1", + "orderId": 4, + "orderListId": -1, //Unless part of an order list, the value will always be -1. + "clientOrderId": "cancelMyOrder1", + "transactTime": 1684804350068, + "price": "2.00000000", + "origQty": "1.00000000", + "executedQty": "0.00000000", + "origQuoteOrderQty": "0.000000", + "cummulativeQuoteQty": "0.00000000", + "status": "CANCELED", + "timeInForce": "GTC", + "type": "LIMIT", + "side": "BUY", + "selfTradePreventionMode": "NONE" +} +DELETE /api/v3/order + +Cancel an active order. + +Weight(IP): 1 + +Parameters: + +Name Type Mandatory Description +symbol STRING YES +orderId LONG NO +origClientOrderId STRING NO +newClientOrderId STRING NO Used to uniquely identify this cancel. Automatically generated by default. +cancelRestrictions ENUM NO Supported values: +ONLY_NEW - Cancel will succeed if the order status is NEW. +ONLY_PARTIALLY_FILLED - Cancel will succeed if order status is PARTIALLY_FILLED. +recvWindow LONG NO The value cannot be greater than 60000 +timestamp LONG YES +Either orderId or origClientOrderId must be sent. If both orderId and origClientOrderId are provided, orderId takes precedence. + +Data Source: Matching Engine + +Regarding cancelRestrictions +If the cancelRestrictions value is not any of the supported values, the error will be: +{"code": -1145,"msg": "Invalid cancelRestrictions"} +If the order did not pass the conditions for cancelRestrictions, the error will be: +{"code": -2011,"msg": "Order was not canceled due to cancel restrictions."} +Note: The payload sample does not show all fields that can appear. Please refer to Conditional fields in Order Responses. + +Cancel all Open Orders on a Symbol (TRADE) +Response: + +[ + { + "symbol": "BTCUSDT", + "origClientOrderId": "E6APeyTJvkMvLMYMqu1KQ4", + "orderId": 11, + "orderListId": -1, + "clientOrderId": "pXLV6Hz6mprAcVYpVMTGgx", + "transactTime": 1684804350068, + "price": "0.089853", + "origQty": "0.178622", + "executedQty": "0.000000", + "origQuoteOrderQty": "0.000000", + "cummulativeQuoteQty": "0.000000", + "status": "CANCELED", + "timeInForce": "GTC", + "type": "LIMIT", + "side": "BUY", + "selfTradePreventionMode": "NONE" + }, + { + "symbol": "BTCUSDT", + "origClientOrderId": "A3EF2HCwxgZPFMrfwbgrhv", + "orderId": 13, + "orderListId": -1, + "clientOrderId": "pXLV6Hz6mprAcVYpVMTGgx", + "transactTime": 1684804350069, + "price": "0.090430", + "origQty": "0.178622", + "executedQty": "0.000000", + "origQuoteOrderQty": "0.000000", + "cummulativeQuoteQty": "0.000000", + "status": "CANCELED", + "timeInForce": "GTC", + "type": "LIMIT", + "side": "BUY", + "selfTradePreventionMode": "NONE" + }, + { + "orderListId": 1929, + "contingencyType": "OCO", + "listStatusType": "ALL_DONE", + "listOrderStatus": "ALL_DONE", + "listClientOrderId": "2inzWQdDvZLHbbAmAozX2N", + "transactionTime": 1585230948299, + "symbol": "BTCUSDT", + "orders": [ + { + "symbol": "BTCUSDT", + "orderId": 20, + "clientOrderId": "CwOOIPHSmYywx6jZX77TdL" + }, + { + "symbol": "BTCUSDT", + "orderId": 21, + "clientOrderId": "461cPg51vQjV3zIMOXNz39" + } + ], + "orderReports": [ + { + "symbol": "BTCUSDT", + "origClientOrderId": "CwOOIPHSmYywx6jZX77TdL", + "orderId": 20, + "orderListId": 1929, + "clientOrderId": "pXLV6Hz6mprAcVYpVMTGgx", + "transactTime": 1688005070874, + "price": "0.668611", + "origQty": "0.690354", + "executedQty": "0.000000", + "origQuoteOrderQty": "0.000000", + "cummulativeQuoteQty": "0.000000", + "status": "CANCELED", + "timeInForce": "GTC", + "type": "STOP_LOSS_LIMIT", + "side": "BUY", + "stopPrice": "0.378131", + "icebergQty": "0.017083", + "selfTradePreventionMode": "NONE" + }, + { + "symbol": "BTCUSDT", + "origClientOrderId": "461cPg51vQjV3zIMOXNz39", + "orderId": 21, + "orderListId": 1929, + "clientOrderId": "pXLV6Hz6mprAcVYpVMTGgx", + "transactTime": 1688005070874, + "price": "0.008791", + "origQty": "0.690354", + "executedQty": "0.000000", + "origQuoteOrderQty": "0.000000", + "cummulativeQuoteQty": "0.000000", + "status": "CANCELED", + "timeInForce": "GTC", + "type": "LIMIT_MAKER", + "side": "BUY", + "icebergQty": "0.639962", + "selfTradePreventionMode": "NONE" + } + ] + } +] +DELETE /api/v3/openOrders + +Cancels all active orders on a symbol. + +This includes orders that are part of an order list. + +Weight(IP): 1 + +Parameters + +Name Type Mandatory Description +symbol STRING YES +recvWindow LONG NO The value cannot be greater than 60000 +timestamp LONG YES +Data Source: Matching Engine + +Note: The payload sample does not show all fields that can appear. Please refer to Conditional fields in Order Responses. + +Query Order (USER_DATA) +Response: + +{ + "symbol": "LTCBTC", + "orderId": 1, + "orderListId": -1, //Unless an order list, value will be -1 + "clientOrderId": "myOrder1", + "price": "0.1", + "origQty": "1.0", + "executedQty": "0.0", + "cummulativeQuoteQty": "0.0", + "status": "NEW", + "timeInForce": "GTC", + "type": "LIMIT", + "side": "BUY", + "stopPrice": "0.0", + "icebergQty": "0.0", + "time": 1499827319559, + "updateTime": 1499827319559, + "isWorking": true, + "workingTime":1499827319559, + "origQuoteOrderQty": "0.000000", + "selfTradePreventionMode": "NONE" +} +GET /api/v3/order + +Check an order's status. + +Weight(IP): 4 + +Parameters: + +Name Type Mandatory Description +symbol STRING YES +orderId LONG NO +origClientOrderId STRING NO +recvWindow LONG NO The value cannot be greater than 60000 +timestamp LONG YES +Notes: + +Either orderId or origClientOrderId must be sent. +For some historical orders cummulativeQuoteQty will be < 0, meaning the data is not available at this time. +The payload sample does not show all fields that can appear. Please refer to Conditional fields in Order Responses. +Data Source: Memory => Database + +Cancel an Existing Order and Send a New Order (TRADE) +Response SUCCESS and account has not exceeded the order rate limit: + +//Both the cancel order placement and new order placement succeeded. +{ + "cancelResult": "SUCCESS", + "newOrderResult": "SUCCESS", + "cancelResponse": { + "symbol": "BTCUSDT", + "origClientOrderId": "DnLo3vTAQcjha43lAZhZ0y", + "orderId": 9, + "orderListId": -1, + "clientOrderId": "osxN3JXAtJvKvCqGeMWMVR", + "transactTime": 1684804350068, + "price": "0.01000000", + "origQty": "0.000100", + "executedQty": "0.00000000", + "origQuoteOrderQty": "0.000000", + "cummulativeQuoteQty": "0.00000000", + "status": "CANCELED", + "timeInForce": "GTC", + "type": "LIMIT", + "side": "SELL", + "selfTradePreventionMode": "NONE" + }, + "newOrderResponse": { + "symbol": "BTCUSDT", + "orderId": 10, + "orderListId": -1, + "clientOrderId": "wOceeeOzNORyLiQfw7jd8S", + "transactTime": 1652928801803, + "price": "0.02000000", + "origQty": "0.040000", + "executedQty": "0.00000000", + "origQuoteOrderQty": "0.000000", + "cummulativeQuoteQty": "0.00000000", + "status": "NEW", + "timeInForce": "GTC", + "type": "LIMIT", + "side": "BUY", + "workingTime": 1669277163808, + "fills": [], + "selfTradePreventionMode": "NONE" + } +} +Response when Cancel Order Fails with STOP_ON_FAILURE: + +{ + "code": -2022, + "msg": "Order cancel-replace failed.", + "data": { + "cancelResult": "FAILURE", + "newOrderResult": "NOT_ATTEMPTED", + "cancelResponse": { + "code": -2011, + "msg": "Unknown order sent." + }, + "newOrderResponse": null + } +} +Response when Cancel Order Succeeds but New Order Placement Fails and account has not exceeded the order rate limit: + +{ + "code": -2021, + "msg": "Order cancel-replace partially failed.", + "data": { + "cancelResult": "SUCCESS", + "newOrderResult": "FAILURE", + "cancelResponse": { + "symbol": "BTCUSDT", + "origClientOrderId": "86M8erehfExV8z2RC8Zo8k", + "orderId": 3, + "orderListId": -1, + "clientOrderId": "G1kLo6aDv2KGNTFcjfTSFq", + "transactTime": 1684804350068, + "price": "0.006123", + "origQty": "10000.000000", + "executedQty": "0.000000", + "origQuoteOrderQty": "0.000000", + "cummulativeQuoteQty": "0.000000", + "status": "CANCELED", + "timeInForce": "GTC", + "type": "LIMIT_MAKER", + "side": "SELL", + "selfTradePreventionMode": "NONE" + }, + "newOrderResponse": { + "code": -2010, + "msg": "Order would immediately match and take." + } + } +} +Response when Cancel Order fails with ALLOW_FAILURE and account has not exceeded the order rate limit: + +{ + "code": -2021, + "msg": "Order cancel-replace partially failed.", + "data": { + "cancelResult": "FAILURE", + "newOrderResult": "SUCCESS", + "cancelResponse": { + "code": -2011, + "msg": "Unknown order sent." + }, + "newOrderResponse": { + "symbol": "BTCUSDT", + "orderId": 11, + "orderListId": -1, + "clientOrderId": "pfojJMg6IMNDKuJqDxvoxN", + "transactTime": 1648540168818 + } + } +} +Response when both Cancel Order and New Order Placement fail using cancelReplaceMode=ALLOW_FAILURE and account has not exceeded the order rate limit: + +{ + "code": -2022, + "msg": "Order cancel-replace failed.", + "data": { + "cancelResult": "FAILURE", + "newOrderResult": "FAILURE", + "cancelResponse": { + "code": -2011, + "msg": "Unknown order sent." + }, + "newOrderResponse": { + "code": -2010, + "msg": "Order would immediately match and take." + } + } +} +Response when using orderRateLimitExceededMode=DO_NOTHING and account's order rate limit has been exceeded: + +{ + "code": -1015, + "msg": "Too many new orders; current limit is 1 orders per 10 SECOND." +} +Response when using orderRateLimitExceededMode=CANCEL_ONLY and account's order rate limit has been exceeded: + +{ + "code": -2021, + "msg": "Order cancel-replace partially failed.", + "data": { + "cancelResult": "SUCCESS", + "newOrderResult": "FAILURE", + "cancelResponse": { + "symbol": "LTCBNB", + "origClientOrderId": "GKt5zzfOxRDSQLveDYCTkc", + "orderId": 64, + "orderListId": -1, + "clientOrderId": "loehOJF3FjoreUBDmv739R", + "transactTime": 1715779007228, + "price": "1.00", + "origQty": "10.00000000", + "executedQty": "0.00000000", + "origQuoteOrderQty": "0.000000", + "cummulativeQuoteQty": "0.00", + "status": "CANCELED", + "timeInForce": "GTC", + "type": "LIMIT", + "side": "SELL", + "selfTradePreventionMode": "NONE" + }, + "newOrderResponse": { + "code": -1015, + "msg": "Too many new orders; current limit is 1 orders per 10 SECOND." + } + } +} +POST /api/v3/order/cancelReplace + +Cancels an existing order and places a new order on the same symbol. + +Filters and Order Count are evaluated before the processing of the cancellation and order placement occurs. + +A new order that was not attempted (i.e. when newOrderResult: NOT_ATTEMPTED), will still increase the order count by 1. + +Weight(IP): 1 + +Parameters: + +Name Type Mandatory Description +symbol STRING YES +side ENUM YES +type ENUM YES +cancelReplaceMode ENUM YES The allowed values are: + +STOP_ON_FAILURE - If the cancel request fails, the new order placement will not be attempted. + +ALLOW_FAILURE - new order placement will be attempted even if cancel request fails. +timeInForce ENUM NO +quantity DECIMAL NO +quoteOrderQty DECIMAL NO +price DECIMAL NO +cancelNewClientOrderId STRING NO Used to uniquely identify this cancel. Automatically generated by default. +cancelOrigClientOrderId STRING NO Either the cancelOrigClientOrderId or cancelOrderId must be provided. If both are provided, cancelOrderId takes precedence. +cancelOrderId LONG NO Either the cancelOrigClientOrderId or cancelOrderId must be provided. If both are provided, cancelOrderId takes precedence. +newClientOrderId STRING NO Used to identify the new order. +strategyId INT NO +strategyType INT NO The value cannot be less than 1000000. +stopPrice DECIMAL NO +trailingDelta LONG NO +icebergQty DECIMAL NO +newOrderRespType ENUM NO Allowed values: + +ACK, RESULT, FULL + +MARKET and LIMIT orders types default to FULL; all other orders default to ACK +selfTradePreventionMode ENUM NO The allowed enums is dependent on what is configured on the symbol. The possible supported values are EXPIRE_TAKER, EXPIRE_MAKER, EXPIRE_BOTH, NONE. +cancelRestrictions ENUM NO Supported values: +ONLY_NEW - Cancel will succeed if the order status is NEW. +ONLY_PARTIALLY_FILLED - Cancel will succeed if order status is PARTIALLY_FILLED. For more information please refer to Regarding cancelRestrictions +orderRateLimitExceededMode ENUM No Supported values: +DO_NOTHING (default)- will only attempt to cancel the order if account has not exceeded the unfilled order rate limit +CANCEL_ONLY - will always cancel the order +recvWindow LONG NO The value cannot be greater than 60000 +timestamp LONG YES +Similar to POST /api/v3/order, additional mandatory parameters are determined by type. + +Response format varies depending on whether the processing of the message succeeded, partially succeeded, or failed. + +Data Source: Matching Engine + +Request Response +cancelReplaceMode orderRateLimitExceededMode Order Count Usage cancelResult newOrderResult status +STOP_ON_FAILURE DO_NOTHING Within Limits ✅ SUCCESS ✅ SUCCESS 200 +❌ FAILURE ➖ NOT_ATTEMPTED 400 +✅ SUCCESS ❌ FAILURE 409 +Exceeds Limits ✅ SUCCESS ✅ SUCCESS N/A +❌ FAILURE ➖ NOT_ATTEMPTED N/A +✅ SUCCESS ❌ FAILURE N/A +CANCEL_ONLY Within Limits ✅ SUCCESS ✅ SUCCESS 200 +❌ FAILURE ➖ NOT_ATTEMPTED 400 +✅ SUCCESS ❌ FAILURE 409 +Exceeds Limits ❌ FAILURE ➖ NOT_ATTEMPTED 429 +✅ SUCCESS ❌ FAILURE 429 +ALLOW_FAILURE DO_NOTHING Within Limits ✅ SUCCESS ✅ SUCCESS 200 +❌ FAILURE ❌ FAILURE 400 +❌ FAILURE ✅ SUCCESS 409 +✅ SUCCESS ❌ FAILURE 409 +Exceeds Limits ✅ SUCCESS ✅ SUCCESS N/A +❌ FAILURE ❌ FAILURE N/A +❌ FAILURE ✅ SUCCESS N/A +✅ SUCCESS ❌ FAILURE N/A +CANCEL_ONLY Within Limits ✅ SUCCESS ✅ SUCCESS 200 +❌ FAILURE ❌ FAILURE 400 +❌ FAILURE ✅ SUCCESS 409 +✅ SUCCESS ❌ FAILURE 409 +Exceeds Limits ✅ SUCCESS ✅ SUCCESS 200 +❌ FAILURE ❌ FAILURE 400 +❌ FAILURE ✅ SUCCESS N/A +✅ SUCCESS ❌ FAILURE 409 +Note: The payload sample does not show all fields that can appear. Please refer to Conditional fields in Order Responses. + +Current Open Orders (USER_DATA) +Response: + +[ + { + "symbol": "LTCBTC", + "orderId": 1, + "orderListId": -1, //Unless an order list, the value will always be -1 + "clientOrderId": "myOrder1", + "price": "0.1", + "origQty": "1.0", + "executedQty": "0.0", + "cummulativeQuoteQty": "0.0", + "status": "NEW", + "timeInForce": "GTC", + "type": "LIMIT", + "side": "BUY", + "stopPrice": "0.0", + "icebergQty": "0.0", + "time": 1499827319559, + "updateTime": 1499827319559, + "isWorking": true, + "workingTime": 1499827319559, + "origQuoteOrderQty": "0.000000", + "selfTradePreventionMode": "NONE" + } +] +GET /api/v3/openOrders + +Get all open orders on a symbol. Careful when accessing this with no symbol. + +Weight(IP): 6 for a single symbol; 80 when the symbol parameter is omitted; + +Parameters: + +Name Type Mandatory Description +symbol STRING NO +recvWindow LONG NO The value cannot be greater than 60000 +timestamp LONG YES +If the symbol is not sent, orders for all symbols will be returned in an array. +Data Source: Memory => Database + +Note: The payload sample does not show all fields that can appear. Please refer to Conditional fields in Order Responses. + +All Orders (USER_DATA) +Response: + +[ + { + "symbol": "LTCBTC", + "orderId": 1, + "orderListId": -1, //Unless an order list, the value will always be -1 + "clientOrderId": "myOrder1", + "price": "0.1", + "origQty": "1.0", + "executedQty": "0.0", + "cummulativeQuoteQty": "0.0", + "status": "NEW", + "timeInForce": "GTC", + "type": "LIMIT", + "side": "BUY", + "stopPrice": "0.0", + "icebergQty": "0.0", + "time": 1499827319559, + "updateTime": 1499827319559, + "isWorking": true, + "origQuoteOrderQty": "0.000000", + "workingTime": 1499827319559, + "selfTradePreventionMode": "NONE" + } +] +GET /api/v3/allOrders + +Get all account orders; active, canceled, or filled. + +Weight(IP): 20 + +Parameters: + +Name Type Mandatory Description +symbol STRING YES +orderId LONG NO +startTime LONG NO +endTime LONG NO +limit INT NO Default 500; max 1000. +recvWindow LONG NO The value cannot be greater than 60000 +timestamp LONG YES +Notes: + +If orderId is set, it will get orders >= that orderId. Otherwise most recent orders are returned. +For some historical orders cummulativeQuoteQty will be < 0, meaning the data is not available at this time. +If startTime and/or endTime provided, orderId is not required. +The payload sample does not show all fields that can appear. Please refer to Conditional fields in Order Responses. +Data Source: Database + +New OCO - Deprecated (TRADE) +Response: + +{ + "orderListId": 0, + "contingencyType": "OCO", + "listStatusType": "EXEC_STARTED", + "listOrderStatus": "EXECUTING", + "listClientOrderId": "JYVpp3F0f5CAG15DhtrqLp", + "transactionTime": 1563417480525, + "symbol": "LTCBTC", + "orders": [ + { + "symbol": "LTCBTC", + "orderId": 2, + "clientOrderId": "Kk7sqHb9J6mJWTMDVW7Vos" + }, + { + "symbol": "LTCBTC", + "orderId": 3, + "clientOrderId": "xTXKaGYd4bluPVp78IVRvl" + } + ], + "orderReports": [ + { + "symbol": "LTCBTC", + "orderId": 2, + "orderListId": 0, + "clientOrderId": "Kk7sqHb9J6mJWTMDVW7Vos", + "transactTime": 1563417480525, + "price": "0.000000", + "origQty": "0.624363", + "executedQty": "0.000000", + "origQuoteOrderQty": "0.000000", + "cummulativeQuoteQty": "0.000000", + "status": "NEW", + "timeInForce": "GTC", + "type": "STOP_LOSS", + "side": "BUY", + "stopPrice": "0.960664", + "workingTime": -1, + "selfTradePreventionMode": "NONE" + }, + { + "symbol": "LTCBTC", + "orderId": 3, + "orderListId": 0, + "clientOrderId": "xTXKaGYd4bluPVp78IVRvl", + "transactTime": 1563417480525, + "price": "0.036435", + "origQty": "0.624363", + "executedQty": "0.000000", + "origQuoteOrderQty": "0.000000", + "cummulativeQuoteQty": "0.000000", + "status": "NEW", + "timeInForce": "GTC", + "type": "LIMIT_MAKER", + "side": "BUY", + "workingTime": 1563417480525, + "selfTradePreventionMode": "NONE" + } + ] +} +POST /api/v3/order/oco + +Send in a new OCO + +Weight(UID): 2 Weight(IP): 1 + +Parameters: + +Name Type Mandatory Description +symbol STRING YES +listClientOrderId STRING NO A unique Id for the entire orderList +side ENUM YES +quantity DECIMAL YES +limitClientOrderId STRING NO A unique Id for the limit order +limitStrategyId INT NO +limitStrategyType INT NO The value cannot be less than 1000000. +price DECIMAL YES +limitIcebergQty DECIMAL NO +trailingDelta LONG NO +stopClientOrderId STRING NO A unique Id for the stop loss/stop loss limit leg +stopPrice DECIMAL YES +stopStrategyId INT NO +stopStrategyType INT NO The value cannot be less than 1000000. +stopLimitPrice DECIMAL NO If provided, stopLimitTimeInForce is required. +stopIcebergQty DECIMAL NO +stopLimitTimeInForce ENUM NO Valid values are GTC/FOK/IOC +newOrderRespType ENUM NO Set the response JSON. +selfTradePreventionMode ENUM NO The allowed enums is dependent on what is configured on the symbol. The possible supported values are EXPIRE_TAKER, EXPIRE_MAKER, EXPIRE_BOTH, NONE. +recvWindow LONG NO The value cannot be greater than 60000 +timestamp LONG YES +Other Info: + +Price Restrictions: +SELL: Limit Price > Last Price > Stop Price +BUY: Limit Price < Last Price < Stop Price +Quantity Restrictions: +Both legs must have the same quantity. +ICEBERG quantities however do not have to be the same +OCO adds 2 orders to the unfilled order count, EXCHANGE_MAX_ORDERS filter and the MAX_NUM_ORDERS filter. +Data Source: Matching Engine + + +New Order List - OCO (TRADE) +Response: + +{ + "orderListId": 1, + "contingencyType": "OCO", + "listStatusType": "EXEC_STARTED", + "listOrderStatus": "EXECUTING", + "listClientOrderId": "lH1YDkuQKWiXVXHPSKYEIp", + "transactionTime": 1710485608839, + "symbol": "LTCBTC", + "orders": [ + { + "symbol": "LTCBTC", + "orderId": 10, + "clientOrderId": "44nZvqpemY7sVYgPYbvPih" + }, + { + "symbol": "LTCBTC", + "orderId": 11, + "clientOrderId": "NuMp0nVYnciDiFmVqfpBqK" + } + ], + "orderReports": [ + { + "symbol": "LTCBTC", + "orderId": 10, + "orderListId": 1, + "clientOrderId": "44nZvqpemY7sVYgPYbvPih", + "transactTime": 1710485608839, + "price": "1.00000000", + "origQty": "5.00000000", + "executedQty": "0.00000000", + "origQuoteOrderQty": "0.000000", + "cummulativeQuoteQty": "0.00000000", + "status": "NEW", + "timeInForce": "GTC", + "type": "STOP_LOSS_LIMIT", + "side": "SELL", + "stopPrice": "1.00000000", + "workingTime": -1, + "icebergQty": "1.00000000", + "selfTradePreventionMode": "NONE" + }, + { + "symbol": "LTCBTC", + "orderId": 11, + "orderListId": 1, + "clientOrderId": "NuMp0nVYnciDiFmVqfpBqK", + "transactTime": 1710485608839, + "price": "3.00000000", + "origQty": "5.00000000", + "executedQty": "0.00000000", + "origQuoteOrderQty": "0.000000", + "cummulativeQuoteQty": "0.00000000", + "status": "NEW", + "timeInForce": "GTC", + "type": "LIMIT_MAKER", + "side": "SELL", + "workingTime": 1710485608839, + "selfTradePreventionMode": "NONE" + } + ] +} +POST /api/v3/orderList/oco + +Send in an one-cancels-the-other (OCO) pair, where activation of one order immediately cancels the other. + +An OCO has 2 orders called the above order and below order. +One of the orders must be a LIMIT_MAKER/TAKE_PROFIT/TAKE_PROFIT_LIMIT order and the other must be STOP_LOSS or STOP_LOSS_LIMIT order. +Price restrictions +If the OCO is on the SELL side: +LIMIT_MAKER/TAKE_PROFIT_LIMIT price > Last Traded Price > STOP_LOSS/STOP_LOSS_LIMIT stopPrice +TAKE_PROFIT stopPrice > Last Traded Price > STOP_LOSS/STOP_LOSS_LIMIT stopPrice +If the OCO is on the BUY side: +LIMIT_MAKER/TAKE_PROFIT_LIMIT price < Last Traded Price < stopPrice +TAKE_PROFIT stopPrice < Last Traded Price < `STOP_LOSS/STOP_LOSS_LIMIT stopPrice +OCOs add 2 orders to the unfilled order count, EXCHANGE_MAX_ORDERS filter, and the MAX_NUM_ORDERS filter. +Response format for orderReports is selected using the newOrderRespType parameter. The response example is for the RESULT response type. See POST /api/v3/order for more examples. + +Weight(IP): 1 + +Parameters: + +Name Type Mandatory Description +symbol STRING YES +listClientOrderId STRING NO Arbitrary unique ID among open order lists. Automatically generated if not sent. +A new order list with the same listClientOrderId is accepted only when the previous one is filled or completely expired. +listClientOrderId is distinct from the aboveClientOrderId and the belowCLientOrderId. +side ENUM YES BUY or SELL +quantity DECIMAL YES Quantity for both legs of the order list. +aboveType ENUM YES Supported values: STOP_LOSS_LIMIT, STOP_LOSS, LIMIT_MAKER, TAKE_PROFIT, TAKE_PROFIT_LIMIT +aboveClientOrderId STRING NO Arbitrary unique ID among open orders for the above leg order. Automatically generated if not sent +aboveIcebergQty LONG NO Note that this can only be used if aboveTimeInForce is GTC. +abovePrice DECIMAL NO Can be used if aboveType is STOP_LOSS_LIMIT , LIMIT_MAKER, or TAKE_PROFIT_LIMIT to specify the limit price. +aboveStopPrice DECIMAL NO Can be used if aboveType is STOP_LOSS, STOP_LOSS_LIMIT, TAKE_PROFIT, TAKE_PROFIT_LIMIT +Either aboveStopPrice or aboveTrailingDelta or both, must be specified. +aboveTrailingDelta LONG NO See Trailing Stop order FAQ. +aboveTimeInForce DECIMAL NO Required if aboveType is STOP_LOSS_LIMIT or TAKE_PROFIT_LIMIT +aboveStrategyId INT NO Arbitrary numeric value identifying the above leg order within an order strategy. +aboveStrategyType INT NO Arbitrary numeric value identifying the above leg order strategy. +Values smaller than 1000000 are reserved and cannot be used. +belowType ENUM YES Supported values: STOP_LOSS, STOP_LOSS_LIMIT, TAKE_PROFIT,TAKE_PROFIT_LIMIT +belowClientOrderId STRING NO Arbitrary unique ID among open orders for the below leg order. Automatically generated if not sent +belowIcebergQty LONG NO Note that this can only be used if belowTimeInForce is GTC. +belowPrice DECIMAL NO Can be used if belowType is STOP_LOSS_LIMIT , LIMIT_MAKER, or TAKE_PROFIT_LIMIT to specify the limit price. +belowStopPrice DECIMAL NO Can be used if belowType is STOP_LOSS, STOP_LOSS_LIMIT, TAKE_PROFIT or TAKE_PROFIT_LIMIT. +Either belowStopPrice or belowTrailingDelta or both, must be specified. belowTrailingDelta |LONG |NO |See Trailing Stop order FAQ. belowTimeInForce |ENUM |NO |Required if belowType is STOP_LOSS_LIMIT or TAKE_PROFIT_LIMIT belowStrategyId |INT |NO |Arbitrary numeric value identifying the below leg order within an order strategy. belowStrategyType |INT |NO |Arbitrary numeric value identifying the below leg order strategy. +Values smaller than 1000000 are reserved and cannot be used. newOrderRespType |ENUM |NO |Select response format: ACK, RESULT, FULL selfTradePreventionMode|ENUM |NO |The allowed enums is dependent on what is configured on the symbol. The possible supported values are EXPIRE_TAKER, EXPIRE_MAKER, EXPIRE_BOTH, NONE. recvWindow |LONG |NO |The value cannot be greater than 60000. timestamp |LONG |YES | + +Data Source: Matching Engine + + +New Order List - OTO (TRADE) +Response: + +{ + "orderListId": 0, + "contingencyType": "OTO", + "listStatusType": "EXEC_STARTED", + "listOrderStatus": "EXECUTING", + "listClientOrderId": "yl2ERtcar1o25zcWtqVBTC", + "transactionTime": 1712289389158, + "symbol": "ABCDEF", + "orders": [ + { + "symbol": "LTCBTC", + "orderId": 4, + "clientOrderId": "Bq17mn9fP6vyCn75Jw1xya" + }, + { + "symbol": "LTCBTC", + "orderId": 5, + "clientOrderId": "arLFo0zGJVDE69cvGBaU0d" + } + ], + "orderReports": [ + { + "symbol": "LTCBTC", + "orderId": 4, + "orderListId": 0, + "clientOrderId": "Bq17mn9fP6vyCn75Jw1xya", + "transactTime": 1712289389158, + "price": "1.00000000", + "origQty": "1.00000000", + "executedQty": "0.00000000", + "origQuoteOrderQty": "0.000000", + "cummulativeQuoteQty": "0.00000000", + "status": "NEW", + "timeInForce": "GTC", + "type": "LIMIT", + "side": "SELL", + "workingTime": 1712289389158, + "selfTradePreventionMode": "NONE" + }, + { + "symbol": "LTCBTC", + "orderId": 5, + "orderListId": 0, + "clientOrderId": "arLFo0zGJVDE69cvGBaU0d", + "transactTime": 1712289389158, + "price": "0.00000000", + "origQty": "5.00000000", + "executedQty": "0.00000000", + "origQuoteOrderQty": "0.000000", + "cummulativeQuoteQty": "0.00000000", + "status": "PENDING_NEW", + "timeInForce": "GTC", + "type": "MARKET", + "side": "BUY", + "workingTime": -1, + "selfTradePreventionMode": "NONE" + } + ] +} +POST /api/v3/orderList/oto + +An OTO (One-Triggers-the-Other) is an order list comprised of 2 orders. +The first order is called the working order and must be LIMIT or LIMIT_MAKER. Initially, only the working order goes on the order book. +The second order is called the pending order. It can be any order type except for MARKET orders using parameter quoteOrderQty. The pending order is only placed on the order book when the working order gets fully filled. +If either the working order or the pending order is cancelled individually, the other order in the order list will also be canceled or expired. +When the order list is placed, if the working order gets immediately fully filled, the placement response will show the working order as FILLED but the pending order will still appear as PENDING_NEW. You need to query the status of the pending order again to see its updated status. +OTOs add 2 orders to the unfilled order count., EXCHANGE_MAX_NUM_ORDERS filter and MAX_NUM_ORDERS filter. +Weight:(IP) 1 + +Parameters: + +Name Type Mandatory Description +symbol STRING YES +listClientOrderId STRING NO Arbitrary unique ID among open order lists. Automatically generated if not sent. +A new order list with the same listClientOrderId is accepted only when the previous one is filled or completely expired. +listClientOrderId is distinct from the workingClientOrderId and the pendingClientOrderId. +newOrderRespType ENUM NO Format of the JSON response. Supported values: ACK, FULL, RESULT +selfTradePreventionMode ENUM NO The allowed values are dependent on what is configured on the symbol. +workingType ENUM YES Supported values: LIMIT,LIMIT_MAKER +workingSide ENUM YES Supported values: BUY, SELL +workingClientOrderId STRING NO Arbitrary unique ID among open orders for the working order. +Automatically generated if not sent. +workingPrice DECIMAL YES +workingQuantity DECIMAL YES Sets the quantity for the working order. +workingIcebergQty DECIMAL YES This can only be used if workingTimeInForce is GTC or if workingType is LIMIT_MAKER. +workingTimeInForce ENUM NO Supported values: FOK, IOC, GTC +workingStrategyId INT NO Arbitrary numeric value identifying the working order within an order strategy. +workingStrategyType INT NO Arbitrary numeric value identifying the working order strategy. +Values smaller than 1000000 are reserved and cannot be used. +pendingType ENUM YES Note that MARKET orders using quoteOrderQty are not supported. +pendingSide ENUM YES Supported values: BUY, SELL +pendingClientOrderId STRING NO Arbitrary unique ID among open orders for the pending order. +Automatically generated if not sent. +pendingPrice DECIMAL NO +pendingStopPrice DECIMAL NO +pendingTrailingDelta DECIMAL NO +pendingQuantity DECIMAL YES Sets the quantity for the pending order. +pendingIcebergQty DECIMAL NO This can only be used if pendingTimeInForce is GTC or if pendingType is LIMIT_MAKER. +pendingTimeInForce ENUM NO Supported values: GTC, FOK, IOC +pendingStrategyId INT NO Arbitrary numeric value identifying the pending order within an order strategy. +pendingStrategyType INT NO Arbitrary numeric value identifying the pending order strategy. +Values smaller than 1000000 are reserved and cannot be used. +recvWindow LONG NO The value cannot be greater than 60000. +timestamp LONG YES +Mandatory parameters based on pendingType or workingType + +Depending on the pendingType or workingType, some optional parameters will become mandatory. + +Type Additional mandatory parameters Additional information +workingType = LIMIT workingTimeInForce +pendingType = LIMIT pendingPrice, pendingTimeInForce +pendingType = STOP_LOSS or TAKE_PROFIT pendingStopPrice and/or pendingTrailingDelta +pendingType = STOP_LOSS_LIMIT or TAKE_PROFIT_LIMIT pendingPrice, pendingStopPrice and/or pendingTrailingDelta, pendingTimeInForce +Data Source: + +Matching Engine + + +New Order List - OTOCO (TRADE) +Response: + +{ + "orderListId": 1, + "contingencyType": "OTO", + "listStatusType": "EXEC_STARTED", + "listOrderStatus": "EXECUTING", + "listClientOrderId": "RumwQpBaDctlUu5jyG5rs0", + "transactionTime": 1712291372842, + "symbol": "ABCDEF", + "orders": [ + { + "symbol": "LTCBTC", + "orderId": 6, + "clientOrderId": "fM9Y4m23IFJVCQmIrlUmMK" + }, + { + "symbol": "LTCBTC", + "orderId": 7, + "clientOrderId": "6pcQbFIzTXGZQ1e2MkGDq4" + }, + { + "symbol": "LTCBTC", + "orderId": 8, + "clientOrderId": "r4JMv9cwAYYUwwBZfbussx" + } + ], + "orderReports": [ + { + "symbol": "LTCBTC", + "orderId": 6, + "orderListId": 1, + "clientOrderId": "fM9Y4m23IFJVCQmIrlUmMK", + "transactTime": 1712291372842, + "price": "1.00000000", + "origQty": "1.00000000", + "executedQty": "0.00000000", + "origQuoteOrderQty": "0.000000", + "cummulativeQuoteQty": "0.00000000", + "status": "NEW", + "timeInForce": "GTC", + "type": "LIMIT", + "side": "SELL", + "workingTime": 1712291372842, + "selfTradePreventionMode": "NONE" + }, + { + "symbol": "LTCBTC", + "orderId": 7, + "orderListId": 1, + "clientOrderId": "6pcQbFIzTXGZQ1e2MkGDq4", + "transactTime": 1712291372842, + "price": "1.00000000", + "origQty": "5.00000000", + "executedQty": "0.00000000", + "origQuoteOrderQty": "0.000000", + "cummulativeQuoteQty": "0.00000000", + "status": "PENDING_NEW", + "timeInForce": "IOC", + "type": "STOP_LOSS_LIMIT", + "side": "BUY", + "stopPrice": "6.00000000", + "workingTime": -1, + "selfTradePreventionMode": "NONE" + }, + { + "symbol": "LTCBTC", + "orderId": 8, + "orderListId": 1, + "clientOrderId": "r4JMv9cwAYYUwwBZfbussx", + "transactTime": 1712291372842, + "price": "3.00000000", + "origQty": "5.00000000", + "executedQty": "0.00000000", + "origQuoteOrderQty": "0.000000", + "cummulativeQuoteQty": "0.00000000", + "status": "PENDING_NEW", + "timeInForce": "GTC", + "type": "LIMIT_MAKER", + "side": "BUY", + "workingTime": -1, + "selfTradePreventionMode": "NONE" + } + ] +} +POST /api/v3/orderList/otoco + +Place an OTOCO. + +An OTOCO (One-Triggers-One-Cancels-the-Other) is an order list comprised of 3 orders. + +The first order is called the working order and must be LIMIT or LIMIT_MAKER. Initially, only the working order goes on the order book. + +The behavior of the working order is the same as the OTO. +OTOCO has 2 pending orders (pending above and pending below), forming an OCO pair. The pending orders are only placed on the order book when the working order gets fully filled. + +The rules of the pending above and pending below follow the same rules as the Order List OCO. +OTOCOs add 3 orders against the unfilled order count, EXCHANGE_MAX_NUM_ORDERS filter, and MAX_NUM_ORDERS filter. + +Weight:(IP) 1 + +Parameters: + +Name Type Mandatory Description +symbol STRING YES +listClientOrderId STRING NO Arbitrary unique ID among open order lists. Automatically generated if not sent. +A new order list with the same listClientOrderId is accepted only when the previous one is filled or completely expired. +listClientOrderId is distinct from the workingClientOrderId, pendingAboveClientOrderId, and the pendingBelowClientOrderId. +newOrderRespType ENUM NO Format the JSON response. Supported values: ACK, FULL, RESPONSE +selfTradePreventionMode ENUM NO The allowed values are dependent on what is configured on the symbol. +workingType ENUM YES Supported values: LIMIT, LIMIT_MAKER +workingSide ENUM YES Supported values: BUY, SELL +workingClientOrderId STRING NO Arbitrary unique ID among open orders for the working order. +Automatically generated if not sent. +workingPrice DECIMAL YES +workingQuantity DECIMAL YES +workingIcebergQty DECIMAL NO This can only be used if workingTimeInForce is GTC or if workingType is LIMIT_MAKER. +workingTimeInForce ENUM NO Supported values: GTC, IOC, FOK +workingStrategyId INT NO Arbitrary numeric value identifying the working order within an order strategy. +workingStrategyType INT NO Arbitrary numeric value identifying the working order strategy. +Values smaller than 1000000 are reserved and cannot be used. +pendingSide ENUM YES Supported values: BUY, SELL +pendingQuantity DECIMAL YES +pendingAboveType ENUM YES Supported values: STOP_LOSS_LIMIT, STOP_LOSS, LIMIT_MAKER, TAKE_PROFIT, TAKE_PROFIT_LIMIT +pendingAboveClientOrderId STRING NO Arbitrary unique ID among open orders for the pending above order. +Automatically generated if not sent. +pendingAbovePrice DECIMAL NO Can be used if pendingAboveType is STOP_LOSS_LIMIT , LIMIT_MAKER, or TAKE_PROFIT_LIMIT to specify the limit price. +pendingAboveStopPrice DECIMAL NO Can be used if pendingAboveType is STOP_LOSS, STOP_LOSS_LIMIT, TAKE_PROFIT, TAKE_PROFIT_LIMIT +pendingAboveTrailingDelta DECIMAL NO +pendingAboveIcebergQty DECIMAL NO This can only be used if pendingAboveTimeInForce is GTC or if pendingAboveType is LIMIT_MAKER. +pendingAboveTimeInForce ENUM NO +pendingAboveStrategyId INT NO Arbitrary numeric value identifying the pending above order within an order strategy. +pendingAboveStrategyType INT NO Arbitrary numeric value identifying the pending above order strategy. +Values smaller than 1000000 are reserved and cannot be used. +pendingBelowType ENUM NO Supported values: STOP_LOSS, STOP_LOSS_LIMIT, TAKE_PROFIT,TAKE_PROFIT_LIMIT +pendingBelowClientOrderId STRING NO Arbitrary unique ID among open orders for the pending below order. +Automatically generated if not sent. +pendingBelowPrice DECIMAL NO Can be used if pendingBelowType is STOP_LOSS_LIMIT or TAKE_PROFIT_LIMIT to specify limit price +pendingBelowStopPrice DECIMAL NO Can be used if pendingBelowType is STOP_LOSS, STOP_LOSS_LIMIT, TAKE_PROFIT or TAKE_PROFIT_LIMIT. +Either pendingBelowStopPrice or pendingBelowTrailingDelta or both, must be specified. pendingBelowTrailingDelta|DECIMAL|NO | pendingBelowIcebergQty |DECIMAL|NO |This can only be used if pendingBelowTimeInForce is GTC or if pendingBelowType is LIMIT_MAKER. pendingBelowTimeInForce |ENUM |NO | pendingBelowStrategyId |INT |NO |Arbitrary numeric value identifying the pending below order within an order strategy. pendingBelowStrategyType |INT |NO |Arbitrary numeric value identifying the pending below order strategy. +Values smaller than 1000000 are reserved and cannot be used. recvWindow |LONG |NO |The value cannot be greater than 60000. timestamp |LONG |YES | + +Mandatory parameters based on pendingAboveType, pendingBelowType or workingType + +Depending on the pendingAboveType/pendingBelowType or workingType, some optional parameters will become mandatory. + +Type Additional mandatory parameters Additional information +workingType = LIMIT workingTimeInForce +pendingAboveType= LIMIT_MAKER pendingAbovePrice +pendingAboveType= STOP_LOSS/TAKE_PROFIT pendingAboveStopPrice and/or pendingAboveTrailingDelta +pendingAboveType=STOP_LOSS_LIMIT/TAKE_PROFIT_LIMIT pendingAbovePrice, pendingAboveStopPrice and/or pendingAboveTrailingDelta, pendingAboveTimeInForce +pendingBelowType= LIMIT_MAKER pendingBelowPrice +pendingBelowType= STOP_LOSS/TAKE_PROFIT pendingBelowStopPrice and/or pendingBelowTrailingDelta +pendingBelowType=STOP_LOSS_LIMIT/TAKE_PROFIT_LIMIT pendingBelowPrice, pendingBelowStopPrice and/or pendingBelowTrailingDelta, pendingBelowTimeInForce +Data Source: + +Matching Engine + +Cancel Order lists (TRADE) +Response: + +{ + "orderListId": 0, + "contingencyType": "OCO", + "listStatusType": "ALL_DONE", + "listOrderStatus": "ALL_DONE", + "listClientOrderId": "C3wyj4WVEktd7u9aVBRXcN", + "transactionTime": 1574040868128, + "symbol": "LTCBTC", + "orders": [ + { + "symbol": "LTCBTC", + "orderId": 2, + "clientOrderId": "pO9ufTiFGg3nw2fOdgeOXa" + }, + { + "symbol": "LTCBTC", + "orderId": 3, + "clientOrderId": "TXOvglzXuaubXAaENpaRCB" + } + ], + "orderReports": [ + { + "symbol": "LTCBTC", + "origClientOrderId": "pO9ufTiFGg3nw2fOdgeOXa", + "orderId": 2, + "orderListId": 0, + "clientOrderId": "unfWT8ig8i0uj6lPuYLez6", + "transactTime": 1688005070874, + "price": "1.00000000", + "origQty": "10.00000000", + "executedQty": "0.00000000", + "origQuoteOrderQty": "0.000000", + "cummulativeQuoteQty": "0.00000000", + "status": "CANCELED", + "timeInForce": "GTC", + "type": "STOP_LOSS_LIMIT", + "side": "SELL", + "stopPrice": "1.00000000", + "selfTradePreventionMode": "NONE" + }, + { + "symbol": "LTCBTC", + "origClientOrderId": "TXOvglzXuaubXAaENpaRCB", + "orderId": 3, + "orderListId": 0, + "clientOrderId": "unfWT8ig8i0uj6lPuYLez6", + "transactTime": 1688005070874, + "price": "3.00000000", + "origQty": "10.00000000", + "executedQty": "0.00000000", + "origQuoteOrderQty": "0.000000", + "cummulativeQuoteQty": "0.00000000", + "status": "CANCELED", + "timeInForce": "GTC", + "type": "LIMIT_MAKER", + "side": "SELL", + "selfTradePreventionMode": "NONE" + } + ] +} +DELETE /api/v3/orderList + +Cancel an entire Order List. + +Weight(IP): 1 + +Parameters: + +Name Type Mandatory Description +symbol STRING YES +orderListId LONG NO Either orderListId or listClientOrderId must be provided +listClientOrderId STRING NO Either orderListId or listClientOrderId must be provided +newClientOrderId STRING NO Used to uniquely identify this cancel. Automatically generated by default +recvWindow LONG NO The value cannot be greater than 60000 +timestamp LONG YES +Additional notes: + +Canceling an individual leg will cancel the entire OCO +If both orderListId and listClientOrderID are provided, orderId takes precedence. +Data Source: Matching Engine + +Query Order lists (USER_DATA) +Response: + +{ + "orderListId": 27, + "contingencyType": "OCO", + "listStatusType": "EXEC_STARTED", + "listOrderStatus": "EXECUTING", + "listClientOrderId": "h2USkA5YQpaXHPIrkd96xE", + "transactionTime": 1565245656253, + "symbol": "LTCBTC", + "orders": [ + { + "symbol": "LTCBTC", + "orderId": 4, + "clientOrderId": "qD1gy3kc3Gx0rihm9Y3xwS" + }, + { + "symbol": "LTCBTC", + "orderId": 5, + "clientOrderId": "ARzZ9I00CPM8i3NhmU9Ega" + } + ] +} +GET /api/v3/orderList + +Retrieves a specific Order list based on provided optional parameters + +Weight(IP): 4 + +Parameters: + +Name Type Mandatory Description +orderListId LONG NO Either orderListId or origClientOrderId must be provided +origClientOrderId STRING NO Either orderListId or origClientOrderId must be provided +recvWindow LONG NO The value cannot be greater than 60000 +timestamp LONG YES +Data Source: Database + +Query all Order lists (USER_DATA) +Response: + +[ + { + "orderListId": 29, + "contingencyType": "OCO", + "listStatusType": "EXEC_STARTED", + "listOrderStatus": "EXECUTING", + "listClientOrderId": "amEEAXryFzFwYF1FeRpUoZ", + "transactionTime": 1565245913483, + "symbol": "LTCBTC", + "orders": [ + { + "symbol": "LTCBTC", + "orderId": 4, + "clientOrderId": "oD7aesZqjEGlZrbtRpy5zB" + }, + { + "symbol": "LTCBTC", + "orderId": 5, + "clientOrderId": "Jr1h6xirOxgeJOUuYQS7V3" + } + ] + }, + { + "orderListId": 28, + "contingencyType": "OCO", + "listStatusType": "EXEC_STARTED", + "listOrderStatus": "EXECUTING", + "listClientOrderId": "hG7hFNxJV6cZy3Ze4AUT4d", + "transactionTime": 1565245913407, + "symbol": "LTCBTC", + "orders": [ + { + "symbol": "LTCBTC", + "orderId": 2, + "clientOrderId": "j6lFOfbmFMRjTYA7rRJ0LP" + }, + { + "symbol": "LTCBTC", + "orderId": 3, + "clientOrderId": "z0KCjOdditiLS5ekAFtK81" + } + ] + } +] +GET /api/v3/allOrderList + +Retrieves all Order lists based on provided optional parameters + +Weight(IP): 20 + +Parameters + +Name Type Mandatory Description +fromId LONG NO If supplied, neither startTime or endTime can be provided +startTime LONG NO +endTime LONG NO +limit INT NO Default Value: 500; Max Value: 1000 +recvWindow LONG NO The value cannot be greater than 60000 +timestamp LONG YES +Data Source: Database + +Query Open Order lists (USER_DATA) +Response: + +[ + { + "orderListId": 31, + "contingencyType": "OCO", + "listStatusType": "EXEC_STARTED", + "listOrderStatus": "EXECUTING", + "listClientOrderId": "wuB13fmulKj3YjdqWEcsnp", + "transactionTime": 1565246080644, + "symbol": "LTCBTC", + "orders": [ + { + "symbol": "LTCBTC", + "orderId": 4, + "clientOrderId": "r3EH2N76dHfLoSZWIUw1bT" + }, + { + "symbol": "LTCBTC", + "orderId": 5, + "clientOrderId": "Cv1SnyPD3qhqpbjpYEHbd2" + } + ] + } +] +GET /api/v3/openOrderList + +Weight(IP): 6 + +Parameters + +Name Type Mandatory Description +recvWindow LONG NO The value cannot be greater than 60000 +timestamp LONG YES +Data Source: Database + +New order using SOR (TRADE) +Response: + +{ + "symbol": "BTCUSDT", + "orderId": 2, + "orderListId": -1, + "clientOrderId": "sBI1KM6nNtOfj5tccZSKly", + "transactTime": 1689149087774, + "price": "31000.00000000", + "origQty": "0.50000000", + "executedQty": "0.50000000", + "cummulativeQuoteQty": "14000.00000000", + "status": "FILLED", + "timeInForce": "GTC", + "type": "LIMIT", + "side": "BUY", + "workingTime": 1689149087774, + "fills": [ + { + "matchType": "ONE_PARTY_TRADE_REPORT", + "price": "28000.00000000", + "qty": "0.50000000", + "commission": "0.00000000", + "commissionAsset": "BTC", + "tradeId": -1, + "allocId": 0 + } + ], + "workingFloor": "SOR", + "selfTradePreventionMode": "NONE", + "usedSor": true +} +POST /api/v3/sor/order + +Places an order using smart order routing (SOR). + +Weight: 1 + +Parameters: + +Name Type Mandatory Description +symbol STRING YES +side ENUM YES +type ENUM YES +timeInForce ENUM NO +quantity DECIMAL YES +price DECIMAL NO +newClientOrderId STRING NO A unique id among open orders. Automatically generated if not sent. +Orders with the same newClientOrderID can be accepted only when the previous one is filled, otherwise the order will be rejected. +strategyId INT NO +strategyType INT NO The value cannot be less than 1000000. +icebergQty DECIMAL NO Used with LIMIT to create an iceberg order. +newOrderRespType ENUM NO Set the response JSON. ACK, RESULT, or FULL. Default to FULL +selfTradePreventionMode ENUM NO The allowed enums is dependent on what is configured on the symbol. The possible supported values are EXPIRE_TAKER, EXPIRE_MAKER, EXPIRE_BOTH, NONE. +recvWindow LONG NO The value cannot be greater than 60000 +timestamp LONG YES +Note: POST /api/v3/sor/order only supports LIMIT and MARKET orders. quoteOrderQty is not supported. + +Data Source: Matching Engine + +Test new order using SOR (TRADE) +Response: + +{} +OR + +{ + "standardCommissionForOrder": { //Standard commission rates on trades from the order. + "maker": "0.00000112", + "taker": "0.00000114", + }, + "taxCommissionForOrder": { //Tax commission rates for trades from the order. + "maker": "0.00000112", + "taker": "0.00000114", + }, + "discount": { //Discount on standard commissions when paying in BNB. + "enabledForAccount": true, + "enabledForSymbol": true, + "discountAsset": "BNB", + "discount": "0.25000000" //Standard commission is reduced by this rate when paying commission in BNB. + } +} +POST /api/v3/sor/order/test + +Test new order creation and signature/recvWindow using smart order routing (SOR). Creates and validates a new order but does not send it into the matching engine. + +Weight: + +Condition Request Weight +Without computeCommissionRates 1 +With computeCommissionRates 20 +Parameters: + +In addition to all parameters accepted by POST /api/v3/sor/order, the following optional parameters are also accepted: + +Name Type Mandatory Description +computeCommissionRates BOOLEAN NO Default: false +Spot Account Endpoints +Account Information (USER_DATA) +Response: + +{ + "makerCommission": 15, + "takerCommission": 15, + "buyerCommission": 0, + "sellerCommission": 0, + "commissionRates": { + "maker": "0.00150000", + "taker": "0.00150000", + "buyer": "0.00000000", + "seller": "0.00000000" + }, + "canTrade": true, + "canWithdraw": true, + "canDeposit": true, + "brokered": false, + "requireSelfTradePrevention": false, + "preventSor": false, + "updateTime": 123456789, + "accountType": "SPOT", + "balances": [ + { + "asset": "BTC", + "free": "4723846.89208129", + "locked": "0.00000000" + }, + { + "asset": "LTC", + "free": "4763368.68006011", + "locked": "0.00000000" + } + ], + "permissions": [ + "SPOT" + ], + "uid": 354937868 +} +GET /api/v3/account + +Get current account information. + +Weight(IP): 20 + +Parameters: + +Name Type Mandatory Description +omitZeroBalances BOOLEAN NO When set to true, emits only the non-zero balances of an account. +Default value: false +recvWindow LONG NO The value cannot be greater than 60000 +timestamp LONG YES +Data Source: Memory => Database + +Account Trade List (USER_DATA) +Response: + +[ + { + "symbol": "BNBBTC", + "id": 28457, + "orderId": 100234, + "orderListId": -1, //Unless an order list, the value will always be -1 + "price": "4.00000100", + "qty": "12.00000000", + "quoteQty": "48.000012", + "commission": "10.10000000", + "commissionAsset": "BNB", + "time": 1499865549590, + "isBuyer": true, + "isMaker": false, + "isBestMatch": true + } +] +GET /api/v3/myTrades + +Get trades for a specific account and symbol. + +Weight(IP): 20 + +Parameters: + +Name Type Mandatory Description +symbol STRING YES +orderId LONG NO This can only be used in combination with symbol. +startTime LONG NO +endTime LONG NO +fromId LONG NO TradeId to fetch from. Default gets most recent trades. +limit INT NO Default 500; max 1000. +recvWindow LONG NO The value cannot be greater than 60000 +timestamp LONG YES +Notes: + +If fromId is set, it will get id >= that fromId. Otherwise most recent trades are returned. +The time between startTime and endTime can't be longer than 24 hours. +These are the supported combinations of all parameters: +symbol +symbol + orderId +symbol + startTime +symbol + endTime +symbol + fromId +symbol + startTime + endTime +symbol+ orderId + fromId +Data Source: Memory => Database + + +Query Unfilled Order Count (USER_DATA) +Response: + +[ + + { + "rateLimitType": "ORDERS", + "interval": "SECOND", + "intervalNum": 10, + "limit": 10000, + "count": 0 + }, + { + "rateLimitType": "ORDERS", + "interval": "DAY", + "intervalNum": 1, + "limit": 20000, + "count": 0 + } +] +GET /api/v3/rateLimit/order + +Displays the user's unfilled order count for all intervals. + +Weight(IP): 40 + +Parameters: + +Name Type Mandatory Description +recvWindow LONG NO The value cannot be greater than 60000 +timestamp LONG YES +Data Source: Memory + +Query Prevented Matches (USER_DATA) +Response: + +[ + { + "symbol": "BTCUSDT", + "preventedMatchId": 1, + "takerOrderId": 5, + "makerOrderId": 3, + "tradeGroupId": 1, + "selfTradePreventionMode": "EXPIRE_MAKER", + "price": "1.100000", + "makerPreventedQuantity": "1.300000", + "transactTime": 1669101687094 + } +] +GET /api/v3/myPreventedMatches + +Displays the list of orders that were expired because of STP. + +For additional information on what a Prevented match is, as well as Self Trade Prevention (STP), please refer to our STP FAQ page. + +These are the combinations supported: + +symbol + preventedMatchId +symbol + orderId +symbol + orderId + fromPreventedMatchId (limit will default to 500) +symbol + orderId + fromPreventedMatchId + limit +Parameters: + +Name Type Mandatory Description +symbol STRING YES +preventedMatchId LONG NO +orderId LONG NO +fromPreventedMatchId LONG NO +limit INT NO Default: 500; Max: 1000 +recvWindow LONG NO The value cannot be greater than 60000 +timestamp LONG YES +Weight(IP) + +Case Weight +If symbol is invalid 2 +Querying by preventedMatchId 2 +Querying by orderId 20 +Data Source: + +Database + +Query Allocations (USER_DATA) +Response: + +[ + { + "symbol": "BTCUSDT", + "allocationId": 0, + "allocationType": "SOR", + "orderId": 1, + "orderListId": -1, + "price": "1.00000000", + "qty": "5.00000000", + "quoteQty": "5.00000000", + "commission": "0.00000000", + "commissionAsset": "BTC", + "time": 1687506878118, + "isBuyer": true, + "isMaker": false, + "isAllocator": false + } +] +GET /api/v3/myAllocations + +Retrieves allocations resulting from SOR order placement. + +Weight: 20 + +Parameters: + +Name Type Mandatory Description +symbol STRING Yes +startTime LONG No +endTime LONG No +fromAllocationId INT No +limit INT No Default 500;Max 1000 +orderId LONG No +recvWindow LONG No The value cannot be greater than 60000. +timestamp LONG No +Supported parameter combinations: + +Parameters Response +symbol allocations from oldest to newest +symbol + startTime oldest allocations since startTime +symbol + endTime newest allocations until endTime +symbol + startTime + endTime allocations within the time range +symbol + fromAllocationId allocations by allocation ID +symbol + orderId allocations related to an order starting with oldest +symbol + orderId + fromAllocationId allocations related to an order by allocation ID +Note: The time between startTime and endTime can't be longer than 24 hours. + +Data Source: Database + +Query Commission Rates (USER_DATA) +Response: + +{ + "symbol": "BTCUSDT", + "standardCommission": { //Standard commission rates on trades from the order. + "maker": "0.00000010", + "taker": "0.00000020", + "buyer": "0.00000030", + "seller": "0.00000040" + }, + "taxCommission": { //Tax commission rates for trades from the order. + "maker": "0.00000112", + "taker": "0.00000114", + "buyer": "0.00000118", + "seller": "0.00000116" + }, + "discount": { //Discount commission when paying in BNB + "enabledForAccount": true, + "enabledForSymbol": true, + "discountAsset": "BNB", + "discount": "0.75000000" //Standard commission is reduced by this rate when paying commission in BNB. + } +} +GET /api/v3/account/commission + +Get current account commission rates. + +Weight: 20 + +Parameters: + +Name Type Mandatory Description +symbol STRING YES +Data Source: Database + +Margin Account/Trade +Margin account borrow/repay(MARGIN) +Response: + +{ + //transaction id + "tranId": 100000001 +} +POST /sapi/v1/margin/borrow-repay + +Margin account borrow/repay(MARGIN) + +Weight(UID): 1500 + +Parameters: + +Name Type Mandatory Description +asset STRING YES +isIsolated STRING YES TRUE for Isolated Margin, FALSE for Cross Margin, Default FALSE +symbol STRING YES Only for Isolated margin +amount STRING YES +type STRING YES BORROW or REPAY +recvWindow LONG NO The value cannot be greater than 60000 +timestamp LONG YES +Query borrow/repay records in Margin account(USER_DATA) +Response: + +{ + "rows": [ + { + "isolatedSymbol": "BNBUSDT", // isolated symbol, will not be returned for crossed margin + "amount": "14.00000000", // Total amount borrowed/repaid + "asset": "BNB", + "interest": "0.01866667", // Interest repaid + "principal": "13.98133333", // Principal repaid + "status": "CONFIRMED", //one of PENDING (pending execution), CONFIRMED (successfully execution), FAILED (execution failed, nothing happened to your account); + "timestamp": 1563438204000, + "txId": 2970933056 + } + ], + "total": 1 +} + +GET /sapi/v1/margin/borrow-repay + +Query borrow/repay records in Margin account + +Weight(IP): 10 + +Parameters: + +Name Type Mandatory Description +asset STRING NO +isolatedSymbol STRING NO Symbol in Isolated Margin +txId LONG NO tranId in POST /sapi/v1/margin/loan +startTime LONG NO +endTime LONG NO +current LONG NO Current querying page. Start from 1. Default:1 +size LONG NO Default:10 Max:100 +type STRING YES BORROW or REPAY +recvWindow LONG NO The value cannot be greater than 60000 +timestamp LONG YES +txId or startTime must be sent. txId takes precedence. Response in descending order +If an asset is sent, data within 30 days before endTime; If an asset is not sent, data within 7 days before endTime +If neither startTime nor endTime is sent, the recent 7-day data will be returned. +startTime set as endTime - 7days by default, endTime set as current time by default +Get All Margin Assets (MARKET_DATA) +Response: + +[ + { + "assetFullName": "USD coin", + "assetName": "USDC", + "isBorrowable": true, + "isMortgageable": true, + "userMinBorrow": "0.00000000", + "userMinRepay": "0.00000000", + "delistTime": 1704973040 + } +] +GET /sapi/v1/margin/allAssets + +Weight(IP): 1 + +Parameters: + +Name Type Mandatory Description +asset STRING NO +Get All Cross Margin Pairs (MARKET_DATA) +Response: + +[ + { + "base": "BNB", + "id": 351637150141315861, + "isBuyAllowed": true, + "isMarginTrade": true, + "isSellAllowed": true, + "quote": "BTC", + "symbol": "BNBBTC" + }, + { + "base": "TRX", + "id": 351637923235429141, + "isBuyAllowed": true, + "isMarginTrade": true, + "isSellAllowed": true, + "quote": "BTC", + "symbol": "TRXBTC", + "delistTime": 1704973040 + }, + { + "base": "XRP", + "id": 351638112213990165, + "isBuyAllowed": true, + "isMarginTrade": true, + "isSellAllowed": true, + "quote": "BTC", + "symbol": "XRPBTC" + }, + { + "base": "ETH", + "id": 351638524530850581, + "isBuyAllowed": true, + "isMarginTrade": true, + "isSellAllowed": true, + "quote": "BTC", + "symbol": "ETHBTC" + } +] +GET /sapi/v1/margin/allPairs + +Weight(IP): 1 + +Parameters: + +Name Type Mandatory Description +symbol STRING NO +Query Margin PriceIndex (MARKET_DATA) +Response: + +{ + "calcTime": 1562046418000, + "price": "0.00333930", + "symbol": "BNBBTC" +} +GET /sapi/v1/margin/priceIndex + +Weight(IP): 10 + +Parameters: + +Name Type Mandatory Description +symbol STRING YES +Margin Account New Order (TRADE) +Response ACK: + +{ + "symbol": "BTCUSDT", + "orderId": 28, + "clientOrderId": "6gCrw2kRUAF9CvJDGP16IP", + "isIsolated": true, // if isolated margin + "transactTime": 1507725176595 +} +Response RESULT: + +{ + "symbol": "BTCUSDT", + "orderId": 28, + "clientOrderId": "6gCrw2kRUAF9CvJDGP16IP", + "transactTime": 1507725176595, + "price": "1.00000000", + "origQty": "10.00000000", + "executedQty": "10.00000000", + "cummulativeQuoteQty": "30000", + "status": "FILLED", + "timeInForce": "GTC", + "type": "MARKET", + "isIsolated": true, // if isolated margin + "side": "SELL", + "selfTradePreventionMode": "NONE" +} +Response FULL: + +{ + "symbol": "BTCUSDT", + "orderId": 28, + "clientOrderId": "6gCrw2kRUAF9CvJDGP16IP", + "transactTime": 1507725176595, + "price": "1.00000000", + "origQty": "10.00000000", + "executedQty": "10.00000000", + "cummulativeQuoteQty": "39983.00000000", + "status": "FILLED", + "timeInForce": "GTC", + "type": "MARKET", + "side": "SELL", + "marginBuyBorrowAmount": 5, // will not return if no margin trade happens + "marginBuyBorrowAsset": "BTC", // will not return if no margin trade happens + "isIsolated": true, // if isolated margin + "selfTradePreventionMode": "NONE", + "fills": [ + { + "price": "4000.00000000", + "qty": "1.00000000", + "commission": "4.00000000", + "commissionAsset": "USDT" + }, + { + "price": "3999.00000000", + "qty": "5.00000000", + "commission": "19.99500000", + "commissionAsset": "USDT" + }, + { + "price": "3998.00000000", + "qty": "2.00000000", + "commission": "7.99600000", + "commissionAsset": "USDT" + }, + { + "price": "3997.00000000", + "qty": "1.00000000", + "commission": "3.99700000", + "commissionAsset": "USDT" + }, + { + "price": "3995.00000000", + "qty": "1.00000000", + "commission": "3.99500000", + "commissionAsset": "USDT" + } + ] +} +POST /sapi/v1/margin/order + +Post a new order for margin account. + +Weight(UID): 6 + +Parameters: + +Name Type Mandatory Description +symbol STRING YES +isIsolated STRING NO for isolated margin or not, "TRUE", "FALSE",default "FALSE" +side ENUM YES BUY + +SELL +type ENUM YES +quantity DECIMAL NO +quoteOrderQty DECIMAL NO +price DECIMAL NO +stopPrice DECIMAL NO Used with STOP_LOSS, STOP_LOSS_LIMIT, TAKE_PROFIT, and TAKE_PROFIT_LIMIT orders. +newClientOrderId STRING NO A unique id among open orders. Automatically generated if not sent. +icebergQty DECIMAL NO Used with LIMIT, STOP_LOSS_LIMIT, and TAKE_PROFIT_LIMIT to create an iceberg order. +newOrderRespType ENUM NO Set the response JSON. ACK, RESULT, or FULL; MARKET and LIMIT order types default to FULL, all other orders default to ACK. +sideEffectType ENUM NO NO_SIDE_EFFECT, MARGIN_BUY, AUTO_REPAY,AUTO_BORROW_REPAY; default NO_SIDE_EFFECT. More info in FAQ +timeInForce ENUM NO GTC,IOC,FOK +selfTradePreventionMode ENUM NO The allowed enums is dependent on what is configured on the symbol. The possible supported values are EXPIRE_TAKER, EXPIRE_MAKER, EXPIRE_BOTH, NONE +autoRepayAtCancel BOOLEAN NO Only when MARGIN_BUY or AUTO_BORROW_REPAY order takes effect, true means that the debt generated by the order needs to be repay after the order is cancelled. The default is true +recvWindow LONG NO The value cannot be greater than 60000 +timestamp LONG YES +autoRepayAtCancel is suggested to set as “FALSE” to keep liability unrepaid under high frequent new order/cancel order execution +Margin Account Cancel Order (TRADE) +Response: + +{ + "symbol": "LTCBTC", + "isIsolated": true, // if isolated margin + "orderId": "28", + "origClientOrderId": "myOrder1", + "clientOrderId": "cancelMyOrder1", + "price": "1.00000000", + "origQty": "10.00000000", + "executedQty": "8.00000000", + "cummulativeQuoteQty": "8.00000000", + "status": "CANCELED", + "timeInForce": "GTC", + "type": "LIMIT", + "side": "SELL" +} +DELETE /sapi/v1/margin/order + +Cancel an active order for margin account. + +Weight(IP): 10 + +Parameters: + +Name Type Mandatory Description +symbol STRING YES +isIsolated STRING NO for isolated margin or not, "TRUE", "FALSE",default "FALSE" +orderId LONG NO +origClientOrderId STRING NO +newClientOrderId STRING NO Used to uniquely identify this cancel. Automatically generated by default. +recvWindow LONG NO The value cannot be greater than 60000 +timestamp LONG YES +Either orderId or origClientOrderId must be sent. +Margin Account Cancel all Open Orders on a Symbol (TRADE) +Response: + +[ + { + "symbol": "BTCUSDT", + "isIsolated": true, // if isolated margin + "origClientOrderId": "E6APeyTJvkMvLMYMqu1KQ4", + "orderId": 11, + "orderListId": -1, + "clientOrderId": "pXLV6Hz6mprAcVYpVMTGgx", + "price": "0.089853", + "origQty": "0.178622", + "executedQty": "0.000000", + "cummulativeQuoteQty": "0.000000", + "status": "CANCELED", + "timeInForce": "GTC", + "type": "LIMIT", + "side": "BUY", + "selfTradePreventionMode": "NONE" + }, + { + "symbol": "BTCUSDT", + "isIsolated": false, // if isolated margin + "origClientOrderId": "A3EF2HCwxgZPFMrfwbgrhv", + "orderId": 13, + "orderListId": -1, + "clientOrderId": "pXLV6Hz6mprAcVYpVMTGgx", + "price": "0.090430", + "origQty": "0.178622", + "executedQty": "0.000000", + "cummulativeQuoteQty": "0.000000", + "status": "CANCELED", + "timeInForce": "GTC", + "type": "LIMIT", + "side": "BUY", + "selfTradePreventionMode": "NONE" + }, + { + "orderListId": 1929, + "contingencyType": "OCO", + "listStatusType": "ALL_DONE", + "listOrderStatus": "ALL_DONE", + "listClientOrderId": "2inzWQdDvZLHbbAmAozX2N", + "transactionTime": 1585230948299, + "symbol": "BTCUSDT", + "isIsolated": true, // if isolated margin + "orders": [ + { + "symbol": "BTCUSDT", + "orderId": 20, + "clientOrderId": "CwOOIPHSmYywx6jZX77TdL" + }, + { + "symbol": "BTCUSDT", + "orderId": 21, + "clientOrderId": "461cPg51vQjV3zIMOXNz39" + } + ], + "orderReports": [ + { + "symbol": "BTCUSDT", + "origClientOrderId": "CwOOIPHSmYywx6jZX77TdL", + "orderId": 20, + "orderListId": 1929, + "clientOrderId": "pXLV6Hz6mprAcVYpVMTGgx", + "price": "0.668611", + "origQty": "0.690354", + "executedQty": "0.000000", + "cummulativeQuoteQty": "0.000000", + "status": "CANCELED", + "timeInForce": "GTC", + "type": "STOP_LOSS_LIMIT", + "side": "BUY", + "stopPrice": "0.378131", + "icebergQty": "0.017083" + }, + { + "symbol": "BTCUSDT", + "origClientOrderId": "461cPg51vQjV3zIMOXNz39", + "orderId": 21, + "orderListId": 1929, + "clientOrderId": "pXLV6Hz6mprAcVYpVMTGgx", + "price": "0.008791", + "origQty": "0.690354", + "executedQty": "0.000000", + "cummulativeQuoteQty": "0.000000", + "status": "CANCELED", + "timeInForce": "GTC", + "type": "LIMIT_MAKER", + "side": "BUY", + "icebergQty": "0.639962" + } + ] + } +] +DELETE /sapi/v1/margin/openOrders + +Cancels all active orders on a symbol for margin account. + +This includes Order list orders. + +Weight(IP): 1 + +Parameters + +Name Type Mandatory Description +symbol STRING YES +isIsolated STRING NO for isolated margin or not, "TRUE", "FALSE",default "FALSE" +recvWindow LONG NO The value cannot be greater than 60000 +timestamp LONG YES +Adjust cross margin max leverage (USER_DATA) +Response: + +{ + "success": true +} +POST /sapi/v1/margin/max-leverage + +Adjust cross margin max leverage + +Weight(UID): 3000 + +Request Limit: 1 times/min per UID + +Parameters + +Name Type Mandatory Description +maxLeverage Integer YES Can only adjust 3 , 5 or 10,Example: maxLeverage=10 for Cross Margin Pro ,maxLeverage = 5 or 3 for Cross Margin Classic +The margin level need higher than the initial risk ratio of adjusted leverage, the initial risk ratio of 3x is 1.5 , the initial risk ratio of 5x is 1.25, the initial risk ratio of 10x is 2.5. +Get Cross Margin Transfer History (USER_DATA) +Response: + +{ + "rows": [ + { + "amount": "0.10000000", + "asset": "BNB", + "status": "CONFIRMED", + "timestamp": 1566898617, + "txId": 5240372201, + "type": "ROLL_IN", + "transFrom": "SPOT", //SPOT,FUTURES,FIAT,DELIVERY,MINING,ISOLATED_MARGIN,FUNDING,MOTHER_SPOT,OPTION,SUB_SPOT,SUB_MARGIN,CROSS_MARGIN + "transTo": "ISOLATED_MARGIN",//SPOT,FUTURES,FIAT,DELIVERY,MINING,ISOLATED_MARGIN,FUNDING,MOTHER_SPOT,OPTION,SUB_SPOT,SUB_MARGIN,CROSS_MARGIN + }, + { + "amount": "5.00000000", + "asset": "USDT", + "status": "CONFIRMED", + "timestamp": 1566888436, + "txId": 5239810406, + "type": "ROLL_OUT", + "transFrom": "ISOLATED_MARGIN",//SPOT,FUTURES,FIAT,DELIVERY,MINING,ISOLATED_MARGIN,FUNDING,MOTHER_SPOT,OPTION,SUB_SPOT,SUB_MARGIN,CROSS_MARGIN + "transTo": "ISOLATED_MARGIN", //SPOT,FUTURES,FIAT,DELIVERY,MINING,ISOLATED_MARGIN,FUNDING,MOTHER_SPOT,OPTION,SUB_SPOT,SUB_MARGIN,CROSS_MARGIN + "fromSymbol": "BNBUSDT", + "toSymbol": "BTCUSDT" + }, + { + "amount": "1.00000000", + "asset": "EOS", + "status": "CONFIRMED", + "timestamp": 1566888403, + "txId": 5239808703, + "type": "ROLL_IN" + } + ], + "total": 3 +} +GET /sapi/v1/margin/transfer + +Weight(IP): 1 + +Parameters: + +Name Type Mandatory Description +asset STRING NO +type STRING NO Transfer Type: ROLL_IN, ROLL_OUT +startTime LONG NO +endTime LONG NO +current LONG NO Currently querying page. Start from 1. Default:1 +size LONG NO Default:10 Max:100 +isolatedSymbol STRING NO Symbol in Isolated Margin +recvWindow LONG NO The value cannot be greater than 60000 +timestamp LONG YES +Response in descending order +The max interval between startTime and endTime is 30 days. +Returns data for last 7 days by default +Get Interest History (USER_DATA) +Response: + +{ + "rows": [ + { + "txId": 1352286576452864727, + "interestAccuredTime": 1672160400000, + "asset": "USDT", + "rawAsset": "USDT", // will not be returned for isolated margin + "principal": "45.3313", + "interest": "0.00024995", + "interestRate": "0.00013233", + "type": "ON_BORROW", + "isolatedSymbol": "BNBUSDT" // isolated symbol, will not be returned for crossed margin + } + ], + "total": 1 +} +GET /sapi/v1/margin/interestHistory + +Weight(IP): 1 + +Parameters: + +Name Type Mandatory Description +asset STRING NO +isolatedSymbol STRING NO isolated symbol +startTime LONG NO per-second accuracy. milliseconds input will be ignored. e.g. XXXXXXXXXX000ms +endTime LONG NO per-second accuracy. milliseconds input will be ignored. e.g. XXXXXXXXXX000ms +current LONG NO Currently querying page. Start from 1. Default:1 +size LONG NO Default:10 Max:100 +recvWindow LONG NO The value cannot be greater than 60000 +timestamp LONG YES +Response in descending order +If isolatedSymbol is not sent, crossed margin data will be returned +The max interval between startTime and endTime is 30 days. +If startTimeand endTime not sent, return records of the last 7 days by default +Set archived to true to query data from 6 months ago +type in response has 4 enums: +PERIODIC interest charged per hour +ON_BORROW first interest charged on borrow +PERIODIC_CONVERTED interest charged per hour converted into BNB +ON_BORROW_CONVERTED first interest charged on borrow converted into BNB +PORTFOLIO interest charged daily on the portfolio margin negative balance +Get Force Liquidation Record (USER_DATA) +Response: + + { + "rows": [ + { + "avgPrice": "0.00388359", + "executedQty": "31.39000000", + "orderId": 180015097, + "price": "0.00388110", + "qty": "31.39000000", + "side": "SELL", + "symbol": "BNBBTC", + "timeInForce": "GTC", + "isIsolated": true, + "updatedTime": 1558941374745 + } + ], + "total": 1 + } +GET /sapi/v1/margin/forceLiquidationRec + +Weight(IP): 1 + +Parameters: + +Name Type Mandatory Description +startTime LONG NO +endTime LONG NO +isolatedSymbol STRING NO +current LONG NO Currently querying page. Start from 1. Default:1 +size LONG NO Default:10 Max:100 +recvWindow LONG NO The value cannot be greater than 60000 +timestamp LONG YES +Response in descending order +Query Cross Margin Account Details (USER_DATA) +Response: + +{ + "created" : true, // True means margin account created , false means margin account not created. + "borrowEnabled": true, + "marginLevel": "11.64405625", + "collateralMarginLevel" : "3.2", + "totalAssetOfBtc": "6.82728457", + "totalLiabilityOfBtc": "0.58633215", + "totalNetAssetOfBtc": "6.24095242", + "totalCollateralValueInUSDT": "5.82728457", + "tradeEnabled": true, + "transferEnabled": true, + "accountType": "MARGIN_1", // //MARGIN_1 for Cross Margin Classic, MARGIN_2 for Cross Margin Pro + "userAssets": [ + { + "asset": "BTC", + "borrowed": "0.00000000", + "free": "0.00499500", + "interest": "0.00000000", + "locked": "0.00000000", + "netAsset": "0.00499500" + }, + { + "asset": "BNB", + "borrowed": "201.66666672", + "free": "2346.50000000", + "interest": "0.00000000", + "locked": "0.00000000", + "netAsset": "2144.83333328" + }, + { + "asset": "ETH", + "borrowed": "0.00000000", + "free": "0.00000000", + "interest": "0.00000000", + "locked": "0.00000000", + "netAsset": "0.00000000" + }, + { + "asset": "USDT", + "borrowed": "0.00000000", + "free": "0.00000000", + "interest": "0.00000000", + "locked": "0.00000000", + "netAsset": "0.00000000" + } + ] +} +GET /sapi/v1/margin/account + +Weight(IP): 10 + +Parameters: + +Name Type Mandatory Description +recvWindow LONG NO The value cannot be greater than 60000 +timestamp LONG YES +Query Margin Account's Order (USER_DATA) +Response: + +{ + "clientOrderId": "ZwfQzuDIGpceVhKW5DvCmO", + "cummulativeQuoteQty": "0.00000000", + "executedQty": "0.00000000", + "icebergQty": "0.00000000", + "isWorking": true, + "orderId": 213205622, + "origQty": "0.30000000", + "price": "0.00493630", + "side": "SELL", + "status": "NEW", + "stopPrice": "0.00000000", + "symbol": "BNBBTC", + "isIsolated": true, + "time": 1562133008725, + "timeInForce": "GTC", + "type": "LIMIT", + "selfTradePreventionMode": "NONE", + "updateTime": 1562133008725 +} +GET /sapi/v1/margin/order + +Weight(IP): 10 + +Parameters: + +Name Type Mandatory Description +symbol STRING YES +isIsolated STRING NO for isolated margin or not, "TRUE", "FALSE",default "FALSE" +orderId LONG NO +origClientOrderId STRING NO +recvWindow LONG NO The value cannot be greater than 60000 +timestamp LONG YES +Either orderId or origClientOrderId must be sent. +For some historical orders cummulativeQuoteQty will be < 0, meaning the data is not available at this time. +Query Margin Account's Open Orders (USER_DATA) +Response: + +[ + { + "clientOrderId": "qhcZw71gAkCCTv0t0k8LUK", + "cummulativeQuoteQty": "0.00000000", + "executedQty": "0.00000000", + "icebergQty": "0.00000000", + "isWorking": true, + "orderId": 211842552, + "origQty": "0.30000000", + "price": "0.00475010", + "side": "SELL", + "status": "NEW", + "stopPrice": "0.00000000", + "symbol": "BNBBTC", + "isIsolated": true, + "time": 1562040170089, + "timeInForce": "GTC", + "type": "LIMIT", + "selfTradePreventionMode": "NONE", + "updateTime": 1562040170089 + } +] +GET /sapi/v1/margin/openOrders + +Weight(IP): 10 + +Parameters: + +Name Type Mandatory Description +symbol STRING NO +isIsolated STRING NO for isolated margin or not, "TRUE", "FALSE",default "FALSE" +recvWindow LONG NO The value cannot be greater than 60000 +timestamp LONG YES +If the symbol is not sent, orders for all symbols will be returned in an array. +When all symbols are returned, the number of requests counted against the rate limiter is equal to the number of symbols currently trading on the exchange. +If isIsolated ="TRUE", symbol must be sent. +Query Margin Account's All Orders (USER_DATA) +Response: + +[ + { + "clientOrderId": "D2KDy4DIeS56PvkM13f8cP", + "cummulativeQuoteQty": "0.00000000", + "executedQty": "0.00000000", + "icebergQty": "0.00000000", + "isWorking": false, + "orderId": 41295, + "origQty": "5.31000000", + "price": "0.22500000", + "side": "SELL", + "status": "CANCELED", + "stopPrice": "0.18000000", + "symbol": "BNBBTC", + "isIsolated": false, + "time": 1565769338806, + "timeInForce": "GTC", + "type": "TAKE_PROFIT_LIMIT", + "selfTradePreventionMode": "NONE", + "updateTime": 1565769342148 + }, + { + "clientOrderId": "gXYtqhcEAs2Rn9SUD9nRKx", + "cummulativeQuoteQty": "0.00000000", + "executedQty": "0.00000000", + "icebergQty": "1.00000000", + "isWorking": true, + "orderId": 41296, + "origQty": "6.65000000", + "price": "0.18000000", + "side": "SELL", + "status": "CANCELED", + "stopPrice": "0.00000000", + "symbol": "BNBBTC", + "isIsolated": false, + "time": 1565769348687, + "timeInForce": "GTC", + "type": "LIMIT", + "selfTradePreventionMode": "NONE", + "updateTime": 1565769352226 + } +] +GET /sapi/v1/margin/allOrders + +Weight(IP): 200 + +Request Limit +60times/min per IP + +Parameters: + +Name Type Mandatory Description +symbol STRING YES +isIsolated STRING NO for isolated margin or not, "TRUE", "FALSE",default "FALSE" +orderId LONG NO +startTime LONG NO +endTime LONG NO +limit INT NO Default 500; max 500. +recvWindow LONG NO The value cannot be greater than 60000 +timestamp LONG YES +If orderId is set, it will get orders >= that orderId. Otherwise most recent orders are returned. +For some historical orders cummulativeQuoteQty will be < 0, meaning the data is not available at this time. +Margin Account New OCO (TRADE) +Response: + +{ + "orderListId": 0, + "contingencyType": "OCO", + "listStatusType": "EXEC_STARTED", + "listOrderStatus": "EXECUTING", + "listClientOrderId": "JYVpp3F0f5CAG15DhtrqLp", + "transactionTime": 1563417480525, + "symbol": "LTCBTC", + "marginBuyBorrowAmount": "5", // will not return if no margin trade happens + "marginBuyBorrowAsset": "BTC", // will not return if no margin trade happens + "isIsolated": false, // if isolated margin + "orders": [ + { + "symbol": "LTCBTC", + "orderId": 2, + "clientOrderId": "Kk7sqHb9J6mJWTMDVW7Vos" + }, + { + "symbol": "LTCBTC", + "orderId": 3, + "clientOrderId": "xTXKaGYd4bluPVp78IVRvl" + } + ], + "orderReports": [ + { + "symbol": "LTCBTC", + "orderId": 2, + "orderListId": 0, + "clientOrderId": "Kk7sqHb9J6mJWTMDVW7Vos", + "transactTime": 1563417480525, + "price": "0.000000", + "origQty": "0.624363", + "executedQty": "0.000000", + "cummulativeQuoteQty": "0.000000", + "status": "NEW", + "timeInForce": "GTC", + "type": "STOP_LOSS", + "side": "BUY", + "stopPrice": "0.960664", + "selfTradePreventionMode": "NONE" + }, + { + "symbol": "LTCBTC", + "orderId": 3, + "orderListId": 0, + "clientOrderId": "xTXKaGYd4bluPVp78IVRvl", + "transactTime": 1563417480525, + "price": "0.036435", + "origQty": "0.624363", + "executedQty": "0.000000", + "cummulativeQuoteQty": "0.000000", + "status": "NEW", + "timeInForce": "GTC", + "type": "LIMIT_MAKER", + "side": "BUY", + "selfTradePreventionMode": "NONE" + } + ] +} +POST /sapi/v1/margin/order/oco + +Send in a new OCO for a margin account + +Weight(UID): 6 + +Parameters: + +Name Type Mandatory Description +symbol STRING YES +isIsolated STRING NO for isolated margin or not, "TRUE", "FALSE",default "FALSE" +listClientOrderId STRING NO A unique Id for the entire orderList +side ENUM YES +quantity DECIMAL YES +limitClientOrderId STRING NO A unique Id for the limit order +price DECIMAL YES +limitIcebergQty DECIMAL NO +stopClientOrderId STRING NO A unique Id for the stop loss/stop loss limit leg +stopPrice DECIMAL YES +stopLimitPrice DECIMAL NO If provided, stopLimitTimeInForce is required. +stopIcebergQty DECIMAL NO +stopLimitTimeInForce ENUM NO Valid values are GTC/FOK/IOC +newOrderRespType ENUM NO Set the response JSON. +sideEffectType ENUM NO NO_SIDE_EFFECT, MARGIN_BUY, AUTO_REPAY,AUTO_BORROW_REPAY; default NO_SIDE_EFFECT. More info in FAQ +selfTradePreventionMode ENUM NO The allowed enums is dependent on what is configured on the symbol. The possible supported values are EXPIRE_TAKER, EXPIRE_MAKER, EXPIRE_BOTH, NONE +autoRepayAtCancel BOOLEAN NO Only when MARGIN_BUY or AUTO_BORROW_REPAY order takes effect, true means that the debt generated by the order needs to be repay after the order is cancelled. The default is true +recvWindow LONG NO The value cannot be greater than 60000 +timestamp LONG YES +Other Info: + +Price Restrictions: +SELL: Limit Price > Last Price > Stop Price +BUY: Limit Price < Last Price < Stop Price +Quantity Restrictions: +Both legs must have the same quantity +ICEBERG quantities however do not have to be the same. +Order Rate Limit + +OCO counts as 2 orders against the order rate limit. +autoRepayAtCancel is suggested to set as “FALSE” to keep liability unrepaid under high frequent new order/cancel order execution + +Margin Account Cancel OCO (TRADE) +Response: + +{ + "orderListId": 0, + "contingencyType": "OCO", + "listStatusType": "ALL_DONE", + "listOrderStatus": "ALL_DONE", + "listClientOrderId": "C3wyj4WVEktd7u9aVBRXcN", + "transactionTime": 1574040868128, + "symbol": "LTCBTC", + "isIsolated": false, // if isolated margin + "orders": [ + { + "symbol": "LTCBTC", + "orderId": 2, + "clientOrderId": "pO9ufTiFGg3nw2fOdgeOXa" + }, + { + "symbol": "LTCBTC", + "orderId": 3, + "clientOrderId": "TXOvglzXuaubXAaENpaRCB" + } + ], + "orderReports": [ + { + "symbol": "LTCBTC", + "origClientOrderId": "pO9ufTiFGg3nw2fOdgeOXa", + "orderId": 2, + "orderListId": 0, + "clientOrderId": "unfWT8ig8i0uj6lPuYLez6", + "price": "1.00000000", + "origQty": "10.00000000", + "executedQty": "0.00000000", + "cummulativeQuoteQty": "0.00000000", + "status": "CANCELED", + "timeInForce": "GTC", + "type": "STOP_LOSS_LIMIT", + "side": "SELL", + "stopPrice": "1.00000000", + "selfTradePreventionMode": "NONE" + }, + { + "symbol": "LTCBTC", + "origClientOrderId": "TXOvglzXuaubXAaENpaRCB", + "orderId": 3, + "orderListId": 0, + "clientOrderId": "unfWT8ig8i0uj6lPuYLez6", + "price": "3.00000000", + "origQty": "10.00000000", + "executedQty": "0.00000000", + "cummulativeQuoteQty": "0.00000000", + "status": "CANCELED", + "timeInForce": "GTC", + "type": "LIMIT_MAKER", + "side": "SELL", + "selfTradePreventionMode": "NONE" + } + ] +} +DELETE /sapi/v1/margin/orderList + +Cancel an entire Order List for a margin account. + +Weight(UID): 1 + +Parameters: + +Name Type Mandatory Description +symbol STRING YES +isIsolated STRING NO for isolated margin or not, "TRUE", "FALSE",default "FALSE" +orderListId LONG NO Either orderListId or listClientOrderId must be provided +listClientOrderId STRING NO Either orderListId or listClientOrderId must be provided +newClientOrderId STRING NO Used to uniquely identify this cancel. Automatically generated by default +recvWindow LONG NO The value cannot be greater than 60000 +timestamp LONG YES +Additional notes: + +Canceling an individual leg will cancel the entire OCO +Query Margin Account's OCO (USER_DATA) +Response: + +{ + "orderListId": 27, + "contingencyType": "OCO", + "listStatusType": "EXEC_STARTED", + "listOrderStatus": "EXECUTING", + "listClientOrderId": "h2USkA5YQpaXHPIrkd96xE", + "transactionTime": 1565245656253, + "symbol": "LTCBTC", + "isIsolated": false, // if isolated margin + "orders": [ + { + "symbol": "LTCBTC", + "orderId": 4, + "clientOrderId": "qD1gy3kc3Gx0rihm9Y3xwS" + }, + { + "symbol": "LTCBTC", + "orderId": 5, + "clientOrderId": "ARzZ9I00CPM8i3NhmU9Ega" + } + ] +} +GET /sapi/v1/margin/orderList + +Retrieves a specific OCO based on provided optional parameters + +Weight(IP): 10 + +Parameters: + +Name Type Mandatory Description +isIsolated STRING NO for isolated margin or not, "TRUE", "FALSE",default "FALSE" +symbol STRING NO mandatory for isolated margin, not supported for cross margin +orderListId LONG NO Either orderListId or origClientOrderId must be provided +origClientOrderId STRING NO Either orderListId or origClientOrderId must be provided +recvWindow LONG NO The value cannot be greater than 60000 +timestamp LONG YES +Query Margin Account's all OCO (USER_DATA) +Response: + +[ + { + "orderListId": 29, + "contingencyType": "OCO", + "listStatusType": "EXEC_STARTED", + "listOrderStatus": "EXECUTING", + "listClientOrderId": "amEEAXryFzFwYF1FeRpUoZ", + "transactionTime": 1565245913483, + "symbol": "LTCBTC", + "isIsolated": true, // if isolated margin + "orders": [ + { + "symbol": "LTCBTC", + "orderId": 4, + "clientOrderId": "oD7aesZqjEGlZrbtRpy5zB" + }, + { + "symbol": "LTCBTC", + "orderId": 5, + "clientOrderId": "Jr1h6xirOxgeJOUuYQS7V3" + } + ] + }, + { + "orderListId": 28, + "contingencyType": "OCO", + "listStatusType": "EXEC_STARTED", + "listOrderStatus": "EXECUTING", + "listClientOrderId": "hG7hFNxJV6cZy3Ze4AUT4d", + "transactionTime": 1565245913407, + "symbol": "LTCBTC", + "orders": [ + { + "symbol": "LTCBTC", + "orderId": 2, + "clientOrderId": "j6lFOfbmFMRjTYA7rRJ0LP" + }, + { + "symbol": "LTCBTC", + "orderId": 3, + "clientOrderId": "z0KCjOdditiLS5ekAFtK81" + } + ] + } +] +GET /sapi/v1/margin/allOrderList + +Retrieves all OCO for a specific margin account based on provided optional parameters + +Weight(IP): 200 + +Parameters + +Name Type Mandatory Description +isIsolated STRING NO for isolated margin or not, "TRUE", "FALSE",default "FALSE" +symbol STRING NO mandatory for isolated margin, not supported for cross margin +fromId LONG NO If supplied, neither startTime or endTime can be provided +startTime LONG NO +endTime LONG NO +limit INT NO Default Value: 500; Max Value: 1000 +recvWindow LONG NO The value cannot be greater than 60000 +timestamp LONG YES +Query Margin Account's Open OCO (USER_DATA) +Response: + +[ + { + "orderListId": 31, + "contingencyType": "OCO", + "listStatusType": "EXEC_STARTED", + "listOrderStatus": "EXECUTING", + "listClientOrderId": "wuB13fmulKj3YjdqWEcsnp", + "transactionTime": 1565246080644, + "symbol": "LTCBTC", + "isIsolated": false, // if isolated margin + "orders": [ + { + "symbol": "LTCBTC", + "orderId": 4, + "clientOrderId": "r3EH2N76dHfLoSZWIUw1bT" + }, + { + "symbol": "LTCBTC", + "orderId": 5, + "clientOrderId": "Cv1SnyPD3qhqpbjpYEHbd2" + } + ] + } +] +GET /sapi/v1/margin/openOrderList + +Weight(IP): 10 + +Parameters + +Name Type Mandatory Description +isIsolated STRING NO for isolated margin or not, "TRUE", "FALSE",default "FALSE" +symbol STRING NO mandatory for isolated margin, not supported for cross margin +recvWindow LONG NO The value cannot be greater than 60000 +timestamp LONG YES +Query Margin Account's Trade List (USER_DATA) +Response: + +[ + { + "commission": "0.00006000", + "commissionAsset": "BTC", + "id": 34, + "isBestMatch": true, + "isBuyer": false, + "isMaker": false, + "orderId": 39324, + "price": "0.02000000", + "qty": "3.00000000", + "symbol": "BNBBTC", + "isIsolated": false, + "time": 1561973357171 + } +] +GET /sapi/v1/margin/myTrades + +Weight(IP): 10 + +Parameters: + +Name Type Mandatory Description +symbol STRING YES +isIsolated STRING NO for isolated margin or not, "TRUE", "FALSE",default "FALSE" +orderId LONG NO +startTime LONG NO +endTime LONG NO +fromId LONG NO TradeId to fetch from. Default gets most recent trades. +limit INT NO Default 500; max 1000. +recvWindow LONG NO The value cannot be greater than 60000 +timestamp LONG YES +If fromId is set, it will get trades >= that fromId. Otherwise most recent trades are returned. +Query Max Borrow (USER_DATA) +Response: + +{ + "amount": "1.69248805", // account's currently max borrowable amount with sufficient system availability + "borrowLimit": "60" // max borrowable amount limited by the account level +} +GET /sapi/v1/margin/maxBorrowable + +Weight(IP): 50 + +Parameters: + +Name Type Mandatory Description +asset STRING YES +isolatedSymbol STRING NO isolated symbol +recvWindow LONG NO The value cannot be greater than 60000 +timestamp LONG YES +If isolatedSymbol is not sent, crossed margin data will be sent. +borrowLimit is also available from https://www.binance.com/en/margin-fee +Query Max Transfer-Out Amount (USER_DATA) +Response: + + { + "amount": "3.59498107" + } +GET /sapi/v1/margin/maxTransferable + +Weight(IP): 50 + +Parameters: + +Name Type Mandatory Description +asset STRING YES +isolatedSymbol STRING NO isolated symbol +recvWindow LONG NO The value cannot be greater than 60000 +timestamp LONG YES +If isolatedSymbol is not sent, crossed margin data will be sent. +Get Summary of Margin account (USER_DATA) +Response: + +{ + "normalBar": "1.5", + "marginCallBar": "1.3", + "forceLiquidationBar": "1.1" +} +GET /sapi/v1/margin/tradeCoeff + +Get personal margin level information + +Weight(IP): 10 + +Parameters: + +Name Type Mandatory Description +recvWindow LONG NO +timestamp LONG YES +Query Isolated Margin Account Info (USER_DATA) +Response: + +If "symbols" is not sent + +{ + "assets":[ + { + "baseAsset": + { + "asset": "BTC", + "borrowEnabled": true, + "borrowed": "0.00000000", + "free": "0.00000000", + "interest": "0.00000000", + "locked": "0.00000000", + "netAsset": "0.00000000", + "netAssetOfBtc": "0.00000000", + "repayEnabled": true, + "totalAsset": "0.00000000" + }, + "quoteAsset": + { + "asset": "USDT", + "borrowEnabled": true, + "borrowed": "0.00000000", + "free": "0.00000000", + "interest": "0.00000000", + "locked": "0.00000000", + "netAsset": "0.00000000", + "netAssetOfBtc": "0.00000000", + "repayEnabled": true, + "totalAsset": "0.00000000" + }, + "symbol": "BTCUSDT", + "isolatedCreated": true, + "enabled": true, // true-enabled, false-disabled + "marginLevel": "0.00000000", + "marginLevelStatus": "EXCESSIVE", // "EXCESSIVE", "NORMAL", "MARGIN_CALL", "PRE_LIQUIDATION", "FORCE_LIQUIDATION" + "marginRatio": "0.00000000", + "indexPrice": "10000.00000000", + "liquidatePrice": "1000.00000000", + "liquidateRate": "1.00000000", + "tradeEnabled": true + } + ], + "totalAssetOfBtc": "0.00000000", + "totalLiabilityOfBtc": "0.00000000", + "totalNetAssetOfBtc": "0.00000000" +} +If "symbols" is sent + +{ + "assets":[ + { + "baseAsset": + { + "asset": "BTC", + "borrowEnabled": true, + "borrowed": "0.00000000", + "free": "0.00000000", + "interest": "0.00000000", + "locked": "0.00000000", + "netAsset": "0.00000000", + "netAssetOfBtc": "0.00000000", + "repayEnabled": true, + "totalAsset": "0.00000000" + }, + "quoteAsset": + { + "asset": "USDT", + "borrowEnabled": true, + "borrowed": "0.00000000", + "free": "0.00000000", + "interest": "0.00000000", + "locked": "0.00000000", + "netAsset": "0.00000000", + "netAssetOfBtc": "0.00000000", + "repayEnabled": true, + "totalAsset": "0.00000000" + }, + "symbol": "BTCUSDT", + "isolatedCreated": true, + "enabled": true, // true-enabled, false-disabled + "marginLevel": "0.00000000", + "marginLevelStatus": "EXCESSIVE", // "EXCESSIVE", "NORMAL", "MARGIN_CALL", "PRE_LIQUIDATION", "FORCE_LIQUIDATION" + "marginRatio": "0.00000000", + "indexPrice": "10000.00000000", + "liquidatePrice": "1000.00000000", + "liquidateRate": "1.00000000", + "tradeEnabled": true + } + ] +} +GET /sapi/v1/margin/isolated/account + +Weight(IP): 10 + +Parameters: + +Name Type Mandatory Description +symbols STRING NO Max 5 symbols can be sent; separated by ",". e.g. "BTCUSDT,BNBUSDT,ADAUSDT" +recvWindow LONG NO No more than 60000 +timestamp LONG YES +If "symbols" is not sent, all isolated assets will be returned. +If "symbols" is sent, only the isolated assets of the sent symbols will be returned. +Disable Isolated Margin Account (TRADE) +Response: + +{ + "success": true, + "symbol": "BTCUSDT" +} +DELETE /sapi/v1/margin/isolated/account (HMAC SHA256) + +Disable isolated margin account for a specific symbol. Each trading pair can only be deactivated once every 24 hours. + +Weight(UID): 300 + +Parameters: + +Name Type Mandatory Description +symbol STRING YES +recvWindow LONG NO No more than 60000 +timestamp LONG YES +Enable Isolated Margin Account (TRADE) +Response: + +{ + "success": true, + "symbol": "BTCUSDT" +} +POST /sapi/v1/margin/isolated/account + +Enable isolated margin account for a specific symbol(Only supports activation of previously disabled accounts). + +Weight(UID): 300 + +Parameters: + +Name Type Mandatory Description +symbol STRING YES +recvWindow LONG NO No more than 60000 +timestamp LONG YES +Query Enabled Isolated Margin Account Limit (USER_DATA) +Response: + +{ + "enabledAccount": 5, + "maxAccount": 20 +} +GET /sapi/v1/margin/isolated/accountLimit + +Query enabled isolated margin account limit. + +Weight(IP): 1 + +Parameters: + +Name Type Mandatory Description +recvWindow LONG NO No more than 60000 +timestamp LONG YES +Get All Isolated Margin Symbol(MARKET_DATA) +Response: + +[ + { + "base": "BNB", + "isBuyAllowed": true, + "isMarginTrade": true, + "isSellAllowed": true, + "quote": "BTC", + "symbol": "BNBBTC" + }, + { + "base": "TRX", + "isBuyAllowed": true, + "isMarginTrade": true, + "isSellAllowed": true, + "quote": "BTC", + "symbol": "TRXBTC", + "delistTime": 1704973040 + }, + { + "base": "XRP", + "isBuyAllowed": true, + "isMarginTrade": true, + "isSellAllowed": true, + "quote": "BTC", + "symbol": "XRPBTC" + }, + { + "base": "ETH", + "isBuyAllowed": true, + "isMarginTrade": true, + "isSellAllowed": true, + "quote": "BTC", + "symbol": "ETHBTC" + } +] +GET /sapi/v1/margin/isolated/allPairs + +Weight(IP): 10 + +Parameters: + +Name Type Mandatory Description +symbol STRING NO +Toggle BNB Burn On Spot Trade And Margin Interest (USER_DATA) +Response: + +{ + "spotBNBBurn":true, + "interestBNBBurn": false +} +POST /sapi/v1/bnbBurn + +Weight(IP): 1 + +Parameters: + +Name Type Mandatory Description +spotBNBBurn STRING NO "true" or "false"; Determines whether to use BNB to pay for trading fees on SPOT +interestBNBBurn STRING NO "true" or "false"; Determines whether to use BNB to pay for margin loan's interest +recvWindow LONG NO No more than 60000 +timestamp LONG YES +"spotBNBBurn" and "interestBNBBurn" should be sent at least one. +Get BNB Burn Status (USER_DATA) +Response: + +{ + "spotBNBBurn":true, + "interestBNBBurn": false +} +GET /sapi/v1/bnbBurn + +Weight(IP): 1 + +Parameters: + +Name Type Mandatory Description +recvWindow LONG NO No more than 60000 +timestamp LONG YES +Query Margin Interest Rate History (USER_DATA) +Response: + +[ + { + "asset": "BTC", + "dailyInterestRate": "0.00025000", + "timestamp": 1611544731000, + "vipLevel": 1 + }, + { + "asset": "BTC", + "dailyInterestRate": "0.00035000", + "timestamp": 1610248118000, + "vipLevel": 1 + } +] +GET /sapi/v1/margin/interestRateHistory + +Weight(IP): 1 + +Parameters: + +Name Type Mandatory Description +asset STRING YES +vipLevel INT NO Default: user's vip level +startTime LONG NO Default: 7 days ago +endTime LONG NO Default: present. Maximum range: 1 months. +recvWindow LONG NO No more than 60000 +timestamp LONG YES +Query Cross Margin Fee Data (USER_DATA) +Response: + +[ + { + "vipLevel": 0, + "coin": "BTC", + "transferIn": true, + "borrowable": true, + "dailyInterest": "0.00026125", + "yearlyInterest": "0.0953", + "borrowLimit": "180", + "marginablePairs": [ + "BNBBTC", + "TRXBTC", + "ETHBTC", + "BTCUSDT" + ] + } +] +GET /sapi/v1/margin/crossMarginData + +Get cross margin fee data collection with any vip level or user's current specific data as https://www.binance.com/en/margin-fee + +Weight(IP): 1 when coin is specified; 5 when the coin parameter is omitted + +Parameters: + +Name Type Mandatory Description +vipLevel INT NO when parameter vipLevel is not sent, it returns data associated with the user's specific config; when parameter vipLevel is sent, it returns the default tier data (assuming user is not logged in) +coin STRING NO +recvWindow LONG NO No more than 60000 +timestamp LONG YES +Query Isolated Margin Fee Data (USER_DATA) +Response: + +[ + { + "vipLevel": 0, + "symbol": "BTCUSDT", + "leverage": "10", + "data": [ + { + "coin": "BTC", + "dailyInterest": "0.00026125", + "borrowLimit": "270" + }, + { + "coin": "USDT", + "dailyInterest": "0.000475", + "borrowLimit": "2100000" + } + ] + } +] +GET /sapi/v1/margin/isolatedMarginData + +Get isolated margin fee data collection with any vip level or user's current specific data as https://www.binance.com/en/margin-fee + +Weight(IP): 1 when a single is specified; 10 when the symbol parameter is omitted + +Parameters: + +Name Type Mandatory Description +vipLevel INT NO User's current specific margin data will be returned if vipLevel is omitted +symbol STRING NO +recvWindow LONG NO No more than 60000 +timestamp LONG YES +Query Isolated Margin Tier Data (USER_DATA) +Response: + +[ + { + "symbol": "BTCUSDT", + "tier": 1, + "effectiveMultiple": "10", + "initialRiskRatio": "1.111", + "liquidationRiskRatio": "1.05", + "baseAssetMaxBorrowable": "9", + "quoteAssetMaxBorrowable": "70000" + } +] +GET /sapi/v1/margin/isolatedMarginTier + +Get isolated margin tier data collection with any tier as https://www.binance.com/en/margin-data + +Weight(IP): 1 + +Parameters: + +Name Type Mandatory Description +symbol STRING YES +tier INTEGER NO All margin tier data will be returned if tier is omitted +recvWindow LONG NO No more than 60000 +timestamp LONG YES +Query Current Margin Order Count Usage (TRADE) +Response: + +[ + + { + "rateLimitType": "ORDERS", + "interval": "SECOND", + "intervalNum": 10, + "limit": 10000, + "count": 0 + }, + { + "rateLimitType": "ORDERS", + "interval": "DAY", + "intervalNum": 1, + "limit": 20000, + "count": 0 + } +] +GET /sapi/v1/margin/rateLimit/order + +Displays the user's current margin order count usage for all intervals. + +Weight(IP): 20 + +Parameters: + +Name Type Mandatory Description +isIsolated STRING NO for isolated margin or not, "TRUE", "FALSE",default "FALSE" +symbol STRING NO isolated symbol, mandatory for isolated margin +recvWindow LONG NO The value cannot be greater than 60000 +timestamp LONG YES +Cross margin collateral ratio (MARKET_DATA) +Response: + +[ + { + "collaterals": [ + { + "minUsdValue": "0", + "maxUsdValue": "13000000", + "discountRate": "1" + }, + { + "minUsdValue": "13000000", + "maxUsdValue": "20000000", + "discountRate": "0.975" + }, + { + "minUsdValue": "20000000", + "discountRate": "0" + } + ], + "assetNames": [ + "BNX" + ] + }, + { + "collaterals": [ + { + "minUsdValue": "0", + "discountRate": "1" + } + ], + "assetNames": [ + "BTC", + "BUSD", + "ETH", + "USDT" + ] + } +] +GET /sapi/v1/margin/crossMarginCollateralRatio + +Weight(IP): 100 + +Parameters: None + +Get Small Liability Exchange Coin List (USER_DATA) +Query the coins which can be small liability exchange + +Response: + +[ + { + "asset": "ETH", + "interest": "0.00083334", + "principal": "0.001", + "liabilityAsset": "USDT", + "liabilityQty": 0.3552 + } +] +GET /sapi/v1/margin/exchange-small-liability + +Weight(IP): 100 + +Parameters: + +Name Type Mandatory Description +recvWindow LONG NO +timestamp LONG YES +Small Liability Exchange (MARGIN) +Cross Margin Small Liability Exchange + +POST /sapi/v1/margin/exchange-small-liability + +Weight(UID): 3000 + +Parameters: + +Name Type Mandatory Description +assetNames ARRAY YES The assets list of small liability exchange, Example: assetNames = BTC,ETH +recvWindow LONG NO +timestamp LONG YES +Only convert once within 6 hours +Only liability valuation less than 10 USDT are supported +The maximum number of coin is 10 +Get Small Liability Exchange History (USER_DATA) +Get Small liability Exchange History + +Response: + +{ + "total": 1, + "rows": [ + { + "asset": "ETH", + "amount": "0.00083434", + "targetAsset": "BUSD", + "targetAmount": "1.37576819", + "bizType": "EXCHANGE_SMALL_LIABILITY", + "timestamp": 1672801339253 + } + ] +} +GET /sapi/v1/margin/exchange-small-liability-history + +Weight(UID): 100 + +Parameters: + +Name Type Mandatory Description +current INT YES Currently querying page. Start from 1. Default:1 +size INT YES Default:10, Max:100 +startTime LONG NO Default: 30 days from current timestamp +endTime LONG NO Default: present timestamp +recvWindow LONG NO +timestamp LONG YES +Get a future hourly interest rate (USER_DATA) +GET /sapi/v1/margin/next-hourly-interest-rate + +Get user the next hourly estimate interest + +Response: + +[ + { + "asset": "BTC", + "nextHourlyInterestRate": "0.00000571" + }, + { + "asset": "ETH", + "nextHourlyInterestRate": "0.00000578" + } +] +Weight(IP): 100 + +Parameters: + +Name Type Mandatory Description +assets String YES List of assets, separated by commas, up to 20 +isIsolated Boolean YES for isolated margin or not, "TRUE", "FALSE" +Get cross or isolated margin capital flow(USER_DATA) +GET /sapi/v1/margin/capital-flow + +Get cross or isolated margin capital flow + +Response: + +[ + { + "id": 123456, + "tranId": 123123, + "timestamp": 1691116657000, + "asset": "USDT", + "symbol": "BTCUSDT", + "type": "BORROW", + "amount": "101" + }, + { + "id": 123457, + "tranId": 123124, + "timestamp": 1691116658000, + "asset": "BTC", + "symbol": "BTCUSDT", + "type": "REPAY", + "amount": "10" + } +] +Weight(IP): 100 + +Parameters: + +Name Type Mandatory Description +asset STRING NO +symbol STRING NO Required when querying isolated data +type STRING NO +startTime LONG NO Only supports querying the data of the last 90 days +endTime LONG NO +fromId LONG NO +If fromId is set, the data with id > fromId will be returned. Otherwise the latest data will be returned +limit LONG NO The number of data items returned each time is limited. Default 500; Max 1000. +recvWindow LONG NO +timestamp LONG YES +Only supports querying the data of the last 90 days +If fromId is set, the data with id > fromId will be returned. Otherwise the latest data will be returned +To query isolated data, Symbol needs to be entered. +Supported types: +TRANSFER("Transfer") +BORROW("Borrow") +REPAY("Repay") +BUY_INCOME("Buy-Trading Income") +BUY_EXPENSE("Buy-Trading Expense") +SELL_INCOME("Sell-Trading Income") +SELL_EXPENSE("Sell-Trading Expense") +TRADING_COMMISSION("Trading Commission") +BUY_LIQUIDATION("Buy by Liquidation") +SELL_LIQUIDATION("Sell by Liquidation") +REPAY_LIQUIDATION("Repay by Liquidation") +OTHER_LIQUIDATION("Other Liquidation") +LIQUIDATION_FEE("Liquidation Fee") +SMALL_BALANCE_CONVERT("Small Balance Convert") +COMMISSION_RETURN("Commission Return") +SMALL_CONVERT("Small Convert") +Get tokens or symbols delist schedule for cross margin and isolated margin (MARKET_DATA) +GET /sapi/v1/margin/delist-schedule + +Get tokens or symbols delist schedule for cross margin and isolated margin + +Response: + +[ + { + "delistTime": 1686161202000, + "crossMarginAssets": [ + "BTC", + "USDT" + ], + "isolatedMarginSymbols": [ + "ADAUSDT", + "BNBUSDT" + ] + }, + { + "delistTime": 1686222232000, + "crossMarginAssets": [ + "ADA" + ], + "isolatedMarginSymbols": [] + }, + "updateTime": 1699272487 +] +Weight(IP): 100 + +Parameters: + +Name Type Mandatory Description +recvWindow LONG NO +timestamp LONG YES +Query Margin Available Inventory (USER_DATA) +GET /sapi/v1/margin/available-inventory + +Margin available Inventory query + +Response: + +{ + "assets": { + "MATIC": "100000000", + "STPT": "100000000", + "TVK": "100000000", + "SHIB": "97409653" + }, + "updateTime": 1699272487 +} +Weight(UID): 50 + +Parameters: + +Name Type Mandatory Description +type STRING YES MARGIN,ISOLATED +recvWindow LONG NO +timestamp LONG YES +Margin manual liquidation(MARGIN) +POST /sapi/v1/margin/manual-liquidation + +Margin manual liquidation + +Response: + +[ + { + "asset": "ETH", + "interest": "0.00083334", + "principal": "0.001", + "liabilityAsset": "USDT", + "liabilityQty": 0.3552 + } +] +Weight(UID): 3000 + +Parameters: + +Name Type Mandatory Description +type STRING YES MARGIN,ISOLATED +symbol STRING NO When type selects ISOLATED, symbol must be filled in +recvWindow LONG NO +timestamp LONG YES +This SAPI can support Cross Margin and Margin Pro , cannot support Isolated Margin. +Query Liability Coin Leverage Bracket in Cross Margin Pro Mode(MARKET_DATA) +GET /sapi/v1/margin/leverageBracket + +Liability Coin Leverage Bracket in Cross Margin Pro Mode + +Response: + +[ + { + "assetNames":[ + "SHIB", + "FDUSD", + "BTC", + "ETH", + "USDC" + ], + "rank":1, + "brackets":[ + { + "leverage":10, + "maxDebt":1000000.00000000, + "maintenanceMarginRate":0.02000000, + "initialMarginRate":0.1112, + "fastNum":0 + }, + { + "leverage":3, + "maxDebt":4000000.00000000, + "maintenanceMarginRate":0.07000000, + "initialMarginRate":0.5000, + "fastNum":60000.0000000000000000 + } + ] + } +] +Weight(IP): 1 + +User Data Streams +The base API endpoint is: https://api.binance.com +A User Data Stream listenKey is valid for 60 minutes after creation. +Doing a PUT on a listenKey will extend its validity for 60 minutes. +Doing a DELETE on a listenKey will close the stream and invalidate the listenKey. +Doing a POST on an account with an active listenKey will return the currently active listenKey and extend its validity for 60 minutes. +A listenKey is a stream. +Users can listen to multiple streams. +The base websocket endpoint is: wss://stream.binance.com:9443 +User Data Streams are accessed at /ws/ or /stream?streams= +A single connection to stream.binance.com is only valid for 24 hours; expect to be disconnected at the 24 hour mark +All time and timestamp related fields in the JSON responses are milliseconds by default. To receive the information in microseconds, please add the parameter timeUnit=MICROSECOND or timeUnit=microsecond in the URL. +For example /ws/&timeUnit=MICROSECOND +LISTEN KEY (SPOT) +Create a ListenKey (USER_STREAM) +Response: + +{ + "listenKey": "pqia91ma19a5s61cv6a81va65sdf19v8a65a1a5s61cv6a81va65sdf19v8a65a1" +} +POST /api/v3/userDataStream + +Start a new user data stream. The stream will close after 60 minutes unless a keepalive is sent. If the account has an active listenKey, that listenKey will be returned and its validity will be extended for 60 minutes. + +Weight: 2 + +Parameters: + +NONE + +Data Source: Memory + +Ping/Keep-alive a ListenKey (USER_STREAM) +Response: + +{} +PUT /api/v3/userDataStream + +Keepalive a user data stream to prevent a time out. User data streams will close after 60 minutes. It's recommended to send a ping about every 30 minutes. + +Weight: 2 + +Parameters: + +Name Type Mandatory Description +listenKey STRING YES +Data Source: Memory + +Close a ListenKey (USER_STREAM) +Response: + +{} +DELETE /api/v3/userDataStream + +Close out a user data stream. + +Weight: 2 + +Parameters: + +Name Type Mandatory Description +listenKey STRING YES +Data Source: Memory + +LISTEN KEY (MARGIN) +Create a ListenKey (USER_STREAM) +Response: + +{"listenKey": "T3ee22BIYuWqmvne0HNq2A2WsFlEtLhvWCtItw6ffhhdmjifQ2tRbuKkTHhr"} +POST /sapi/v1/userDataStream + +Weight: 1 + +Parameters: + +NONE + +Ping/Keep-alive a ListenKey (USER_STREAM) +Response: + +{} +PUT /sapi/v1/userDataStream + +Weight: 1 + +Parameters: + +Name Type Mandatory Description +listenKey STRING YES +Close a ListenKey (USER_STREAM) +Response: + +{} +DELETE /sapi/v1/userDataStream + +Weight: 1 + +Parameters: + +Name Type Mandatory Description +listenKey STRING YES +LISTEN KEY (ISOLATED MARGIN) +Generate a Listen Key (USER_STREAM) +Response: + +{ + "listenKey": "T3ee22BIYuWqmvne0HNq2A2WsFlEtLhvWCtItw6ffhhdmjifQ2tRbuKkTHhr" +} +POST /sapi/v1/userDataStream/isolated + +Weight: 1 + +Parameters: + +Name Type Mandatory Description +symbol STRING YES +Ping/Keep-alive a Listen Key (USER_STREAM) +Response: + +{} +PUT /sapi/v1/userDataStream/isolated + +Weight: 1 + +Parameters: + +Name Type Mandatory Description +symbol STRING YES +listenKey STRING YES +Close a ListenKey (USER_STREAM) +Response: + +{} +DELETE /sapi/v1/userDataStream/isolated + +Weight: 1 + +Parameters: + +Name Type Mandatory Description +symbol STRING YES +listenKey STRING YES +Payload: Account Update +outboundAccountPosition is sent any time an account balance has changed and contains the assets that were possibly changed by the event that generated the balance change. + +Payload: + +{ + "e": "outboundAccountPosition", //Event type + "E": 1564034571105, //Event Time + "u": 1564034571073, //Time of last account update + "B": [ //Balances Array + { + "a": "ETH", //Asset + "f": "10000.000000", //Free + "l": "0.000000" //Locked + } + ] +} +Payload: Balance Update +Balance Update occurs during the following: + +Deposits or withdrawals from the account +Transfer of funds between accounts (e.g. Spot to Margin) +Payload + +{ + "e": "balanceUpdate", //Event Type + "E": 1573200697110, //Event Time + "a": "BTC", //Asset + "d": "100.00000000", //Balance Delta + "T": 1573200697068 //Clear Time +} +Payload: Order Update +Orders are updated with the executionReport event. + +Execution types: + +NEW - The order has been accepted into the engine. +CANCELED - The order has been canceled by the user. +REPLACED (currently unused) +REJECTED - The order has been rejected and was not processed (This message appears only with Cancel Replace Orders wherein the new order placement is rejected but the request to cancel request succeeds.) +TRADE - Part of the order or all of the order's quantity has filled. +EXPIRED - The order was canceled according to the order type's rules (e.g. LIMIT FOK orders with no fill, LIMIT IOC or MARKET orders that partially fill) or by the exchange, (e.g. orders canceled during liquidation, orders canceled during maintenance). +TRADE_PREVENTION - The order has expired due to STP trigger. +Check the Public API Definitions for more relevant enum definitions. + +Payload: + +{ + "e": "executionReport", // Event type + "E": 1499405658658, // Event time + "s": "ETHBTC", // Symbol + "c": "mUvoqJxFIILMdfAW5iGSOW", // Client order ID + "S": "BUY", // Side + "o": "LIMIT", // Order type + "f": "GTC", // Time in force + "q": "1.00000000", // Order quantity + "p": "0.10264410", // Order price + "P": "0.00000000", // Stop price + "F": "0.00000000", // Iceberg quantity + "g": -1, // OrderListId + "C": "", // Original client order ID; This is the ID of the order being canceled + "x": "NEW", // Current execution type + "X": "NEW", // Current order status + "r": "NONE", // Order reject reason; will be an error code. + "i": 4293153, // Order ID + "l": "0.00000000", // Last executed quantity + "z": "0.00000000", // Cumulative filled quantity + "L": "0.00000000", // Last executed price + "n": "0", // Commission amount + "N": null, // Commission asset + "T": 1499405658657, // Transaction time + "t": -1, // Trade ID + "I": 8641984, // Ignore + "w": true, // Is the order on the book? + "m": false, // Is this trade the maker side? + "M": false, // Ignore + "O": 1499405658657, // Order creation time + "Z": "0.00000000", // Cumulative quote asset transacted quantity + "Y": "0.00000000", // Last quote asset transacted quantity (i.e. lastPrice * lastQty) + "Q": "0.00000000", // Quote Order Quantity + "W": 1499405658657, // Working Time; This is only visible if the order has been placed on the book. + "V": "NONE" // selfTradePreventionMode +} +Note: Average price can be found by doing Z divided by z. + +Conditional Fields in Execution Report +These are fields that appear in the payload only if certain conditions are met. + +Field Name Description Examples +d Trailing Delta Appears only for trailing stop orders. "d": 4 +D Trailing Time "D": 1668680518494 +j Strategy Id Appears only if the strategyId parameter was provided upon order placement. "j": 1 +J Strategy Type Appears only if the strategyType parameter was provided upon order placement. "J": 1000000 +v Prevented Match Id Appears only for orders that expired due to STP. "v": 3 +A Prevented Quantity "A":"3.000000" +B Last Prevented Quantity "B":"3.000000" +u Trade Group Id "u":1 +U Counter Order Id "U":37 +Cs Counter Symbol "Cs": "BTCUSDT" +pl Prevented Execution Quantity "pl":"2.123456" +pL Prevented Execution Price "pL":"0.10000001" +pY Prevented Execution Quote Qty "pY":"0.21234562" +W Working Time Appears when the order is working on the book "W": 1668683798379 +b Match Type Appears for orders that have allocations "b":"ONE_PARTY_TRADE_REPORT" +a Allocation ID "a":1234 +k Working Floor Appears for orders that could potentially have allocations "k":"SOR" +uS UsedSor Appears for orders that used SOR "uS":true +If the order is an order list, an event will be displayed named ListStatus in addition to the executionReport event. + +Payload + +{ + "e": "listStatus", //Event Type + "E": 1564035303637, //Event Time + "s": "ETHBTC", //Symbol + "g": 2, //OrderListId + "c": "OCO", //Contingency Type + "l": "EXEC_STARTED", //List Status Type + "L": "EXECUTING", //List Order Status + "r": "NONE", //List Reject Reason + "C": "F4QN4G8DlFATFlIUQ0cjdD", //List Client Order ID + "T": 1564035303625, //Transaction Time + "O": [ //An array of objects + { + "s": "ETHBTC", //Symbol + "i": 17, // orderId + "c": "AJYsMjErWJesZvqlJCTUgL" //ClientOrderId + }, + { + "s": "ETHBTC", + "i": 18, + "c": "bfYPSQdLoqAJeNrOr9adzq" + } + ] +} +Payload: Listen Key Expired +This event is sent when the listen key expires. + +No more events will be sent after this until a new listenKey is created. + +This event will not be pushed when the stream is closed normally. + +Payload + +{ + "e": "listenKeyExpired", // Event type + "E": 1699596037418, // Event time + "listenKey": "OfYGbUzi3PraNagEkdKuFwUHn48brFsItTdsuiIXrucEvD0rhRXZ7I6URWfE8YE8" +} +Margin User Data Streams +Margin websocket only support Cross Margin Accounts +The base API endpoint is: https://api.binance.com +A User Data Stream listenKey is valid for 24 hours after creation. +Doing a PUT on a listenKey will extend its validity for 24 hours. +Doing a DELETE on a listenKey will close the stream and invalidate the listenKey. +Doing a POST on an account with an active listenKey will return the currently active listenKey and extend its validity for 24 hours. +A listenKey is a stream. +Users can listen to multiple streams. +The base websocket endpoint is: wss://margin-stream.binance.com +User Data Streams are accessed at /ws/ or /stream?streams= +A single connection to stream.binance.com is only valid for 24 hours; expect to be disconnected at the 24 hour mark +LISTEN KEY +Create a Margin ListenKey (USER_STREAM) +Response: + +{ + "listenKey": "T3ee22BIYuWqmvne0HNq2A2WsFlEtLhvWCtItw6ffhhd" +} +POST /sapi/v1/margin/listen-key + +Start a new margin user data stream. + +Weight(UID): 1 + +Parameters: + +NONE + +Keep-alive a Margin ListenKey (USER_STREAM) +Response: + +{} +PUT /sapi/v1/margin/listen-key + +Keepalive a user data stream to prevent a time out. + +Weight(UID): 1 + +Parameters: + +Name Type Mandatory Description +listenKey STRING YES +Close a Margin ListenKey(USER_STREAM) +Response: + +{} +DELETE /sapi/v1/margin/listen-key + +Close out a user data stream. + +Weight(UID): 3000 3000 + +Parameters: + +Name Type Mandatory Description +listenKey STRING YES +Payload: liability update +Liability update during the following : + +borrowing +Repayment +Interest Calculation +Payload: + +{ + "e": "USER_LIABILITY_CHANGE", // Event Type + "E": 1701949801133, // Event Time + "a": "BTC", // Asset + "t": "BORROW", // Liability Update Type + "p": "0.00000100", // Principle Quantity + "i": "0.00000000" // Interest Quantity +} +Payload: Margin Call +Margin call trigger the event + +Payload + +{ + "e": "MARGIN_LEVEL_STATUS_CHANGE", // Event Type + "E": 1701949763462, // Event Time + "l": "1.1", // margin level + "s": "MARGIN_CALL" // margin call status +} +Simple Earn Endpoints +The endpoints below allow you to interact with Binance Simple Earn. +For more information on this, please refer to the Binance Simple Earn page +Get Simple Earn Flexible Product List (USER_DATA) +Response: + +{ + "rows":[ + { + "asset": "BTC", + "latestAnnualPercentageRate": "0.05000000", + "tierAnnualPercentageRate": { + "0-5BTC": 0.05, + "5-10BTC": 0.03 + }, + "airDropPercentageRate": "0.05000000", + "canPurchase": true, + "canRedeem": true, + "isSoldOut": true, + "hot": true, + "minPurchaseAmount": "0.01000000", + "productId": "BTC001", + "subscriptionStartTime": "1646182276000", + "status": "PURCHASING" + } + ], + "total": 1 +} +GET /sapi/v1/simple-earn/flexible/list + +Get available Simple Earn flexible product list + +Weight(IP): 150 + +Parameters: + +Name Type Mandatory Description +asset STRING NO +current LONG NO Currently querying page. Start from 1. Default:1 +size LONG NO Default:10, Max:100 +recvWindow LONG NO +timestamp LONG YES +Get Simple Earn Locked Product List (USER_DATA) +Response: + +{ + "rows": [ + { + "projectId": "Axs*90", + "detail": { + "asset": "AXS", + "rewardAsset": "AXS", + "duration": 90, + "renewable": true, + "isSoldOut": true, + "apr": "1.2069", + "status": "CREATED", + "subscriptionStartTime": "1646182276000", + "extraRewardAsset": "BNB", + "extraRewardAPR": "0.23" + }, + "quota": { + "totalPersonalQuota": "2", + "minimum": "0.001" + } + } + ], + "total": 1 +} +GET /sapi/v1/simple-earn/locked/list + +Weight(IP): 150 + +Parameters: + +Name Type Mandatory Description +asset STRING NO +current LONG NO Currently querying page. Start from 1. Default:1 +size LONG NO Default:10, Max:100 +recvWindow LONG NO +timestamp LONG YES +Get available Simple Earn locked product list + +Subscribe Flexible Product (TRADE) +Response: + +{ + "purchaseId": 40607, + "success": true +} +POST /sapi/v1/simple-earn/flexible/subscribe + +Weight(IP): 1 + +Rate Limit: 1/3s per account + +Parameters: + +Name Type Mandatory Description +productId STRING YES +amount DECIMAL YES +autoSubscribe BOOLEAN NO true or false, default true. +sourceAccount ENUM NO SPOT,FUND,ALL, default SPOT +recvWindow LONG NO +timestamp LONG YES +You need to open Enable Spot & Margin Trading permission for the API Key which requests this endpoint. +Subscribe Locked Product (TRADE) +Response: + +{ + "purchaseId": 40607, + "positionId": "12345", + "success": true +} +POST /sapi/v1/simple-earn/locked/subscribe + +Weight(IP): 1 + +Rate Limit: 1/3s per account + +Parameters: + +Name Type Mandatory Description +projectId STRING YES +amount DECIMAL YES +autoSubscribe BOOLEAN NO true or false, default true. +sourceAccount ENUM NO SPOT,FUND,ALL, default SPOT +recvWindow LONG NO +timestamp LONG YES +You need to open Enable Spot & Margin Trading permission for the API Key which requests this endpoint. +Redeem Flexible Product (TRADE) +Response: + +{ + "redeemId": 40607, + "success": true +} +POST /sapi/v1/simple-earn/flexible/redeem + +Weight(IP): 1 + +Rate Limit: 1/3s per account + +Parameters: + +Name Type Mandatory Description +productId STRING YES +redeemAll BOOLEAN NO true or false, default to false +amount DECIMAL NO if redeemAll is false, amount is mandatory +destAccount ENUM NO SPOT,FUND, default SPOT +recvWindow LONG NO +timestamp LONG YES +You need to open Enable Spot & Margin Trading permission for the API Key which requests this endpoint. +Redeem Locked Product (TRADE) +Response: + +{ + "redeemId": 40607, + "success": true +} +POST /sapi/v1/simple-earn/locked/redeem + +Weight(IP): 1 + +Rate Limit: 1/3s per account + +Parameters: + +Name Type Mandatory Description +positionId STRING YES "1234" +recvWindow LONG NO +timestamp LONG YES +You need to open Enable Spot & Margin Trading permission for the API Key which requests this endpoint. +Get Flexible Product Position (USER_DATA) +Response: + +{ + "rows":[ + { + "totalAmount": "75.46000000", + "tierAnnualPercentageRate": { + "0-5BTC": 0.05, + "5-10BTC": 0.03 + }, + "latestAnnualPercentageRate": "0.02599895", + "yesterdayAirdropPercentageRate": "0.02599895", + "asset": "USDT", + "airDropAsset": "BETH", + "canRedeem": true, + "collateralAmount": "232.23123213", + "productId": "USDT001", + "yesterdayRealTimeRewards": "0.10293829", + "cumulativeBonusRewards": "0.22759183", + "cumulativeRealTimeRewards": "0.22759183", + "cumulativeTotalRewards": "0.45459183", + "autoSubscribe": true + } + ], + "total": 1 +} +GET /sapi/v1/simple-earn/flexible/position + +Weight(IP): 150 + +Parameters: + +Name Type Mandatory Description +asset STRING NO +productId STRING NO +current LONG NO Currently querying the page. Start from 1. Default:1 +size LONG NO Default:10, Max:100 +recvWindow LONG NO +timestamp LONG YES +Get Locked Product Position (USER_DATA) +Response: + +{ + "rows":[ + { + "positionId": "123123", + "projectId": "Axs*90", + "asset": "AXS", + "amount": "122.09202928", + "purchaseTime": "1646182276000", + "duration": "60", + "accrualDays": "4", + "rewardAsset": "AXS", + "APY": "0.23", + "isRenewable": true, + "isAutoRenew": true, + "redeemDate": "1732182276000" + } + ], + "total": 1 +} +GET /sapi/v1/simple-earn/locked/position + +Weight(IP): 150 + +Parameters: + +Name Type Mandatory Description +asset STRING NO +positionId STRING NO +projectId STRING NO +current LONG NO Currently querying the page. Start from 1. Default:1 +size LONG NO Default:10, Max:100 +recvWindow LONG NO +timestamp LONG YES +Simple Account (USER_DATA) +Response: + +{ + "totalAmountInBTC": "0.01067982", + "totalAmountInUSDT": "77.13289230", + "totalFlexibleAmountInBTC": "0.00000000", + "totalFlexibleAmountInUSDT": "0.00000000", + "totalLockedInBTC": "0.01067982", + "totalLockedInUSDT": "77.13289230" +} +GET /sapi/v1/simple-earn/account + +Weight(IP): 150 + +Parameters: + +Name Type Mandatory Description +recvWindow LONG NO The value cannot be greater than 60000 +timestamp LONG YES +Get Flexible Subscription Record (USER_DATA) +Response: + +{ + "rows": [ + { + "amount": "100.00000000", + "asset": "USDT", + "time": 1575018510000, + "purchaseId": 26055, + "type": "AUTO", // AUTO for auto subscribe, NORMAL for normal subscription, CONVERT for Locked to Flexible, LOAN for flexible loan collateral, AI for Auto Invest subscribe, TRANSFER for Locked Savings to Flexible + "sourceAccount": "SPOT", // SPOT, FUNDING, SPOTANDFUNDING + "amtFromSpot": "30", // Display if sourceAccount is SPOTANDFUNDING + "amtFromFunding": "70", // Display if sourceAccount is SPOTANDFUNDING + "status": "SUCCESS" // PURCHASING/SUCCESS/FAILED + } + ], + "total": 1 +} +GET /sapi/v1/simple-earn/flexible/history/subscriptionRecord + +Weight(IP): 150 + +Parameters: + +Name Type Mandatory Description +productId STRING NO +purchaseId STRING NO +asset STRING NO +startTime LONG NO +endTime LONG NO +current LONG NO Currently querying the page. Start from 1. Default:1 +size LONG NO Default:10, Max:100 +recvWindow LONG NO +timestamp LONG YES +The time between startTime and endTime cannot be longer than 3 months. +If startTime and endTime are both not sent, then the last 30 days' data will be returned. +If startTime is sent but endTime is not sent, the next 30 days' data beginning from startTime will be returned. +If endTime is sent but startTime is not sent, the 30 days' data before endTime will be returned. +Get Locked Subscription Record (USER_DATA) +Response: + +{ + "rows":[ + { + "positionId": "123123", + "purchaseId": 26055, + "time": 1575018510000, + "asset": "BNB", + "amount": "21312.23223", + "lockPeriod": "30", + "type": "AUTO", // NORMAL for normal subscription, AUTO for auto-subscription order, ACTIVITY for activity order, TRIAL for trial fund order, RESTAKE for restake order + "sourceAccount": "SPOT", // SPOT, FUNDING, SPOTANDFUNDING + "amtFromSpot": "30", // Display if sourceAccount is SPOTANDFUNDING + "amtFromFunding": "70", // Display if sourceAccount is SPOTANDFUNDING + "status": "SUCCESS" // PURCHASING/SUCCESS/FAILED + } + ], + "total": 1 +} +GET /sapi/v1/simple-earn/locked/history/subscriptionRecord + +Weight(IP): 150 + +Parameters: + +Name Type Mandatory Description +purchaseId STRING NO +asset STRING NO +startTime LONG NO +endTime LONG NO +current LONG NO Currently querying the page. Start from 1. Default:1 +size LONG NO Default:10, Max:100 +recvWindow LONG NO +timestamp LONG YES +The time between startTime and endTime cannot be longer than 3 months. +If startTime and endTime are both not sent, then the last 30 days' data will be returned. +If startTime is sent but endTime is not sent, the next 30 days' data beginning from startTime will be returned. +If endTime is sent but startTime is not sent, the 30 days' data before endTime will be returned. +Get Flexible Redemption Record (USER_DATA) +Response: + +{ + "rows": [ + { + "amount": "10.54000000", + "asset": "USDT", + "time": 1577257222000, + "productId": "USDT001", + "redeemId": 40607, + "destAccount":"SPOT", // SPOT, FUNDING + "status": "PAID" + } + ], + "total": 1 +} +GET /sapi/v1/simple-earn/flexible/history/redemptionRecord + +Weight(IP): 150 + +Parameters: + +Name Type Mandatory Description +productId STRING NO +redeemId STRING NO +asset STRING NO +startTime LONG NO +endTime LONG NO +current LONG NO Currently querying the page. Start from 1. Default:1 +size LONG NO Default:10, Max:100 +The time between startTime and endTime cannot be longer than 3 months. +If startTime and endTime are both not sent, then the last 30 days' data will be returned. +If startTime is sent but endTime is not sent, the next 30 days' data beginning from startTime will be returned. +If endTime is sent but startTime is not sent, the 30 days' data before endTime will be returned. +Get Locked Redemption Record (USER_DATA) +Response: + +{ + "rows": [ + { + "positionId": "123123", + "redeemId": 40607, + "time": 1575018510000, + "asset": "BNB", + "lockPeriod": "30", + "amount": "21312.23223", + "type": "MATURE", //MATURE for redeem to Spot Wallet, NEW_TRANSFERRED for redeem to Flexible product, AHEAD for early redemption + "deliverDate": "1575018510000", + "status": "PAID" + } + ], + "total": 1 +} +GET /sapi/v1/simple-earn/locked/history/redemptionRecord + +Weight(IP): 150 + +Parameters: + +Name Type Mandatory Description +positionId STRING NO +redeemId STRING NO +asset STRING NO +startTime LONG NO +endTime LONG NO +current LONG NO Currently querying the page. Start from 1. Default:1 +size LONG NO Default:10, Max:100 +recvWindow LONG NO +timestamp LONG YES +The time between startTime and endTime cannot be longer than 3 months. +If startTime and endTime are both not sent, then the last 30 days' data will be returned. +If startTime is sent but endTime is not sent, the next 30 days' data beginning from startTime will be returned. +If endTime is sent but startTime is not sent, the 30 days' data before endTime will be returned. +Get Flexible Rewards History (USER_DATA) +Response: + +{ + "rows": [ + { + "asset": "BUSD", + "rewards": "0.00006408", + "projectId": "USDT001", + "type": "BONUS", + "time": 1577233578000 + }, + { + "asset": "USDT", + "rewards": "0.00687654", + "projectId": "USDT001", + "type": "REALTIME", + "time": 1577233562000 + } + ], + "total": 2 +} +GET /sapi/v1/simple-earn/flexible/history/rewardsRecord + +Weight(IP): 150 + +Parameters: + +Name Type Mandatory Description +productId STRING NO +asset STRING NO +startTime LONG NO +endTime LONG NO +type ENUM YES BONUS - Bonus tiered APR, REALTIME Real-time APR, REWARDS Historical rewards +current LONG NO current page 1, default 1 +size LONG NO default 10,max 100 +recvWindow LONG NO +timestamp LONG YES +The time between startTime and endTime cannot be longer than 3 months. +If startTime and endTime are both not sent, then the last 30 days' data will be returned. +If startTime is sent but endTime is not sent, the next 30 days' data beginning from startTime will be returned. +If endTime is sent but startTime is not sent, the 30 days' data before endTime will be returned. +Get Locked Rewards History (USER_DATA) +Response: + +{ + "rows": [ + { + "positionId": "123123", + "time": 1575018510000, + "asset": "BNB", + "lockPeriod": "30", + "amount": "21312.23223" + } + ], + "total": 1 +} +GET /sapi/v1/simple-earn/locked/history/rewardsRecord + +Weight(IP): 150 + +Parameters: + +Name Type Mandatory Description +positionId STRING NO +asset STRING NO +startTime LONG NO +endTime LONG NO +current LONG NO Currently querying the page. Start from 1. Default:1 +size LONG NO Default:10, Max:100 +recvWindow LONG NO +timestamp LONG YES +The time between startTime and endTime cannot be longer than 3 months. +If startTime and endTime are both not sent, then the last 30 days' data will be returned. +If startTime is sent but endTime is not sent, the next 30 days' data beginning from startTime will be returned. +If endTime is sent but startTime is not sent, the 30 days' data before endTime will be returned. +Set Flexible Auto Subscribe (USER_DATA) +Response: + +{ + "success": true +} +POST /sapi/v1/simple-earn/flexible/setAutoSubscribe + +Weight(IP): 150 + +Parameters: + +Name Type Mandatory Description +productId STRING YES +autoSubscribe BOOLEAN YES true or false +recvWindow LONG NO +timestamp LONG YES +Set Locked Auto Subscribe (USER_DATA) +Response: + +{ + "success": true +} +POST /sapi/v1/simple-earn/locked/setAutoSubscribe + +Weight(IP): 150 + +Parameters: + +Name Type Mandatory Description +positionId STRING YES +autoSubscribe BOOLEAN YES true or false +recvWindow LONG NO +timestamp LONG YES +Get Flexible Personal Left Quota (USER_DATA) +Response: + +{ + "leftPersonalQuota": "1000" +} +GET /sapi/v1/simple-earn/flexible/personalLeftQuota + +Weight(IP): 150 + +Parameters: + +Name Type Mandatory Description +productId STRING YES +recvWindow LONG NO +timestamp LONG YES +Get Locked Personal Left Quota (USER_DATA) +Response: + +{ + "leftPersonalQuota": "1000" +} +GET /sapi/v1/simple-earn/locked/personalLeftQuota + +Weight(IP): 150 + +Parameters: + +Name Type Mandatory Description +projectId STRING YES +recvWindow LONG NO +timestamp LONG YES +Get Flexible Subscription Preview (USER_DATA) +Response: + +{ + "totalAmount": "1232.32230982", + "rewardAsset": "BUSD", + "airDropAsset": "BETH", + "estDailyBonusRewards": "0.22759183", + "estDailyRealTimeRewards": "0.22759183", + "estDailyAirdropRewards": "0.22759183" +} +GET /sapi/v1/simple-earn/flexible/subscriptionPreview + +Weight(IP): 150 + +Parameters: + +Name Type Mandatory Description +productId STRING YES +amount DECIMAL YES +recvWindow LONG NO +timestamp LONG YES +Get Locked Subscription Preview (USER_DATA) +Response: + +[ + { + "rewardAsset": "AXS", + "totalRewardAmt": "5.17181528", + "extraRewardAsset": "BNB", + "estTotalExtraRewardAmt": "5.17181528", + "nextPay": "1.29295383", + "nextPayDate": "1646697600000", + "valueDate": "1646697600000", + "rewardsEndDate": "1651449600000", + "deliverDate": "1651536000000", + "nextSubscriptionDate": "1651536000000" + } +] +GET /sapi/v1/simple-earn/locked/subscriptionPreview + +Weight(IP): 150 + +Parameters: + +Name Type Mandatory Description +projectId STRING YES +amount DECIMAL YES +autoSubscribe BOOLEAN NO true or false, default true. +recvWindow LONG NO +timestamp LONG YES +Get Rate History (USER_DATA) +Response: + +{ + "rows": [ + { + "productId": "BUSD001", + "asset": "BUSD", + "annualPercentageRate": "0.00006408", + "time": 1577233578000 + } + ], + "total": "1" +} +GET /sapi/v1/simple-earn/flexible/history/rateHistory + +Weight(IP): 150 + +Parameters: + +Name Type Mandatory Description +productId STRING YES +startTime LONG NO +endTime LONG NO +current LONG NO Currently querying page. Start from 1. Default:1 +size LONG NO Default:10, Max:100 +recvWindow LONG NO The value cannot be greater than 60000 +timestamp LONG YES +The time between startTime and endTime cannot be longer than 3 months. +If startTime and endTime are both not sent, then the last 30 days' data will be returned. +If startTime is sent but endTime is not sent, the next 30 days' data beginning from startTime will be returned. +If endTime is sent but startTime is not sent, the 30 days' data before endTime will be returned. +Get Collateral Record (USER_DATA) +Response: + +{ + "rows": [ + { + "amount": "100.00000000", + "productId": "BUSD001", + "asset": "USDT", + "createTime": 1575018510000, + "type": "REPAY", + "productName": "USDT", + "orderId": 26055 + } + ], + "total": "1" +} +GET /sapi/v1/simple-earn/flexible/history/collateralRecord + +Weight(IP): 1 + +Parameters: + +Name Type Mandatory Description +productId STRING NO +startTime LONG NO +endTime LONG NO +current LONG NO Currently querying page. Start from 1. Default:1 +size LONG NO Default:10, Max:100 +recvWindow LONG NO The value cannot be greater than 60000 +timestamp LONG YES +The time between startTime and endTime cannot be longer than 30 days. +If startTime and endTime are both not sent, then the last 30 days' data will be returned. +If startTime is sent but endTime is not sent, the next 30 days' data beginning from startTime will be returned. +If endTime is sent but startTime is not sent, the 30 days' data before endTime will be returned. +Dual Investment Endpoints +Get Dual Investment product list(USER_DATA) +Response: + +{ + "total": 1, + "list": [ + { + "id": "741590", + "investCoin": "USDT", + "exercisedCoin": "BNB", + "strikePrice": "380", + "duration": 4, + "settleDate": 1709020800000, + "purchaseDecimal": 8, + "purchaseEndTime": 1708934400000, + "canPurchase": true, //true, false + "apr": "0.6076", + "orderId": 8257205859, + "minAmount": "0.1", + "maxAmount": "25265.7", + "createTimestamp": 1708560084000, + "optionType": "PUT", + "isAutoCompoundEnable": true, //true, false + "autoCompoundPlanList": [ + "STANDARD", + "ADVANCE" + ] + } + ] +} +GET /sapi/v1/dci/product/list + +Get Dual Investment product list + +Weight(IP): 1 + +Parameters: + +Name Type Mandatory Description +optionType STRING YES Input CALL or PUT +exercisedCoin STRING YES Target exercised asset, e.g.: if you subscribe to a high sell product (call option), you should input: optionType:CALL,exercisedCoin:USDT,investCoin:BNB; if you subscribe to a low buy product (put option), you should input: optionType:PUT,exercisedCoin:BNB,investCoin:USDT +investCoin STRING YES Asset used for subscribing, e.g.: if you subscribe to a high sell product (call option), you should input: optionType:CALL,exercisedCoin:USDT,investCoin:BNB; if you subscribe to a low buy product (put option), you should input: optionType:PUT,exercisedCoin:BNB,investCoin:USDT +pageSize LONG NO Default: 10, Maximum: 100 +pageIndex INT NO Default: 1 +recvWindow LONG NO The value cannot be greater than 60000 +timestamp LONG YES +Subscribe Dual Investment products(USER_DATA) +Response: + +{ + "positionId": 10208824, + "investCoin": "BNB", + "exercisedCoin": "USDT", + "subscriptionAmount": "0.002", + "duration": 4, + "autoCompoundPlan": "STANDARD", //STANDARD, ADVANCED, this field won't display when autocompound is set to None + "strikePrice": "380", + "settleDate": 1709020800000, + "purchaseStatus": "PURCHASE_SUCCESS", + "apr": "0.7397", + "orderId": 8259117597, + "purchaseTime": 1708677583874, + "optionType": "CALL" +} +POST /sapi/v1/dci/product/subscribe + +Subscribe Dual Investment products + +Weight(IP): 1 + +Parameters: + +Name Type Mandatory Description +id STRING YES get id from /sapi/v1/dci/product/list +orderId STRING YES get orderId from /sapi/v1/dci/product/list +depositAmount DECIMAL YES the amount for subscribing +autoCompoundPlan ENUM YES NONE: switch off the plan, STANDARD:standard plan,ADVANCED:advanced plan +recvWindow LONG NO The value cannot be greater than 60000 +timestamp LONG YES +Failed messages: + +Products are not available. // this means APR changes to lower value, or orders are not unavailable. +Failed. This means System or network errors. +Get Dual Investment positions(USER_DATA) +Response: + +{ + "total": 1, + "list": [ + { + "id": "10160533", //positionId + "investCoin": "USDT", + "exercisedCoin": "BNB", + "subscriptionAmount": "0.5", + "strikePrice": "330", + "duration": 4, + "settleDate": 1708416000000, + "purchaseStatus": "PURCHASE_SUCCESS", + "apr": "0.0365", + "orderId": 7973677530, + "purchaseEndTime": 1708329600000, //申购中, 申购成功, 已结算, 申购失败, 退款中, 退款成功, 结算中 + "optionType": "PUT", + "autoCompoundPlan": "STANDARD" //关闭计划, 基础计划, 进阶计划 + } + ] +} +GET /sapi/v1/dci/product/positions + +Get Dual Investment positions (batch) + +Weight(IP): 1 + +Parameters: + +Name Type Mandatory Description +status ENUM NO PENDING:Products are purchasing, will give results later;PURCHASE_SUCCESS:purchase successfully;SETTLED: Products are finish settling;PURCHASE_FAIL:fail to purchase;REFUNDING:refund ongoing;REFUND_SUCCESS:refund to spot account successfully; SETTLING:Products are settling. If don't fill this field, will response all the position status. +pageSize LONG NO Default: 10, Max:100 +pageIndex INT NO Default:1 +recvWindow LONG NO The value cannot be greater than 60000 +timestamp LONG YES +Check Dual Investment accounts(USER_DATA) +Response: + +{ + "totalAmountInBTC": "0.01067982", //Total BTC amounts in Dual Investment + "totalAmountInUSDT": "77.13289230" //Total USDT equivalents in BTC in Dual Investment +} +GET /sapi/v1/dci/product/accounts + +Check Dual Investment accounts + +Weight(IP): 1 + +Parameters: + +Name Type Mandatory Description +recvWindow LONG NO The value cannot be greater than 60000 +timestamp LONG YES +Change Auto-Compound status(USER_DATA) +Response: + +{ + "positionId":"123456789" + "autoCompoundPlan":"ADVANCED", //NONE,STANDARD,ADVANCED +} +POST /sapi/v1/dci/product/auto_compound/edit-status + +Change Auto-Compound status + +Weight(IP): 1 + +Rate Limit: Maximum 1 time/s per account + +Parameters: + +Name Type Mandatory Description +positionId STRING YES Get positionId from /sapi/v1/dci/product/positions +autoCompoundPlan STRING YES NONE, STANDARD,ADVANCED +recvWindow LONG NO The value cannot be greater than 60000 +timestamp LONG YES +Notes: + +15:31 ~ 16:00 UTC+8 This function is disabled +Auto-Invest Endpoints +The endpoints below allow you to interact with Binance Auto-Invest. +For more information on this, please refer to the Binance Auto-Invest page and Binance Auto-Invest FAQ +Get target asset list(USER_DATA) +Response: + +{ + "targetAssets": [ + "BTC" + ], + "autoInvestAssetList": [ + { + "targetAsset": "BTC", + "roiAndDimensionTypeList": [ + { + "simulateRoi": "5.004", + "dimensionValue": "3", + "dimensionUnit": "year" + }, + { + "simulateRoi": "2.004", + "dimensionValue": "1", + "dimensionUnit": "year" + }, + { + "simulateRoi": "1.004", + "dimensionValue": "6", + "dimensionUnit": "month" + }, + { + "simulateRoi": "0.904", + "dimensionValue": "3", + "dimensionUnit": "month" + }, + { + "simulateRoi": "0.14", + "dimensionValue": "7", + "dimensionUnit": "day" + } + ] + } + ] +} +GET /sapi/v1/lending/auto-invest/target-asset/list + +Weight(IP): 1 + +Parameters: + +Name Type Mandatory Description +targetAsset STRING NO +size LONG NO Default: 8, Max:100 +current LONG NO Current query page. Default: 1, start from 1 +recvWindow LONG NO no more than 60000 +timestamp LONG YES +Get target asset ROI data(USER_DATA) +Response: + +[ + { + "date": "1648378800000", // date of the ROI accumulation + "simulateRoi": "1.75" // value of calculated ROI till the date + }, + { + "date": "1648478800000", + "simulateRoi": "2.9" + } +] +GET /sapi/v1/lending/auto-invest/target-asset/roi/list + +ROI return list for target asset + +Weight(IP): 1 + +Parameters: + +Name Type Mandatory Description +targetAsset STRING YES e.g "BTC" +hisRoiType ENUM YES FIVE_YEAR,THREE_YEAR,ONE_YEAR,SIX_MONTH,THREE_MONTH,SEVEN_DAY +recvWindow LONG NO no more than 60000 +timestamp LONG YES +Query all source asset and target asset(USER_DATA) +Response: + +{ + "targetAssets": [ + "BTC", + "BNB" + ], + "sourceAssets": [ + "USDT", + "BUSD" + ], +} +GET /sapi/v1/lending/auto-invest/all/asset + +Query all source assets and target assets + +Weight(IP): 1 + +Parameters: + +Name Type Mandatory Description +recvWindow LONG NO no more than 60000 +timestamp LONG YES +Query source asset list(USER_DATA) +Response: + +{ + "feeRate": "0.002", + "taxRate": "0.001", + "sourceAssets": [ + { + "sourceAsset": "USDT", + "assetMinAmount": "0.1" , + "assetMaxAmount": "1000000", + "scale": "2", + "flexibleAmount":"1111" + }, + { + "sourceAsset": "BUSD", + "assetMinAmount": "0.1" , + "assetMaxAmount": "1000000", + "scale": "2", + "flexibleAmount":"1111" + } + ] +} +GET /sapi/v1/lending/auto-invest/source-asset/list + +Query Source Asset to be used for investment + +Weight(IP): 1 + +Parameters: + +Name Type Mandatory Description +targetAsset Array NO BTC、ETH、BNB +indexId Long NO 指数identifier, value = 1 +usageType STRING YES "RECURRING", "ONE_TIME" +flexibleAllowedToUse BOOLEAN NO +sourceType ENUM NO MAIN_SITE for Binance user,TR for Binance Turkey user +recvWindow LONG NO no more than 60000 +timestamp LONG YES +Investment plan creation(USER_DATA) +Response: + +{ + "planId": 12345, //for success creation, planId is associated. PlanId remains constant when plan is being updated + "nextExecutionDateTime":1648378800000, //plan next excute timestamp +} +POST /sapi/v1/lending/auto-invest/plan/add + +Post an investment plan creation + +Weight(IP): 1 + +Parameters: + +Name Type Mandatory Description +sourceType ENUM YES "MAIN_SITE" for Binance,“TR” for Binance Turkey +requestId STRING NO if not null, must follow sourceType + unique string, e.g: TR12354859 +planType ENUM YES “SINGLE”,”PORTFOLIO”,”INDEX” +indexId LONG NO Only for planType = INDEX , value = 1 +subscriptionAmount DECIMAL YES Fiat&stablecoin: 2dp, BNB/ETH/BTC: 4dp +subscriptionCycle ENUM YES "H1", "H4", "H8","H12", "WEEKLY","DAILY","MONTHLY","BI_WEEKLY" +subscriptionStartDay INTEGER NO “1”,...”31”; Mandatory if “subscriptionCycleNumberUnit” = “MONTHLY”, Must be sent in form of UTC+0 +subscriptionStartWeekday ENUM NO “MON”,”TUE”,”WED”,”THU”,”FRI”,”SAT”,”SUN”; Mandatory if “subscriptionCycleNumberUnit” = “WEEKLY” or “BI_WEEKLY”, Must be sent in form of UTC+0 +subscriptionStartTime INTEGER YES “0,1,2,3,4,5,6,7,8,..23”;Must be sent in form of UTC+0 +sourceAsset STRING YES like “USDT” +flexibleAllowedToUse BOOLEAN NO true/false;true: use flexible wallet +details Array YES sum(all node's percentage) == 100,sum(all node's percentage) == 100, When input request parameter, each entry should be like details[0].targetAsset=BTC, Example of the request parameter array: +details[0].targetAsset=BTC details[0].percentage=60 details[1].targetAsset=ETH details[1].percentage=40 +recvWindow LONG NO no more than 60000 +timestamp LONG YES +max one request every 3s per account +Investment plan adjustment (TRADE) +Response: + +{ + "planId": 12345, //for success creation, planId is associated. PlanId remains constant when plan is being updated + "nextExecutionDateTime":1648378800000 +} +POST /sapi/v1/lending/auto-invest/plan/edit + +Query Source Asset to be used for investment + +Weight(IP): 1 + +Parameters: + +Name Type Mandatory Description +planId LONG YES Plan identifier +subscriptionAmount DECIMAL YES Fiat&Stablecoin: 2dp, BNB/ETH/BTC: 4dp +subscriptionCycle ENUM YES "H1", "H4", "H8","H12", "WEEKLY","DAILY","MONTHLY","BI_WEEKLY" +subscriptionStartDay INTEGER NO “1”,...”31”;Mandatory if “subscriptionCycleNumberUnit” = “MONTHLY”,Must be sent in form of UTC+0 +subscriptionStartWeekday ENUM NO “MON”,”TUE”,”WED”,”THU”,”FRI”,”SAT”,”SUN”;Mandatory if “subscriptionCycleNumberUnit” = “WEEKLY” or “BI_WEEKLY”, Must be sent in form of UTC+0 +subscriptionStartTime INTEGER YES “0,1, 2,3,4,5,6,7,8,..23”; Must be sent in form of UTC+0 +sourceAsset STRING YES e.g. “USDT” +flexibleAllowedToUse BOOLEAN NO true/false;true:use flexible wallet +details Array YES sum(all node's percentage) == 100,sum(all node's percentage) == 100, When input request parameter, each entry should be like details[0].targetAsset=BTC, Example of the request parameter array: +details[0].targetAsset=BTC details[0].percentage=60 details[1].targetAsset=ETH details[1].percentage=40 +recvWindow LONG NO no more than 60000 +timestamp LONG YES +max one request every 3s per account +Change Plan Status (TRADE) +Response: + +{ + "planId": 12345, //planId is constant regardless the change of the status + "nextExecutionDateTime":1648378800000, + "status":"ONGOING" //ONGOING, PAUSED, REMOVED +} +POST /sapi/v1/lending/auto-invest/plan/edit-status + +Change Plan Status + +Weight(IP): 1 + +Parameters: + +Name Type Mandatory Description +planId LONG YES Plan identifier +status ENUM YES “ONGOING”,”PAUSED","REMOVED" +recvWindow LONG NO no more than 60000 +timestamp LONG YES +max one request every 3s per account +Get list of plans (USER_DATA) +Response: + +SINGLE/PORTFOLIO + +{ + "planValueInUSD": "123", + "planValueInBTC":"0.1", + "pnlInUSD":"120", + "roi":"2.3", + "plans": [ + { + "planId": 12345, + "planType": "SINGLE", + "editAllowed": "true", + "creationDateTime": 1648378800000, + "firstExecutionDateTime": 1648378800000, //first subscription date time + "nextExecutionDateTime": 1648378800000, + "status": "ONGOING", // ONGOING,PAUSED + "lastUpdatedDateTime": 1648378800000, + "targetAsset": "BTC", + "totalTargetAmount":"0.111", + "sourceAsset": "BUSD", + "totalInvestedInUSD":"4.555", + "subscriptionAmount": "0.1", + "subscriptionCycle": "WEEKLY", + "subscriptionStartDay": null, + "subscriptionStartWeekday" : "MON", + "subscriptionStartTime": "1", + "sourceWallet": "SPOT_WALLET", + "flexibleAllowedToUse": "false", + "planValueInUSD": "101.2", + "pnlInUSD": "101.2", + "roi": "1.02" + } + ] +} +OR INDEX + +{ + "planValueInUSD": "123", + "planValueInBTC": "0.1", + "plans": [ + { + "planId": 12345, + "planType": "INDEX", + "editAllowed": "true", + "creationDateTime": 1648378800000, + "firstExecutionDateTime": 1648378800000, //first subscription date time + "nextExecutionDateTime": 1648378800000, + "status": "ONGOING", + "lastUpdatedDateTime": 1648378800000, + "targetAsset": "BTC", + "sourceAsset": "BUSD", + "totalInvestedInUSD":"4.555", + "subscriptionAmount": "0.1", + "subscriptionCycle": "DAILY", + "subscriptionStartDay": "1", + "subscriptionStartWeekday" : null, + "subscriptionStartTime": "2", + "sourceWallet": "SPOT", + "flexibleAllowedToUse": "false", + + } + ] +} +GET /sapi/v1/lending/auto-invest/plan/list + +Query plan lists + +Weight(IP): 1 + +Parameters: + +Name Type Mandatory Description +planType STRING YES Plan identifier +recvWindow LONG NO no more than 60000 +timestamp LONG YES +max one request every 3s per account +Query holding details of the plan (USER_DATA) +Response: + +{ + "planId": 111212, + "planType": "INDEX", // this is the plan type: "SINGLE","PORTFOLIO","INDEX" + "editAllowed": "true", //whether this plan is allowed to be modified + "flexibleAllowedToUse": "false", + "creationDateTime": 1648378800000, // date time that this plan is created. YYYY-MM-DD HH:mm:SS e.g 2022-01-07 08:00:00 + "firstExecutionDateTime": 1648378800000, //first subscription date time + "nextExecutionDateTime": 1648378800000, //next subscription date time + "status": "ONGOING", //plan status of the selected plan + "targetAsset": "BTC", + "sourceAsset": "BUSD", //source asset of the plan created + "planValueInUSD": "101.2", //market value of the plan + "pnlInUSD": "101.2", // PNL of the plan in USD + "roi": "1.023", //ROI of the plan + "totalInvestedInUSD": "122", //total source asset invested in equivilent of USD + "details": [ + { + "targetAsset": "ADA", + "averagePriceInUSD": "3.4", //average price of the asset in USD + "totalInvestedInUSD": "222.21", //total source asset invested for this target asset in equivilent of USD + "purchasedAmount": "122.12345678", //purchased amount of target asset + "purchasedAmountUnit": "ADA", + "pnlInUSD": "109.2", //PNL denominated in USD + "roi": "0.1", //ROI calculated in decimal + "percentage": "50", //asset allocation in the plan. If it's single plan, then it's 100 + "assetStatus":"ACTIVE", // ACTIVE / INACTIVE whether this asset is still being subscribed in this plan + "availableAmount": "122.12345678", // Only for planType = INDEX + "availableAmountUnit": "ADA", // Only for planType = INDEX + "redeemedAmout": "122.12345678", // Only for planType = INDEX + "redeemedAmoutUnit": "ADA", // Only for planType = INDEX + "assetValueInUSD": "101.2" // Only for planType = INDEX + } + ] +} +GET /sapi/v1/lending/auto-invest/plan/id + +Query holding details of the plan + +Weight(IP): 1 + +Parameters: + +Name Type Mandatory Description +planId LONG NO Plan identifier +requestId STRING NO requestId when create +recvWindow LONG NO no more than 60000 +timestamp LONG YES +Query subscription transaction history (USER_DATA) +Response: + +[ + { + "id":1111, + "targetAsset":"BTC", //name of the asset + "planType":"SINGLE", //plan type of which this transaction is from + "planName":"BTC", // plan name of which this transaction is from + "planId":1234, // plan identifier of which this transaction is from + "transactionDateTime":1648378800000, //transaction timestamp + "transactionStatus":"SUCCESS", //status of the transaction: "SUCCESS","FAILED","PENDING" + "failedType":"INSUFFICIENT_BALANCE",// only show when transactionStatus = FAILED, INSUFFICIENT_BALANCE,TRANSACTION_REJECT/GCC_RJECT + "sourceAsset":"BUSD", //source asset of the transaction + "sourceAssetAmount":"297.12345", //amount of source asset used + "targetAssetAmount":"0.005", //purchased amount of the asset + "sourceWallet":"SPOT_WALLET", // SPOT_WALLET,FLEXIBLE_SAVINGS,SPOT_WALLET_FLEXIBLE_SAVINGS,REWARDS + "flexibleUsed":"false", //whether simple earn wallet is used + "transactionFee":"0.002", //transaction fee amount + "transactionFeeUnit":"BUSD", //denominated coin of the transaction fee + "executionPrice":"2342" //price of the subscription price. It's amount of source asset equivilent of 1 unit of target asset + "executionType":"RECURRING", //ONE_TIME,RECURRING + "subscriptionCycle": "WEEKLY" + } +] +GET /sapi/v1/lending/auto-invest/history/list + +Query subscription transaction history of a plan + +Weight(IP): 1 + +Parameters: + +Name Type Mandatory Description +planId LONG NO Plan identifier +startTime LONG NO +endTime LONG NO +targetAsset STRING NO +planType ENUM NO SINGLE, PORTFOLIO, INDEX, ALL +size LONG NO Default:10, Max:100 +current LONG NO Currently querying page. Start from 1. Default:1 +recvWindow LONG NO no more than 60000 +timestamp LONG YES +Max span between startTime and endTime is 30days +If both startTime and endTime are null,then default is 30days +Query Index Details(USER_DATA) +Response: + +{ + "indexId": 1, + "indexName":"BINANCE TOP 10 EW ", + "status": "RUNNING", // RUNNING/REBALANCING/PAUSED + "assetAllocation": [ + { + "targetAsset": "ADA", // for pie chart + "allocation":"10" + }, + { + "targetAsset": "BTC", + "allocation":"10" + } + ] +} +GET /sapi/v1/lending/auto-invest/index/info + +Query index details + +Weight(IP): 1 + +Parameters: + +Name Type Mandatory Description +indexId LONG YES +recvWindow LONG NO no more than 60000 +timestamp LONG YES +Query Index Linked Plan Position Details(USER_DATA) +Response: + +{ + "indexId": 1, + "totalInvestedInUSD":"114.555", + "currentInvestedInUSD": "101.2", //current invest + "pnlInUSD": "101.2", // PNL of the plan in USD based on current amount + "roi": "1.023", //ROI of the plan based on current amount + "assetAllocation": [ + { + "targetAsset": "ADA", // for pie chart + "allocation":"10" + }, + { + "targetAsset": "BTC", + "allocation":"10" + } + ] + "details": [ + { + "targetAsset": "ADA", + "averagePriceInUSD": "3.4", //average price of the asset in USD + "totalInvestedInUSD": "222.21", //total source asset invested for this target asset in equivilent of USD + + "currentInvestedInUSD": "101.2", //current invest + "purchasedAmount": "122.12345678", //purchased amount of target asset + "pnlInUSD": "109.2", //PNL denominated in USD + "roi": "0.1", //ROI calculated in decimal + "percentage": "10", //asset allocation in the plan. If it's single plan, then it's 100 + "availableAmount": "122.12345678", + "redeemedAmount": "122.12345678", + "assetValueInUSD": "101.2" + }, + { + "targetAsset": "MATIC", + "averagePriceInUSD": "3.4", //average price of the asset in USD + "totalInvestedInUSD": "222.21", //total source asset invested for this target asset in equivilent of USD + "currentInvestedInUSD": "101.2", //current invest + "purchasedAmount": "122.12345678", //purchased amount of target asset + "pnlInUSD": "109.2", //PNL denominated in USD + "roi": "0.1", //ROI calculated in decimal + "percentage": "10", //asset allocation in the plan. If it's single plan, then it's 100 + "availableAmount": "122.12345678", + "redeemedAmount": "122.12345678", + "assetValueInUSD": "101.2" + } + ] +} +GET /sapi/v1/lending/auto-invest/index/user-summary + +Details on users Index-Linked plan position details + +Weight(IP): 1 + +Parameters: + +Name Type Mandatory Description +indexId LONG YES +recvWindow LONG NO no more than 60000 +timestamp LONG YES +One Time Transaction(TRADE) +Response: + +{ + "transactionId": 12345, //transaction identifier + "waitSecond": 5 // wait this second,then check the result +} +POST /sapi/v1/lending/auto-invest/one-off + +One time transaction + +Weight(IP): 1 + +Rate Limit: once every 3s per account + +Parameters: + +Name Type Mandatory Description +sourceType STRING YES "MAIN_SITE" for Binance,“TR” for Binance Turkey +requestId STRING NO if not null, must follow sourceType + unique string, e.g: TR12354859 +subscriptionAmount DECIMAL YES +sourceAsset STRING YES e.g “USDT” +flexibleAllowedToUse BOOLEAN NO true/false;true: using flexible wallet +planId LONG NO PORTFOLIO plan's Id +indexId LONG NO now only can set = 1 +details Array YES sum(all node's percentage) == 100,sum(all node's percentage) == 100, When input request parameter, each entry should be like details[0].targetAsset=BTC, Example of the request parameter array: +details[0].targetAsset=BTC details[0].percentage=60 details[1].targetAsset=ETH details[1].percentage=40 +recvWindow LONG NO no more than 60000 +timestamp LONG YES +planId/planId/details must not all be null +Query One-Time Transaction Status(USER_DATA) +Response: + +{ + "transactionId": 12345, //transaction identifier + "status": "SUCCESS" //status of transaction"SUCCESS"/"CONVERTING" +} +GET /sapi/v1/lending/auto-invest/one-off/status + +Transaction status for one-time transaction + +Weight(IP): 1 + +Parameters: + +Name Type Mandatory Description +transactionId LONG YES PORTFOLIO plan's Id +requestId STRING NO sourceType + unique, transactionId and requestId cannot be empty at the same time +recvWindow LONG NO no more than 60000 +timestamp LONG YES +Index Linked Plan Redemption(TRADE) +Response: + +{ + "redemptionId":19, //This is the identifier for this redemption requests +} +POST /sapi/v1/lending/auto-invest/redeem + +To redeem index-Linked plan holdings + +Weight(IP): 1 + +Rate Limit: once every 3s per account + +Parameters: + +Name Type Mandatory Description +indexId LONG YES PORTFOLIO plan's Id +requestId STRING NO sourceType + unique, transactionId and requestId cannot be empty at the same time +redemptionPercentage LONG YES user redeem percentage,10/20/100.. +recvWindow LONG NO no more than 60000 +timestamp LONG YES +Index Linked Plan Redemption(USER_DATA) +Response: + +[ + { + "indexId":1, //index identifier + "indexName":"BINANCE TOP 10 EW", //index name + "redemptionId":11 //redemption record identifier + "status":"SUCCESS", //redemption SUCCESS/FAILED + "asset":"BTC", //asset invovled + "amount":"0.005", //redemption amount + "redemptionDateTime":1648378800000, //redemption timestamp + "transactionFee":"0", //redemption fee + "transactionFeeUnit":"USDT" //denomination of redemption fee amount + }, + { + "indexId":1, + "indexName":"BINANCE TOP 10 EW", + "redemptionId":12 + "status":"SUCCESS", + "asset":"BNB", + "amount":"0.005", + "redemptionDateTime":1648378800000, + "transactionFee":"0", + "transactionFeeUnit":"USDT" + } +] +GET /sapi/v1/lending/auto-invest/redeem/history + +Get the history of Index Linked Plan Redemption transactions + +Weight(IP): 1 + +Parameters: + +Name Type Mandatory Description +requestId LONG YES request id +startTime LONG NO +endTime LONG NO +current LONG NO Currently querying page. Start from 1,Default:1 +asset STRING NO +size LONG NO Default:10, Max:100 +recvWindow LONG NO no more than 60000 +timestamp LONG YES +Max 30 day difference between startTime and endTime +If no startTime and endTime, default to show past 30 day records +Index Linked Plan Rebalance Details(USER_DATA) +Response: + +[ + { + "indexId":1, //index identifier + "indexName":"BINANCE TOP 10 EW", //index name + "rebalanceId":11, //rebalance identifier + "status":"SUCCESS", //rebalance status SUCCESS/INIT + "rebalanceFee":"10", //rebalance fee + "rebalanceFeeUnit":"USDT", // rebalance fee unit + "transactionDetails":[ + { + "asset":"BTC", //assets to be rebalanced + "transactionDateTime":1648378800000, //rebalance transaction timestamp + "rebalanceDirection":"BUY", //rebalance direction + "rebalanceAmount":"0.005", //rebalance amount for the asset + }, + { + "asset":"ETH", + "transactionDateTime":1648378800000, + "rebalanceDirection":"BUY", + "rebalanceAmount":"0.005", + } + ] + } +] +GET /sapi/v1/lending/auto-invest/rebalance/history + +Get the history of Index Linked Plan Redemption transactions + +Weight(IP): 1 + +Parameters: + +Name Type Mandatory Description +startTime LONG NO +endTime LONG NO +current LONG NO Currently querying page. Start from 1,Default:1 +size LONG NO Default:10, Max:100 +recvWindow LONG NO no more than 60000 +timestamp LONG YES +Max 30 day difference between startTime and endTime +If no startTime and endTime, default to show past 30 day records +Staking Endpoints +The endpoints below allow you to interact with Staking. For more information on this, please refer to the Staking page + +Subscribe ETH Staking(TRADE) +Response: + +{ + "success": true +} +POST /sapi/v1/eth-staking/eth/stake + +Weight(IP): 150 + +Rate Limit: 1/3s per account + +Parameters: + +Name Type Mandatory Description +amount DECIMAL YES Amount in ETH, limit 4 decimals +recvWindow LONG NO +timestamp LONG YES +You need to open Enable Spot & Margin Trading permission for the API Key which requests this endpoint. +Subscribe ETH Staking V2(TRADE) +Response: + +{ + "success": true, + "wbethAmount":"0.23092091", + "conversionRatio": "1.001212342342" // ETH amount per 1 WBETH +} +POST /sapi/v2/eth-staking/eth/stake + +Stake ETH to get WBETH + +Weight(IP): 150 + +Rate Limit: 1/3s per account + +Parameters: + +Name Type Mandatory Description +amount DECIMAL YES Amount in ETH, limit 4 decimals +recvWindow LONG NO +timestamp LONG YES +You need to open Enable Spot & Margin Trading permission for the API Key which requests this endpoint. +Redeem ETH (TRADE) +Response: + +{ + "success": true, + "arrivalTime": 1575018510000, + "ethAmount":"0.23092091", + "conversionRatio": "1.00121234" +} +POST /sapi/v1/eth-staking/eth/redeem + +Redeem WBETH or BETH and get ETH + +Weight(IP): + +150 + +Rate Limit: + +1/3s per account + +Parameters: + +Name Type Mandatory Description +asset STRING NO WBETH or BETH, default to BETH +amount DECIMAL YES Amount in BETH, limit 8 decimals +recvWindow LONG NO +timestamp LONG YES +You need to open Enable Spot & Margin Trading permission for the API Key which requests this endpoint. +Get ETH staking history (USER_DATA) +Response: + +{ + "rows": [ + { + "time": 1575018510000, + "asset": "ETH", + "amount": "21312.23223", + "status": "SUCCESS" //PENDING,SUCCESS,FAILED + "distributeAmount":"21286.42584", + "conversionRatio":"1.00121234" + } + ], + "total": 1 +} +GET /sapi/v1/eth-staking/eth/history/stakingHistory + +Weight(IP): + +150 + +Parameters: + +Name Type Mandatory Description +startTime LONG NO +endTime LONG NO +current LONG NO Currently querying page. Start from 1. Default: 1 +size LONG NO Default: 10, Max: 100 +recvWindow LONG NO +timestamp LONG YES +The time between startTime and endTime cannot be longer than 3 months. +If startTime and endTime are both not sent, then the last 30 days' data will be returned. +If startTime is sent but endTime is not sent, the next 30 days' data beginning from startTime will be returned. +If endTime is sent but startTime is not sent, the 30 days' data before endTime will be returned. +Get ETH redemption history (USER_DATA) +Response: + +{ + "rows": [ + { + "time": 1575018510000, + "arrivalTime": 1575018510000, + "amount": "21312.23223", + "status": "SUCCESS", + "asset":"WBETH", + "distributeAsset": "ETH", //PENDING,SUCCESS,FAILED + "distributeAmount": "21338.0699", + "conversionRatio": "1.00121234" + } + ], + "total": 1 +} +GET /sapi/v1/eth-staking/eth/history/redemptionHistory + +Weight(IP): + +150 + +Parameters: + +Name Type Mandatory Description +startTime LONG NO +endTime LONG NO +current LONG NO Currently querying page. Start from 1. Default: 1 +size LONG NO Default: 10, Max: 100 +recvWindow LONG NO +timestamp LONG YES +The time between startTime and endTime cannot be longer than 3 months. +If startTime and endTime are both not sent, then the last 30 days' data will be returned. +If startTime is sent but endTime is not sent, the next 30 days' data beginning from startTime will be returned. +If endTime is sent but startTime is not sent, the 30 days' data before endTime will be returned. +Get BETH rewards distribution history(USER_DATA) +Response: + +{ + "rows": [ + { + "time": 1575018510000, + "asset": "BETH", + "holding": "2.3223", // BETH holding balance + "amount": "0.23223", // Distributed rewards + "annualPercentageRate": "0.5", // 0.5 means 50% here + "status": "SUCCESS" + } + ], + "total": 1 +} +GET /sapi/v1/eth-staking/eth/history/rewardsHistory + +Weight(IP): + +150 + +Parameters: + +Name Type Mandatory Description +startTime LONG NO +endTime LONG NO +current LONG NO Currently querying page. Start from 1. Default: 1 +size LONG NO Default: 10, Max: 100 +recvWindow LONG NO +timestamp LONG YES +The time between startTime and endTime cannot be longer than 3 months. +If startTime and endTime are both not sent, then the last 30 days' data will be returned. +If startTime is sent but endTime is not sent, the next 30 days' data beginning from startTime will be returned. +If endTime is sent but startTime is not sent, the 30 days' data before endTime will be returned. +Get current ETH staking quota (USER_DATA) +Response: + +{ + "leftStakingPersonalQuota": "1000", // Show min(Daily available limit, total personal staking quota) + "leftRedemptionPersonalQuota": "1000" // Show min(Daily personal redeem quota, total redemption limit) +} +GET /sapi/v1/eth-staking/eth/quota + +Weight(IP): + +150 + +Parameters: + +Name Type Mandatory Description +recvWindow LONG NO +timestamp LONG YES +Get WBETH Rate History (USER_DATA) +Response: + +{ + "rows": [ + { + "annualPercentageRate": "0.00006408", // BETH APR + "exchangeRate": "1.00121234", // BETH value per 1 WBETH + "time": 1577233578000 + } + ], + "total": "1" +} +GET /sapi/v1/eth-staking/eth/history/rateHistory + +Weight(IP): + +150 + +Parameters: + +Name Type Mandatory Description +startTime LONG NO +endTime LONG NO +current LONG NO Currently querying page. Start from 1. Default:1 +size LONG NO Default:10, Max:100 +recvWindow LONG NO +timestamp LONG YES +The time between startTime and endTime cannot be longer than 3 months. +If startTime and endTime are both not sent, then the last 30 days' data will be returned. +If startTime is sent but endTime is not sent, the next 30 days' data beginning from startTime will be returned. +If endTime is sent but startTime is not sent, the 30 days' data before endTime will be returned. +ETH Staking account (USER_DATA) +Response: + +{ + "cumulativeProfitInBETH": "0.01067982", + "lastDayProfitInBETH": "0.01067982" +} +GET /sapi/v1/eth-staking/account + +Weight(IP): + +150 + +Parameters: + +Name Type Mandatory Description +recvWindow LONG NO +timestamp LONG YES +ETH Staking account V2(USER_DATA) +Response: + +{ + "holdingInETH":"1.22330928", + "holdings":{ + wbethAmount="1.10928781", + bethAmount="1.90002112" + }, + "thirtyDaysProfitInETH":"0.22330928", + "profit":{ + amountFromWBETH="0.12330928", //Profit accrued within WBETH + amountFromBETH="0.1" //BETH distributed to your Spot Wallet + } +} +GET /sapi/v2/eth-staking/account + +Weight(IP): + +150 + +Parameters: + +Name Type Mandatory Description +recvWindow LONG NO +timestamp LONG YES +Wrap BETH(TRADE) +Response: + +{ + "success": true, + "wbethAmount": "0.23092091", + "exchangeRate": "1.001212343432" +} +POST /sapi/v1/eth-staking/wbeth/wrap + +Weight(IP): + +150 + +Rate Limit: + +1/3s per account + +Parameters: + +Name Type Mandatory Description +amount DECIMAL YES Amount in BETH, limit 4 decimals +recvWindow LONG NO +timestamp LONG YES +You need to open Enable Spot & Margin Trading permission for the API Key which requests this endpoint. +Get WBETH wrap history (USER_DATA) +Response: + +{ + "rows": [ + { + "time": 1575018510000, + "fromAsset": "BETH", + "fromAmount": "21312.23223", + "toAsset": "WBETH", + "toAmount": "21312.23223", + "exchangeRate": "1.01243253", // BETH amount per 1 WBETH + "status": "SUCCESS" //PENDING,SUCCESS,FAILED + } + ], + "total": 1 +} +GET /sapi/v1/eth-staking/wbeth/history/wrapHistory + +Weight(IP): + +150 + +Parameters: + +Name Type Mandatory Description +startTime LONG NO +endTime LONG NO +current LONG NO Currently querying page. Start from 1. Default:1 +size LONG NO Default:10, Max:100 +recvWindow LONG NO +timestamp LONG YES +The time between startTime and endTime cannot be longer than 3 months. +If startTime and endTime are both not sent, then the last 30 days' data will be returned. +If startTime is sent but endTime is not sent, the next 30 days' data beginning from startTime will be returned. +If endTime is sent but startTime is not sent, the 30 days' data before endTime will be returned. +Get WBETH unwrap history (USER_DATA) +Response: + +{ + "rows": [ + { + "time": 1575018510000, + "fromAsset": "WBETH", + "fromAmount": "21312.23223", + "toAsset": "BETH", + "toAmount": "21312.23223", + "exchangeRate": "1.01243253", // BETH value per 1 WBETH + "status": "SUCCESS" //PENDING,SUCCESS,FAILED + } + ], + "total": 1 +} +GET /sapi/v1/eth-staking/wbeth/history/unwrapHistory + +Weight(IP): + +150 + +Parameters: + +Name Type Mandatory Description +startTime LONG NO +endTime LONG NO +current LONG NO Currently querying page. Start from 1. Default:1 +size LONG NO Default:10, Max:100 +recvWindow LONG NO +timestamp LONG YES +The time between startTime and endTime cannot be longer than 3 months. +If startTime and endTime are both not sent, then the last 30 days' data will be returned. +If startTime is sent but endTime is not sent, the next 30 days' data beginning from startTime will be returned. +If endTime is sent but startTime is not sent, the 30 days' data before endTime will be returned. +Get WBETH rewards history(USER_DATA) +Response: + +{ + "estRewardsInETH":"1.23230920", + "rows":[ + { + "time":1575018510000, + "amountInETH":"0.23223", // Estimated rewards accrued within WBETH + "holding":"2.3223", // WBETH holding balance + "holdingInETH":"2.4231", + "annualPercentageRate":"0.5", + } + ], + "total": 1 +} +GET /sapi/v1/eth-staking/eth/history/wbethRewardsHistory + +Weight(IP): + +150 + +Parameters: + +Name Type Mandatory Description +startTime LONG NO +endTime LONG NO +current LONG NO Currently querying page. Start from 1. Default:1 +size LONG NO Default:10, Max:100 +recvWindow LONG NO +timestamp LONG YES +The time between startTime and endTime cannot be longer than 3 months. +If startTime and endTime are both not sent, then the last 30 days' data will be returned. +If startTime is sent but endTime is not sent, the next 30 days' data beginning from startTime will be returned. +If endTime is sent but startTime is not sent, the 30 days' data before endTime will be returned. +Mining Endpoints +The endpoints below allow to interact with Binance Pool. +For more information on this, please refer to the Binance Pool page +Acquiring Algorithm (MARKET_DATA) +Response: + +{ + "code": 0, + "msg": "", + "data": [ + { + "algoName": "sha256", // Algorithm name + "algoId": 1, // Algorithm ID + "poolIndex": 0, // Sequence + "unit": "h/s" // Unit + } + ] +} +GET /sapi/v1/mining/pub/algoList + +Weight(IP): 1 + +Parameter: + +None + +Acquiring CoinName (MARKET_DATA) +GET /sapi/v1/mining/pub/coinList + +Weight(IP): 1 + +Parameter: + +None + +Response: + +{ + "code": 0, + "msg": "", + "data": [ + { + "coinName": "BTC", // Currencyname + "coinId": 1, // id + "poolIndex": 0, // Sort + "algoId": 1, // Algorithm + "algoName": "sha256" //Name of algorithm + } + ] +} +Request for Detail Miner List (USER_DATA) +Response: + +{ + "code": 0, + "msg": "", + "data": [ + { + "workerName": "bhdc1.16A10404B", //Mining Account name + "type": "H_hashrate", // Type of hourly hashrate + "hashrateDatas": [ + { + "time": 1587902400000, // Time + "hashrate": "0", // Hashrate + "reject": 0 //Rejection Rate + }, + { + "time": 1587906000000, + "hashrate": "0", + "reject": 0 + } + ] + }, + { + "workerName": "bhdc1.16A10404B", //Mining Account name + "type": "D_hashrate", //Type of daily hashrate + "hashrateDatas": [ + { + "time": 1587902400000, // Time + "hashrate": "0", // Hashrate + "reject": 0 //Rejection Rate + }, + { + "time": 1587906000000, + "hashrate": "0", + "reject": 0 + } + ] + } + ] +} +GET /sapi/v1/mining/worker/detail + +Weight(IP): 5 + +Parameter: + +Name Type Mandatory Description For Example +algo STRING YES Algorithm(sha256) sha256 +userName STRING YES Mining account test +workerName STRING YES Miner’s name(required) bhdc1.16A10404B +recvWindow LONG NO +timestamp LONG YES +Request for Miner List (USER_DATA) +Response: + +{ + "code": 0, + "msg": "", + "data": { + "workerDatas": [ + { + "workerId": "1420554439452400131", //Miner ID + "workerName": "2X73", //Miner's name + "status": 3, // Status:1 valid, 2 invalid, 3 no longer valid + "hashRate": 0, // Real-time rate + "dayHashRate": 0, //24H Hashrate + "rejectRate": 0, //Real-time Rejection Rate + "lastShareTime": 1587712919000 // Last submission time + }, + { + "workerId": "7893926126382807951", + "workerName": "AZDC1.1A10101", + "status": 2, + "hashRate": 29711247541680, + "dayHashRate": 12697781298013.66, + "rejectRate": 0, + "lastShareTime": 1587969727000 + } + ], + "totalNum": 18530, // Total amount + "pageSize": 20 // Rows per page + } +} +GET /sapi/v1/mining/worker/list + +Weight(IP): 5 + +Parameter: + +Name Type Mandatory Description For Example +algo STRING YES Algorithm(sha256) sha256 +userName STRING YES Mining account test +pageIndex INTEGER NO Page number,default is first page,start from 1 +sort INTEGER NO sort sequence(default=0)0 positive sequence,1 negative sequence +sortColumn INTEGER NO 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 INTEGER NO miners status(default=0), 0 all, 1 valid,2 invalid, 3 failure +recvWindow LONG NO +timestamp LONG YES +Earnings List(USER_DATA) +Response: + +{ + "code": 0, + "msg": "", + "data": { + "accountProfits": [ + { + "time": 1586188800000, // Mining date + "type": 31, // 0:Mining Wallet,5:Mining Address,7:Pool Savings,8:Transferred,31:Income Transfer ,32:Hashrate Resale-Mining Wallet 33:Hashrate Resale-Pool Savings + "hashTransfer": null, // Transferred Hashrate + "transferAmount": null, // Transferred Income + "dayHashRate": 129129903378244, // Daily Hashrate + "profitAmount": 8.6083060304, //Earnings Amount + "coinName":"BTC", // Coin Type + "status": 2 //Status:0:Unpaid, 1:Paying 2:Paid + }, + { + "time": 1607529600000, + "coinName": "BTC", + "type": 0, + "dayHashRate": 9942053925926, + "profitAmount": 0.85426469, + "hashTransfer": 200000000000, + "transferAmount": 0.02180958, + "status": 2 + }, + { + "time": 1607443200000, + "coinName": "BTC", + "type": 31, + "dayHashRate": 200000000000, + "profitAmount": 0.02905916, + "hashTransfer": null, + "transferAmount": null, + "status": 2 + } + ], + "totalNum": 3, // Total Rows + "pageSize": 20 // Rows per page + } +} +GET /sapi/v1/mining/payment/list + +Weight(IP): 5 + +Parameter: + +Name Type Mandatory Description Example +algo STRING YES Transfer algorithm(sha256) sha256 +userName STRING YES Mining account test +coin STRING NO Coin name +startDate Long NO Search date, millisecond timestamp, while empty query all +endDate Long NO Search date, millisecond timestamp, while empty query all +pageIndex INTEGER NO Page number, empty default first page, starting from 1 +pageSize INTEGER NO Number of pages, minimum 10, maximum 200 +recvWindow LONG NO +timestamp LONG YES +Extra Bonus List (USER_DATA) +Response: + +{ + "code": 0, + "msg": "", + "data": { + "otherProfits": [ + { + "time": 1607443200000, // Mining date + "coinName": "BTC", // Coin Name + "type": 4, // 1: Merged Mining, 2: Activity Bonus, 3:Rebate 4:Smart Pool 6:Income Transfer 7:Pool Savings + "profitAmount": 0.0011859, //Amount + "status": 2 //Status:0:Unpaid, 1:Paying 2:Paid + } + ], + "totalNum": 3, // Total Rows + "pageSize": 20 // Rows per page + } +} +GET /sapi/v1/mining/payment/other + +Weight(IP): 5 + +Parameter: + +Name Type Mandatory Description Example +algo STRING YES Transfer algorithm(sha256) sha256 +userName STRING YES Mining Account test +coin STRING NO Coin Name +startDate Long NO Search date, millisecond timestamp, while empty query all +endDate Long NO Search date, millisecond timestamp, while empty query all +pageIndex INTEGER NO Page number, empty default first page, starting from 1 +pageSize INTEGER NO Number of pages, minimum 10, maximum 200 +recvWindow LONG NO +timestamp LONG YES +Hashrate Resale List (USER_DATA) +Response: + +{ + "code": 0, + "msg": "", + "data": { + "configDetails": [ + { + "configId": 168, // Mining ID + "poolUsername": "123", //Transfer out of subaccount + "toPoolUsername": "user1", // Transfer into subaccount + "algoName": "Ethash", // Transfer algorithm + "hashRate": 5000000, // Transferred Hashrate quantity + "startDay": 20201210, // Start date + "endDay": 20210405, //End date + "status": 1 //Status:0 Processing,1:Cancelled,2:Terminated + }, + { + "configId": 166, + "poolUsername": "pop", + "toPoolUsername": "111111", + "algoName": "Ethash", + "hashRate": 3320000, + "startDay": 20201226, + "endDay": 20201227, + "status": 0 + } + ], + "totalNum": 21, + "pageSize": 200 + } +} +GET /sapi/v1/mining/hash-transfer/config/details/list + +Weight(IP): 5 + +Parameter: + +Name Type Mandatory Description Example +pageIndex INTEGER NO Page number, empty default first page, starting from 1 +pageSize INTEGER NO Number of pages, minimum 10, maximum 200 +recvWindow LONG NO +timestamp LONG YES +Hashrate Resale Detail (USER_DATA) +Response: + +{ + "code": 0, + "msg": "", + "data": { + "profitTransferDetails": [{ + "poolUsername": "test4001", // Transfer out of sub-account + + "toPoolUsername": "pop", // Transfer into subaccount + "algoName": "sha256", // Transfer algorithm + "hashRate": 200000000000, // Transferred Hashrate quantity + "day": 20201213, // Transfer date + "amount": 0.2256872, // Transferred income + "coinName": "BTC" // Coin Name + }, + { + "poolUsername": "test4001", + "toPoolUsername": "pop", + "algoName": "sha256", + "hashRate": 200000000000, + "day": 20201213, + "amount": 0.2256872, + "coinName": "BTC" + } + ], + "totalNum": 8, + "pageSize": 200 + } +} +GET /sapi/v1/mining/hash-transfer/profit/details + +Weight(IP): 5 + +Parameter: + +Name Type Mandatory Description Example +configId INTEGER YES Mining ID 168 +userName STRING YES Mining Account test +pageIndex INTEGER NO Page number, empty default first page, starting from 1 +pageSize INTEGER NO Number of pages, minimum 10, maximum 200 +recvWindow LONG NO +timestamp LONG YES +Hashrate Resale Request (USER_DATA) +Response: + +{ + "code": 0, + "msg": "", + "data": 171 // Mining Account +} +POST /sapi/v1/mining/hash-transfer/config + +Weight(IP): 5 + +Parameter: + +Name Type Mandatory Description Example +userName STRING YES Mining Account test +algo STRING YES Transfer algorithm(sha256) sha256 +endDate Long YES Resale End Time (Millisecond timestamp) 1617659086000 +startDate Long YES Resale Start Time(Millisecond timestamp) 1607659086000 +toPoolUser STRING YES Mining Account S19pro +hashRate Long YES Resale hashrate h/s must be transferred (BTC is greater than 500000000000 ETH is greater than 500000) 100000000 +recvWindow LONG NO +timestamp LONG YES +Cancel hashrate resale configuration(USER_DATA) +Response: + +{ + "code": 0, + "msg": "", + "data": true +} +POST /sapi/v1/mining/hash-transfer/config/cancel + +Weight(IP): 5 + +Parameter: + +Name Type Mandatory Description Example +configId INTEGER YES Mining ID 168 +userName STRING YES Mining Account test +recvWindow LONG NO +timestamp LONG YES +Statistic List (USER_DATA) +Response: + +{ + "code": 0, + "msg": "", + "data": { + "fifteenMinHashRate": "457835490067496409.00000000", // 15 mins hashrate + "dayHashRate": "214289268068874127.65000000", // 24H Hashrate + "validNum": 0, // Effective quantity + "invalidNum": 17562, // Invalid quantity + "profitToday":{ // Today's estimate + "BTC":"0.00314332", + "BSV":"56.17055953", + "BCH":"106.61586001" + }, + "profitYesterday":{ // Yesterday's earnings + "BTC":"0.00314332", + "BSV":"56.17055953", + "BCH":"106.61586001" + }, + + "userName": "test", // Mining account + "unit": "h/s", // Hashrate unit + "algo": "sha256" // Algorithm + } +} +GET /sapi/v1/mining/statistics/user/status + +Weight(IP): 5 + +Parameter: + +Name Type Mandatory Description For Example +algo STRING YES Algorithm(sha256) sha256 +userName STRING YES Mining account test +recvWindow LONG NO +timestamp LONG YES +Account List (USER_DATA) +Response: + +{ + "code": 0, + "msg": "", + "data": [ + { + "type": "H_hashrate", //Type of hourly hashrate + "userName": "test", // Mining account + "list": [ + { + "time": 1585267200000, // Time + "hashrate": "0.00000000", // Hashrate + "reject": "0.00000000" //Rejection Rate + }, + { + "time": 1585353600000, + "hashrate": "0.00000000", + "reject": "0.00000000" + } + ] + }, + { + "type": "D_hashrate", //Type of daily hashrate + "userName": "test", // Mining account + "list": [ + { + "time": 1587906000000, // Time + "hashrate": "0.00000000", // Hashrate + "reject": "0.00000000" //Rejection Rate + }, + { + "time": 1587909600000, + "hashrate": "0.00000000", + "reject": "0.00000000" + } + ] + } + ] +} +GET /sapi/v1/mining/statistics/user/list + +Weight(IP): 5 + +Parameter: + +Name Type Mandatory Description For Example +algo STRING YES Algorithm(sha256) sha256 +userName STRING YES Mining account test +recvWindow LONG NO +timestamp LONG YES +Mining Account Earning (USER_DATA) +Response: + +{ + "code": 0, + "msg": "", + "data": { + "accountProfits": [ + { + "time": 1607443200000, + "coinName": "BTC", // Coin + "type": 2, // 0:Referral 1:Refund 2:Rebate + "puid": 59985472, //Sub-account id + "subName": "vdvaghani", //Mining account + "amount": 0.09186957 //Amount + } + ], + "totalNum": 3, // Total records + "pageSize": 20 // Size of one page + } +} +GET /sapi/v1/mining/payment/uid + +Weight(IP): 5 + +Parameter: + +Name Type Mandatory Description For Example +algo STRING YES Algorithm(sha256) sha256 +startDate Long NO Millisecond timestamp +endDate Long NO Millisecond timestamp +pageIndex INTEGER NO Default 1 +pageSize INTEGER NO Min 10,Max 200 +recvWindow LONG NO +timestamp LONG YES +Futures +New Future Account Transfer (USER_DATA) +Response: + +{ + "tranId": 100000001 //transaction id +} +POST /sapi/v1/futures/transfer + +Execute transfer between spot account and futures account. + +Weight(IP): 1 + +Parameters: + +Name Type Mandatory Description +asset STRING YES The asset being transferred, e.g., USDT +amount DECIMAL YES The amount to be transferred +type INT YES 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. +recvWindow LONG NO +timestamp LONG YES +You need to open Enable Futures permission for the API Key which requests this endpoint. +Get Future Account Transaction History List (USER_DATA) +Response: + +{ + "rows": [ + { + "asset": "USDT", + "tranId": 100000001, + "amount": "40.84624400", + "type": "1", // one of 1( from spot to USDT-Ⓜ), 2( from USDT-Ⓜ to spot), 3( from spot to COIN-Ⓜ), and 4( from COIN-Ⓜ to spot) + "timestamp": 1555056425000, + "status": "CONFIRMED" //one of PENDING (pending to execution), CONFIRMED (successfully transfered), FAILED (execution failed, nothing happened to your account); + } + ], + "total": 1 +} +GET /sapi/v1/futures/transfer + +Weight(IP): 10 + +Parameters: + +Name Type Mandatory Description +asset STRING NO +startTime LONG YES +endTime LONG NO +current LONG NO Currently querying page. Start from 1. Default:1 +size LONG NO Default:10 Max:100 +recvWindow LONG NO +timestamp LONG YES +Support query within the last 6 months only +Get Future TickLevel Orderbook Historical Data Download Link (USER_DATA) +Response: + +{ + "data": [ + { + "day": "2023-06-30", + "url": "https://bin-prod-user-rebate-bucket.s3.ap-northeast-1.amazonaws.com/future-data-symbol-update/2023-06-30/BTCUSDT_T_DEPTH_2023-06-30.tar.gz?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Date=20230925T025710Z&X-Amz-SignedHeaders=host&X-Amz-Expires=86399&X-Amz-Credential=AKIAVL364M5ZNFZ74IPP%2F20230925%2Fap-northeast-1%2Fs3%2Faws4_request&X-Amz-Signature=5fffcb390d10f34d71615726f81f99e42d80a11532edeac77b858c51a88cbf59" + } + ] +} +GET /sapi/v1/futures/histDataLink + +Weight(IP): 200 + +Parameters: + +Name Type Mandatory Description +symbol STRING YES symbol name, e.g. BTCUSDT or BTCUSD_PERP | +dataType ENUM YES T_DEPTH for ticklevel orderbook data, S_DEPTH for orderbook snapshot data +startTime LONG YES +endTime LONG YES +recvWindow LONG NO +timestamp LONG YES +The span between startTime and endTime can't be more than 7 days +The downloand link will be valid for 1 day +Only VIP user can query this endpoint +Futures Algo Endpoints +Binance Futures Execution Algorithm API solution aims to provide users ability to programmatically leverage Binance in-house algorithmic trading capability to automate order execution strategy, improve execution transparency and give users smart access to the available market liquidity. + +FAQ: Volume Participation(VP) Introduction + +FAQ: Time-Weighted Average Price(Twap) Introduction + +Volume Participation(VP) New Order (TRADE) +Response: + +{ + "clientAlgoId": "00358ce6a268403398bd34eaa36dffe7", + "success": true, + "code": 0, + "msg": "OK" +} +POST /sapi/v1/algo/futures/newOrderVp + +Send in a VP new order. Only support on USDⓈ-M Contracts. + +Weight(UID): 3000 + +Noted: + +You need to enable Futures Trading Permission for the api key which requests this endpoint. +Base URL: https://api.binance.com +Parameters: + +Name Type Mandatory Description +symbol STRING YES Trading symbol eg. BTCUSDT +side ENUM YES Trading side ( BUY or SELL ) +positionSide ENUM NO Default BOTH for One-way Mode ; LONG or SHORT for Hedge Mode. It must be sent in Hedge Mode. +quantity DECIMAL YES Quantity of base asset; The notional (quantity * mark price(base asset)) must be more than the equivalent of 1,000 USDT and less than the equivalent of 1,000,000 USDT +urgency ENUM YES Represent the relative speed of the current execution; ENUM: LOW, MEDIUM, HIGH +clientAlgoId STRING NO A unique id among Algo orders (length should be 32 characters), If it is not sent, we will give default value +reduceOnly BOOLEAN NO "true" or "false". Default "false"; Cannot be sent in Hedge Mode; Cannot be sent when you open a position +limitPrice DECIMAL NO Limit price of the order; If it is not sent, will place order by market price by default +recvWindow LONG NO +timestamp LONG YES +Other Info: + +Maximum number of active Algo Strategies is 20 +Leverage of symbols and position mode will be the same as your futures account settings. You can set up through the trading page or fapi. +Receiving "success": true does not mean that your order will be executed. Please use the query order endpoints(GET sapi/v1/algo/futures/openOrders or GET sapi/v1/algo/futures/historicalOrders) to check the order status. For example: Your futures balance is insufficient, or open position with reduce only or position side is inconsistent with your own setting. In these cases you will receive "success": true, but the order status will be expired after we check it. +Time-Weighted Average Price(Twap) New Order (TRADE) +Response: + +{ + "clientAlgoId": "65ce1630101a480b85915d7e11fd5078", + "success": true, + "code": 0, + "msg": "OK" +} +POST /sapi/v1/algo/futures/newOrderTwap + +Send in a Twap new order. Only support on USDⓈ-M Contracts. + +Weight(UID): 3000 + +Noted: + +You need to enable Futures Trading Permission for the api key which requests this endpoint. +Base URL: https://api.binance.com +Parameters: + +Name Type Mandatory Description +symbol STRING YES Trading symbol eg. BTCUSDT +side ENUM YES Trading side ( BUY or SELL ) +positionSide ENUM NO Default BOTH for One-way Mode ; LONG or SHORT for Hedge Mode. It must be sent in Hedge Mode. +quantity DECIMAL YES Quantity of base asset; The notional (quantity * mark price(base asset)) must be more than the equivalent of 1,000 USDT and less than the equivalent of 1,000,000 USDT +duration LONG YES Duration for TWAP orders in seconds. [300, 86400] +clientAlgoId STRING NO A unique id among Algo orders (length should be 32 characters), If it is not sent, we will give default value +reduceOnly BOOLEAN NO "true" or "false". Default "false"; Cannot be sent in Hedge Mode; Cannot be sent when you open a position +limitPrice DECIMAL NO Limit price of the order; If it is not sent, will place order by market price by default +recvWindow LONG NO +timestamp LONG YES +Other Info: + +Maximum number of active Algo Strategies is 20 +Leverage of symbols and position mode will be the same as your futures account settings. You can set up through the trading page or fapi. +Receiving "success": true does not mean that your order will be executed. Please use the query order endpoints(GET sapi/v1/algo/futures/openOrders or GET sapi/v1/algo/futures/historicalOrders) to check the order status. For example: Your futures balance is insufficient, or open position with reduce only or position side is inconsistent with your own setting. In these cases you will receive "success": true, but the order status will be expired after we check it. +quantity * 60 / duration should be larger than minQty +duration cannot be less than 5 mins or more than 24 hours. +For delivery contracts, TWAP end time should be one hour earlier than the delivery time of the symbol. +Cancel Algo Order (TRADE) +Response: + +{ + "algoId": 14511, + "success": true, + "code": 0, + "msg": "OK" +} +DELETE /sapi/v1/algo/futures/order + +Cancel an active order. + +Weight(IP): 1 + +Noted: + +You need to enable Futures Trading Permission for the api key which requests this endpoint. +Base URL: https://api.binance.com +Parameters: + +Name Type Mandatory Description +algoId LONG YES eg. 14511 +recvWindow LONG NO +timestamp LONG YES +Query Current Algo Open Orders (USER_DATA) +Response: + +{ + "total": 1, + "orders": [ + { + "algoId": 14517, + "symbol": "ETHUSDT", + "side": "SELL", + "positionSide": "SHORT", + "totalQty": "5.000", + "executedQty": "0.000", + "executedAmt": "0.00000000", + "avgPrice": "0.00", + "clientAlgoId": "d7096549481642f8a0bb69e9e2e31f2e", + "bookTime": 1649756817004, + "endTime": 0, + "algoStatus": "WORKING", + "algoType": "VP", + "urgency": "LOW" + } + ] +} +GET /sapi/v1/algo/futures/openOrders + +Weight(IP): 1 + +Noted: + +You need to enable Futures Trading Permission for the api key which requests this endpoint. +Base URL: https://api.binance.com +Parameters: + +Name Type Mandatory Description +recvWindow LONG NO +timestamp LONG YES +Query Historical Algo Orders (USER_DATA) +Response: + +{ + "total": 1, + "orders": [ + { + "algoId": 14518, + "symbol": "BNBUSDT", + "side": "BUY", + "positionSide": "BOTH", + "totalQty": "100.00", + "executedQty": "0.00", + "executedAmt": "0.00000000", + "avgPrice": "0.000", + "clientAlgoId": "acacab56b3c44bef9f6a8f8ebd2a8408", + "bookTime": 1649757019503, + "endTime": 1649757088101, + "algoStatus": "CANCELLED", + "algoType": "VP", + "urgency": "LOW" + } + ] +} +GET /sapi/v1/algo/futures/historicalOrders + +Weight(IP): 1 + +Noted: + +You need to enable Futures Trading Permission for the api key which requests this endpoint. +Base URL: https://api.binance.com +Parameters: + +Name Type Mandatory Description +symbol STRING NO Trading symbol eg. BTCUSDT +side ENUM NO BUY or SELL +startTime LONG NO in milliseconds eg.1641522717552 +endTime LONG NO in milliseconds eg.1641522526562 +page INT NO Default is 1 +pageSize INT NO MIN 1, MAX 100; Default 100 +recvWindow LONG NO +timestamp LONG YES +Query Sub Orders (USER_DATA) +Response: + +{ + "total": 1, + "executedQty": "1.000", + "executedAmt": "3229.44000000", + "subOrders": [ + { + "algoId": 13723, + "orderId": 8389765519993908929, + "orderStatus": "FILLED", + "executedQty": "1.000", + "executedAmt": "3229.44000000", + "feeAmt": "-1.61471999", + "feeAsset": "USDT", + "bookTime": 1649319001964, + "avgPrice": "3229.44", + "side": "SELL", + "symbol": "ETHUSDT", + "subId": 1, + "timeInForce": "IMMEDIATE_OR_CANCEL", + "origQty": "1.000" + } + ] +} +GET /sapi/v1/algo/futures/subOrders + +Get respective sub orders for a specified algoId + +Weight(IP): 1 + +Noted: + +You need to enable Futures Trading Permission for the api key which requests this endpoint. +Base URL: https://api.binance.com +Parameters: + +Name Type Mandatory Description +algoId LONG YES +page INT NO Default is 1 +pageSize INT NO MIN 1, MAX 100; Default 100 +recvWindow LONG NO +timestamp LONG YES +Spot Algo Endpoints +Binance Spot Execution Algorithm API solution aims to provide users ability to programmatically leverage Binance in-house algorithmic trading capability to automate order execution strategy, improve execution transparency and give users smart access to the available market liquidity. During the introductory period, there will be no additional fees for TWAP orders. Standard trading fees apply. Order size exceeds to maximum API supported size (100,000 USDT). Please contact liquidity@binance.com for larger sizes. + +Time-Weighted Average Price (Twap) New Order (TRADE) +Response: + +{ + "clientAlgoId": "65ce1630101a480b85915d7e11fd5078", + "success": true, + "code": 0, + "msg": "OK" +} +POST /sapi/v1/algo/spot/newOrderTwap + +Place a new spot TWAP order with Algo service. + +Weight(UID): 3000 + +Parameters: + +Name Type Mandatory Description +symbol STRING YES Trading symbol eg. BTCUSDT +side ENUM YES Trading side ( BUY or SELL ) +quantity DECIMAL YES Quantity of base asset; The notional (quantity * last price(base asset)) must be more than the equivalent of 1,000 USDT and less than the equivalent of 100,000 USDT +duration LONG YES Duration for TWAP orders in seconds. [300, 86400] +clientAlgoId STRING NO A unique id among Algo orders (length should be 32 characters), If it is not sent, we will give default value +limitPrice DECIMAL NO Limit price of the order; If it is not sent, will place order by market price by default +stpMode ENUM NO The allowed enums is dependent on what is configured on the symbol. The possible supported values are EXPIRE_TAKER, EXPIRE_MAKER, EXPIRE_BOTH, NONE +recvWindow LONG NO +timestamp LONG YES +Other Info: + +Maximum number of active Algo Strategies is 20 +Cancel Algo Order (TRADE) +Response: + +{ + "algoId": 14511, + "success": true, + "code": 0, + "msg": "OK" +} +DELETE /sapi/v1/algo/spot/order + +Cancel an open TWAP order + +Weight(IP): 1 + +Parameters: + +Name Type Mandatory Description +algoId LONG YES eg. 14511 +recvWindow LONG NO +timestamp LONG YES +Query Current Algo Open Orders (USER_DATA) +Response: + +{ + "total": 1, + "orders": [ + { + "algoId": 14517, + "symbol": "ETHUSDT", + "side": "SELL", + "totalQty": "5.000", + "executedQty": "0.000", + "executedAmt": "0.00000000", + "avgPrice": "0.00", + "clientAlgoId": "d7096549481642f8a0bb69e9e2e31f2e", + "bookTime": 1649756817004, + "endTime": 0, + "algoStatus": "WORKING", + "algoType": "TWAP", + "urgency": "LOW" + } + ] +} +GET /sapi/v1/algo/spot/openOrders + +Weight(IP): 1 + +Get all open SPOT TWAP orders + +Parameters: + +Name Type Mandatory Description +recvWindow LONG NO +timestamp LONG YES +Query Historical Algo Orders (USER_DATA) +Response: + +{ + "total": 1, + "orders": [ + { + "algoId": 14518, + "symbol": "BNBUSDT", + "side": "BUY", + "totalQty": "100.00", + "executedQty": "0.00", + "executedAmt": "0.00000000", + "avgPrice": "0.000", + "clientAlgoId": "acacab56b3c44bef9f6a8f8ebd2a8408", + "bookTime": 1649757019503, + "endTime": 1649757088101, + "algoStatus": "CANCELLED", + "algoType": "VP", + "urgency": "LOW" + } + ] +} +GET /sapi/v1/algo/spot/historicalOrders + +Weight(IP): 1 + +Get all historical SPOT TWAP orders + +Parameters: + +Name Type Mandatory Description +symbol STRING NO Trading symbol eg. BTCUSDT +side ENUM NO BUY or SELL +startTime LONG NO in milliseconds eg.1641522717552 +endTime LONG NO in milliseconds eg.1641522526562 +page INT NO Default is 1 +pageSize INT NO MIN 1, MAX 100; Default 100 +recvWindow LONG NO +timestamp LONG YES +Query Sub Orders (USER_DATA) +Response: + +{ + "total": 1, + "executedQty": "1.000", + "executedAmt": "3229.44000000", + "subOrders": [ + { + "algoId": 13723, + "orderId": 8389765519993908929, + "orderStatus": "FILLED", + "executedQty": "1.000", + "executedAmt": "3229.44000000", + "feeAmt": "-1.61471999", + "feeAsset": "USDT", + "bookTime": 1649319001964, + "avgPrice": "3229.44", + "side": "SELL", + "symbol": "ETHUSDT", + "subId": 1, + "timeInForce": "IMMEDIATE_OR_CANCEL", + "origQty": "1.000" + } + ] +} +GET /sapi/v1/algo/spot/subOrders + +Get respective sub orders for a specified algoId + +Weight(IP): 1 + +Parameters: + +Name Type Mandatory Description +algoId LONG YES +page INT NO Default is 1 +pageSize INT NO MIN 1, MAX 100; Default 100 +recvWindow LONG NO +timestamp LONG YES +Portfolio Margin Pro Endpoints +The Binance Portfolio Margin Pro Program is a cross-asset margin program supporting consolidated margin balance across trading products with over 200+ effective crypto collaterals. It is designed for professional traders, market makers, and institutional users looking to actively trade & hedge cross-asset and optimize risk-management in a consolidated setup. + +FAQ: Portfolio Margin Pro Program + +Only Portfolio Margin Pro Account is accessible to these endpoints. To enroll, kindly refer to: How to Enroll into the Binance Portfolio Margin Program + +Get Portfolio Margin Pro Account Info (USER_DATA) +Response: + +{ + "uniMMR": "5167.92171923", // Portfolio Margin Pro account maintenance margin rate + "accountEquity": "122607.35137903", // Account equity, unit:USD + "actualEquity": "142607.35137903", // Actual equity, unit:USD + "accountMaintMargin": "23.72469206", // Portfolio Margin Pro account maintenance margin, unit:USD + "accountStatus": "NORMAL", // Portfolio Margin Pro account status:"NORMAL", "MARGIN_CALL", "SUPPLY_MARGIN", "REDUCE_ONLY", "ACTIVE_LIQUIDATION", "FORCE_LIQUIDATION", "BANKRUPTED" + "accountType": "PM_1" //PM_1 for PM Pro, PM_2 for PM ,PM_3 for PM Pro(SPAN) +} +GET /sapi/v1/portfolio/account + +Weight(IP): 5 + +Parameters: + +Name Type Mandatory Description +recvWindow LONG NO +timestamp LONG YES +Portfolio Margin Pro Collateral Rate (MARKET_DATA) +Response: + +[ + { + "asset": "USDC", + "collateralRate": "1.0000" + }, + { + "asset": "BUSD", + "collateralRate": "1.0000" + }, +] +GET /sapi/v1/portfolio/collateralRate + +Portfolio Margin Pro Collateral Rate + +Weight(IP): 50 + +Parameters: None + +Query Portfolio Margin Pro Bankruptcy Loan Amount (USER_DATA) +Response: + +{ + "asset": "BUSD", + "amount": "579.45", // portfolio margin bankruptcy loan amount in BUSD +} +GET /sapi/v1/portfolio/pmLoan + +Query Portfolio Margin Pro Bankruptcy Loan Amount + +Weight(UID): 500 + +Parameters: + +Name Type Mandatory Description +recvWindow LONG NO +timestamp LONG YES +If there’s no Portfolio Margin Pro bankruptcy loan, the amount would be 0 +Portfolio Margin Pro Bankruptcy Loan Repay +Response: + +{ + "tranId": 58203331886213504 +} +POST /sapi/v1/portfolio/repay + +Repay Portfolio Margin Pro Bankruptcy Loan + +Weight(UID): 3000 + +Parameters: + +Name Type Mandatory Description +from STRING NO SPOT or MARGIN,default SPOT +recvWindow LONG NO +timestamp LONG YES +Query Portfolio Margin Pro Negative Balance Interest History(USER_DATA) +Response: + +[ + { + "asset": "USDT", + "interest": "24.4440", //interest amount + "interestAccruedTime": 1670227200000, + "interestRate": "0.0001164", //daily interest rate + "principal": "210000" + } +] +GET /sapi/v1/portfolio/interest-history + +Query interest history of negative balance for portfolio margin. + +Weight(IP): 50 + +Parameters: + +Name Type Mandatory Description +asset STRING NO +startTime LONG NO +endTime LONG NO +size LONG NO Default:10 Max:100 +recvWindow LONG NO +timestamp LONG YES +Query Portfolio Margin Asset Index Price (MARKET_DATA) +Response: + +[ + { + "asset": "BTC", + "assetIndexPrice": "28251.9136906", // in USD + "time": 1683518338121 + } +] +GET /sapi/v1/portfolio/asset-index-price + +Query Portfolio Margin Asset Index Price + +Weight(IP): + +1 if send asset or 50 if not send asset + +Parameters: + +Name Type Mandatory Description +asset STRING NO +Fund Auto-collection (USER_DATA) +Response: + +{ + "msg": "success" +} +POST /sapi/v1/portfolio/auto-collection + +Transfers all assets from Futures Account to Margin account + +Weight(IP): + +1500 + +Parameters: + +Name Type Mandatory Description +recvWindow LONG NO +timestamp LONG YES +The BNB would not be collected from UM-PM account to the Portfolio Margin account. +You can only use this function 500 times per hour in a rolling manner. +Fund Collection by Asset(USER_DATA) +Response: + +{ + "msg": "success" +} +POST /sapi/v1/portfolio/asset-collection + +Transfers specific asset from Futures Account to Margin account + +Weight(IP): + +60 + +Parameters: + +Name Type Mandatory Description +asset STRING YES +recvWindow LONG NO +timestamp LONG YES +The BNB transfer is not be supported +BNB transfer(USER_DATA) +Response: + +{ + "tranId": 100000001 +} +POST /sapi/v1/portfolio/bnb-transfer + +BNB transfer can be between Margin Account and USDM Account + +Weight(IP): + +1500 + +Parameters: + +Name Type Mandatory Description +amount DECIMAL YES +transferSide STRING YES "TO_UM","FROM_UM" +recvWindow LONG NO +timestamp LONG YES +You can only use this function 2 times per 10 minutes in a rolling manner +Change Auto-repay-futures Status (TRADE) +Response: + +{ + "msg": "success" +} +POST /sapi/v1/portfolio/repay-futures-switch + +Change Auto-repay-futures Status + +Weight(IP): + +1500 + +Parameters: + +Name Type Mandatory Description +autoRepay STRING YES Default: true; false for turn off the auto-repay futures negative balance function +recvWindow LONG NO +timestamp LONG YES +Get Auto-repay-futures Status (USER_DATA) +Response: + +{ + "autoRepay": true // "true" for turn on the auto-repay futures; "false" for turn off the auto-repay futures +} +GET /sapi/v1/portfolio/repay-futures-switch + +Query Auto-repay-futures Status + +Weight(IP): + +30 + +Parameters: + +Name Type Mandatory Description +recvWindow LONG NO +timestamp LONG YES +Repay futures Negative Balance (USER_DATA) +Response: + +{ + "msg": "success" +} +POST /sapi/v1/portfolio/repay-futures-negative-balance + +Repay futures Negative Balance + +Weight(IP): + +1500 + +Parameters: + +Name Type Mandatory Description +recvWindow LONG NO +timestamp LONG YES +Get Portfolio Margin Asset Leverage (USER_DATA) +Response: + +[ + { + "asset": "USDC", + "leverage": 10 + }, + { + "asset": "USDT", + "leverage": 10 + } +] +GET /sapi/v1/portfolio/margin-asset-leverage + +Weight(IP): + +50 + +Fiat Endpoints +Get Fiat Deposit/Withdraw History (USER_DATA) +Response: + +{ + "code": "000000", + "message": "success", + "data": [ + { + "orderNo":"7d76d611-0568-4f43-afb6-24cac7767365", + "fiatCurrency": "BRL", + "indicatedAmount": "10.00", + "amount": "10.00", + "totalFee": "0.00", // Trade fee + "method": "BankAccount", // Trade method + "status": "Expired", // Processing, Failed, Successful, Finished, Refunding, Refunded, Refund Failed, Order Partial credit Stopped + "createTime": 1626144956000, + "updateTime": 1626400907000 + } + ], + "total": 1, + "success": true +} +GET /sapi/v1/fiat/orders + +Weight(UID): 90000 + +Parameters: + +Name Type Mandatory Description +transactionType STRING YES 0-deposit,1-withdraw +beginTime LONG NO +endTime LONG NO +page INT NO default 1 +rows INT NO default 100, max 500 +recvWindow LONG NO +timestamp LONG YES +If beginTime and endTime are not sent, the recent 30-day data will be returned. +Get Fiat Payments History (USER_DATA) +Response: + +{ + "code": "000000", + "message": "success", + "data": [ + { + "orderNo": "353fca443f06466db0c4dc89f94f027a", + "sourceAmount": "20.0", // Fiat trade amount + "fiatCurrency": "EUR", // Fiat token + "obtainAmount": "4.462", // Crypto trade amount + "cryptoCurrency": "LUNA", // Crypto token + "totalFee": "0.2", // Trade fee + "price": "4.437472", + "status": "Failed", // Processing, Completed, Failed, Refunded + "paymentMethod": "Credit Card", + "createTime": 1624529919000, + "updateTime": 1624529919000 + } + ], + "total": 1, + "success": true +} +GET /sapi/v1/fiat/payments + +Weight(IP): 1 + +Parameters: + +Name Type Mandatory Description +transactionType STRING YES 0-buy,1-sell +beginTime LONG NO +endTime LONG NO +page INT NO default 1 +rows INT NO default 100, max 500 +recvWindow LONG NO +timestamp LONG YES +If beginTime and endTime are not sent, the recent 30-day data will be returned. +paymentMethod: Only when requesting payments history for buy (transactionType=0), response contains paymentMethod representing the way of purchase. Now we have: +Cash Balance +Credit Card +Online Banking +Bank Transfer +C2C Endpoints +Get C2C Trade History (USER_DATA) +Response: + +{ + "code": "000000", + "message": "success", + "data": [ + { + "orderNumber":"20219644646554779648", + "advNo": "11218246497340923904", + "tradeType": "SELL", + "asset": "BUSD", + "fiat": "CNY", + "fiatSymbol": "¥", + "amount": "5000.00000000", // Quantity (in Crypto) + "totalPrice": "33400.00000000", + "unitPrice": "6.68", // Unit Price (in Fiat) + "orderStatus": "COMPLETED", // PENDING, TRADING, BUYER_PAYED, DISTRIBUTING, COMPLETED, IN_APPEAL, CANCELLED, CANCELLED_BY_SYSTEM + "createTime": 1619361369000, + "commission": "0", // Transaction Fee (in Crypto) + "counterPartNickName": "ab***", + "advertisementRole": "TAKER" + } + ], + "total": 1, + "success": true +} +GET /sapi/v1/c2c/orderMatch/listUserOrderHistory + +Weight(IP): 1 + +Parameters: + +Name Type Mandatory Description +tradeType STRING YES BUY, SELL +startTimestamp LONG NO +endTimestamp LONG NO +page INT NO default 1 +rows INT NO default 100, max 100 +recvWindow LONG NO +timestamp LONG YES +If startTimestamp and endTimestamp are not sent, the recent 30-day data will be returned. +The max interval between startTimestamp and endTimestamp is 30 days. +Only the last 6 months of data can be retrieved. To view the complete P2P order history, you can download it from https://c2c.binance.com/en/fiatOrder +VIP Loans Endpoints +Get VIP Loan Ongoing Orders (USER_DATA) +Response: + +{ + "rows": [ + { + "orderId": 100000001, + "loanCoin": "BUSD", + "totalDebt": "10000", + "loanRate": "0.0123", // "flexible rate" for flexible rate loan + "residualInterest": "10.27687923", + "collateralAccountId": "12345678,23456789", + "collateralCoin": "BNB,BTC,ETH", + "totalCollateralValueAfterHaircut": "25000.27565492", + "lockedCollateralValue": "25000.27565492", + "currentLTV": "0.57", + "expirationTime": 1575018510000, + "loanDate": "1676851200000", + "loanTerm": "30days", // "open term" for open term loan + "expirationTime": 1575018510000 or 0, // 0 means open term + "initialLtv": "72%", + "marginCallLtv": "77%", + "liquidationLtv": "91%" + } + ], + "total": 1 +} +GET /sapi/v1/loan/vip/ongoing/orders + +VIP loan is available for VIP users only. + +Weight(IP): 400 + +Parameters: + +Name Type Mandatory Description +orderId LONG NO +collateralAccountId LONG NO +loanCoin STRING NO +collateralCoin STRING NO +current LONG NO Currently querying page. Start from 1, Default:1, Max: 1000. +limit LONG NO Default: 10, Max: 100 +recvWindow LONG NO +timestamp LONG YES +VIP Loan Repay (TRADE) +Response: + +{ + "loanCoin": "BUSD", + "repayAmount": "200.5", + "remainingPrincipal": "100.5", + "remainingInterest": "0", + "collateralCoin": "BNB,BTC,ETH", + "currentLTV": "0.25", + "repayStatus": "Repaid" // Repaid, Repaying, Failed +} +POST /sapi/v1/loan/vip/repay + +VIP loan is available for VIP users only. + +Weight(UID): 6000 + +Parameters: + +Name Type Mandatory Description +orderId LONG YES +amount DECIMAL YES +recvWindow LONG NO +timestamp LONG YES +Get VIP Loan Repayment History (USER_DATA) +Response: + +{ + "rows": [ + { + "loanCoin": "BUSD", + "repayAmount": "10000", + "collateralCoin": "BNB,BTC,ETH", + "repayStatus": "Repaid", // Repaid, Repaying, Failed + "loanDate": "1676851200000", + "repayTime": "1575018510000", + "orderId": "756783308056935434" + } + ], + "total": 1 +} +GET /sapi/v1/loan/vip/repay/history + +VIP loan is available for VIP users only. + +Weight(IP): 400 + +Parameters: + +Name Type Mandatory Description +orderId LONG NO +loanCoin STRING NO +startTime LONG NO +endTime LONG NO +current LONG NO Currently querying page. Start from 1, Default:1, Max: 1000 +limit LONG NO Default: 10, Max: 100 +recvWindow LONG NO +timestamp LONG YES +If startTime and endTime are not sent, the recent 90-day data will be returned +The max interval between startTime and end Time is 180 days. +VIP Loan Renew (TRADE) +Response: + +{ + "loanAccountId": "12345678", //loan receiving account + "loanCoin": "BTC", + "loanAmount": "100.55", + "collateralAccountId": "12345677,12345678,12345679", + "collateralCoin": "BUSD,USDT,ETH", + "loanTerm": "30", +} +POST /sapi/v1/loan/vip/renew + +VIP loan is available for VIP users only. + +Weight(UID): 6000 + +Parameters: + +Name Type Mandatory Description +orderId LONG YES +loanTerm INT NO 30/60 days +recvWindow LONG NO +timestamp LONG YES +Check Locked Value of VIP Collateral Account (USER_DATA) +Response: + +{ + "rows": [ + { + "collateralAccountId": "12345678", + "collateralCoin": "BNB,BTC,ETH", + } + ], + [ + { + "collateralAccountId": "23456789", + "collateralCoin": "BNB,BTC,ETH", + } + ], + "total": 2 +} +GET /sapi/v1/loan/vip/collateral/account + +VIP loan is available for VIP users only. + +Weight(IP): 6000 + +Parameters: + +Name Type Mandatory Description +orderId LONG NO +collateralAccountId LONG NO +recvWindow LONG NO +timestamp LONG YES +If the login account is loan account, all collateral accounts under the loan account can be queried. +If the login account is collateral account, only the current collateral account can be queried. +VIP Loan Borrow (TRADE) +Response: + +{ + "loanAccountId": "12345678", //loan receiving account + "requestId": "12345678", + "loanCoin": "BTC", + "isFlexibleRate": "No", + "loanAmount": "100.55", + "collateralAccountId": "12345678,12345678,12345678", + "collateralCoin": "BUSD,USDT,ETH", + "loanTerm": "30" +} +or + +{ + "loanAccountId": "12345678", //loan receiving account + "requestId": "12345678", + "loanCoin": "BTC", + "isFlexibleRate": "Yes", + "loanAmount": "100.55", + "collateralAccountId": "12345678,12345678,12345678", + "collateralCoin": "BUSD,USDT,ETH" +} +POST /sapi/v1/loan/vip/borrow + +VIP loan is available for VIP users only. + +Weight(UID): 6000 + +Request Limit: 1 time/2 seconds per UID + +Parameters: + +Name Type Mandatory Description +loanAccountId LONG YES +loanCoin STRING YES +loanAmount DECIMAL YES +collateralAccountId STRING YES Multiple split by , +collateralCoin STRING YES Multiple split by , +isFlexibleRate BOOLEAN YES Default: TRUE. TRUE : flexible rate; FALSE: fixed rate +loanTerm INT NO Mandatory for fixed rate. Optional for fixed interest rate. Eg: 30/60 days +recvWindow LONG NO +timestamp LONG YES +loanAccountId refer to loan receiving account +Only master account applications are supported +loanAccountId and collateralAccountId under same master account +loanTerm is mandatory if user choose stable rate +Get Loanable Assets Data (USER_DATA) +Response: + +{ + "rows": [ + { + "loanCoin": "BUSD", + "_flexibleHourlyInterestRate": "0.000103", + "_flexibleYearlyInterestRate": "0.548595", + "_30dDailyInterestRate": "0.000136", + "_30dYearlyInterestRate": "0.03450", + "_60dDailyInterestRate": "0.000145", + "_60dYearlyInterestRate": "0.04103", + "minLimit": "100" + "maxLimit": "1000000" + "vipLevel": 1 + } + ], + "total": 1 +} +GET /sapi/v1/loan/vip/loanable/data + +Get interest rate and borrow limit of loanable assets. The borrow limit is shown in USD value. + +Weight(IP): 400 + +Parameters: + +Name Type Mandatory Description +loanCoin STRING NO +vipLevel INT NO default:user's vip level +recvWindow LONG NO +timestamp LONG YES +Get Collateral Asset Data (USER_DATA) +Response: + +{ + "rows": [ + { + "collateralCoin": "BUSD", + "_1stCollateralRatio": "100%", + "_1stCollateralRange": "1-10000000", + "_2ndCollateralRatio": "80%", + "_2ndCollateralRange": "10000000-100000000", + "_3rdCollateralRatio": "60%", + "_3rdCollateralRange": "100000000-1000000000", + "_4thCollateralRatio": "0%", + "_4thCollateralRange": ">10000000000", + } + ], + "total": 1 +} +GET /sapi/v1/loan/vip/collateral/data + +Get Collateral Asset Data + +Weight(IP): 400 + +Parameters: + +Name Type Mandatory Description +collateralCoin STRING NO +recvWindow LONG NO +timestamp LONG YES +Query Application Status (USER_DATA) +Response: + +{ + "rows": [ + { + "loanAccountId": "12345678", //loan receiving account + "orderId": "12345678", + "requestId": "12345678", + "loanCoin": "BTC", + "loanAmount": "100.55", + "collateralAccountId": "12345678,12345678,12345678", + "collateralCoin": "BUSD,USDT,ETH", + "loanTerm": "30", + "status": "Repaid", // Accruing_Interest, Overdue, Liquidating, Repaying, Repaid, Liquidated, Pending, Failed + "loanDate":"1676851200000" + } + ], + "total": 1 +} +GET /sapi/v1/loan/vip/request/data + +Weight(UID): 400 + +Request Limit: 1 time/second per UID + +Parameters: + +Name Type Mandatory Description +current LONG NO Currently querying page. Start from 1, Default:1, Max: 1000 +limit LONG NO Default: 10, Max: 100 +recvWindow LONG NO +timestamp LONG YES +Get Borrow Interest Rate (USER_DATA) +Response: + +[ + { + "asset": "BUSD", + "flexibleDailyInterestRate": "0.001503", + "flexibleYearlyInterestRate": "0.548595", + "time": 1577233578000 + }, + + { + "asset": "BTC", + "flexibleDailyInterestRate": "0.001503", + "flexibleYearlyInterestRate": "0.548595", + "time": 1577233562000 + } +] +GET /sapi/v1/loan/vip/request/interestRate + +Weight(UID): 400 + +Parameters: + +Name Type Mandatory Description +loanCoin STRING YES Max 10 assets, Multiple split by "," +recvWindow LONG NO +timestamp LONG YES +Crypto Loans Endpoints +Get Crypto Loans Income History (USER_DATA) +Response: + +[ + { + "asset": "BUSD", + "type": "borrowIn", + "amount": "100", + "timestamp": 1633771139847, + "tranId": "80423589583" + }, + { + "asset": "BUSD", + "type": "borrowIn", + "amount": "100", + "timestamp": 1634638371496, + "tranId": "81685123491" + } + ] + +GET /sapi/v1/loan/income + +Weight(UID): 6000 + +Parameters: + +Name Type Mandatory Description +asset STRING NO +type STRING NO All types will be returned by default. Enum:borrowIn ,collateralSpent, repayAmount, collateralReturn(Collateral return after repayment), addCollateral, removeCollateral, collateralReturnAfterLiquidation +startTime LONG NO +endTime LONG NO +limit INT NO default 20, max 100 +recvWindow LONG NO +timestamp LONG YES +If startTime and endTime are not sent, the recent 7-day data will be returned. +The max interval between startTime and endTime is 30 days. +Borrow - Crypto Loan Borrow (TRADE) +Response: + +{ + "loanCoin": "BUSD", + "loanAmount": "100.5", + "collateralCoin": "BNB", + "collateralAmount": "50.5", + "hourlyInterestRate": "0.001234", + "orderId": "100000001" +} +POST /sapi/v1/loan/borrow + +Weight(UID): 36000 + +Request Limit: 1 time/second per UID + +Parameters: + +Name Type Mandatory Description +loanCoin STRING YES +loanAmount DECIMAL NO Mandatory when collateralAmount is empty +collateralCoin STRING YES +collateralAmount DECIMAL NO Mandatory when loanAmount is empty +loanTerm INT YES 7/30 days +recvWindow LONG NO +timestamp LONG YES +Borrow - Get Loan Borrow History (USER_DATA) +Response: + +{ + "rows": [ + { + "orderId": 100000001, + "loanCoin": "BUSD", + "initialLoanAmount": "10000", + "hourlyInterestRate": "0.000057" + "loanTerm": "7" + "collateralCoin": "BNB", + "initialCollateralAmount": "49.27565492" + "borrowTime": 1575018510000 + "status": "Repaid" // Accruing_Interest, Overdue, Liquidating, Repaying, Repaid, Liquidated, Pending, Failed + } + ], + "total": 1 +} +GET /sapi/v1/loan/borrow/history + +Weight(IP): 400 + +Parameters: + +Name Type Mandatory Description +orderId LONG NO orderId in POST /sapi/v1/loan/borrow +loanCoin STRING NO +collateralCoin STRING NO +startTime LONG NO +endTime LONG NO +current LONG NO Current querying page. Start from 1; default: 1; max: 1000. +limit LONG NO Default: 10; max: 100. +recvWindow LONG NO +timestamp LONG YES +If startTime and endTime are not sent, the recent 90-day data will be returned. +The max interval between startTime and endTime is 180 days. +Borrow - Get Loan Ongoing Orders (USER_DATA) +Response: + +{ + "rows": [ + { + "orderId": 100000001, + "loanCoin": "BUSD", + "totalDebt": "10000", + "residualInterest":"10.27687923" + "collateralCoin": "BNB", + "collateralAmount": "49.27565492" + "currentLTV": "0.57" + "expirationTime": 1575018510000 + } + ], + "total": 1 +} +GET /sapi/v1/loan/ongoing/orders + +Weight(IP): 300 + +Parameters: + +Name Type Mandatory Description +orderId LONG NO orderId in POST /sapi/v1/loan/borrow +loanCoin STRING NO +collateralCoin STRING NO +current LONG NO Current querying page. Start from 1; default: 1; max: 1000 +limit LONG NO Default: 10; max: 100 +recvWindow LONG NO +timestamp LONG YES +Repay - Crypto Loan Repay (TRADE) +Response: + +{ + "loanCoin": "BUSD" + "remainingPrincipal": "100.5" + "remainingInterest": "0" + "collateralCoin": "BNB" + "remainingCollateral": "5.253" + "currentLTV": "0.25" + "repayStatus": "Repaid" // Repaid, Repaying +} + +or + +{ + "loanCoin": "BUSD" + "collateralCoin": "BNB" + "repayStatus": "Repaying" // Repaid, Repaying +} +POST /sapi/v1/loan/repay + +Weight(UID): 6000 + +Parameters: + +Name Type Mandatory Description +orderId LONG YES +amount DECIMAL YES +type INT NO Default: 1. 1 for "repay with borrowed coin"; 2 for "repay with collateral". +collateralReturn BOOLEAN NO Default: TRUE. TRUE: Return extra collateral to spot account; FALSE: Keep extra collateral in the order. +recvWindow LONG NO +timestamp LONG YES +Repay - Get Loan Repayment History (USER_DATA) +Response: + +{ + "rows": [ + { + "loanCoin": "BUSD", + "repayAmount": "10000", + "collateralCoin": "BNB", + "collateralUsed": "0" + "collateralReturn": "49.27565492" + "repayType": "1" // 1 for "repay with borrowed coin", 2 for "repay with collateral" + "repayStatus": "Repaid" // Repaid, Repaying, Failed + "repayTime": 1575018510000 + "orderId": 756783308056935434 + } + ], + "total": 1 +} +GET /sapi/v1/loan/repay/history + +Weight(IP): 400 + +Parameters: + +Name Type Mandatory Description +orderId LONG NO +loanCoin STRING NO +collateralCoin STRING NO +startTime LONG NO +endTime LONG NO +current LONG NO Current querying page. Start from 1; default: 1; max: 1000 +limit LONG NO Default: 10; max: 100 +recvWindow LONG NO +timestamp LONG YES +If startTime and endTime are not sent, the recent 90-day data will be returned. +The max interval between startTime and endTime is 180 days. +Adjust LTV - Crypto Loan Adjust LTV (TRADE) +Response: + +{ + "loanCoin": "BUSD", + "collateralCoin": "BNB", + "direction": "ADDITIONAL", + "amount": "5.235", + "currentLTV": "0.52" +} +POST /sapi/v1/loan/adjust/ltv + +Weight(UID): 6000 + +Parameters: + +Name Type Mandatory Description +orderId LONG YES +amount DECIMAL YES +direction ENUM YES "ADDITIONAL", "REDUCED" +recvWindow LONG NO +timestamp LONG YES +Adjust LTV - Get Loan LTV Adjustment History (USER_DATA) +Response: + +{ + "rows": [ + { + "loanCoin": "BUSD", + "collateralCoin": "BNB", + "direction": "ADDITIONAL", + "amount": "5.235", + "preLTV": "0.78", + "afterLTV": "0.56", + "adjustTime": 1575018510000, + "orderId": 756783308056935434 + } + ], + "total": 1 +} +GET /sapi/v1/loan/ltv/adjustment/history + +Weight(IP): 400 + +Parameters: + +Name Type Mandatory Description +orderId LONG NO +loanCoin STRING NO +collateralCoin STRING NO +startTime LONG NO +endTime LONG NO +current LONG NO Current querying page. Start from 1; default: 1; max: 1000 +limit LONG NO Default: 10; max: 100 +recvWindow LONG NO +timestamp LONG YES +If startTime and endTime are not sent, the recent 90-day data will be returned. +The max interval between startTime and endTime is 180 days. +Get Loanable Assets Data (USER_DATA) +Response: + +{ + "rows": [ + { + "loanCoin": "BUSD", + "_7dHourlyInterestRate": "0.00000491", + "_7dDailyInterestRate": "0.000118", + "_14dHourlyInterestRate": "0.00000491", + "_14dDailyInterestRate": "0.000118", + "_30dHourlyInterestRate": "0.00000567", + "_30dDailyInterestRate": "0.000136", + "_90dHourlyInterestRate": "0.00000596", + "_90dDailyInterestRate": "0.000143", + "_180dHourlyInterestRate": "0.00000631", + "_180dDailyInterestRate": "0.000151", + "minLimit": "100" + "maxLimit": "1000000" + "vipLevel": 1 + } + ], + "total": 1 +} +GET /sapi/v1/loan/loanable/data + +Get interest rate and borrow limit of loanable assets. The borrow limit is shown in USD value. + +Weight(IP): 400 + +Request Limit: 1 time/2 seconds per UID + +Parameters: + +Name Type Mandatory Description +loanCoin STRING NO +vipLevel INT NO Default: user's vip level. Send "-1" to check specified configuration +recvWindow LONG NO +timestamp LONG YES +Get Collateral Assets Data (USER_DATA) +Response: + +{ + "rows": [ + { + "collateralCoin": "BNB", + "initialLTV": "0.65", + "marginCallLTV": "0.75", + "liquidationLTV": "0.83", + "maxLimit": "1000000" + "vipLevel": 1 + } + ], + "total": 1 +} +GET /sapi/v1/loan/collateral/data + +Get LTV information and collateral limit of collateral assets. The collateral limit is shown in USD value. + +Weight(IP): 400 + +Request Limit: 1 time/2 seconds per UID + +Parameters: + +Name Type Mandatory Description +collateralCoin STRING NO +vipLevel INT NO Default: user's vip level. Send "-1" to check specified configuration +recvWindow LONG NO +timestamp LONG YES +Check Collateral Repay Rate (USER_DATA) +Response: + +{ + "loanlCoin": "BUSD", + "collateralCoin": "BNB", + "repayAmount": "1000", + "rate": "300.36781234" // rate of collateral coin/loan coin +} +GET /sapi/v1/loan/repay/collateral/rate + +Get the the rate of collateral coin / loan coin when using collateral repay, the rate will be valid within 8 second. + +Weight(IP): 6000 + +Parameters: + +Name Type Mandatory Description +loanCoin STRING YES +collateralCoin STRING YES +repayAmount DECIMAL YES repay amount of loanCoin +recvWindow LONG NO +timestamp LONG YES +Crypto Loan Customize Margin Call (TRADE) +Response: + +{ + "rows": [ + { + "orderId": "100000001" + "collateralCoin": "BNB" + "preMarginCall": "0.8" + "afterMarginCall": "0.7" + "customizeTime": 1575018510000 + } + ], + "total": 1 +} +POST /sapi/v1/loan/customize/margin_call + +Customize margin call for ongoing orders only. + +Weight(UID): 6000 + +Parameters: + +Name Type Mandatory Description +orderId LONG NO Mandatory when collateralCoin is empty. Send either orderId or collateralCoin, if both parameters are sent, take orderId only. +collateralCoin STRING NO Mandatory when orderID is empty. Send either orderId or collateralCoin, if both parameters are sent, take orderId only. +marginCall DECIMAL YES +recvWindow LONG NO +timestamp LONG YES +Borrow - Flexible Loan Borrow (TRADE) +Response: + +{ + "loanCoin": "BUSD", + "loanAmount": "100.5", + "collateralCoin": "BNB", + "collateralAmount": "50.5", + "status": "Succeeds" //Succeeds, Failed, Processing +} +POST /sapi/v1/loan/flexible/borrow (deprecated) + +Please switch to: + +POST /sapi/v2/loan/flexible/borrow + +Weight(UID): 6000 + +Request Limit: 1 time/2 seconds per UID + +Parameters: + +Name Type Mandatory Description +loanCoin STRING YES +loanAmount DECIMAL NO Mandatory when collateralAmount is empty +collateralCoin STRING YES +collateralAmount DECIMAL NO Mandatory when loanAmount is empty +recvWindow LONG NO +timestamp LONG YES +Only available for master account +Borrow - Get Flexible Loan Ongoing Orders (USER_DATA) +Response: + +{ + "rows": [ + { + "loanCoin": "BUSD", + "totalDebt": "10000", + "collateralCoin": "BNB", + "collateralAmount": "49.27565492", + "currentLTV": "0.57" + } + ], + "total": 1 +} +GET /sapi/v1/loan/flexible/ongoing/orders (To be deprecated) + +Please switch to: + +GET /sapi/v2/loan/flexible/ongoing/orders + +Weight(IP): 300 + +Parameters: + +Name Type Mandatory Description +loanCoin STRING NO +collateralCoin STRING NO +current LONG NO Current querying page. Start from 1; default: 1; max: 1000 +limit LONG NO Default: 10; max: 100 +recvWindow LONG NO +timestamp LONG YES +Borrow - Get Flexible Loan Borrow History (USER_DATA) +Response: + +{ + "rows": [ + { + "loanCoin": "BUSD", + "initialLoanAmount": "10000", + "collateralCoin": "BNB", + "initialCollateralAmount": "49.27565492", + "borrowTime": 1575018510000, + "status": "Succeeds" //Succeeds, Failed, Processing + } + ], + "total": 1 +} +GET /sapi/v1/loan/flexible/borrow/history (To be deprecated) + +Please switch to: + +GET /sapi/v2/loan/flexible/borrow/history `` + +Weight(IP): 400 + +Parameters: + +Name Type Mandatory Description +loanCoin STRING NO +collateralCoin STRING NO +startTime LONG NO +endTime LONG NO +current LONG NO Current querying page. Start from 1; default: 1; max: 1000 +limit LONG NO Default: 10; max: 100 +recvWindow LONG NO +timestamp LONG YES +If startTime and endTime are not sent, the recent 90-day data will be returned. +The max interval between startTime and endTime is 180 days. +Repay - Flexible Loan Repay (TRADE) +Response: + +{ + "loanCoin": "BUSD", + "collateralCoin": "BNB", + "remainingDebt": "100.5", + "remainingCollateral": "5.253", + "fullRepayment": false, + "currentLTV": "0.25", + "repayStatus": "Repaid" // Repaid, Repaying, Failed +} +POST /sapi/v1/loan/flexible/repay (To be deprecated) + +Please switch to: + +POST /sapi/v2/loan/flexible/repay + +Weight(UID): 6000 + +Parameters: + +Name Type Mandatory Description +loanCoin STRING YES +collateralCoin DECIMAL YES +repayAmount DECIMAL YES +collateralReturn BOOLEAN NO Default: TRUE. TRUE: Return extra collateral to earn account; FALSE: Keep extra collateral in the order, and lower LTV. +fullRepayment BOOLEAN NO Default: FALSE. TRUE: Full repayment; FALSE: Partial repayment, based on loanAmount +recvWindow LONG NO +timestamp LONG YES +repayAmount is mandatory even fullRepayment = FALSE +Repay - Get Flexible Loan Repayment History (USER_DATA) +Response: + +{ + "rows": [ + { + "loanCoin": "BUSD", + "repayAmount": "10000", + "collateralCoin": "BNB", + "collateralReturn": "49.27565492", + "repayStatus": "Repaid", // Repaid, Repaying, Failed + "repayTime": 1575018510000 + } + ], + "total": 1 +} +GET /sapi/v1/loan/flexible/repay/history (To be (To be deprecated)) + +Please switch to: + +GET /sapi/v2/loan/flexible/repay/history + +Weight(IP): 400 + +Parameters: + +Name Type Mandatory Description +loanCoin STRING NO +collateralCoin STRING NO +startTime LONG NO +endTime LONG NO +current LONG NO Current querying page. Start from 1; default: 1; max: 1000 +limit LONG NO Default: 10; max: 100 +recvWindow LONG NO +timestamp LONG YES +If startTime and endTime are not sent, the recent 90-day data will be returned. +The max interval between startTime and endTime is 180 days. +Adjust LTV - Flexible Loan Adjust LTV (TRADE) +Response: + +{ + "loanCoin": "BUSD", + "collateralCoin": "BNB", + "direction": "ADDITIONAL", + "adjustmentAmount": "5.235", + "currentLTV": "0.52" +} +POST /sapi/v1/loan/flexible/adjust/ltv (To be deprecated) + +Please switch to: + +POST /sapi/v2/loan/flexible/adjust/ltv + +Weight(UID): 6000 + +Request Limit: 1 time/2 seconds per UID + +Parameters: + +Name Type Mandatory Description +loanCoin STRING YES +collateralCoin STRING YES +adjustmentAmount DECIMAL YES +direction ENUM YES "ADDITIONAL", "REDUCED" +recvWindow LONG NO +timestamp LONG YES +API Key needs Spot & Margin Trading permission for this endpoint +Adjust LTV - Get Flexible Loan LTV Adjustment History (USER_DATA) +Response: + +{ + "rows": [ + { + "loanCoin": "BUSD", + "collateralCoin": "BNB", + "direction": "ADDITIONAL", + "collateralAmount": "5.235", + "preLTV": "0.78", + "afterLTV": "0.56", + "adjustTime": 1575018510000 + } + ], + "total": 1 +} +GET /sapi/v1/loan/flexible/ltv/adjustment/history (To be deprecated) + +Please switch to: + +GET /sapi/v2/loan/flexible/ltv/adjustment/history + +Weight(IP): 400 + +Parameters: + +Name Type Mandatory Description +loanCoin STRING NO +collateralCoin STRING NO +startTime LONG NO +endTime LONG NO +current LONG NO Current querying page. Start from 1; default: 1; max: 1000 +limit LONG NO Default: 10; max: 100 +recvWindow LONG NO +timestamp LONG YES +If startTime and endTime are not sent, the recent 90-day data will be returned. +The max interval between startTime and endTime is 180 days. +Get Flexible Loan Assets Data (USER_DATA) +Response: + +{ + "rows": [ + { + "loanCoin": "BUSD", + "flexibleInterestRate": "0.00000491", + "flexibleMinLimit": "100", + "flexibleMaxLimit": "1000000" + } + ], + "total": 1 +} +GET /sapi/v1/loan/flexible/loanable/data (deprecated) + +Please switch to: + +GET /sapi/v2/loan/flexible/loanable/data + +Get interest rate and borrow limit of flexible loanable assets. The borrow limit is shown in USD value. + +Weight(IP): 400 + +Request Limit: 1 time/2 seconds per UID + +Parameters: + +Name Type Mandatory Description +loanCoin STRING NO +recvWindow LONG NO +timestamp LONG YES +Get Flexible Loan Collateral Assets Data (USER_DATA) +Response: + +{ + "rows": [ + { + "collateralCoin": "BNB", + "initialLTV": "0.65", + "marginCallLTV": "0.75", + "liquidationLTV": "0.83", + "maxLimit": "1000000" + } + ], + "total": 1 +} +GET /sapi/v1/loan/flexible/collateral/data (deprecated) + +Please switch to: + +GET /sapi/v2/loan/flexible/collateral/data + +Get LTV information and collateral limit of flexible loan's collateral assets. The collateral limit is shown in USD value. + +Weight(IP): 400 + +Request Limit: 1 time/2 seconds per UID + +Parameters: + +Name Type Mandatory Description +collateralCoin STRING NO +recvWindow LONG NO +timestamp LONG YES +Copy Trading Endpoints +Get Futures Lead Trader Status (USER_DATA) +Response: + +{ + "code": "000000", + "message": "success", + "data": { + "isLeadTrader": true, + "time": 1717382310843 + }, + "success": true +} +GET /sapi/v1/copyTrading/futures/userStatus + +Weight(UID): 20 + +Parameters: + +Name Type Mandatory Description +recvWindow LONG NO +timestamp LONG YES +Get Futures Lead Trading Symbol Whitelist(USER_DATA) +Response: + +{ + "code": "000000", + "message": "success", + "data": [ + { + "symbol": "BTCUSDT", + "baseAsset": "BTC", + "quoteAsset": "USDT" + }, + { + "symbol": "ETHUSDT", + "baseAsset": "ETH", + "quoteAsset": "USDT" + } + ], +} +GET /sapi/v1/copyTrading/futures/leadSymbol + +Weight(UID): 20 + +Parameters: + +Name Type Mandatory Description +recvWindow LONG NO +timestamp LONG YES +Pay Endpoints +Get Pay Trade History (USER_DATA) +Response: + +{ + "code": "000000", + "message": "success", + "data": [ + { + "orderType": "C2C", // Enum:PAY(C2B Merchant Acquiring Payment), PAY_REFUND(C2B Merchant Acquiring Payment,refund), C2C(C2C Transfer Payment),CRYPTO_BOX(Crypto box), CRYPTO_BOX_RF(Crypto Box, refund), C2C_HOLDING(Transfer to new Binance user), C2C_HOLDING_RF(Transfer to new Binance user,refund), PAYOUT(B2C Disbursement Payment), REMITTANCE(Send cash) + "transactionId": "M_P_71505104267788288", + "transactionTime": 1610090460133, //trade timestamp + "amount": "23.72469206", //order amount(up to 8 decimal places), positive is income, negative is expenditure + "currency": "BNB", + "walletType": 1, //main wallet type, 1 for funding wallet, 2 for spot wallet, 3 for fiat wallet, 4 or 6 for card payment, 5 for earn wallet + "walletTypes": [1,2], //array format,there are multiple values when using combination payment + "fundsDetail": [ // details + { + "currency": "USDT", //asset + "amount": "1.2", + "walletAssetCost":[ //details of asset cost per wallet + {"1":"0.6"}, + {"2":"0.6"} + ] + }, + { + "currency": "ETH", + "amount": "0.0001", + "walletAssetCost":[ + {"1":"0.00005"}, + {"2":"0.00005"} + ] + } + ], + "payerInfo":{ + "name":"Jack", //nickname or merchant name + "type":"USER", //account type,USER for personal,MERCHANT for merchant + "binanceId":"12345678", //binance uid + "accountId":"67736251" //binance pay id + }, + "receiverInfo":{ + "name":"Alan", //nickname or merchant name + "type":"MERCHANT", //account type,USER for personal,MERCHANT for merchant + "email":"alan@binance.com", //email + "binanceId":"34355667", //binance uid + "accountId":"21326891", //binance pay id + "countryCode":"1", //International area code + "phoneNumber":"8057651210", + "mobileCode":"US", //country code + "extend":[ //extension field + "institutionName": "", + "cardNumber": "", + "digitalWalletId": "" + ] + } + } + ], + "success": true +} +GET /sapi/v1/pay/transactions + +Weight(UID): 3000 + +Parameters: + +Name Type Mandatory Description +startTime LONG NO +endTime LONG NO +limit INT NO default 100, max 100 +recvWindow LONG NO +timestamp LONG YES +If startTime and endTime are not sent, the recent 90 days' data will be returned. +The max interval between startTime and endTime is 90 days. +Support for querying orders within the last 18 months. + +For payerInfo and receiverInfo,there are different return values in different orderTypes. + +Sender's perspective when orderType is C2C +payerInfo : binanceId +receiverInfo : name, binanceId/accountId/email/countryCode/phoneNumber/mobileCode (based on user input) +Receiver's perspective when orderType is C2C +payerInfo : name, accountId +receiverInfo : binanceId +Sender's perspective when orderType is CRYPTO_BOX +payerInfo : binanceId +receiverInfo : name(the value is always "Crypto Box") +Receiver's perspective when orderType is CRYPTO_BOX +payerInfo : name, accountId +receiverInfo : binanceId +Sender's perspective when orderType is PAY +payerInfo : binanceId +receiverInfo : name +Receiver's perspective when orderType is PAY +payerInfo : name, accountId +receiverInfo : binanceId, name +Sender's perspective when orderType is PAY_REFUND +payerInfo : binanceId, name +receiverInfo : name, accountId +Receiver's perspective when orderType is PAY_REFUND +payerInfo : name +receiverInfo : binanceId +Sender's perspective when orderType is PAYOUT +payerInfo : binanceId, name +receiverInfo : name, accountId +Receiver's perspective when orderType is PAYOUT +payerInfo : name +receiverInfo : binanceId +Receiver's perspective when orderType is CRYPTO_BOX_RF +payerInfo : name(the value is always "Crypto Box") +receiverInfo : binanceId +Sender's perspective when orderType is REMITTANCE +payerInfo : binanceId +receiverInfo : name, institutionName, cardNumber, digitalWalletId +Convert Endpoints +Would you like to have access to Binance Convert API? Please complete the questionnaire to submit your request for access. The Convert API service is created for users who wish to automate their trading on Binance Convert. You will receive a confirmation email after we have approved your application. + +Note: All users of this service are subject to the Binance Terms of Use and the use of the API services is not suitable for purposes including price arbitrage, high frequency trading or price exploitation. Binance may restrict or terminate a Binance API Connection at any time for any reason in its sole discretion and is not obliged to provide any prior notice to the User of any such restriction or termination or any reason therefore. + +List All Convert Pairs +Response: + +[ + { + "fromAsset":"BTC", + "toAsset":"USDT", + "fromAssetMinAmount":"0.0004", + "fromAssetMaxAmount":"50", + "toAssetMinAmount":"20", + "toAssetMaxAmount":"2500000", + "fromIsBase": True + } +] +GET /sapi/v1/convert/exchangeInfo + +Query for all convertible token pairs and the tokens’ respective upper/lower limits + +Weight(IP): 20 + +Parameters: + +Name Type Mandatory Description +fromAsset STRING EITHER OR BOTH User spends coin +toAsset STRING EITHER OR BOTH User receives coin +User needs to supply either or both of the input parameter +If not defined for both fromAsset and toAsset, only partial token pairs will be returned +Query order quantity precision per asset (USER_DATA) +Response: + +[ + { + "asset": "BTC", + "fraction": 8 + }, + { + "asset": "SHIB", + "fraction": 2 + } +] +GET /sapi/v1/convert/assetInfo + +Query for supported asset’s precision information + +Weight(IP): 100 + +Parameters: + +Name Type Mandatory Description +recvWindow LONG NO The value cannot be greater than 60000 +timestamp LONG YES +Send quote request (USER_DATA) +Response: + +{ + "quoteId":"12415572564", + "ratio":"38163.7", + "inverseRatio":"0.0000262", + "validTimestamp":1623319461670, + "toAmount":"3816.37", + "fromAmount":"0.1" +} +POST /sapi/v1/convert/getQuote + +Request a quote for the requested token pairs + +Weight(UID): 200 + +Parameters: + +Name Type Mandatory Description +fromAsset STRING YES +toAsset STRING YES +fromAmount DECIMAL EITHER When specified, it is the amount you will be debited after the conversion +toAmount DECIMAL EITHER When specified, it is the amount you will be credited after the conversion +walletType ENUM NO SPOT or FUNDING. Default is SPOT +validTime ENUM NO 10s, 30s, 1m, 2m, default 10s +recvWindow LONG NO The value cannot be greater than 60000 +timestamp LONG YES +Either fromAmount or toAmount should be sent +quoteId will be returned only if you have enough funds to convert +Accept Quote (TRADE) +Response: + +{ + "orderId":"933256278426274426", + "createTime":1623381330472, + "orderStatus":"PROCESS" //PROCESS/ACCEPT_SUCCESS/SUCCESS/FAIL +} +POST /sapi/v1/convert/acceptQuote + +Accept the offered quote by quote ID. + +Weight(UID): 500 + +Parameters: + +Name Type Mandatory Description +quoteId STRING YES +recvWindow LONG NO The value cannot be greater than 60000 +timestamp LONG YES +Order status (USER_DATA) +Response: + +{ + "orderId":933256278426274426, + "orderStatus":"SUCCESS", + "fromAsset":"BTC", + "fromAmount":"0.00054414", + "toAsset":"USDT", + "toAmount":"20", + "ratio":"36755", + "inverseRatio":"0.00002721", + "createTime":1623381330472 +} +GET /sapi/v1/convert/orderStatus + +Query order status by order ID. + +Weight(UID): 100 + +Parameters: + +Name Type Mandatory Description +orderId STRING NO Either orderId or quoteId is required +quoteId STRING NO Either orderId or quoteId is required +Place limit order (USER_DATA) +Response: + +{ + "orderId": 1603680255057330400, + "status": "PROCESS" +} +POST /sapi/v1/convert/limit/placeOrder + +Enable users to place a limit order + +Weight(UID): 500 + +Parameters: + +Name Type Mandatory Description +baseAsset STRING YES base asset (use the response fromIsBase from GET /sapi/v1/convert/exchangeInfo api to check which one is baseAsset ) +quoteAsset STRING YES quote asset +limitPrice DECIMAL YES Symbol limit price (from baseAsset to quoteAsset) +baseAmount DECIMAL NO Base asset amount. (One of baseAmount or quoteAmount is required) +quoteAmount DECIMAL NO Quote asset amount. (One of baseAmount or quoteAmount is required) +side ENUM YES BUY or SELL +walletType ENUM NO SPOT or FUNDING or SPOT_FUNDING. It is to use which type of assets. Default is SPOT. +expiredType ENUM YES 1_D, 3_D, 7_D, 30_D (D means day) +recvWindow LONG NO +timestamp LONG YES +baseAsset or quoteAsset can be determined via exchangeInfo endpoint. +Limit price is defined from baseAsset to quoteAsset. +Either baseAmount or quoteAmount is used. +Cancel limit order (USER_DATA) +Response: + +{ + "orderId": 1603680255057330400, + "status": "CANCELED" +} +POST /sapi/v1/convert/limit/cancelOrder + +Enable users to cancel a limit order + +Weight(UID): 200 + +Parameters: + +Name Type Mandatory Description +orderId LONG YES The orderId from placeOrder api +recvWindow LONG NO +timestamp LONG YES +Query limit open orders (USER_DATA) +Response: + +{ + "list": [ + { + "quoteId": "18sdf87kh9df", + "orderId": 1150901289839, + "orderStatus": "SUCCESS", + "fromAsset": "BNB", + "fromAmount": "10", + "toAsset": "USDT", + "toAmount": "2317.89", + "ratio": "231.789", + "inverseRatio": "0.00431427", + "createTime": 1614089498000, + "expiredTimestamp": 1614099498000 + } + ] +} +GET /sapi/v1/convert/limit/queryOpenOrders + +Enable users to query for all existing limit orders + +Weight(UID): 3000 + +Parameters: + +Name Type Mandatory Description +recvWindow LONG NO +timestamp LONG YES +Get Convert Trade History (USER_DATA) +Response: + +{ + "list": [ + { + "quoteId": "f3b91c525b2644c7bc1e1cd31b6e1aa6", + "orderId": 940708407462087195, + "orderStatus": "SUCCESS", // order status + "fromAsset": "USDT", // from asset + "fromAmount": "20", // from amount + "toAsset": "BNB", // to asset + "toAmount": "0.06154036", // to amount + "ratio": "0.00307702", // price ratio + "inverseRatio": "324.99", // inverse price + "createTime": 1624248872184 + } + ], + "startTime": 1623824139000, + "endTime": 1626416139000, + "limit": 100, + "moreData": false +} +GET /sapi/v1/convert/tradeFlow + +Weight(UID): 3000 + +Parameters: + +Name Type Mandatory Description +startTime LONG YES +endTime LONG YES +limit INT NO Default 100, Max 1000 +recvWindow LONG NO +timestamp LONG YES +The max interval between startTime and endTime is 30 days. +Rebate Endpoints +Get Spot Rebate History Records (USER_DATA) +Response: + +{ + "status": "OK", + "type": "GENERAL", + "code": "000000000", + "data": { + "page": 1, // current page + "totalRecords": 2, // total records + "totalPageNum": 1, // total pages + "data": [ + { + "asset": "USDT", // rebate asset + "type": 1, // rebate type:1 is commission rebate,2 is referral kickback + "amount": "0.0001126", + "updateTime": 1637651320000 + }, + { + "asset": "ETH", + "type": 1, + "amount": "0.00000056", + "updateTime": 1637928379000 + } + ] + } + +} +GET /sapi/v1/rebate/taxQuery + +Weight(UID): 12000 + +Parameters: + +Name Type Mandatory Description +startTime LONG NO +endTime LONG NO +page INT NO Default 1 +recvWindow LONG NO +timestamp LONG YES +The max interval between startTime and endTime is 30 days. +If startTime and endTime are not sent, the recent 7 days' data will be returned. +The earliest startTime is supported on June 10, 2020 +Return up to 200 records per request. +NFT Endpoints +Get NFT Transaction History (USER_DATA) +Response: + +{ + "total": 2, //total records + "list": [ + { + "orderNo": "1_470502070600699904", // 0: purchase order, 1: sell order, 2: royalty income, 3: primary market order, 4: mint fee + "tokens": [ + { + "network": "BSC", // NFT Network + "tokenId": "216000000496", // NFT Token ID + "contractAddress": "MYSTERY_BOX0000087" // NFT Contract Address + } + ], + "tradeTime": 1626941236000, + "tradeAmount": "19.60000000", + "tradeCurrency": "BNB" + }, + { + "orderNo": "1_488306442479116288", + "tokens": [ + { + "network": "BSC", + "tokenId": "132900000007", + "contractAddress": "0xAf12111a592e408DAbC740849fcd5e68629D9fb6" + } + ], + "tradeTime": 1631186130000, + "tradeAmount": "192.00000000", + "tradeCurrency": "BNB" + } + ] +} +GET /sapi/v1/nft/history/transactions + +Weight(UID): 3000 + +Parameters: + +Name Type Mandatory Description +orderType INT YES 0: purchase order, 1: sell order, 2: royalty income, 3: primary market order, 4: mint fee +startTime LONG NO +endTime LONG NO +limit INT NO Default 50, Max 50 +page INT NO Default 1 +recvWindow LONG NO +timestamp LONG YES +The max interval between startTime and endTime is 90 days. +If startTime and endTime are not sent, the recent 7 days' data will be returned. +Get NFT Deposit History(USER_DATA) +Response: + +{ + "total": 2, + "list": [ + { + "network": "ETH", // NFT Network + "txID": null, // Transaction ID + "contractAdrress": "0xe507c961ee127d4439977a61af39c34eafee0dc6", // NFT Contract Address + "tokenId": "10014", // NFT Token ID + "timestamp": 1629986047000 + }, + { + "network": "BSC", + "txID": null, + "contractAdrress": "0x058451b463bab04f52c0799d55c4094f507acfa9", + "tokenId": "10016", + "timestamp": 1630083581000 + } + ] +} +GET /sapi/v1/nft/history/deposit + +Weight(UID): 3000 + +Parameters: + +Name Type Mandatory Description +startTime LONG NO +endTime LONG NO +limit INT NO Default 50, Max 50 +page INT NO Default 1 +recvWindow LONG NO +timestamp LONG YES +The max interval between startTime and endTime is 90 days. +If startTime and endTime are not sent, the recent 7 days' data will be returned. +Get NFT Withdraw History (USER_DATA) +Response: + +{ + "total": 178, + "list": [ + { + "network": "ETH", + "txID": "0x2be5eed31d787fdb4880bc631c8e76bdfb6150e137f5cf1732e0416ea206f57f", + "contractAdrress": "0xe507c961ee127d4439977a61af39c34eafee0dc6", // NFT Contract Address + "tokenId": "1000001247", // NFT Token ID + "timestamp": 1633674433000, + "fee": 0.1, // Withdraw Fee + "feeAsset": "ETH" // Asset + }, + { + "network": "ETH", + "txID": "0x3b3aea5c0a4faccd6f306641e6deb9713ab229ac233be3be227f580311e4362a", + "contractAdrress": "0xe507c961ee127d4439977a61af39c34eafee0dc6", + "tokenId": "40000030", + "timestamp": 1633677022000, + "fee": 0.1, + "feeAsset": "ETH" + } + ] +} +GET /sapi/v1/nft/history/withdraw + +Weight(UID): 3000 + +Parameters: + +Name Type Mandatory Description +startTime LONG NO +endTime LONG NO +limit INT NO Default 50, Max 50 +page INT NO Default 1 +recvWindow LONG NO +timestamp LONG YES +The max interval between startTime and endTime is 90 days. +If startTime and endTime are not sent, the recent 7 days' data will be returned. +Get NFT Asset (USER_DATA) +Response: + +{ + "total": 347, + "list": [ + { + "network": "BSC", // NFT Network + "contractAddress": "REGULAR11234567891779", // NFT Contract Address + "tokenId": "100900000017" // NFT Token ID + }, + { + "network": "BSC", + "contractAddress": "SSMDQ8W59", + "tokenId": "200500000011" + }, + { + "network": "BSC", + "contractAddress": "SSMDQ8W59", + "tokenId": "200500000019" + } + ] +} +GET /sapi/v1/nft/user/getAsset + +Weight(UID): 3000 + +Parameters: + +Name Type Mandatory Description +limit INT NO Default 50, Max 50 +page INT NO Default 1 +recvWindow LONG NO +timestamp LONG YES +Binance Gift Card Endpoints +Binance Gift Card allows simple crypto transfer and exchange through secured and prepaid codes. Binance Gift Card API solution is to facilitate instant creation, redemption and value-checking for Binance Gift Card. Binance Gift Card product feature consists of two parts: “Gift Card Number” and “Binance Gift Card Redemption Code”. The Gift Card Number can be circulated in public, and it is used to verify the validity of the Binance Gift Card; Binance Gift Card Redemption Code should be kept confidential, because as long as someone knows the redemption code, that person can redeem it anytime. + +By using any of the Binance Gift Card endpoints you are confirming your agreement to the Terms of Use for Binance Gift Cards and Binance Pay Terms of Use. + +Creating gift cards is limited only to entity accounts which have passed KYB verification. + +Effective from 21 Aug 2023, a 1% transaction fee will apply when you buy or create gift cards in Binance directly. + +Create a single-token gift card (USER_DATA) +Response: + +{ + "code": "000000", + "message": "success", + "data": { + "referenceNo": "0033002144060553", + "code": "6H9EKF5ECCWFBHGE", + "expiredTime": 1727417154000 + }, + "success": true +} +POST /sapi/v1/giftcard/createCode + +This API is for creating a Binance Gift Card. + +To get started with, please make sure: + +You have a Binance account +You have passed KYB +You have a sufficient balance(Gift Card amount and fee amount) in your Binance funding wallet +You need Enable Withdrawals for the API Key which requests this endpoint. +Weight(IP): 1 + +Daily creation volume: 2 BTC / 24H / account +Daily creation quantity: 200 Gift Cards / 24H / account +Parameters: + +Name Type Mandatory Description +token STRING YES The token type contained in the Binance Gift Card +amount DOUBLE YES The amount of the token contained in the Binance Gift Card +recvWindow LONG NO +timestamp LONG YES +Create a dual-token gift card (fixed value, discount feature) (TRADE) +Response: + +{ + "code": "000000", + "message": "success", + "data": { + "referenceNo": "0033002144060553", + "code": "6H9EKF5ECCWFBHGE", + "expiredTime": 1727417154000 + }, + "success": true +} +POST /sapi/v1/giftcard/buyCode + +This API is for creating a dual-token ( stablecoin-denominated) Binance Gift Card. You may create a gift card using USDT as baseToken, that is redeemable to another designated token (faceToken). For example, you can create a fixed-value BTC gift card and pay with 100 USDT plus 1 USDT fee. This gift card can keep the value fixed at 100 USDT before redemption, and will be redeemable to BTC equivalent to 100 USDT upon redemption. +Once successfully created, the amount of baseToken (e.g. USDT) in the fixed-value gift card along with the fee would be deducted from your funding wallet. + +To get started with, please make sure: + +You have a Binance account +You have passed KYB +You have a sufficient balance(Gift Card amount and fee amount) in your Binance funding wallet +You need Enable Withdrawals for the API Key which requests this endpoint. +Weight(IP): 1 + +Daily creation volume: 2 BTC / 24H / account +Daily creation quantity: 200 Gift Cards / 24H / account +Parameters: + +Name Type Mandatory Description +baseToken STRING YES The token you want to pay, example: BUSD +faceToken STRING YES The token you want to buy, example: BNB. If faceToken = baseToken, it's the same as createCode endpoint. +baseTokenAmount DOUBLE YES The base token asset quantity, example : 1.002 +discount DOUBLE NO Stablecoin-denominated card discount percentage, Example: 1 for 1% discount. Scale should be less than 6. +recvWindow LONG NO +timestamp LONG YES +Redeem a Binance Gift Card (USER_DATA) +Response: + +{ + "code":"000000", + "message":"success", + "data":{ + "referenceNo":"0033002328060227", + "identityNo":"10317392647411060736", + "token":"BNB", + "amount":"0.00000001" + }, + "success":true +} +POST /sapi/v1/giftcard/redeemCode + +This API is for redeeming a Binance Gift Card + +Once redeemed, the coins will be deposited in your funding wallet. + +Please note that if you enter the wrong redemption code 5 times within 24 hours, you will no longer be able to redeem any Binance Gift Cards that day + +Weight(IP): 1 + +Parameters: + +Name Type Mandatory Description +code STRING YES Redemption code of Binance Gift Card to be redeemed, supports both Plaintext & Encrypted code. +externalUid STRING NO 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 Gift Cards on your platform. To protect user data privacy, you may choose to transfer the user id in any desired format (max. 400 characters). +recvWindow LONG NO +timestamp LONG YES +Notes: + +Parameter code can be sent in two formats: + +Plaintext +Encrypted +Sending code in Encrypted format provides more security than sending it as a plaintext. To send card code in encrypted format the following steps must be followed: + +Fetch RSA public key from api stated below. +Use the below algorithm to encrypt the card code using the RSA public key fetched above: RSA/ECB/OAEPWithSHA-256AndMGF1Padding +A sample code snippet (JAVA) is stated below for reference, the same approach can be used for different languages like C#, PERL, PYTHON, SHELL etc.: + + private static PublicKey getPublicKey(String publicKey) throws Exception { + KeyFactory keyFactory = KeyFactory.getInstance("RSA"); + byte[] decodedKey = Base64.decodeBase64(publicKey.getBytes()); + X509EncodedKeySpec keySpec = new X509EncodedKeySpec(decodedKey); + return keyFactory.generatePublic(keySpec); + } + + public static String encrypt(String content, String publicKeyString) throws Exception { + if (StringUtils.isAnyEmpty(new CharSequence[]{content, publicKeyString})) { + throw new IllegalArgumentException("invalid content or privateKey."); + } else { + Cipher cipher = Cipher.getInstance("RSA/ECB/OAEPWITHSHA-256ANDMGF1PADDING", "BC"); + cipher.init(Cipher.ENCRYPT_MODE, getPublicKey(publicKeyString)); + return new String(Base64.encodeBase64URLSafe(cipher.doFinal(content.getBytes("UTF-8")))); + } + } + + static { + Security.addProvider(new BouncyCastleProvider()); + } +Verify Binance Gift Card by Gift Card Number (USER_DATA) +Response: + +{ + "code": "000000", + "message": "success", + "data": { + "valid":true, + "token":"BNB", // coin + "amount":"0.00000001" // amount + }, + "success": true +} +GET /sapi/v1/giftcard/verify + +This API is for verifying whether the Binance Gift Card is valid or not by entering Gift Card Number. + +Please note that if you enter the wrong Gift Card Number 5 times within an hour, you will no longer be able to verify any Gift Card Number for that hour. + +Weight(IP): 1 + +Parameters: + +Name Type Mandatory Description +referenceNo STRING YES Enter the Gift Card Number +recvWindow LONG NO +timestamp LONG YES +Fetch RSA Public Key (USER_DATA) +Response: + +{ + "code": "000000", + "message": "success", + "data": "MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCXBBVKLAc1GQ5FsIFFqOHrPTox5noBONIKr+IAedTR9FkVxq6e65updEbfdhRNkMOeYIO2i0UylrjGC0X8YSoIszmrVHeV0l06Zh1oJuZos1+7N+WLuz9JvlPaawof3GUakTxYWWCa9+8KIbLKsoKMdfS96VT+8iOXO3quMGKUmQIDAQAB", + "success": true +} +GET /sapi/v1/giftcard/cryptography/rsa-public-key + +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 + +Parameters: + +Name Type Mandatory Description +recvWindow LONG NO +timestamp LONG YES +Fetch Token Limit (USER_DATA) +Response: + +{ + "code": "000000", + "message": "success", + "data": [ + { + "coin": "BNB", + "fromMin": "0.01", + "fromMax": "1" + } + ], + "success":true +} +GET /sapi/v1/giftcard/buyCode/token-limit + +This API is to help you verify which tokens are available for you to create Stablecoin-Denominated gift cards as mentioned in section 2 and its’ limitation. + +Weight(IP): 1 + +Parameters: + +Name Type Mandatory Description +baseToken STRING YES The token you want to pay, example: BUSD +recvWindow LONG NO +timestamp LONG YES +Error Codes +The error JSON payload: + +{ + "code":-1121, + "msg":"Invalid symbol." +} +Errors consist of two parts: an error code and a message. Codes are universal, but messages can vary. + +10xx - General Server or Network issues +-1000 UNKNOWN +An unknown error occurred while processing the request. +An unknown error occurred while processing the request.[%s] +-1001 DISCONNECTED +Internal error; unable to process your request. Please try again. +-1002 UNAUTHORIZED +You are not authorized to execute this request. +-1003 TOO_MANY_REQUESTS +Too many requests queued. +Too much request weight used; current limit is %s request weight per %s. Please use WebSocket Streams for live updates to avoid polling the API. +Way too much request weight used; IP banned until %s. Please use WebSocket Streams for live updates to avoid bans. +-1004 SERVER_BUSY +Server is busy, please wait and try again +-1006 UNEXPECTED_RESP +An unexpected response was received from the message bus. Execution status unknown. +-1007 TIMEOUT +Timeout waiting for response from backend server. Send status unknown; execution status unknown. +-1008 SERVER_BUSY +Spot server is currently overloaded with other requests. Please try again in a few minutes. +-1014 UNKNOWN_ORDER_COMPOSITION +Unsupported order combination. +-1015 TOO_MANY_ORDERS +Too many new orders. +Too many new orders; current limit is %s orders per %s. +-1016 SERVICE_SHUTTING_DOWN +This service is no longer available. +-1020 UNSUPPORTED_OPERATION +This operation is not supported. +-1021 INVALID_TIMESTAMP +Timestamp for this request is outside of the recvWindow. +Timestamp for this request was 1000ms ahead of the server's time. +-1022 INVALID_SIGNATURE +Signature for this request is not valid. +-1099 Not found, authenticated, or authorized +This replaces error code -1999 +11xx - 2xxx Request issues +-1100 ILLEGAL_CHARS +Illegal characters found in a parameter. +Illegal characters found in a parameter. %s +Illegal characters found in parameter %s; legal range is %s. +-1101 TOO_MANY_PARAMETERS +Too many parameters sent for this endpoint. +Too many parameters; expected %s and received %s. +Duplicate values for a parameter detected. +-1102 MANDATORY_PARAM_EMPTY_OR_MALFORMED +A mandatory parameter was not sent, was empty/null, or malformed. +Mandatory parameter %s was not sent, was empty/null, or malformed. +Param %s or %s must be sent, but both were empty/null! +-1103 UNKNOWN_PARAM +An unknown parameter was sent. +-1104 UNREAD_PARAMETERS +Not all sent parameters were read. +Not all sent parameters were read; read %s parameter(s) but was sent %s. +-1105 PARAM_EMPTY +A parameter was empty. +Parameter %s was empty. +-1106 PARAM_NOT_REQUIRED +A parameter was sent when not required. +Parameter %s sent when not required. +-1111 BAD_PRECISION +Parameter %s has too much precision. +-1112 NO_DEPTH +No orders on book for symbol. +-1114 TIF_NOT_REQUIRED +TimeInForce parameter sent when not required. +-1115 INVALID_TIF +Invalid timeInForce. +-1116 INVALID_ORDER_TYPE +Invalid orderType. +-1117 INVALID_SIDE +Invalid side. +-1118 EMPTY_NEW_CL_ORD_ID +New client order ID was empty. +-1119 EMPTY_ORG_CL_ORD_ID +Original client order ID was empty. +-1120 BAD_INTERVAL +Invalid interval. +-1121 BAD_SYMBOL +Invalid symbol. +-1122 INVALID_SYMBOLSTATUS +Invalid symbolStatus. +-1125 INVALID_LISTEN_KEY +This listenKey does not exist. +-1127 MORE_THAN_XX_HOURS +Lookup interval is too big. +More than %s hours between startTime and endTime. +-1128 OPTIONAL_PARAMS_BAD_COMBO +Combination of optional parameters invalid. +-1130 INVALID_PARAMETER +Invalid data sent for a parameter. +Data sent for parameter %s is not valid. +-1131 BAD_RECV_WINDOW +recvWindow must be less than 60000 +-1134 BAD_STRATEGY_TYPE +strategyType was less than 1000000. +-1139 INVALID_TICKER_TYPE +Invalid ticker type. +-1145 INVALID_CANCEL_RESTRICTIONS +cancelRestrictions has to be either ONLY_NEW or ONLY_PARTIALLY_FILLED. +-1151 DUPLICATE_SYMBOLS +Symbol is present multiple times in the list. +-1152 INVALID_SBE_HEADER +Invalid X-MBX-SBE header; expected :. +-1153 UNSUPPORTED_SCHEMA_ID +Unsupported SBE schema ID or version specified in the X-MBX-SBE header. +-1155 SBE_DISABLED +SBE is not enabled. +-1158 OCO_ORDER_TYPE_REJECTED +Order type not supported in OCO. +If the order type provided in the aboveType and/or belowType is not supported. +-1160 OCO_ICEBERGQTY_TIMEINFORCE +Parameter '%s' is not supported if aboveTimeInForce/belowTimeInForce is not GTC. +If the order type for the above or below leg is STOP_LOSS_LIMIT, and icebergQty is provided for that leg, the timeInForce has to be GTC else it will throw an error. +-1161 DEPRECATED_SCHEMA +Unable to encode the response in SBE schema 'x'. Please use schema 'y' or higher +-1194 INVALID_TIME_UNIT +Invalid value for time unit; expected either MICROSECOND or MILLISECOND. +-1196 BUY_OCO_STOP_LOSS_MUST_BE_ABOVE +A stop loss order in a buy OCO must be above. +-1197 SELL_OCO_STOP_LOSS_MUST_BE_BELOW +A stop loss order in a sell OCO must be below. +-1198 BUY_OCO_TAKE_PROFIT_MUST_BE_BELOW +A take profit order in a buy OCO must be below. +-1199 SELL_OCO_TAKE_PROFIT_MUST_BE_ABOVE +A take profit order in a sell OCO must be above. +-2010 NEW_ORDER_REJECTED +NEW_ORDER_REJECTED +-2011 CANCEL_REJECTED +CANCEL_REJECTED +-2013 NO_SUCH_ORDER +Order does not exist. +-2014 BAD_API_KEY_FMT +API-key format invalid. +-2015 REJECTED_MBX_KEY +Invalid API-key, IP, or permissions for action. +-2016 NO_TRADING_WINDOW +No trading window could be found for the symbol. Try ticker/24hrs instead. +-2026 ORDER_ARCHIVED +Order was canceled or expired with no executed qty over 90 days ago and has been archived. +3xxx-5xxx SAPI-specific issues +-3000 INNER_FAILURE +Internal server error. +-3001 NEED_ENABLE_2FA +Please enable 2FA first. +-3002 ASSET_DEFICIENCY +We don't have this asset. +-3003 NO_OPENED_MARGIN_ACCOUNT +Margin account does not exist. +-3004 TRADE_NOT_ALLOWED +Trade not allowed. +-3005 TRANSFER_OUT_NOT_ALLOWED +Transferring out not allowed. +-3006 EXCEED_MAX_BORROWABLE +Your borrow amount has exceed maximum borrow amount. +-3007 HAS_PENDING_TRANSACTION +You have pending transaction, please try again later. +-3008 BORROW_NOT_ALLOWED +Borrow not allowed. +-3009 ASSET_NOT_MORTGAGEABLE +This asset are not allowed to transfer into margin account currently. +-3010 REPAY_NOT_ALLOWED +Repay not allowed. +-3011 BAD_DATE_RANGE +Your input date is invalid. +-3012 ASSET_ADMIN_BAN_BORROW +Borrow is banned for this asset. +-3013 LT_MIN_BORROWABLE +Borrow amount less than minimum borrow amount. +-3014 ACCOUNT_BAN_BORROW +Borrow is banned for this account. +-3015 REPAY_EXCEED_LIABILITY +Repay amount exceeds borrow amount. +-3016 LT_MIN_REPAY +Repay amount less than minimum repay amount. +-3017 ASSET_ADMIN_BAN_MORTGAGE +This asset are not allowed to transfer into margin account currently. +-3018 ACCOUNT_BAN_MORTGAGE +Transferring in has been banned for this account. +-3019 ACCOUNT_BAN_ROLLOUT +Transferring out has been banned for this account. +-3020 EXCEED_MAX_ROLLOUT +Transfer out amount exceeds max amount. +-3021 PAIR_ADMIN_BAN_TRADE +Margin account are not allowed to trade this trading pair. +-3022 ACCOUNT_BAN_TRADE +You account's trading is banned. +-3023 WARNING_MARGIN_LEVEL +You can't transfer out/place order under current margin level. +-3024 FEW_LIABILITY_LEFT +The unpaid debt is too small after this repayment. +-3025 INVALID_EFFECTIVE_TIME +Your input date is invalid. +-3026 VALIDATION_FAILED +Your input param is invalid. +-3027 NOT_VALID_MARGIN_ASSET +Not a valid margin asset. +-3028 NOT_VALID_MARGIN_PAIR +Not a valid margin pair. +-3029 TRANSFER_FAILED +Transfer failed. +-3036 ACCOUNT_BAN_REPAY +This account is not allowed to repay. +-3037 PNL_CLEARING +PNL is clearing. Wait a second. +-3038 LISTEN_KEY_NOT_FOUND +Listen key not found. +-3041 BALANCE_NOT_CLEARED +Balance is not enough +-3042 PRICE_INDEX_NOT_FOUND +PriceIndex not available for this margin pair. +-3043 TRANSFER_IN_NOT_ALLOWED +Transferring in not allowed. +-3044 SYSTEM_BUSY +System busy. +-3045 SYSTEM +The system doesn't have enough asset now. +-3999 NOT_WHITELIST_USER +This function is only available for invited users. +-4001 CAPITAL_INVALID +Invalid operation. +-4002 CAPITAL_IG +Invalid get. +-4003 CAPITAL_IEV +Your input email is invalid. +-4004 CAPITAL_UA +You don't login or auth. +-4005 CAPITAL_TOO_MANY_REQUEST +Too many new requests. +-4006 CAPITAL_ONLY_SUPPORT_PRIMARY_ACCOUNT +Support main account only. +-4007 CAPITAL_ADDRESS_VERIFICATION_NOT_PASS +Address validation is not passed. +-4008 CAPITAL_ADDRESS_TAG_VERIFICATION_NOT_PASS +Address tag validation is not passed. +-4010 CAPITAL_WHITELIST_EMAIL_CONFIRM +White list mail has been confirmed. +-4011 CAPITAL_WHITELIST_EMAIL_EXPIRED +White list mail is invalid. +-4012 CAPITAL_WHITELIST_CLOSE +White list is not opened. +-4013 CAPITAL_WITHDRAW_2FA_VERIFY +2FA is not opened. +-4014 CAPITAL_WITHDRAW_LOGIN_DELAY +Withdraw is not allowed within 2 min login. +-4015 CAPITAL_WITHDRAW_RESTRICTED_MINUTE +Withdraw is limited. +-4016 CAPITAL_WITHDRAW_RESTRICTED_PASSWORD +Within 24 hours after password modification, withdrawal is prohibited. +-4017 CAPITAL_WITHDRAW_RESTRICTED_UNBIND_2FA +Within 24 hours after the release of 2FA, withdrawal is prohibited. +-4018 CAPITAL_WITHDRAW_ASSET_NOT_EXIST +We don't have this asset. +-4019 CAPITAL_WITHDRAW_ASSET_PROHIBIT +Current asset is not open for withdrawal. +-4021 CAPITAL_WITHDRAW_AMOUNT_MULTIPLE +Asset withdrawal must be an %s multiple of %s. +-4022 CAPITAL_WITHDRAW_MIN_AMOUNT +Not less than the minimum pick-up quantity %s. +-4023 CAPITAL_WITHDRAW_MAX_AMOUNT +Within 24 hours, the withdrawal exceeds the maximum amount. +-4024 CAPITAL_WITHDRAW_USER_NO_ASSET +You don't have this asset. +-4025 CAPITAL_WITHDRAW_USER_ASSET_LESS_THAN_ZERO +The number of hold asset is less than zero. +-4026 CAPITAL_WITHDRAW_USER_ASSET_NOT_ENOUGH +You have insufficient balance. +-4027 CAPITAL_WITHDRAW_GET_TRAN_ID_FAILURE +Failed to obtain tranId. +-4028 CAPITAL_WITHDRAW_MORE_THAN_FEE +The amount of withdrawal must be greater than the Commission. +-4029 CAPITAL_WITHDRAW_NOT_EXIST +The withdrawal record does not exist. +-4030 CAPITAL_WITHDRAW_CONFIRM_SUCCESS +Confirmation of successful asset withdrawal. +-4031 CAPITAL_WITHDRAW_CANCEL_FAILURE +Cancellation failed. +-4032 CAPITAL_WITHDRAW_CHECKSUM_VERIFY_FAILURE +Withdraw verification exception. +-4033 CAPITAL_WITHDRAW_ILLEGAL_ADDRESS +Illegal address. +-4034 CAPITAL_WITHDRAW_ADDRESS_CHEAT +The address is suspected of fake. +-4035 CAPITAL_WITHDRAW_NOT_WHITE_ADDRESS +This address is not on the whitelist. Please join and try again. +-4036 CAPITAL_WITHDRAW_NEW_ADDRESS +The new address needs to be withdrawn in {0} hours. +-4037 CAPITAL_WITHDRAW_RESEND_EMAIL_FAIL +Re-sending Mail failed. +-4038 CAPITAL_WITHDRAW_RESEND_EMAIL_TIME_OUT +Please try again in 5 minutes. +-4039 CAPITAL_USER_EMPTY +The user does not exist. +-4040 CAPITAL_NO_CHARGE +This address not charged. +-4041 CAPITAL_MINUTE_TOO_SMALL +Please try again in one minute. +-4042 CAPITAL_CHARGE_NOT_RESET +This asset cannot get deposit address again. +-4043 CAPITAL_ADDRESS_TOO_MUCH +More than 100 recharge addresses were used in 24 hours. +-4044 CAPITAL_BLACKLIST_COUNTRY_GET_ADDRESS +This is a blacklist country. +-4045 CAPITAL_GET_ASSET_ERROR +Failure to acquire assets. +-4046 CAPITAL_AGREEMENT_NOT_CONFIRMED +Agreement not confirmed. +-4047 CAPITAL_DATE_INTERVAL_LIMIT +Time interval must be within 0-90 days +-4060 CAPITAL_WITHDRAW_USER_ASSET_LOCK_DEPOSIT +As your deposit has not reached the required block confirmations, we have temporarily locked {0} asset +-5001 ASSET_DRIBBLET_CONVERT_SWITCH_OFF +Don't allow transfer to micro assets. +-5002 ASSET_ASSET_NOT_ENOUGH +You have insufficient balance. +-5003 ASSET_USER_HAVE_NO_ASSET +You don't have this asset. +-5004 USER_OUT_OF_TRANSFER_FLOAT +The residual balances have exceeded 0.001BTC, Please re-choose. +The residual balances of %s have exceeded 0.001BTC, Please re-choose. +-5005 USER_ASSET_AMOUNT_IS_TOO_LOW +The residual balances of the BTC is too low +The residual balances of %s is too low, Please re-choose. +-5006 USER_CAN_NOT_REQUEST_IN_24_HOURS +Only transfer once in 24 hours. +-5007 AMOUNT_OVER_ZERO +Quantity must be greater than zero. +-5008 ASSET_WITHDRAW_WITHDRAWING_NOT_ENOUGH +Insufficient amount of returnable assets. +-5009 PRODUCT_NOT_EXIST +Product does not exist. +-5010 TRANSFER_FAIL +Asset transfer fail. +-5011 FUTURE_ACCT_NOT_EXIST +future account not exists. +-5012 TRANSFER_PENDING +Asset transfer is in pending. +-5021 PARENT_SUB_HAVE_NO_RELATION +This parent sub have no relation +-5012 FUTURE_ACCT_OR_SUBRELATION_NOT_EXIST +future account or sub relation not exists. +6XXX - Savings Issues +-6001 DAILY_PRODUCT_NOT_EXIST +Daily product not exists. +-6003 DAILY_PRODUCT_NOT_ACCESSIBLE +Product not exist or you don't have permission +-6004 DAILY_PRODUCT_NOT_PURCHASABLE +Product not in purchase status +-6005 DAILY_LOWER_THAN_MIN_PURCHASE_LIMIT +Smaller than min purchase limit +-6006 DAILY_REDEEM_AMOUNT_ERROR +Redeem amount error +-6007 DAILY_REDEEM_TIME_ERROR +Not in redeem time +-6008 DAILY_PRODUCT_NOT_REDEEMABLE +Product not in redeem status +-6009 REQUEST_FREQUENCY_TOO_HIGH +Request frequency too high +-6011 EXCEEDED_USER_PURCHASE_LIMIT +Exceeding the maximum num allowed to purchase per user +-6012 BALANCE_NOT_ENOUGH +Balance not enough +-6013 PURCHASING_FAILED +Purchasing failed +-6014 UPDATE_FAILED +Exceed up-limit allowed to purchased +-6015 EMPTY_REQUEST_BODY +Empty request body +-6016 PARAMS_ERR +Parameter err +-6017 NOT_IN_WHITELIST +Not in whitelist +-6018 ASSET_NOT_ENOUGH +Asset not enough +-6019 PENDING +Need confirm +-6020 PROJECT_NOT_EXISTS +Project not exists +70xx - Futures +-7001 FUTURES_BAD_DATE_RANGE +Date range is not supported. +-7002 FUTURES_BAD_TYPE +Data request type is not supported. +20xxx - Futures/Spot Algo +-20121 +Invalid symbol. +-20124 +Invalid algo id or it has been completed. +-20130 +Invalid data sent for a parameter. +-20132 +The client algo id is duplicated. +-20194 +Duration is too short to execute all required quantity. +-20195 +The total size is too small. +-20196 +The total size is too large. +-20198 +Reach the max open orders allowed. +-20204 +The notional of USD is less or more than the limit. +Filter failures +Error message Description +"Filter failure: PRICE_FILTER" price is too high, too low, and/or not following the tick size rule for the symbol. +"Filter failure: PERCENT_PRICE" price is X% too high or X% too low from the average weighted price over the last Y minutes. +"Filter failure: PERCENT_PRICE_BY_SIDE" price is X% too high or Y% too low from the lastPrice on that side (i.e. BUY/SELL) +"Filter failure: LOT_SIZE" quantity is too high, too low, and/or not following the step size rule for the symbol. +"Filter failure: MIN_NOTIONAL" price * quantity is too low to be a valid order for the symbol. +"Filter failure: ICEBERG_PARTS" ICEBERG order would break into too many parts; icebergQty is too small. +"Filter failure: MARKET_LOT_SIZE" MARKET order's quantity is too high, too low, and/or not following the step size rule for the symbol. +"Filter failure: MAX_POSITION" The account's position has reached the maximum defined limit. + +This is composed of the sum of the balance of the base asset, and the sum of the quantity of all open BUYorders. +"Filter failure: MAX_NUM_ORDERS" Account has too many open orders on the symbol. +"Filter failure: MAX_NUM_ALGO_ORDERS" Account has too many open stop loss and/or take profit orders on the symbol. +"Filter failure: MAX_NUM_ICEBERG_ORDERS" Account has too many open iceberg orders on the symbol. +"Filter failure: TRAILING_DELTA" trailingDelta is not within the defined range of the filter for that order type. +"Filter failure: EXCHANGE_MAX_NUM_ORDERS" Account has too many open orders on the exchange. +"Filter failure: EXCHANGE_MAX_NUM_ALGO_ORDERS" Account has too many open stop loss and/or take profit orders on the exchange. +10xxx - Crypto Loans +-10001 SYSTEM_MAINTENANCE +The system is under maintenance, please try again later. +-10002 INVALID_INPUT +Invalid input parameters. +-10005 NO_RECORDS +No records found. +-10007 COIN_NOT_LOANABLE +This coin is not loanable. +-10008 COIN_NOT_LOANABLE +This coin is not loanable +-10009 COIN_NOT_COLLATERAL +This coin can not be used as collateral. +-10010 COIN_NOT_COLLATERAL +This coin can not be used as collateral. +-10011 INSUFFICIENT_ASSET +Insufficient spot assets. +-10012 INVALID_AMOUNT +Invalid repayment amount. +-10013 INSUFFICIENT_AMOUNT +Insufficient collateral amount. +-10015 DEDUCTION_FAILED +Collateral deduction failed. +-10016 LOAN_FAILED +Failed to provide loan. +-10017 REPAY_EXCEED_DEBT +Repayment amount exceeds debt. +-10018 INVALID_AMOUNT +Invalid repayment amount. +-10019 CONFIG_NOT_EXIST +Configuration does not exists. +-10020 UID_NOT_EXIST +User ID does not exist. +-10021 ORDER_NOT_EXIST +Order does not exist. +-10022 INVALID_AMOUNT +Invalid adjustment amount. +-10023 ADJUST_LTV_FAILED +Failed to adjust LTV. +-10024 ADJUST_LTV_NOT_SUPPORTED +LTV adjustment not supported. +-10025 REPAY_FAILED +Repayment failed. +-10026 INVALID_PARAMETER +Invalid parameter. +-10028 INVALID_PARAMETER +Invalid parameter. +-10029 AMOUNT_TOO_SMALL +Loan amount is too small. +-10030 AMOUNT_TOO_LARGE +Loan amount is too much. +-10031 QUOTA_REACHED +Individual loan quota reached. +-10032 REPAY_NOT_AVAILABLE +Repayment is temporarily unavailable. +-10034 REPAY_NOT_AVAILABLE +Repay with collateral is not available currently, please try to repay with borrowed coin. +-10039 AMOUNT_TOO_SMALL +Repayment amount is too small. +-10040 AMOUNT_TOO_LARGE +Repayment amount is too large. +-10041 INSUFFICIENT_AMOUNT +Due to high demand, there are currently insufficient loanable assets for {0}. Please adjust your borrow amount or try again tomorrow. +-10042 ASSET_NOT_SUPPORTED +asset %s is not supported +-10043 ASSET_NOT_SUPPORTED +{0} borrowing is currently not supported. +-10044 QUOTA_REACHED +Collateral amount has reached the limit. Please reduce your collateral amount or try with other collaterals. +-10045 COLLTERAL_REPAY_NOT_SUPPORTED +The loan coin does not support collateral repayment. Please try again later. +-10046 EXCEED_MAX_ADJUSTMENT +Collateral Adjustment exceeds the maximum limit. Please try again. +-10047 REGION_NOT_SUPPORTED +This coin is currently not supported in your location due to local regulations. +18xxx - Binance Code +-18002 +The total amount of codes you created has exceeded the 24-hour limit, please try again after UTC 0 +-18003 +Too many codes created in 24 hours, please try again after UTC 0 +-18004 +Too many invalid redeem attempts in 24 hours, please try again after UTC 0 +-18005 +Too many invalid verify attempts, please try later +-18006 +The amount is too small, please re-enter +-18007 +This token is not currently supported, please re-enter +21xxx - Portfolio Margin Account +-21001 USER_IS_NOT_UNIACCOUNT +Request ID is not a Portfolio Margin Account. +-21002 UNI_ACCOUNT_CANT_TRANSFER_FUTURE +Portfolio Margin Account doesn't support transfer from margin to futures. +-21003 NET_ASSET_MUST_LTE_RATIO +Fail to retrieve margin assets. +-21004 USER_NO_LIABILITY +User doesn’t have portfolio margin bankruptcy loan +-21005 NO_ENOUGH_ASSET +User’s spot wallet doesn’t have enough BUSD to repay portfolio margin bankruptcy loan +-21006 HAD_IN_PROCESS_REPAY +User had portfolio margin bankruptcy loan repayment in process +-21007 IN_FORCE_LIQUIDATION +User failed to repay portfolio margin bankruptcy loan since liquidation was in process +Order Rejection Issues +Error messages like these are indicated when the error is coming specifically from the matching engine: + +-1010 ERROR_MSG_RECEIVED +-2010 NEW_ORDER_REJECTED +-2011 CANCEL_REJECTED +The following messages which will indicate the specific error: + +Error message Description +"Unknown order sent." The order (by either orderId, clientOrderId, origClientOrderId) could not be found. +"Duplicate order sent." The clientOrderId is already in use. +"Market is closed." The symbol is not trading. +"Account has insufficient balance for requested action." Not enough funds to complete the action. +"Market orders are not supported for this symbol." MARKET is not enabled on the symbol. +"Iceberg orders are not supported for this symbol." icebergQty is not enabled on the symbol +"Stop loss orders are not supported for this symbol." STOP_LOSS is not enabled on the symbol +"Stop loss limit orders are not supported for this symbol." STOP_LOSS_LIMIT is not enabled on the symbol +"Take profit orders are not supported for this symbol." TAKE_PROFIT is not enabled on the symbol +"Take profit limit orders are not supported for this symbol." TAKE_PROFIT_LIMIT is not enabled on the symbol +"Price * QTY is zero or less." price * quantity is too low +"IcebergQty exceeds QTY." icebergQty must be less than the order quantity +"This action is disabled on this account." Contact customer support; some actions have been disabled on the account. +"This account may not place or cancel orders." Contact customer support; the account has trading ability disabled. +"Unsupported order combination" The orderType, timeInForce, stopPrice, and/or icebergQty combination isn't allowed. +"Order would trigger immediately." The order's stop price is not valid when compared to the last traded price. +"Cancel order is invalid. Check origClientOrderId and orderId." No origClientOrderId or orderId was sent in. +"Order would immediately match and take." LIMIT_MAKER order type would immediately match and trade, and not be a pure maker order. +"The relationship of the prices for the orders is not correct." The prices set in the OCO is breaking the Price restrictions. +For reference: +BUY : LIMIT_MAKER price < Last Traded Price < stopPrice +SELL : LIMIT_MAKER price > Last Traded Price > stopPrice +"OCO orders are not supported for this symbol" OCO is not enabled on the symbol. +"Quote order qty market orders are not support for this symbol." MARKET orders using the parameter quoteOrderQty are not enabled on this symbol. +"Trailing stop orders are not supported for this symbol." Orders using trailingDelta are not enabled on the symbol. +"Order cancel-replace is not supported for this symbol." POST /api/v3/order/cancelReplace (REST API) or order.cancelReplace (WebSocket API) is on enabled the symbol. +"This symbol is not permitted for this account." Account and symbol do not have the same permissions. (e.g. SPOT, MARGIN, etc) +"This symbol is restricted for this account." Account is unable to trade on that symbol. (e.g. An ISOLATED_MARGIN account cannot place SPOT orders.) +"Order was not canceled due to cancel restrictions." Either cancelRestrictions was set to ONLY_NEW but the order status was not NEW +or +cancelRestrictions was set to ONLY_PARTIALLY_FILLED but the order status was not PARTIALLY_FILLED. +"Rest API trading is not enabled." / "WebSocket API trading is not enabled." Order is being placed or a server that is not configured to allow access to TRADE endpoints. +"Order book liquidity is less than LOT_SIZE filter minimum quantity." Quote quantity market orders cannot be placed when the order book liquidity is less than minimum quantity configured for the LOT_SIZE filter. +"Order book liquidity is less than MARKET_LOT_SIZE filter minimum quantity." Quote quantity market orders cannot be placed when the order book liquidity is less than the minimum quantity for MARKET_LOT_SIZE filter. +"Order book liquidity is less than symbol minimum quantity." Quote quantity market orders cannot be placed when there are no orders on the book. +Errors regarding POST /api/v3/order/cancelReplace +-2021 Order cancel-replace partially failed +This code is sent when either the cancellation of the order failed or the new order placement failed but not both. + +-2022 Order cancel-replace failed. +This code is sent when both the cancellation of the order failed and the new order placement failed. + +Notes +Request Parameters +Email Address +Email address should be encoded. e.g. alice@test.com should be encoded into alice%40test.com +Email address should be in lower case. diff --git a/utils/spot_endpoints_list.txt b/utils/spot_endpoints_list.txt new file mode 100644 index 000000000..2bda40edb --- /dev/null +++ b/utils/spot_endpoints_list.txt @@ -0,0 +1,437 @@ +POST /api/v3/order +POST /api/v3/sor/order +POST /api/v3/orderList/oco +POST /api/v3/orderList/oto +POST /api/v3/orderList/otoco +DELETE /api/v3/order +DELETE /api/v3/orderList +POST /api/v3/order/cancelReplace +GET /api/v3/exchangeInfo +GET /api/v3/klines +GET /api/v3/uiKlines +GET /sapi/v1/copyTrading/futures/userStatus +GET /sapi/v1/copyTrading/futures/leadSymbol +GET /sapi/v1/capital/deposit/hisrec +GET /sapi/v1/capital/withdraw/history +GET /sapi/v1/capital/deposit/subHisrec +GET /sapi/v1/sub-account/transfer/subUserHistory +GET /sapi/v1/account/info +GET /sapi/v1/capital/withdraw/address/list +POST /sapi/v1/giftcard/createCode +POST /sapi/v1/giftcard/buyCode +GET /sapi/v1/capital/config/getall +GET /api/v3/account +GET /api/v3/trades +GET /api/v3/historicalTrades +POST /sapi/v2/loan/flexible/borrow +GET /sapi/v2/loan/flexible/ongoing/orders +GET /sapi/v2/loan/flexible/borrow/history +POST /sapi/v2/loan/flexible/repay +GET /sapi/v2/loan/flexible/repay/history +POST /sapi/v2/loan/flexible/adjust/ltv +GET /sapi/v2/loan/flexible/ltv/adjustment/history +GET /sapi/v2/loan/flexible/loanable/data +GET /sapi/v2/loan/flexible/collateral/data +GET /sapi/v1/dci/product/list +POST /sapi/v1/dci/product/subscribe +GET /sapi/v1/dci/product/positions +GET /sapi/v1/dci/product/accounts +POST /sapi/v1/dci/product/auto_compound/edit-status +POST /sapi/v1/convert/limit/placeOrder +POST /sapi/v1/convert/limit/cancelOrder +GET /sapi/v1/convert/limit/queryOpenOrders +GET /sapi/v1/bswap/pools +GET /sapi/v1/bswap/liquidity +POST /sapi/v1/bswap/liquidityAdd +POST /sapi/v1/bswap/liquidityRemove +GET /sapi/v1/bswap/liquidityOps +GET /sapi/v1/bswap/quote +POST /sapi/v1/bswap/swap +GET /sapi/v1/bswap/swap +GET /sapi/v1/bswap/poolConfigure +GET /sapi/v1/bswap/addLiquidityPreview +GET /sapi/v1/bswap/removeLiquidityPreview +GET /sapi/v1/bswap/unclaimedRewards +POST /sapi/v1/bswap/claimRewards +GET /sapi/v1/bswap/claimedHistory +GET /sapi/v1/staking/productList +POST /sapi/v1/staking/purchase +POST /sapi/v1/staking/redeem +GET /sapi/v1/staking/position +GET /sapi/v1/staking/stakingRecord +POST /sapi/v1/staking/setAutoStaking +GET /sapi/v1/staking/personalLeftQuota +GET /sapi/v1/spot/delist-schedule +GET /sapi/v1/asset/dribblet +POST /sapi/v1/asset/dust-btc +POST /sapi/v1/asset/dust +POST /sapi/v1/margin/transfer +POST /sapi/v1/asset/transfer +POST /sapi/v1/margin/isolated/transfer +POST /sapi/v1/margin/loan +POST /sapi/v1/margin/borrow-repay +POST /sapi/v1/margin/repay +GET /sapi/v1/margin/isolated/transfer +GET /sapi/v1/margin/transfer +GET /sapi/v1/margin/asset +GET /sapi/v1/margin/allAssets +GET /sapi/v1/margin/pair +GET /sapi/v1/margin/allPairs +GET /sapi/v1/margin/isolated/pair +GET /sapi/v1/margin/isolated/allPairs +GET /sapi/v1/margin/loan +GET /sapi/v1/margin/borrow-repay +GET /sapi/v1/margin/repay +GET /sapi/v1/margin/dribblet +GET /sapi/v1/margin/dust +POST /sapi/v1/margin/dust +GET /sapi/v1/eth-staking/eth/history/wbethRewardsHistory +POST /sapi/v2/eth-staking/eth/stake +GET /sapi/v2/eth-staking/account +POST /sapi/v1/eth-staking/wbeth/unwrap +POST /sapi/v1/eth-staking/eth/redeem +GET /sapi/v1/eth-staking/eth/history/stakingHistory +GET /sapi/v1/eth-staking/eth/history/redemptionHistory +POST /sapi/v1/eth-staking/wbeth/wrap +GET /api/v3/openOrderList +GET /api/v3/allOrderList +GET /api/v3/order +GET /api/v3/account/commission +GET /api/v3/ticker/tradingDay +GET /api/v3/avgPrice +POST /api/v3/order/test +POST /api/v3/sor/order/test +GET /sapi/v1/capital/deposit/address/list +POST /sapi/v1/margin/order +POST /sapi/v1/margin/order/oco +GET /sapi/v1/margin/available-inventory +GET /sapi/v1/margin/leverageBracket +POST /sapi/v1/margin/max-leverage +GET /sapi/v1/margin/account +GET /sapi/v1/account/apiRestrictions +GET /api/v3/depth +POST /sapi/v1/margin/manual-liquidation +GET /sapi/v1/loan/vip/request/interestRate +GET /sapi/v1/futures/histDataLink +GET /sapi/v1/futures/loan/borrow/history +GET /sapi/v1/futures/loan/repay/history +GET /sapi/v2/futures/loan/wallet +GET /sapi/v1/futures/loan/adjustCollateral/history +GET /sapi/v1/futures/loan/liquidationHistory +GET /sapi/v1/futures/loan/interestHistory +GET /sapi/v1/asset/wallet/balance +GET /sapi/v1/asset/custody/transfer-history +GET /sapi/v1/loan/vip/loanable/data +GET /sapi/v1/loan/vip/ongoing/orders +POST /sapi/v1/portfolio/repay +GET /sapi/v1/lending/auto-invest/index/info +GET /sapi/v1/lending/auto-invest/index/user-summary +POST /sapi/v1/lending/auto-invest/one-off +GET /sapi/v1/lending/auto-invest/one-off/status +POST /sapi/v1/lending/auto-invest/redeem +GET /sapi/v1/lending/auto-invest/redeem/history +GET /sapi/v1/lending/auto-invest/rebalance/history +GET /sapi/v1/portfolio/margin-asset-leverage +POST /sapi/v1/portfolio/auto-collection +POST /sapi/v1/portfolio/asset-collection +POST /sapi/v1/portfolio/bnb-transfer +GET /sapi/v1/simple-earn/flexible/history/subscriptionRecord +GET /sapi/v1/simple-earn/locked/history/subscriptionRecord +GET /sapi/v1/simple-earn/flexible/history/redemptionRecord +POST /sapi/v1/simple-earn/flexible/subscribe +POST /sapi/v1/simple-earn/locked/subscribe +POST /sapi/v1/simple-earn/flexible/redeem +POST /sapi/v1/loan/flexible/repay/history +GET /api/v3/orderList +GET /api/v3/openOrders +GET /api/v3/openOrders- +GET /api/v3/allOrders +GET /api/v3/myTrades +GET /api/v3/myAllocations +GET /api/v3/myPreventedMatches +GET /api/v3/rateLimit/order +GET /api/v3/aggTrades +GET /api/v3/ticker/bookTicker +GET /api/v3/ticker/price- +GET /api/v3/ticker/24hr +GET /api/v3/ticker +POST /api/v3/userDataStream +PUT /api/v3/userDataStream +DELETE /api/v3/userDataStream +POST /sapi/v1/loan/vip/borrow +POST /sapi/v1/portfolio/repay-futures-switch +GET /sapi/v1/portfolio/repay-futures-switch +POST /sapi/v1/portfolio/repay-futures-negative-balance +POST /sapi/v1/loan/vip/renew +GET /api/v3/ticker/price +DELETE /api/v3/openOrders +GET /sapi/v1/loan/vip/collateral/data +GET /sapi/v1/loan/vip/request/data +POST /sapi/v1/sub-account/eoptions/enable +GET /sapi/v1/managed-subaccount/query-trans-log +GET /sapi/v1/lending/daily/product/list +GET /sapi/v1/lending/daily/userLeftQuota +POST /sapi/v1/lending/daily/purchase +GET /sapi/v1/lending/daily/userRedemptionQuota +POST /sapi/v1/lending/daily/redeem +GET /sapi/v1/lending/daily/token/position +GET /sapi/v1/lending/union/account +GET /sapi/v1/lending/union/purchaseRecord +GET /sapi/v1/lending/union/redemptionRecord +GET /sapi/v1/lending/union/interestHistory +GET /sapi/v1/lending/auto-invest/target-asset/list +GET /sapi/v1/lending/auto-invest/target-asset/roi/list +GET /sapi/v1/lending/auto-invest/all/asset +GET /sapi/v1/lending/auto-invest/source-asset/list +POST /sapi/v1/lending/auto-invest/plan/add +POST /sapi/v1/lending/auto-invest/plan/edit-status +GET /sapi/v1/lending/auto-invest/plan/list +GET /sapi/v1/lending/auto-invest/plan/id +GET /sapi/v1/lending/auto-invest/history/list +GET /sapi/v1/margin/delist-schedule +POST /sapi/v1/sub-account/futures/internalTransfer +POST /sapi/v1/sub-account/futures/transfer +POST /sapi/v1/futures/transfer +POST /sapi/v1/sub-account/universalTransfer +GET /sapi/v1/pay/transactions +GET /sapi/v1/margin/interestRateHistory +POST /sapi/v1/capital/deposit/credit-apply +GET /sapi/v1/portfolio/asset-index-price +GET /sapi/v1/managed-subaccount/deposit/address +POST /sapi/v1/algo/spot/newOrderTwap +DELETE /sapi/v1/algo/spot/order +GET /sapi/v1/algo/spot/openOrders +GET /sapi/v1/algo/spot/historicalOrders +GET /sapi/v1/algo/spot/subOrders +GET /sapi/v1/managed-subaccount/queryTransLogForInvestor +GET /sapi/v1/managed-subaccount/queryTransLogForTradeParent +GET /sapi/v1/managed-subaccount/info +GET /sapi/v1/sub-account/transaction-statistics +GET /sapi/v1/portfolio/interest-history +POST /sapi/v1/loan/borrow +GET /sapi/v4/sub-account/assets +GET /sapi/v1/margin/exchange-small-liability +POST /sapi/v1/margin/exchange-small-liability +GET /sapi/v1/margin/exchange-small-liability-history +POST /sapi/v1/sub-account/subAccountApi/ipRestriction +POST /sapi/v1/sub-account/subAccountApi/ipRestriction/ipList +GET /sapi/v1/managed-subaccount/fetch-future-asset +GET /sapi/v1/managed-subaccount/marginAsset +GET /sapi/v1/margin/crossMarginCollateralRatio +GET /sapi/v1/capital/contract/convertible-coins +POST /sapi/v1/capital/contract/convertible-coins +GET /api/v3/acccount +GET /sapi/v1/loan/vip/collateral/account +GET /sapi/v1/convert/exchangeInfo +GET /sapi/v1/convert/assetInfo +POST /sapi/v1/convert/getQuote +POST /sapi/v1/convert/acceptQuote +GET /sapi/v1/convert/orderStatus +GET /sapi/v1/asset/ledger-transfer/cloud-mining/queryByPage +POST /sapi/v2/sub-account/subAccountApi/ipRestriction +POST /sapi/v1/loan/vip/repay +GET /sapi/v1/loan/vip/repay/history +POST /sapi/v1/capital/withdraw/apply +GET /sapi/v1/loan/loanable/data +GET /sapi/v1/loan/collateral/data +GET /sapi/v1/loan/repay/collateral/rate +POST /sapi/v1/loan/customize/margin_call +POST /sapi/v1/asset/convert-transfer +POST /sapi/v1/asset/convert-transfer/queryByPage +GET /sapi/v1/giftcard/buyCode/token-limit +POST /sapi/v1/futures/loan/borrow +POST /sapi/v1/futures/loan/repay +GET /sapi/v1/futures/loan/configs +GET /sapi/v2/futures/loan/configs +GET /sapi/v1/futures/loan/calcAdjustLevel +GET /sapi/v2/futures/loan/calcAdjustLevel +GET /sapi/v1/futures/loan/calcMaxAdjustAmount +GET /sapi/v2/futures/loan/calcMaxAdjustAmount +POST /sapi/v1/futures/loan/adjustCollateral +POST /sapi/v2/futures/loan/adjustCollateral +GET /sapi/v1/futures/loan/collateralRepayLimit +GET /sapi/v1/futures/loan/collateralRepay +POST /sapi/v1/futures/loan/collateralRepay +GET /sapi/v1/futures/loan/collateralRepayResult +DELETE /sapi/v1/sub-account/subAccountApi/ipRestriction/ipList +POST /sapi/v1/lending/customizedFixed/purchase +GET /sapi/v1/margin/tradeCoeff +GET /sapi/v1/loan/borrow/history +GET /sapi/v1/sub-account/subAccountApi/ipRestriction +GET /sapi/v1/futures/loan/wallet +GET /sapi/v1/convert/tradeFlow +GET /sapi/v1/portfolio/pmLoan +GET /sapi/v1/portfolio/collateralRate +POST /sapi/v3/asset/getUserAsset +GET /sapi/v1/sub-account/sub/transfer/history +GET /sapi/v1/fiat/orders +GET /sapi/v1/margin/interestHistory +GET /sapi/v1/mining/pub/algoList +GET /sapi/v1/mining/pub/coinList +GET /sapi/v1/giftcard/cryptography/rsa-public-key +POST /sapi/v1/giftcard/redeemCode +POST /sapi/v1/algo/futures/newOrderTwap +GET /sapi/v1/margin/rateLimit/order +GET /sapi/v1/portfolio/account +POST /sapi/v1/algo/futures/newOrderVp +DELETE /sapi/v1/algo/futures/order +GET /sapi/v1/algo/futures/openOrders +GET /sapi/v1/algo/futures/historicalOrders +GET /sapi/v1/algo/futures/subOrders +GET /sapi/v1/sub-account/universalTransfer +GET /sapi/v1/managed-subaccount/accountSnapshot +GET /sapi/v1/sub-account/listto +GET /sapi/v1/accountSnapshot +POST /sapi/v1/lending/positionChanged +GET /sapi/v1/giftcard/verify +GET /sapi/v1/mining/payment/uid +GET /sapi/v1/margin/crossMarginData +GET /sapi/v1/margin/isolatedMarginData +GET /sapi/v1/margin/isolatedMarginTier +GET /sapi/v1/nft/history/transactions +GET /sapi/v1/nft/history/deposit +GET /sapi/v1/nft/history/withdraw +GET /sapi/v1/nft/user/getAsset +GET /sapi/v1/rebate/taxQuery +GET /sapi/v1/pay/transactionsto +GET /sapi/v1/capital/withdraw/historyto +POST /sapi/v1/account/apiRestrictions/ipRestriction +POST /sapi/v1/account/apiRestrictions/ipRestriction/ipList +GET /sapi/v1/account/apiRestrictions/ipRestriction +DELETE /sapi/v1/account/apiRestrictions/ipRestriction/ipList +GET /sapi/v1/loan/incometo +GET /sapi/v1/asset/transfer +GET /sapi/v1/futures/transfer +DELETE /sapi/v1/margin/isolated/account +POST /sapi/v1/margin/isolated/account +GET /sapi/v1/margin/isolated/accountLimit +GET /sapi/v1/margin/isolated/account +DELETE /sapi/v1/margin/orderList +GET /sapi/v1/margin/orderList +GET /sapi/v1/margin/allOrderList +GET /sapi/v1/margin/openOrderList +GET /sapi/v1/c2c/orderMatch/listUserOrderHistory +GET /sapi/v1/fiat/payments +POST /sapi/v1/asset/get-funding-asset +POST /sapi/v1/managed-subaccount/deposit +GET /sapi/v1/managed-subaccount/asset +POST /sapi/v1/managed-subaccount/withdraw +GET /wapi/v3/systemStatus +POST /wapi/v3/withdraw +GET /wapi/v3/depositHistory +GET /wapi/v3/withdrawHistory +GET /wapi/v3/depositAddress +GET /wapi/v3/accountStatus +GET /wapi/v3/apiTradingStatus +GET /wapi/v3/userAssetDribbletLog +GET /wapi/v3/assetDetail +GET /wapi/v3/tradeFee +GET /wapi/v3/sub-account/list +GET /wapi/v3/sub-account/transfer/history +POST /wapi/v3/sub-account/transfer +GET /wapi/v3/sub-account/assets +POST /sapi/v1/margin/isolated/create +GET /sapi/v1/sub-account/futures/accountSummary +GET /sapi/v2/sub-account/futures/accountSummary +GET /sapi/v1/system/status +GET /sapi/v1/account/status +GET /sapi/v1/account/apiTradingStatus +GET /sapi/v1/asset/assetDetail +GET /sapi/v1/asset/tradeFee +GET /sapi/v3/sub-account/assets +POST /sapi/v1/sub-account/virtualSubAccount +GET /sapi/v1/sub-account/list +DELETE /sapi/v1/margin/openOrders +GET /sapi/v1/mining/payment/list +GET /sapi/v1/mining/payment/other +GET /sapi/v1/mining/hash-transfer/config/details +GET /sapi/v1/mining/hash-transfer/config/details/list +GET /sapi/v1/mining/hash-transfer/profit/details +POST /sapi/v1/mining/hash-transfer/config +POST /sapi/v1/mining/hash-transfer/config/cancel +GET /sapi/v2/sub-account/futures/account +GET /sapi/v2/sub-account/futures/positionRisk +POST /sapi/v1/bnbBurn +GET /sapi/v1/bnbBurn +GET /sapi/v1/sub-account/futures/internalTransfer +POST /sapi/v1/sub-account/futures/transferto +GET /sapi/v1/margin/maxBorrowable +GET /sapi/v1/lending/project/list +GET /sapi/v1/lending/project/position/list +GET /sapi/v1/sub-account/spotSummary +DELETE /sapi/v1/margin/order +GET /sapi/v1/margin/order +GET /sapi/v1/margin/openOrders +GET /sapi/v1/margin/allOrders +GET /sapi/v1/margin/myTrades +GET /sapi/v1/margin/forceLiquidationRec +GET /sapi/v1/margin/maxTransferable +POST /sapi/v1/userDataStream/isolated +PUT /sapi/v1/userDataStream/isolated +DELETE /sapi/v1/userDataStream/isolated +GET /sapi/v1/mining/worker/detail +GET /sapi/v1/mining/worker/list +GET /sapi/v1/mining/statistics/user/status +GET /sapi/v1/mining/statistics/user/list +POST /sapi/v1/sub-account/margin/transfer +POST /sapi/v1/sub-account/transfer/subToSub +POST /sapi/v1/sub-account/transfer/subToMaster +POST /sapi/v1/account/disableFastWithdrawSwitch +POST /sapi/v1/account/enableFastWithdrawSwitch +GET /sapi/v1/sub-account/margin/account +GET /sapi/v1/sub-account/status +POST /sapi/v1/sub-account/margin/enable +GET /sapi/v1/sub-account/margin/accountSummary +POST /sapi/v1/sub-account/futures/enable +GET /sapi/v1/sub-account/futures/account +GET /sapi/v1/sub-account/futures/positionRisk +GET /sapi/v1/capital/deposit/subAddress +GET /sapi/v1/capital/deposit/address +GET /api/v1/trades +GET /api/v1/historicalTrades +GET /api/v1/aggTrades +GET /api/v1/klines +GET /api/v1/ticker/24hr +GET /api/v1/depth +GET /api/v3/ping +GET /api/v3/time +GET /sapi/v1/asset/assetDividend +GET /sapi/v1/asset/convert-transfer/queryByPage +GET /sapi/v1/margin/priceIndex +GET /sapi/v1/margin/next-hourly-interest-rate +GET /sapi/v1/margin/capital-flow +POST /sapi/v1/userDataStream +PUT /sapi/v1/userDataStream +DELETE /sapi/v1/userDataStream +POST /sapi/v1/margin/listen-key +PUT /sapi/v1/margin/listen-key +DELETE /sapi/v1/margin/listen-key +GET /sapi/v1/simple-earn/flexible/list +GET /sapi/v1/simple-earn/locked/list +POST /sapi/v1/simple-earn/locked/redeem +GET /sapi/v1/simple-earn/flexible/position +GET /sapi/v1/simple-earn/locked/position +GET /sapi/v1/simple-earn/account +GET /sapi/v1/simple-earn/locked/history/redemptionRecord +GET /sapi/v1/simple-earn/flexible/history/rewardsRecord +GET /sapi/v1/simple-earn/locked/history/rewardsRecord +POST /sapi/v1/simple-earn/flexible/setAutoSubscribe +POST /sapi/v1/simple-earn/locked/setAutoSubscribe +GET /sapi/v1/simple-earn/flexible/personalLeftQuota +GET /sapi/v1/simple-earn/locked/personalLeftQuota +GET /sapi/v1/simple-earn/flexible/subscriptionPreview +GET /sapi/v1/simple-earn/locked/subscriptionPreview +GET /sapi/v1/simple-earn/flexible/history/rateHistory +GET /sapi/v1/simple-earn/flexible/history/collateralRecord +POST /sapi/v1/lending/auto-invest/plan/edit +GET /sapi/v1/eth-staking/eth/history/rewardsHistory +GET /sapi/v1/eth-staking/eth/quota +GET /sapi/v1/eth-staking/eth/history/rateHistory +GET /sapi/v1/eth-staking/wbeth/history/wrapHistory +GET /sapi/v1/eth-staking/wbeth/history/unwrapHistory +GET /sapi/v1/loan/income +GET /sapi/v1/loan/ongoing/orders +POST /sapi/v1/loan/repay +GET /sapi/v1/loan/repay/history +POST /sapi/v1/loan/adjust/ltv +GET /sapi/v1/loan/ltv/adjustment/history \ No newline at end of file