Get All Orders (Including History)
Description
Get all orders for a specific trading pair (including active, canceled, or filled orders).
HTTP Request
GET /fapi/v1/allOrders (HMAC SHA256)
Weight
5
Request Parameters
| Name | Type | Required | Description |
|---|---|---|---|
| symbol | STRING | YES | Trading pair |
| orderId | LONG | NO | System order ID |
| startTime | LONG | NO | Start time |
| endTime | LONG | NO | End time |
| limit | INT | NO | Default 500; Max 1000 |
| timestamp | LONG | YES | Timestamp |
Response Example
[
{
"avgPrice": "0.00000",
"clientOrderId": "abc",
"cumQty": "0",
"cumQuote": "0",
"executedQty": "0",
"orderId": 1917641,
"origQty": "0.40",
"origType": "LIMIT",
"price": "3.30000",
"reduceOnly": false,
"side": "BUY",
"positionSide": "BOTH",
"status": "NEW",
"stopPrice": "0",
"closePosition": false,
"symbol": "BTCUSDT",
"time": 1579581837605,
"timeInForce": "GTC",
"type": "LIMIT",
"activatePrice": "9020",
"priceRate": "0.3",
"updateTime": 1579581837605,
"workingType": "CONTRACT_PRICE",
"priceProtect": false
}
]
Returns data for the most recent 3 months only.
Code Examples
cURL
API_KEY="your_api_key"
API_SECRET="your_api_secret"
TIMESTAMP=$(date +%s%3N)
QUERY_STRING="symbol=BTCUSDT&limit=500×tamp=${TIMESTAMP}"
SIGNATURE=$(echo -n "${QUERY_STRING}" | openssl dgst -sha256 -hmac "${API_SECRET}" | awk '{print $2}')
curl -s -H "X-MBX-APIKEY: ${API_KEY}" \
"https://api-sepolia.ztdx.io/fapi/v1/allOrders?${QUERY_STRING}&signature=${SIGNATURE}"
Python
import time, hmac, hashlib, requests
API_KEY = "your_api_key"
API_SECRET = "your_api_secret"
BASE_URL = "https://api.ztdx.io"
def sign(params: str) -> str:
return hmac.new(API_SECRET.encode(), params.encode(), hashlib.sha256).hexdigest()
def signed_get(path, params={}):
params["timestamp"] = int(time.time() * 1000)
qs = "&".join(f"{k}={v}" for k, v in params.items())
params["signature"] = sign(qs)
return requests.get(f"{BASE_URL}{path}", params=params, headers={"X-MBX-APIKEY": API_KEY})
# Get all orders history for BTCUSDT
resp = signed_get("/fapi/v1/allOrders", params={
"symbol": "BTCUSDT",
"limit": "500"
})
print(resp.json())