New Order
Description
Create and submit a new order.
HTTP Request
POST /fapi/v1/order (HMAC SHA256)
Weight
0 (The order endpoint does not consume general weight, but is subject to order rate limits)
Request Parameters
| Name | Type | Required | Description |
|---|---|---|---|
| symbol | STRING | YES | Trading pair |
| side | ENUM | YES | Order side: BUY, SELL |
| positionSide | ENUM | NO | Position side: BOTH, LONG, SHORT (only BOTH is currently supported — ZTDX is one-way mode only) |
| type | ENUM | YES | Order type: LIMIT, MARKET, STOP, TAKE_PROFIT, STOP_MARKET, TAKE_PROFIT_MARKET, TRAILING_STOP_MARKET. STOP_LIMIT and TAKE_PROFIT_LIMIT are accepted as aliases for STOP and TAKE_PROFIT. |
| reduceOnly | BOOL or STRING | NO | true / false / "true" / "false". Reduce-only orders are clamped to the opposite-side position size at admission and rejected if they would open or flip a position. reduceOnly=true orders bypass the MIN_NOTIONAL filter so a sub-10 USD residual position can still be closed; LOT_SIZE and MAX_NOTIONAL still apply. |
| quantity | DECIMAL | NO | Order quantity. Floored to the symbol's lot size; the resulting notional must satisfy the symbol's min/max bounds, otherwise -1013. The error message starts with Filter failure: <FILTER>. where <FILTER> is one of LOT_SIZE, MIN_NOTIONAL, or MAX_NOTIONAL — clients can switch on the filter type. |
| price | DECIMAL | NO | Order price |
| newClientOrderId | STRING | NO | User-defined order ID. Persisted; round-tripped on query-order / all-orders. |
| stopPrice | DECIMAL | NO | Stop / trigger price. Trigger orders whose condition is already satisfied at submission are rejected with -2021. |
| activationPrice | DECIMAL | NO | Activation price (trailing stop orders only) |
| callbackRate | DECIMAL | NO | Callback rate (trailing stop orders only) |
| timeInForce | ENUM | NO | Time in force: GTC, IOC, FOK, GTX. GTX is post-only — a crossing GTX order is rejected with -2010. IOC / FOK semantics are strictly enforced at the engine level. |
| workingType | ENUM | NO | Working type: MARK_PRICE, CONTRACT_PRICE |
| recvWindow | LONG | NO | See Endpoint Security Type |
| timestamp | LONG | YES | Timestamp |
Attaching take-profit / stop-loss to a market entry
To open a position with TP and/or SL, place the market entry first, then submit one or two reduce-only trigger orders sitting on the opposite side at the desired trigger price:
| Order | type | side | stopPrice | reduceOnly |
|---|---|---|---|---|
| Entry | MARKET | your direction (BUY / SELL) | — | false |
| Take-profit | TAKE_PROFIT_MARKET | opposite of entry | TP trigger price | true |
| Stop-loss | STOP_MARKET | opposite of entry | SL trigger price | true |
The trigger orders execute as MARKET when their stopPrice is hit
against the configured workingType (MARK_PRICE or CONTRACT_PRICE).
Cancel them explicitly via DELETE /fapi/v1/order if you close the
position by other means — they are not chained to the entry.
Response Example
{
"clientOrderId": "testOrder1",
"cumQty": "0",
"cumQuote": "0",
"executedQty": "0",
"orderId": 2254222045,
"avgPrice": "0.00000",
"origQty": "10",
"price": "0",
"reduceOnly": false,
"side": "SELL",
"positionSide": "BOTH",
"status": "NEW",
"stopPrice": "0",
"closePosition": false,
"symbol": "BTCUSDT",
"timeInForce": "GTC",
"type": "TRAILING_STOP_MARKET",
"origType": "TRAILING_STOP_MARKET",
"activatePrice": "9020",
"priceRate": "0.3",
"updateTime": 1566818724722,
"workingType": "CONTRACT_PRICE",
"priceProtect": false
}
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?${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"},
)
# Place a LIMIT BUY order for BTCUSDT
resp = signed_post("/fapi/v1/order", body={
"symbol": "BTCUSDT",
"side": "BUY",
"type": "LIMIT",
"timeInForce": "GTC",
"quantity": "0.01",
"price": "60000",
})
print(resp.json())