Test New Order
Description
Test whether an order can be placed successfully. This endpoint does not count toward order rate limits and does not actually execute the order.
HTTP Request
POST /fapi/v1/order/test (HMAC SHA256)
Weight
1
Request Parameters
Same as New Order interface.
Response Example
{}
If the test passes, the response is an empty object; if it fails, the corresponding error code is returned.
Code Examples
cURL
API_KEY="your_api_key"
API_SECRET="your_api_secret"
TIMESTAMP=$(date +%s%3N)
QUERY_STRING="symbol=BTCUSDT&side=BUY&type=LIMIT&timeInForce=GTC&quantity=0.01&price=60000×tamp=${TIMESTAMP}"
SIGNATURE=$(echo -n "${QUERY_STRING}" | openssl dgst -sha256 -hmac "${API_SECRET}" | awk '{print $2}')
curl -s -X POST \
-H "X-MBX-APIKEY: ${API_KEY}" \
"https://api-sepolia.ztdx.io/fapi/v1/order/test?${QUERY_STRING}&signature=${SIGNATURE}"
Python
import time, hmac, hashlib, requests, json
API_KEY = "your_api_key"
API_SECRET = "your_api_secret"
BASE_URL = "https://api.ztdx.io"
def sign(msg: str) -> str:
return hmac.new(API_SECRET.encode(), msg.encode(), hashlib.sha256).hexdigest()
def signed_post(path, body={}):
ts = int(time.time() * 1000)
qs = f"timestamp={ts}"
body_str = json.dumps(body, separators=(',', ':'))
sig = sign(qs + body_str)
return requests.post(
f"{BASE_URL}{path}?timestamp={ts}&signature={sig}",
data=body_str,
headers={"X-MBX-APIKEY": API_KEY, "Content-Type": "application/json"},
)
# Test a LIMIT BUY order for BTCUSDT (not actually executed)
resp = signed_post("/fapi/v1/order/test", body={
"symbol": "BTCUSDT",
"side": "BUY",
"type": "LIMIT",
"timeInForce": "GTC",
"quantity": "0.01",
"price": "60000",
})
print(resp.json()) # {}