### Rate Limiter Configuration Example (REQUEST_WEIGHT) Source: https://developers.binance.com/docs/binance-spot-api-docs/enums Example configuration for the REQUEST_WEIGHT rate limiter. ```json { "rateLimitType": "REQUEST_WEIGHT", "interval": "MINUTE", "intervalNum": 1, "limit": 6000 } ``` -------------------------------- ### Rate Limiter Configuration Example (ORDERS) Source: https://developers.binance.com/docs/binance-spot-api-docs/enums Example configuration for the ORDERS rate limiter. ```json { "rateLimitType": "ORDERS", "interval": "SECOND", "intervalNum": 1, "limit": 10 } ``` -------------------------------- ### Rate Limiter Configuration Example (RAW_REQUESTS) Source: https://developers.binance.com/docs/binance-spot-api-docs/enums Example configuration for the RAW_REQUESTS rate limiter. ```json { "rateLimitType": "RAW_REQUESTS", "interval": "MINUTE", "intervalNum": 5, "limit": 61000 } ``` -------------------------------- ### Example Request for exchangeInfo with Permissions Source: https://developers.binance.com/docs/binance-spot-api-docs/CHANGELOG Shows how to use the 'permissions' parameter with the GET /api/v3/exchangeInfo endpoint to filter symbols by trading permissions. This parameter cannot be combined with 'symbol' or 'symbols'. ```HTTP GET /api/v3/exchangeInfo?permissions=TRD_GRP_004 ``` -------------------------------- ### REST API - Place Order Example Source: https://developers.binance.com/docs/binance-spot-api-docs/CHANGELOG Example of placing an order using the REST API. Ensure payloads are percent-encoded before computing signatures to avoid rejection. ```http POST /api/v3/order HTTP/1.1 Host: api.binance.com X-MBX-APIKEY: YOUR_API_KEY Content-Type: application/x-www-form-urlencoded symbol=LTCBTC&side=BUY&type=LIMIT&timeInForce=GTC&quantity=1&price=0.1&recvWindow=5000×tamp=1678886400000&signature=YOUR_SIGNATURE ``` -------------------------------- ### OCO Order Response Example Source: https://developers.binance.com/docs/binance-spot-api-docs/rest-api/trading-endpoints This is an example response for a successfully placed OCO order, detailing the order list ID, status, and individual order reports. ```json { "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" } ] } ``` -------------------------------- ### Order Response with Strategy Fields Source: https://developers.binance.com/docs/binance-spot-api-docs Example of a response from GET /api/v3/order, GET /api/v3/openOrders, or GET /api/v3/allOrders that includes 'strategyId' and 'strategyType' for orders placed with these fields. ```JSON { "orderId": 123456, "symbol": "BTCUSDT", "status": "NEW", "clientOrderId": "abc", "price": "0.00000000", "origQty": "0.00100000", "executedQty": "0.00000000", "cummulativeQuoteQty": "0.00000000", "type": "STOP_MARKET", "timeInForce": "GTC", "strategyId": 1000000, "strategyType": 1000000, "createTime": 1670570000000, "updateTime": 1670570000000 } ``` -------------------------------- ### Placing an Order with RSA Key Signature Source: https://developers.binance.com/docs/binance-spot-api-docs/rest-api/request-security This example demonstrates how to place an order using the Binance API. It includes the necessary API key, order details, timestamp, and a signature generated using RSA keys. The `recvWindow` parameter specifies the maximum time in milliseconds that the server is allowed to wait for the request. ```APIDOC ## POST /api/v3/order ### Description Places an order on the Binance exchange. This endpoint requires authentication and a valid signature. ### Method POST ### Endpoint /api/v3/order ### Parameters #### Query Parameters - **symbol** (string) - Required - The trading pair symbol (e.g., BTCUSDT). - **side** (string) - Required - The order side (e.g., BUY, SELL). - **type** (string) - Required - The order type (e.g., LIMIT, MARKET). - **timeInForce** (string) - Required - The time in force for the order (e.g., GTC, IOC, FOK). - **quantity** (decimal) - Required - The quantity of the asset to trade. - **price** (decimal) - Required - The price at which to place the order (for LIMIT orders). - **timestamp** (long) - Required - The current timestamp in milliseconds. - **recvWindow** (long) - Optional - The number of milliseconds the server is allowed to wait for the request. - **signature** (string) - Required - The signature generated using your private RSA key. ### Request Example ```bash 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=1668481559918&recvWindow=5000&signature=HZ8HOjiJ1s%2FigS9JA%2Bn7%2B7Ti%2FihtkRF5BIWcPIEluJP6tlbFM%2FBf44LfZka%2FiemtahZAZzcO9TnI5uaXh3%2B%2BlrqtNonCwp6%2F245UFWkiW1elpgtVAmJPbogcAv6rSlokztAfWk296ZJXzRDYAtzGH0gq7CgSJKfH%2BXxaCmR0WcvlKjNQnp12%2FeKXJYO4tDap8UCBLuyxDnR7oJKLHQHJLP0r0EAVOOSIbrFang%2F1WOq%2BJaq4Efc4XpnTgnwlBbWTmhWDR1pvS9iVEzcSYLHT%2FfNnMRxFc7u%2Bj3qI%2F%2F5yuGuu14KR0MuQKKCSpViieD%2BfIti46sxPTsjSemoUKp0oXA%3D%3D' ``` ### Response #### Success Response (200) - **orderId** (long) - The ID of the placed order. - **symbol** (string) - The trading pair symbol. - **status** (string) - The status of the order (e.g., NEW, FILLED, CANCELED). #### Response Example ```json { "orderId": 123456789, "symbol": "BTCUSDT", "status": "NEW" } ``` ``` -------------------------------- ### Example FIX Message with SOH Character Source: https://developers.binance.com/docs/binance-spot-api-docs/fix-api This example demonstrates a FIX message where the '|' character represents the SOH (Start of Header) character, used as a delimiter. ```FIX 8=FIX.4.4|9=113|35=A|34=1|49=SPOT|52=20240612-08:52:21.636837|56=5JQmUOsm|98=0|108=30|25037=4392a152-3481-4499-921a-6d42c50702e2|10=051| ``` -------------------------------- ### Set up and send an authenticated API request Source: https://developers.binance.com/docs/binance-spot-api-docs/rest-api/request-security This snippet shows how to load a private key, set up request parameters, sign the request with the private key, and send it to the Binance API. ```python 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 = urllib.parse.urlencode(params, encoding='UTF-8') 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()) ``` -------------------------------- ### STP Symbol Configuration Example Source: https://developers.binance.com/docs/binance-spot-api-docs/faqs/stp_faq This configuration shows the default STP mode and the allowed STP modes for a symbol. Orders will use the default mode if not specified, and invalid modes will result in an error. ```json { "defaultSelfTradePreventionMode": "NONE", "allowedSelfTradePreventionModes": ["NONE", "EXPIRE_TAKER", "EXPIRE_BOTH"] } ``` -------------------------------- ### Previous Invalid Parameter Error Example Source: https://developers.binance.com/docs/binance-spot-api-docs/CHANGELOG Example of a specific error message that could be returned for invalid parameter combinations in `GET /api/v3/myTrades` prior to a recent update. This corresponds to error code -1106. ```JSON { "code": -1106, "msg": "Parameter X was sent when not required." } ``` -------------------------------- ### Get Symbol Price Ticker Response (Single) Source: https://developers.binance.com/docs/binance-spot-api-docs/rest-api/market-data-endpoints Example response for a single symbol's latest price. ```JSON { "symbol": "LTCBTC", "price": "4.00000200" } ``` -------------------------------- ### Rolling Window Computation Example Source: https://developers.binance.com/docs/binance-spot-api-docs/websocket-api/market-data-requests Illustrates the `openTime` and `closeTime` for a rolling window calculation, highlighting precision limitations. ```json { "openTime": 1659580020000, "closeTime": 1660184865291 } ``` -------------------------------- ### Get Symbol Price Ticker Response (Multiple) Source: https://developers.binance.com/docs/binance-spot-api-docs/rest-api/market-data-endpoints Example response for multiple symbols' latest prices when the 'symbols' parameter is used. ```JSON [ { "symbol": "LTCBTC", "price": "4.00000200" }, { "symbol": "ETHBTC", "price": "0.07946600" } ] ``` -------------------------------- ### Prevented Matches Output Example Source: https://developers.binance.com/docs/binance-spot-api-docs/faqs/stp_faq This is a sample output from the GET /api/v3/preventedMatches endpoint, illustrating the structure and fields returned for a prevented match. ```json [ { "symbol": "BTCDUSDT", // Symbol of the orders "preventedMatchId": 8, // Identifies the prevented match of the expired order(s) for the symbol. "takerOrderId": 12, // Order Id of the Taker Order "makerOrderId": 10, // Order Id of the Maker Order "tradeGroupId": 1, // Identifies the Trade Group Id. (If the account is not part of a trade group, this will be -1.) "selfTradePreventionMode": "EXPIRE_BOTH", // STP mode that expired the order(s). "price": "50.00000000", // Price at which the match occurred. "takerPreventedQuantity": "1.00000000", // Taker's remaining quantity before the STP. Only appears if the STP mode is EXPIRE_TAKER, EXPIRE_BOTH or DECREMENT. "makerPreventedQuantity": "10.00000000", // Maker's remaining quantity before the STP. Only appears if the STP mode is EXPIRE_MAKER, EXPIRE_BOTH, or DECREMENT. "transactTime": 1663190634060 // Time the order(s) expired due to STP. } ] ``` -------------------------------- ### API Key and Private Key Path Initialization Source: https://developers.binance.com/docs/binance-spot-api-docs/rest-api/request-security Initializes API key and private key path variables for use in API requests. Replace placeholder values with your actual credentials. ```bash API_KEY="put your own API Key here" PRIVATE_KEY_PATH="test-prv-key.pem" ``` -------------------------------- ### Error Response for Missing Symbol Parameter Source: https://developers.binance.com/docs/binance-spot-api-docs/CHANGELOG Example of an error message returned when the 'symbol' parameter is not provided for endpoints like GET /api/v3/myTrades. ```json { "code": -1102, "msg": "Mandatory parameter 'symbol' was not sent, was empty/null, or malformed." } ``` -------------------------------- ### Get Historical Trades Request Source: https://developers.binance.com/docs/binance-spot-api-docs/websocket-api/market-data-requests Use this JSON request to retrieve historical trades for a symbol, specifying a starting trade ID and limit. ```json { "id": "cffc9c7d-4efc-4ce0-b587-6b87448f052a", "method": "trades.historical", "params": { "symbol": "BNBBTC", "fromId": 0, "limit": 1 } } ``` -------------------------------- ### Place New Order - OTOCO Example Response Source: https://developers.binance.com/docs/binance-spot-api-docs/websocket-api/trading-requests This is an example response for placing a new OTOCO order. It includes details about the order's execution, status, and rate limits. ```json { "symbol": "BTCUSDT", "orderId": 1234567890, "orderListId": 0, // Unless part of an OCO, the value will be -1 "clientOrderId": "abcdefg", "transactTime": 1678886400000, "price": "0.000000", "origQty": "0.000000", "executedQty": "0.000000", "origQuoteOrderQty": "0.000000", "cummulativeQuoteQty": "0.000000", "status": "PENDING_NEW", "timeInForce": "GTC", "type": "LIMIT_MAKER", "side": "SELL", "workingTime": -1, "selfTradePreventionMode": "NONE" ] }, "rateLimits": [ { "rateLimitType": "ORDERS", "interval": "MINUTE", "intervalNum": 1, "limit": 10000000, "count": 18 }, { "rateLimitType": "REQUEST_WEIGHT", "interval": "MINUTE", "intervalNum": 1, "limit": 1000, "count": 65 } ] } ``` -------------------------------- ### Get Symbol Order Book Ticker Response (Single) Source: https://developers.binance.com/docs/binance-spot-api-docs/rest-api/market-data-endpoints Example response for a single symbol's best bid and ask prices and quantities. ```JSON { "symbol": "LTCBTC", "bidPrice": "4.00000000", "bidQty": "431.00000000", "askPrice": "4.00000200", "askQty": "9.00000000" } ``` -------------------------------- ### GET /api/v3/historicalTrades - Old Trade Lookup Source: https://developers.binance.com/docs/binance-spot-api-docs/rest-api/market-data-endpoints Retrieves older trades for a symbol, optionally starting from a specific trade ID. The limit is capped at 1000. ```http GET /api/v3/historicalTrades ``` ```json [ { "id": 28457, "price": "4.00000100", "qty": "12.00000000", "quoteQty": "48.000012", "time": 1499865549590, "isBuyerMaker": true, "isBestMatch": true } ] ``` -------------------------------- ### Exchange Info Request with Permissions Parameter Source: https://developers.binance.com/docs/binance-spot-api-docs Example of a GET request to /api/v3/exchangeInfo with the new optional 'permissions' parameter. This allows filtering symbols based on trading permissions. ```HTTP GET /api/v3/exchangeInfo?permissions=SPOT,MARGIN ``` -------------------------------- ### Place a New Order (Ed25519 Keys) Source: https://developers.binance.com/docs/binance-spot-api-docs/rest-api/request-security This example demonstrates how to place a new order using Ed25519 keys. It includes the necessary API key and signature in the request headers and query parameters. ```APIDOC ## POST /api/v3/order ### Description Places a new order on the Binance Spot market. ### Method POST ### Endpoint /api/v3/order ### Parameters #### Query Parameters - **symbol** (string) - Required - The trading pair symbol (e.g., BTCUSDT). - **side** (string) - Required - The order side (BUY or SELL). - **type** (string) - Required - The order type (e.g., LIMIT, MARKET). - **timeInForce** (string) - Required - The time in force for the order (e.g., GTC, IOC, FOK). - **quantity** (decimal) - Required - The quantity of the asset to trade. - **price** (decimal) - Required - The price at which to place the order (required for LIMIT orders). - **timestamp** (long) - Required - The current timestamp in milliseconds. - **recvWindow** (long) - Optional - The number of milliseconds the request should be valid for. - **signature** (string) - Required - The signature generated using your Ed25519 private key. ### Request Example ``` curl -H "X-MBX-APIKEY: YOUR_API_KEY" -X POST 'https://api.binance.com/api/v3/order?symbol=BTCUSDT&side=SELL&type=LIMIT&timeInForce=GTC&quantity=1&price=0.2×tamp=1668481559918&recvWindow=5000&signature=YOUR_SIGNATURE' ``` ### Response #### Success Response (200) - **orderId** (long) - The ID of the placed order. - **symbol** (string) - The trading pair symbol. - **status** (string) - The status of the order. #### Response Example ```json { "orderId": 123456789, "symbol": "BTCUSDT", "status": "NEW" } ``` ``` -------------------------------- ### Example Commission Configuration Source: https://developers.binance.com/docs/binance-spot-api-docs/faqs/commission_faq This JSON object defines the commission rates and discount settings for a specific symbol. It includes standard, special, and tax commissions for makers, takers, buyers, and sellers, along with discount parameters. ```json { "symbol": "BTCUSDT", "standardCommission": { "maker": "0.00000010", "taker": "0.00000020", "buyer": "0.00000030", "seller": "0.00000040" }, "specialCommission": { "maker": "0.01000000", "taker": "0.02000000", "buyer": "0.03000000", "seller": "0.04000000" }, "taxCommission": { "maker": "0.00000112", "taker": "0.00000114", "buyer": "0.00000118", "seller": "0.00000116" }, "discount": { "enabledForAccount": true, "enabledForSymbol": true, "discountAsset": "BNB", "discount": "0.25000000" } } ``` -------------------------------- ### Get Symbol Order Book Ticker Response (Multiple) Source: https://developers.binance.com/docs/binance-spot-api-docs/rest-api/market-data-endpoints Example response for multiple symbols' best bid and ask prices and quantities when the 'symbols' parameter is used. ```JSON [ { "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" } ] ``` -------------------------------- ### Signing a Binance Spot API Request Source: https://developers.binance.com/docs/binance-spot-api-docs/rest-api/request-security This script demonstrates how to construct and sign a POST request to the Binance Spot API. It includes setting API details, generating a timestamp, signing the parameters with a private key, and sending the request using curl. ```bash 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" rawSignature=$(echo -n $api_params_with_timestamp | openssl dgst -keyform PEM -sha256 -sign $PRIVATE_KEY_PATH | openssl enc -base64 | tr -d '\n') # Percent-encode the signature signature=$(rawurlencode "$rawSignature") # 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" ``` -------------------------------- ### GET /api/v3/historicalBlockTrades - Historical Block Trades Source: https://developers.binance.com/docs/binance-spot-api-docs/rest-api/market-data-endpoints Fetches historical block trades for a symbol, starting from a specified block trade ID. The limit is set to a maximum of 1000. ```http GET /api/v3/historicalBlockTrades ``` ```json [ { "id": 582, "price": "0.052", "qty": "5838", "quoteQty": "303.576", "time": 1772506983321, "isBuyerMaker": true } ] ``` -------------------------------- ### New Order Response Example (FILLED) Source: https://developers.binance.com/docs/binance-spot-api-docs/rest-api/trading-endpoints This is an example of a successful response when placing a new order using SOR that is immediately FILLED. It includes details about the order, execution, and fills. ```JSON { "symbol": "BTCUSDT", "orderId": 2, "orderListId": -1, "clientOrderId": "sBI1KM6nNtOfj5tccZSKly", "transactTime": 1689149087774, "price": "31000.00000000", "origQty": "0.50000000", "executedQty": "0.50000000", "origQuoteOrderQty": "0.000000", "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 } ``` -------------------------------- ### Rolling Window Price Change Statistics (Multiple Symbols - MINI) Source: https://developers.binance.com/docs/binance-spot-api-docs/rest-api/market-data-endpoints Example response for the GET /api/v3/ticker endpoint when requesting statistics for multiple symbols with the MINI data type. ```json [ { "symbol": "BNBBTC", "openPrice": "0.10000000", "highPrice": "2.00000000", ``` -------------------------------- ### Reference Price Response (Set) Source: https://developers.binance.com/docs/binance-spot-api-docs/rest-api/market-data-endpoints Example response when a reference price is successfully set for a symbol. ```JSON { "symbol": "BAZUSD", "referencePrice": "10.00", "timestamp": 1770736694138 // Timestamp when reference price was valid } ``` -------------------------------- ### Making a POST request with Ed25519 signature Source: https://developers.binance.com/docs/binance-spot-api-docs/rest-api/request-security This example demonstrates how to make a POST request to the Binance Spot API, including the necessary API key and signature in the headers. Ensure your timestamp and signature are correctly generated. ```bash curl -H "X-MBX-APIKEY: 4yNzx3yWC5bS6YTwEkSRaC0nRmSQIIStAUOh1b6kqaBrTLIhjCpI5lJH8q8R8WNO" -X POST 'https://api.binance.com/api/v3/order?symbol=BTCUSDT&side=SELL&type=LIMIT&timeInForce=GTC&quantity=1&price=0.2×tamp=1668481559918&recvWindow=5000&signature=HaZnek7KOGa%2Fk5%2Bf6Q1nw8lzMUpo36mRVvvLHCMUCXxlmdQQGZge1luAUKnleD%2FDYeD19YrqzeHbb6xU3MkSIXKhAO1MaYq48uGVYb3vJScEZVOutgMInrZzUcCWNulNkfcbmExSiymCZ5xQBw5QDuzpuDFqRZ1Xt%2BBZxEHBN9OYQKpoe0%2BovjnXyVOaH8VUKhE%2FghUWnThrXJr%2BhmSc5t7ggjiVPQc7pGn3qSNGCQwdpkQC9GHMr%2Fr%2B8n6qeEKMYB5j%2F1wC4d8Jae8FQiU8xcXR0NlUgV2LAw61%2FZJv5BTJpa%2Bz5Lv1W9v6jHQWRX2O8uaG3KU%2FlR3spR7%2BoGlWOw%3D' ``` -------------------------------- ### Rolling Window Price Change Statistics (Single Symbol - MINI) Source: https://developers.binance.com/docs/binance-spot-api-docs/rest-api/market-data-endpoints Example response for the GET /api/v3/ticker endpoint when requesting statistics for a single symbol with the MINI data type. ```json { "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 } ``` -------------------------------- ### Signature Payload Construction (ASCII Symbol) Source: https://developers.binance.com/docs/binance-spot-api-docs/websocket-api/request-security This example shows how to format the signature payload by sorting parameters alphabetically and encoding values in UTF-8. ```text apiKey=CAvIjXy3F44yW6Pou5k8Dy1swsYDWJZLeoK2r8G4cFDnE9nosRppc2eKc1T8TRTQ&price=52000.00&quantity=0.01000000&recvWindow=100&side=SELL&symbol=BTCUSDT&timeInForce=GTC×tamp=1645423376532&type=LIMIT ``` -------------------------------- ### Rolling Window Price Change Statistics (Multiple Symbols - FULL) Source: https://developers.binance.com/docs/binance-spot-api-docs/rest-api/market-data-endpoints Example response for the GET /api/v3/ticker endpoint when requesting statistics for multiple symbols with the FULL data type. ```json [ { "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 } ] ``` -------------------------------- ### Rolling Window Price Change Statistics (Single Symbol - FULL) Source: https://developers.binance.com/docs/binance-spot-api-docs/rest-api/market-data-endpoints Example response for the GET /api/v3/ticker endpoint when requesting statistics for a single symbol with the FULL data type. ```json { "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, // Close time for ticker window "firstId": 0, // Trade IDs "lastId": 60, "count": 61 // Number of trades in the interval } ``` -------------------------------- ### Order Request Payload Example Source: https://developers.binance.com/docs/binance-spot-api-docs/websocket-api/trading-requests This example shows a payload for placing orders, including fields like timeInForce, type, side, and symbol. It demonstrates both limit and market order structures. ```json { "timeInForce": "GTC", "type": "LIMIT", "side": "BUY", "workingTime": 1762941318142, "selfTradePreventionMode": "NONE" }, { "symbol": "BTCUSDT", "orderId": 3, "orderListId": 2, "clientOrderId": "x7ISSjywZxFXOdzwsThNnd", "transactTime": 1762941318142, "price": "0.00000000", "executedQty": "0.00000000", "origQuoteOrderQty": "0.00000000", "cummulativeQuoteQty": "0.00000000", "status": "PENDING_NEW", "timeInForce": "GTC", "type": "MARKET", "side": "SELL", "workingTime": -1, "selfTradePreventionMode": "NONE" } ] ``` -------------------------------- ### Maker Order with STP NONE (Scenario F) Source: https://developers.binance.com/docs/binance-spot-api-docs/faqs/stp_faq Example of a maker order with STP mode set to NONE, used in Scenario F. This order is intended to be matched by a taker order. ```json { "symbol": "BTCUSDT", "orderId": 2, "orderListId": -1, "clientOrderId": "7sgrQQInL69XDMQpiqMaG2", "price": "1.000000", "origQty": "1.000000", "executedQty": "0.000000", "cummulativeQuoteQty": "0.000000", "status": "EXPIRED_IN_MATCH", "timeInForce": "GTC", "type": "LIMIT", "side": "BUY", "stopPrice": "0.000000", "icebergQty": "0.000000", "time": 1670222557456, "updateTime": 1670222557478, "isWorking": true, "workingTime": 1670222557456, "origQuoteOrderQty": "0.000000", "selfTradePreventionMode": "NONE", "preventedMatchId": 0, "preventedQuantity": "1.000000" } ```