### Get Latest Price - Response Example (Multiple)
Source: https://developers.binance.com/docs/zh-CN/binance-spot-api-docs/rest-api/market-data-endpoints
Example of the JSON response when requesting prices for multiple symbols.
```JSON
[
{
"symbol": "LTCBTC",
"price": "4.00000200"
},
{
"symbol": "ETHBTC",
"price": "0.07946600"
}
]
```
--------------------------------
### Get Latest Price - Response Example (Single)
Source: https://developers.binance.com/docs/zh-CN/binance-spot-api-docs/rest-api/market-data-endpoints
Example of the JSON response when requesting the price for a single symbol.
```JSON
{
"symbol": "LTCBTC",
"price": "4.00000200"
}
```
--------------------------------
### Get Best Bid/Ask Order - Response Example (Multiple)
Source: https://developers.binance.com/docs/zh-CN/binance-spot-api-docs/rest-api/market-data-endpoints
Example of the JSON response when requesting best bid/ask orders for multiple symbols.
```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"
}
]
```
--------------------------------
### Get Best Bid/Ask Order - Response Example (Single)
Source: https://developers.binance.com/docs/zh-CN/binance-spot-api-docs/rest-api/market-data-endpoints
Example of the JSON response when requesting the best bid/ask for a single symbol.
```JSON
{
"symbol": "LTCBTC",
"bidPrice": "4.00000000",
"bidQty": "431.00000000",
"askPrice": "4.00000200",
"askQty": "9.00000000"
}
```
--------------------------------
### Binance API GET /api/v3/allOrderList Example
Source: https://developers.binance.com/docs/zh-CN/binance-spot-api-docs/CHANGELOG
This endpoint retrieves all order lists. The API now allows startTime and endTime parameters to be equal.
```json
GET /api/v3/allOrderList
```
--------------------------------
### Binance API GET /api/v3/allOrders Example
Source: https://developers.binance.com/docs/zh-CN/binance-spot-api-docs/CHANGELOG
This endpoint retrieves all orders. The API now allows startTime and endTime parameters to be equal.
```json
GET /api/v3/allOrders
```
--------------------------------
### Binance API GET /api/v3/myTrades Example
Source: https://developers.binance.com/docs/zh-CN/binance-spot-api-docs/CHANGELOG
This endpoint retrieves user's trades. The API now allows startTime and endTime parameters to be equal.
```json
GET /api/v3/myTrades
```
--------------------------------
### Binance API GET /api/v3/aggTrades Example
Source: https://developers.binance.com/docs/zh-CN/binance-spot-api-docs/CHANGELOG
This endpoint retrieves aggregated trades. The API now allows startTime and endTime parameters to be equal.
```json
GET /api/v3/aggTrades
```
--------------------------------
### GET /api/v3/aggTrades, GET /api/v3/klines, GET /api/v3/allOrderList, GET /api/v3/allOrders, GET /api/v3/myTrades
Source: https://developers.binance.com/docs/zh-CN/binance-spot-api-docs
These REST API endpoints now allow `startTime` and `endTime` parameters to be equal.
```APIDOC
## GET /api/v3/aggTrades, GET /api/v3/klines, GET /api/v3/allOrderList, GET /api/v3/allOrders, GET /api/v3/myTrades
### Description
These REST API endpoints now allow `startTime` and `endTime` parameters to be equal.
### Method
GET
### Endpoint
/api/v3/aggTrades
/api/v3/klines
/api/v3/allOrderList
/api/v3/allOrders
/api/v3/myTrades
### Parameters
#### Query Parameters
- **startTime** (long) - The start time in milliseconds.
- **endTime** (long) - The end time in milliseconds. (Can be equal to startTime)
```
--------------------------------
### Place Order with Security
Source: https://developers.binance.com/docs/zh-CN/binance-spot-api-docs/rest-api/request-security
This example demonstrates how to place an order by signing the request with your private key and including the necessary API key and timestamp.
```APIDOC
## POST /api/v3/order
### Description
Places an order on the Binance exchange. This endpoint requires authentication via API key and a signed payload.
### Method
POST
### Endpoint
https://api.binance.com/api/v3/order
### Parameters
#### Request Body
- **symbol** (string) - Required - The trading pair (e.g., BTCUSDT)
- **side** (string) - Required - Order side (e.g., BUY, SELL)
- **type** (string) - Required - Order type (e.g., LIMIT, MARKET)
- **timeInForce** (string) - Optional - Time in force (e.g., GTC, IOC, FOK)
- **quantity** (string) - Required - The amount of the asset to trade
- **price** (string) - Required if type is LIMIT - The price at which to place the order
- **timestamp** (integer) - Required - The current Unix timestamp in milliseconds
- **signature** (string) - Required - The signature generated from the payload and your private key
### Request Example
```python
API_KEY = 'YOUR_API_KEY'
PRIVATE_KEY_PATH = 'path/to/your/private.pem'
with open(PRIVATE_KEY_PATH, 'rb') as f:
private_key = load_pem_private_key(data=f.read(), password=None)
params = {
'symbol': 'BTCUSDT',
'side': 'SELL',
'type': 'LIMIT',
'timeInForce': 'GTC',
'quantity': '1.0000000',
'price': '0.20',
}
timestamp = int(time.time() * 1000)
params['timestamp'] = timestamp
payload = urllib.parse.urlencode(params, encoding='UTF-8')
signature = base64.b64encode(private_key.sign(payload.encode('ASCII')))
params['signature'] = signature.decode('utf-8')
headers = {
'X-MBX-APIKEY': API_KEY,
}
response = requests.post(
'https://api.binance.com/api/v3/order',
headers=headers,
data=params,
)
print(response.json())
```
### Response
#### Success Response (200)
- **orderId** (integer) - The ID of the placed order
- **symbol** (string) - The trading pair
- **status** (string) - The status of the order (e.g., NEW, FILLED)
#### Response Example
```json
{
"orderId": 123456789,
"symbol": "BTCUSDT",
"status": "NEW"
}
```
```
--------------------------------
### Order Placement with RSA Key
Source: https://developers.binance.com/docs/zh-CN/binance-spot-api-docs/rest-api/request-security
This example demonstrates how to place an order using an RSA key. It includes the necessary API key, endpoint, and parameters, along with the generated signature.
```APIDOC
## POST /api/v3/order
### Description
Places an order with specified parameters, secured by an API key and signature.
### Method
POST
### Endpoint
https://api.binance.com/api/v3/order
### Parameters
#### Query Parameters
- **symbol** (string) - Required - The trading pair symbol.
- **side** (string) - Required - Order side (BUY or SELL).
- **type** (string) - Required - Order type (e.g., LIMIT, MARKET).
- **timeInForce** (string) - Optional - Time in force (e.g., GTC, IOC).
- **quantity** (decimal) - Required - The quantity of the asset to trade.
- **price** (decimal) - Required for LIMIT orders - The price at which to place the order.
- **timestamp** (long) - Required - Current server time in milliseconds.
- **recvWindow** (long) - Optional - The number of milliseconds the request should be valid for.
- **signature** (string) - Required - The signature generated using the secret key.
### Request Example
```json
{
"symbol": "123456",
"side": "SELL",
"type": "LIMIT",
"timeInForce": "GTC",
"quantity": "1",
"price": "0.2",
"timestamp": 1668481559918,
"recvWindow": 5000,
"signature": "qJtv66wyp%2F1mZE%2BmIFAAMUoTe8xkmLN7%2FeAZjuC9x1ocxovItHLl%2FsNK7Wq8QjgiHqGn0bb8P7yVvGBEd1gFe71NQ8aM0M%2BJNIMz5UFxfeA53rXjFlvsyH1Sig%2BOuO9Nz5nhCaJ6bEfj2iuv7w27pB3L8MVqmoCi6D9C%2FQMiLxtPaR70CxtnvoOlIgPmpv2bQy029A31NEK19ieVLkoyp1EUkXRaX3v0mohx8yMnUG1dhX9nUg3Oy8TYZ03DQy7kHDGkMKisNX7rt%2FGuGx1HIgjFclDGLsbAFIodvSLjm9FbseasMELoxlAJDlwRnW8zo5sQmL0Fz7ao935QBynrng%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).
#### Response Example
```json
{
"orderId": 123456789,
"symbol": "123456",
"status": "NEW"
}
```
```
--------------------------------
### Order Placement with Signature
Source: https://developers.binance.com/docs/zh-CN/binance-spot-api-docs/rest-api/request-security
This example demonstrates how to place an order using the Binance API, including generating a signature for authentication.
```APIDOC
## POST api/v3/order
### Description
Places an order on the Binance exchange. This endpoint requires authentication and a valid signature.
### Method
POST
### Endpoint
https://api.binance.com/api/v3/order
### Parameters
#### Query Parameters
- **symbol** (string) - Required - The trading pair (e.g., BTCUSDT).
- **side** (string) - Required - BUY or SELL.
- **type** (string) - Required - Order type (e.g., LIMIT, MARKET).
- **timeInForce** (string) - Optional - Time in force (e.g., GTC, IOC).
- **quantity** (number) - Required - The quantity of the asset to trade.
- **price** (number) - Required (for LIMIT orders) - The price at which to place the order.
- **timestamp** (integer) - Required - The current timestamp in milliseconds.
### Request Example
```bash
API_KEY="YOUR_API_KEY"
PRIVATE_KEY_PATH="path/to/your/private.pem"
API_METHOD="POST"
API_CALL="api/v3/order"
API_PARAMS="symbol=BTCUSDT&side=SELL&type=LIMIT&timeInForce=GTC&quantity=1&price=0.2"
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')
signature=$(rawurlencode "$rawSignature")
curl -H "X-MBX-APIKEY: $API_KEY" -X "$API_METHOD" \
"https://api.binance.com/$API_CALL?$api_params_with_timestamp" \
--data-urlencode "signature=$signature"
```
### Response
#### Success Response (200)
- **symbol** (string) - The trading pair.
- **orderId** (integer) - The unique identifier for the order.
- **clientOrderId** (string) - The client-generated order ID.
#### Response Example
```json
{
"symbol": "BTCUSDT",
"orderId": 123456789,
"clientOrderId": "my_custom_id_123"
}
```
```
--------------------------------
### Place Order with WebSocket API
Source: https://developers.binance.com/docs/zh-CN/binance-spot-api-docs/websocket-api/request-security
This example demonstrates how to place an order using the WebSocket API. It includes setting up API keys, loading private keys, constructing request parameters, calculating a signature, and sending the request over a WebSocket connection.
```python
API_KEY='替换成您的 API Key'
PRIVATE_KEY_PATH='test-prv-key.pem'
with open(PRIVATE_KEY_PATH, 'rb') as f:
private_key = load_pem_private_key(data=f.read(), password=None)
params = {
'apiKey': API_KEY,
'symbol': '123456',
'side': 'SELL',
'type': 'LIMIT',
'timeInForce': 'GTC',
'quantity': '1.0000000',
'price': '0.10000000',
'recvWindow': 5000
}
timestamp = int(time.time() * 1000) # UNIX timestamp in milliseconds
params['timestamp'] = timestamp
params = dict(sorted(params.items()))
payload = '&'.join([f"{k}={v}" for k,v in params.items()]) # no percent encoding here!
signature = base64.b64encode(private_key.sign(payload.encode('UTF-8')))
params['signature'] = signature.decode('ASCII')
request = {
'id': 'my_new_order',
'method': 'order.place',
'params': params
}
ws = create_connection("wss://ws-api.binance.com:443/ws-api/v3")
ws.send(json.dumps(request))
result = ws.recv()
ws.close()
print(result)
```
--------------------------------
### 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 Updates
Source: https://developers.binance.com/docs/zh-CN/binance-spot-api-docs/CHANGELOG
For orders where `trailingDelta` is provided for TAKE_PROFIT, TAKE_PROFIT_LIMIT, STOP_LOSS, or STOP_LOSS_LIMIT, the `trailingTime` field will now appear in the response. This field indicates the time when the trailing order was activated and started tracking price changes.
```APIDOC
## Trailing Order Updates
### Description
When `trailingDelta` is used with specific order types, the `trailingTime` field will be included in the response. This indicates when the trailing order became active and began tracking price movements.
### Affected 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
### Response Fields Added
- **trailingTime** (long) - The time in ms when the trailing order was activated and started tracking price changes.
```
--------------------------------
### Rolling Window Calculation Example
Source: https://developers.binance.com/docs/zh-CN/binance-spot-api-docs/websocket-api/market-data-requests
This example illustrates the openTime and closeTime derived from a rolling window price change statistics request. Note that due to precision limitations, the effective window might be slightly wider than the requested windowSize.
```json
{
"openTime": 1659580020000,
"closeTime": 1660184865291
}
```
--------------------------------
### Placing an Order with Ed25519 Keys
Source: https://developers.binance.com/docs/zh-CN/binance-spot-api-docs/rest-api/request-security
This example demonstrates how to place an order using the Binance API with Ed25519 keys for authentication. It includes the necessary headers and parameters for a POST request.
```APIDOC
## POST /api/v3/order
### Description
Places an order on the Binance exchange. This endpoint requires authentication using API keys and a signature.
### Method
POST
### Endpoint
https://api.binance.com/api/v3/order
### Parameters
#### Query Parameters
- **symbol** (string) - Required - The trading pair symbol (e.g., 123456).
- **side** (string) - Required - Order side (e.g., SELL).
- **type** (string) - Required - Order type (e.g., LIMIT).
- **timeInForce** (string) - Required - Time in force (e.g., GTC).
- **quantity** (number) - Required - The quantity of the asset to trade.
- **price** (number) - Required - The price at which to place the order.
- **timestamp** (long) - Required - The current timestamp in milliseconds.
- **recvWindow** (long) - Optional - The number of milliseconds a request should be valid for.
- **signature** (string) - Required - The signature generated using your Ed25519 private key.
### Request Example
```bash
curl -H "X-MBX-APIKEY: 4yNzx3yWC5bS6YTwEkSRaC0nRmSQIIStAUOh1b6kqaBrTLIhjCpI5lJH8q8R8WNO" -X POST 'https://api.binance.com/api/v3/order?symbol=%EF%BC%91%EF%BC%92%EF%BC%93%EF%BC%94%EF%BC%95%EF%BC%96&side=SELL&type=LIMIT&timeInForce=GTC&quantity=1&price=0.2×tamp=1668481559918&recvWindow=5000&signature=qJtv66wyp%2F1mZE%2BmIFAAMUoTe8xkmLN7%2FeAZjuC9x1ocxovItHLl%2FsNK7Wq8QjgiHqGn0bb8P7yVvGBEd1gFe71NQ8aM0M%2BJNIMz5UFxfeA53rXjFlvsyH1Sig%2BOuO9Nz5nhCaJ6bEfj2iuv7w27pB3L8MVqmoCi6D9C%2FQMiLxtPaR70CxtnvoOlIgPmpv2bQy029A31NEK19ieVLkoyp1EUkXRaX3v0mohx8yMnUG1dhX9nUg3Oy8TYZ03DQy7kHDGkMKisNX7rt%2FGuGx1HIgjFclDGLsbAFIodvSLjm9FbseasMELoxlAJDlwRnW8zo5sQmL0Fz7ao935QBynrng%3D%3D'
```
### Response
#### Success Response (200)
- **orderId** (long) - The ID of the placed order.
- **symbol** (string) - The trading pair symbol.
- **status** (string) - The current status of the order.
#### Response Example
```json
{
"orderId": 123456789,
"symbol": "123456",
"status": "NEW"
}
```
```
--------------------------------
### Binance API GET /api/v3/klines Example
Source: https://developers.binance.com/docs/zh-CN/binance-spot-api-docs/CHANGELOG
This endpoint retrieves candlestick data. The API now allows startTime and endTime parameters to be equal.
```json
GET /api/v3/klines
```
--------------------------------
### Commission Configuration Example
Source: https://developers.binance.com/docs/zh-CN/binance-spot-api-docs/faqs/commission_faq
Example JSON structure representing commission rates for a symbol, including standard, special, tax commissions, and discount settings.
```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"
}
}
```
--------------------------------
### Logon Request Message Example
Source: https://developers.binance.com/docs/zh-CN/binance-spot-api-docs/fix-api
This example shows a Logon request message, which is the first message sent by a client to authenticate a connection. It includes fields like EncryptMethod, HeartBtInt, Username, and RawData for signature.
```fix
8=FIX.4.4|9=248|35=A|34=1|49=5JQmUOsm|52=20240612-08:52:21.613|56=SPOT|95=88|96=KhJLbZqADWknfTAcp0ZjyNz36Kxa4ffvpNf9nTIc+K5l35h+vA1vzDRvLAEQckyl6VDOwJ53NOBnmmRYxQvQBQ==|98=0|108=30|141=Y|553=W5rcOD30c0gT4jHK8oX5d5NbzWoa0k4SFVoTHIFNJVZ3NuRpYb6ZyJznj8THyx5d|25035=1|10=000|
```
--------------------------------
### GET /api/v3/historicalTrades - Query Historical Trades
Source: https://developers.binance.com/docs/zh-CN/binance-spot-api-docs/rest-api/market-data-endpoints
Retrieves historical trades for a symbol. You can specify a 'limit' (up to 1000) and a 'fromId' to start fetching from a specific trade ID.
```http
GET /api/v3/historicalTrades
```
```json
[
{
"id": 28457,
"price": "4.00000100",
"qty": "12.00000000",
"quoteQty": "48.000012",
"time": 1499865549590,
"isBuyerMaker": true,
"isBestMatch": true
}
]
```
--------------------------------
### Example POST Request with RSA Signature
Source: https://developers.binance.com/docs/zh-CN/binance-spot-api-docs/rest-api/request-security
This is an example of a POST request to the /api/v3/order endpoint, including the necessary API key, parameters, timestamp, and a generated RSA signature.
```bash
curl -H "X-MBX-APIKEY: CAvIjXy3F44yW6Pou5k8Dy1swsYDWJZLeoK2r8G4cFDnE9nosRppc2eKc1T8TRTQ" -X POST 'https://api.binance.com/api/v3/order?symbol=%EF%BC%91%EF%BC%92%EF%BC%93%EF%BC%94%EF%BC%95%EF%BC%96&side=SELL&type=LIMIT&timeInForce=GTC&quantity=1&price=0.2×tamp=1668481559918&recvWindow=5000&signature=qJtv66wyp%2F1mZE%2BmIFAAMUoTe8xkmLN7%2FeAZjuC9x1ocxovItHLl%2FsNK7Wq8QjgiHqGn0bb8P7yVvGBEd1gFe71NQ8aM0M%2BJNIMz5UFxfeA53rXjFlvsyH1Sig%2BOuO9Nz5nhCaJ6bEfj2iuv7w27pB3L8MVqmoCi6D9C%2FQMiLxtPaR70CxtnvoOlIgPmpv2bQy029A31NEK19ieVLkoyp1EUkXRaX3v0mohx8yMnUG1dhX9nUg3Oy8TYZ03DQy7kHDGkMKisNX7rt%2FGuGx1HIgjFclDGLsbAFIodvSLjm9FbseasMELoxlAJDlwRnW8zo5sQmL0Fz7ao935QBynrng%3D%3D'
```
--------------------------------
### GET /api/v3/order, GET /api/v3/openOrders, GET /api/v3/allOrders Updates
Source: https://developers.binance.com/docs/zh-CN/binance-spot-api-docs/CHANGELOG
The `workingTime` field, indicating when an order was added to the order book, is now included in the responses for GET /api/v3/order, GET /api/v3/openOrders, and GET /api/v3/allOrders.
```APIDOC
## Order Query Endpoints Updates
### Description
Responses for order query endpoints now include the `workingTime` field, which specifies when the order was added to the order book.
### Affected Endpoints
- GET /api/v3/order
- GET /api/v3/openOrders
- GET /api/v3/allOrders
### Response Fields Added
- **workingTime** (long) - The time in ms that the order was added to the order book.
```
--------------------------------
### Clone and Build Simple Binary Encoding
Source: https://developers.binance.com/docs/zh-CN/binance-spot-api-docs/faqs/sbe_faq
Instructions for cloning the Simple Binary Encoding (SBE) repository and building the project using Gradle. This is a prerequisite for generating SBE decoders.
```bash
$ git clone https://github.com/real-logic/simple-binary-encoding.git
$ cd simple-binary-encoding
$ ./gradlew
```
--------------------------------
### GET /api/v3/order, GET /api/v3/openOrders, GET /api/v3/allOrders - New Parameters
Source: https://developers.binance.com/docs/zh-CN/binance-spot-api-docs
The GET /api/v3/order, GET /api/v3/openOrders, and GET /api/v3/allOrders endpoints now support the strategyId and strategyType parameters, which will be returned in the response JSON if provided during order placement.
```APIDOC
## GET /api/v3/order, GET /api/v3/openOrders, GET /api/v3/allOrders
### Description
New parameters `strategyId` and `strategyType` are now supported. These parameters must be provided during order placement to be included in the response JSON.
### Parameters
#### Query Parameters
- **strategyId** (string) - Optional - Identifier for the strategy associated with the order.
- **strategyType** (integer) - Optional - Type of the strategy associated with the order.
### Method
GET
### Endpoint
/api/v3/order
/api/v3/openOrders
/api/v3/allOrders
```
--------------------------------
### Order Response Example
Source: https://developers.binance.com/docs/zh-CN/binance-spot-api-docs/rest-api/trading-endpoints
This is an example of a typical order response, showing trade details like commission and trade ID.
```json
{
"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
}
]
}
```
--------------------------------
### GET /api/v3/ticker and GET /api/v3/ticker/24hr Update
Source: https://developers.binance.com/docs/zh-CN/binance-spot-api-docs/CHANGELOG
New optional query parameter `type` added to GET /api/v3/ticker and GET /api/v3/ticker/24hr. It accepts 'FULL' (default) or 'MINI', where 'MINI' omits several fields for a more concise response.
```APIDOC
## GET /api/v3/ticker and GET /api/v3/ticker/24hr
### Description
Get ticker price change statistics. A new optional query parameter `type` has been added. `FULL` is the default and returns all fields. `MINI` omits `priceChangePercent`, `weightedAvgPrice`, `bidPrice`, `bidQty`, `askPrice`, `askQty`, and `lastQty`.
### Method
GET
### Endpoint
/api/v3/ticker
/api/v3/ticker/24hr
### Parameters
#### Query Parameters
- **symbol** (string) - Optional - The symbol to query.
- **type** (enum) - Optional - `FULL` (default) or `MINI`.
```
--------------------------------
### Example Logon FIX Message
Source: https://developers.binance.com/docs/zh-CN/binance-spot-api-docs/fix-api
This is a complete example of a Logon FIX message, including the signed `RawData` (96) field. It demonstrates the structure and required fields for initiating a FIX API connection.
```fix
8=FIX.4.4|9=247|35=A|34=1|49=EXAMPLE|52=20240627-11:17:25.223|56=SPOT|95=88|96=4MHXelVVcpkdwuLbl6n73HQUXUf1dse2PCgT1DYqW9w8AVZ1RACFGM+5UdlGPrQHrgtS3CvsRURC1oj73j8gCA==|98=0|108=30|141=Y|553=sBRXrJx2DsOraMXOaUovEhgVRcjOvCtQwnWj8VxkOh1xqboS02SPGfKi2h8spZJb|25035=2|10=227|
```
--------------------------------
### GET /api/v3/ticker and GET /api/v3/ticker/24hr Updates
Source: https://developers.binance.com/docs/zh-CN/binance-spot-api-docs
The GET /api/v3/ticker and GET /api/v3/ticker/24hr endpoints now support an optional 'type' parameter, which can be set to 'FULL' (default) or 'MINI'. The 'MINI' type reduces the response size by omitting several fields.
```APIDOC
## GET /api/v3/ticker and GET /api/v3/ticker/24hr
### Description
Get ticker price change statistics. An optional 'type' parameter has been added. 'FULL' is the default and returns all fields. 'MINI' omits several fields to reduce response size.
### Method
GET
### Endpoint
/api/v3/ticker or /api/v3/ticker/24hr
### Parameters
#### Query Parameters
- **type** (enum) - Optional - `FULL` (default) or `MINI`.
### Response
#### Success Response (200)
- **priceChangePercent** (string) - Omitted in 'MINI' type.
- **weightedAvgPrice** (string) - Omitted in 'MINI' type.
- **bidPrice** (string) - Omitted in 'MINI' type.
- **bidQty** (string) - Omitted in 'MINI' type.
- **askPrice** (string) - Omitted in 'MINI' type.
- **askQty** (string) - Omitted in 'MINI' type.
- **lastQty** (string) - Omitted in 'MINI' type.
```
--------------------------------
### FIX SBE Trade Stream Example (Fragmented)
Source: https://developers.binance.com/docs/zh-CN/binance-spot-api-docs/fix-api
Example of a fragmented MarketDataIncrementalRefresh message for the Trade Stream. Note that NoMDEntry is limited to 2 for this example, but can be up to 10000 in actual streams.
```fix
8=FIX.4.4|9=237|35=X|34=114|49=SPOT|52=20250116-19:36:44.544549|56=EXAMPLE|262=id|268=2|279=0|270=240.00|271=3.00000000|269=2|55=BNBBUSD|60=20250116-19:36:44.196569|1003=67|279=0|270=238.00|271=2.00000000|269=2|60=20250116-19:36:44.196569|1003=68|893=N|10=180|
```
```fix
8=FIX.4.4|9=163|35=X|34=115|49=SPOT|52=20250116-19:36:44.544659|56=EXAMPLE|262=id|268=1|279=0|270=233.00|271=1.00000000|269=2|55=BNBBUSD|60=20250116-19:36:44.196569|1003=69|893=Y|10=243|
```
--------------------------------
### Complete Bash Script for API Request
Source: https://developers.binance.com/docs/zh-CN/binance-spot-api-docs/rest-api/request-security
A comprehensive Bash script demonstrating all steps: setting keys, constructing the payload, calculating the signature, and sending the request.
```bash
apiKey="vmPUZE6mv9SD5VNHk4HlWFsOr6aKE2zvsw0MuIgwCIPy6utIco14y7Ju91duEh8A"
secretKey="NhqPtmdSJYdKjVHjA7PZj4Mge3R5YNiP1e3UZjInClVN65XAbvqqM6A7H5fATj0j"
payload="symbol=LTCBTC&side=BUY&type=LIMIT&timeInForce=GTC&quantity=1&price=0.1&recvWindow=5000×tamp=1499827319559"
# 对请求进行签名
signature=$(echo -n "$payload" | openssl dgst -sha256 -hmac "$secretKey")
signature=${signature#*= } # Keep only the part after the "= "
# 发送请求
curl -H "X-MBX-APIKEY: $apiKey" -X POST "https://api.binance.com/api/v3/order?$payload&signature=$signature"
```
--------------------------------
### GET /api/v3/historicalTrades
Source: https://developers.binance.com/docs/zh-CN/binance-spot-api-docs
Get historical trades. The call weight has been changed to 20.
```APIDOC
## GET /api/v3/historicalTrades
### Description
Get historical trades. The call weight has been changed to 20.
### Method
GET
### Endpoint
/api/v3/historicalTrades
### Parameters
#### Query Parameters
- **symbol** (string) - Required - The symbol you want to query for.
- **limit** (integer) - Optional - Default 500, Max 1000
- **fromId** (long) - Optional - The ID of the trade to get the historical trade data after
- **startTime** (long) - Optional - Get trades data before this time
- **endTime** (long) - Optional - Get trades data after this time
### Response
#### Success Response (200)
- **id** (long) - Trade id
- **price** (string) - Trade price
- **qty** (string) - Trade quantity
- **time** (long) - Trade time
- **isBuyerMaker** (boolean) - Whether the buyer is the maker
- **isBestMatch** (boolean) - Whether the trade is best price match
```
--------------------------------
### GET /api/v1/aggTrades
Source: https://developers.binance.com/docs/zh-CN/binance-spot-api-docs
Get aggregate trades. The call weight has been changed to 2.
```APIDOC
## GET /api/v1/aggTrades
### Description
Get aggregate trades. The call weight has been changed to 2.
### Method
GET
### Endpoint
/api/v1/aggTrades
### Parameters
#### Query Parameters
- **symbol** (string) - Optional - The symbol you want to query for.
- **limit** (integer) - Optional - Default 500, Max 1000
- **startTime** (long) - Optional - Get trades data before this time
- **endTime** (long) - Optional - Get trades data after this time
- **fromId** (long) - Optional - The ID of the trade to get the aggregate trade data after
### Response
#### Success Response (200)
- **aggTradeId** (long) - Aggregate trade id
- **price** (string) - Aggregate trade price
- **quantity** (string) - Aggregate trade quantity
- **firstId** (long) - First trade id
- **lastId** (long) - Last trade id
- **time** (long) - Trade time
- **isBuyerMaker** (boolean) - Whether the buyer is the maker
- **isBestMatch** (boolean) - Whether the trade is best price match
```
--------------------------------
### Symbol STP Configuration Example
Source: https://developers.binance.com/docs/zh-CN/binance-spot-api-docs/faqs/stp_faq
This JSON object shows the STP configuration for a trading symbol. It specifies the default STP mode and the allowed STP modes for placing orders.
```json
{
"defaultSelfTradePreventionMode": "NONE",
"allowedSelfTradePreventionModes": ["NONE", "EXPIRE_TAKER", "EXPIRE_BOTH"]
}
```
--------------------------------
### Binance WebSocket API allOrders Example
Source: https://developers.binance.com/docs/zh-CN/binance-spot-api-docs/CHANGELOG
This WebSocket stream provides all orders. The API now allows startTime and endTime parameters to be equal.
```json
allOrders
```
--------------------------------
### GET /api/v3/account Update
Source: https://developers.binance.com/docs/zh-CN/binance-spot-api-docs/CHANGELOG
The response for GET /api/v3/account will now include the `commissionRates` field.
```APIDOC
## GET /api/v3/account
### Description
Get current account information. The `commissionRates` field has been added to the response.
### Method
GET
### Endpoint
/api/v3/account
### Response Fields Added
- **commissionRates** (object) - Commission rates for different trading types.
```
--------------------------------
### Binance WebSocket API allOrderList Example
Source: https://developers.binance.com/docs/zh-CN/binance-spot-api-docs/CHANGELOG
This WebSocket stream provides all order lists. The API now allows startTime and endTime parameters to be equal.
```json
allOrderList
```
--------------------------------
### FIX SBE Diff. Depth Stream Example (Fragmented)
Source: https://developers.binance.com/docs/zh-CN/binance-spot-api-docs/fix-api
Example of fragmented MarketDataIncrementalRefresh messages for the Diff. Depth Stream. Note that NoMDEntry is limited to 2 for this example, but can be up to 10000 in actual streams.
```fix
8=FIX.4.4|9=156|35=X|34=12|49=SPOT|52=20250116-19:45:31.774162|56=EXAMPLE|262=id|268=2|279=2|270=362.00|269=0|55=BNBBUSD|25043=1143|25044=1145|279=2|270=313.00|269=0|893=N|10=047|
```
```fix
8=FIX.4.4|9=171|35=X|34=13|49=SPOT|52=20250116-19:45:31.774263|56=EXAMPLE|262=id|268=2|279=2|270=284.00|269=0|55=BNBBUSD|25043=1143|25044=1145|279=1|270=264.00|271=3.00000000|269=0|893=N|10=239|
```
```fix
8=FIX.4.4|9=149|35=X|34=14|49=SPOT|52=20250116-19:45:31.774281|56=EXAMPLE|262=id|268=1|279=1|270=395.00|271=19.00000000|269=1|55=BNBBUSD|25043=1143|25044=1145|893=Y|10=024|
```
--------------------------------
### GET /api/v3/account
Source: https://developers.binance.com/docs/zh-CN/binance-spot-api-docs
Get current account information. The call weight has been changed to 20.
```APIDOC
## GET /api/v3/account
### Description
Get current account information. The call weight has been changed to 20.
### Method
GET
### Endpoint
/api/v3/account
### Parameters
#### Query Parameters
- **timestamp** (number) - Required - UTC timestamp in ms
- **signature** (string) - Required - Signature generated by HMAC SHA256
- **recvWindow** (number) - Optional - The request was received before this time. Defaults to 5000
### Response
#### Success Response (200)
- **makerCommission** (integer) - account maker commission
- **takerCommission** (integer) - account taker commission
- **buyerCommission** (integer) - account buyer commission
- **sellerCommission** (integer) - account seller commission
- **canTrade** (boolean)
- **canWithdraw** (boolean)
- **canDeposit** (boolean)
- **updateTime** (number) - last account update time
- **accountType** (string)
- **balances** (array)
- **asset** (string)
- **free** (string)
- **locked** (string)
- **permissions** (array)
```
--------------------------------
### GET /api/v3/exchangeInfo - allowTrailingStop Field
Source: https://developers.binance.com/docs/zh-CN/binance-spot-api-docs
The GET /api/v3/exchangeInfo endpoint now includes the `allowTrailingStop` field.
```APIDOC
## GET /api/v3/exchangeInfo - allowTrailingStop Field
### Description
Added new field `allowTrailingStop` to the `GET /api/v3/exchangeInfo` endpoint.
### Method
GET
### Endpoint
/api/v3/exchangeInfo
```
--------------------------------
### GET /api/v3/uiKlines
Source: https://developers.binance.com/docs/zh-CN/binance-spot-api-docs/CHANGELOG
A new endpoint GET /api/v3/uiKlines has been added for retrieving UI klines.
```APIDOC
## GET /api/v3/uiKlines
### Description
Retrieves UI klines data.
### Method
GET
### Endpoint
/api/v3/uiKlines
```
--------------------------------
### RSA (2048 bits) Public Key Example
Source: https://developers.binance.com/docs/zh-CN/binance-spot-api-docs/faqs/api_key_types
Example of an RSA (2048 bits) public key. This key is shared with Binance to verify your requests.
```text
-----BEGIN PUBLIC KEY-----
MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAyfKiFXpcOhF5rX1XxePN
akwN7Etwtn3v05cZNY+ftDHbVZHs/kY6Ruj5lhxVFAq5dv7Ba9/4jPijXuMuIc6Y
8nUlqtrrxC8DEOAczw9SKATDYZN9nbLfYlbBFfHzRQUXdAtYCPI6XtxmJBS7aOBb
4nZe1SVm+bhLrp0YQnx2P0s+37qkGeVn09m6w9MnWxjgCkkYFPWQkXIu5qOnwx6p
NfqDmFD7d7dUc/6PZQ1bKFALu/UETsobmBk82ShbrBhlc0JXuhf9qBR7QASjHjFQ
2N+VF2PfH8dm5prZIpz/MFKPkBW4Yuss0OXiD+jQt1J2JUKspLqsIqoXjHQQGjL7
3wIDAQAB
-----END PUBLIC KEY-----
```
--------------------------------
### GET /api/v3/ticker/24hr, GET /api/v3/ticker/price, GET /api/v3/ticker/bookTicker - Symbol Query
Source: https://developers.binance.com/docs/zh-CN/binance-spot-api-docs
These endpoints now support querying multiple symbols using the 'symbols' parameter, with request weights varying based on the number of symbols requested.
```APIDOC
## Multiple Symbol Queries
### Description
The following endpoints support the `symbols` parameter for querying multiple symbols. Request weights vary based on the number of symbols.
### Endpoints
- `GET /api/v3/ticker/24hr`
- `GET /api/v3/ticker/price`
- `GET /api/v3/ticker/bookTicker`
### Weight Table
| Interface | 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 | 40 |
```