New Algo Order (Conditional)
Description
Create a Binance-compatible conditional (algo) order. Supports take-profit, stop-loss, and trailing-stop variants backed by ZTDX's trigger-order engine.
HTTP Request
POST /fapi/v1/algoOrder (HMAC SHA256)
Request Parameters
| Name | Type | Required | Description |
|---|---|---|---|
| algoType | ENUM | NO | CONDITIONAL (only value accepted) |
| symbol | STRING | YES | Trading pair |
| side | ENUM | YES | BUY, SELL |
| positionSide | ENUM | NO | Must be BOTH — ZTDX is one-way mode |
| type | ENUM | YES | STOP, STOP_MARKET, TAKE_PROFIT, TAKE_PROFIT_MARKET, TRAILING_STOP_MARKET |
| timeInForce | ENUM | NO | GTC (default), GTD. Other values accepted but treated as GTC |
| quantity | DECIMAL | NO | Base-currency amount. Required unless closePosition=true. Internally converted to a USD notional size (quantity × reference price, where the reference price is triggerPrice, or activatePrice / mark for TRAILING_STOP_MARKET) — see the response note below. |
| price | DECIMAL | NO | Limit price; required for STOP and TAKE_PROFIT |
| triggerPrice / stopPrice | DECIMAL | YES (except TRAILING_STOP_MARKET) | Trigger price |
| workingType | ENUM | NO | MARK_PRICE, CONTRACT_PRICE (default) |
| closePosition | BOOL/STRING | NO | true closes the entire position on trigger. Mutually exclusive with quantity and reduceOnly. Only valid for STOP_MARKET / TAKE_PROFIT_MARKET. |
| priceProtect | BOOL/STRING | NO | Accepted, no-op for v1 |
| reduceOnly | BOOL/STRING | NO | true to make the triggered order reduce-only |
| activatePrice | DECIMAL | NO | Trailing-stop activation price. Defaults to current mark price |
| callbackRate | DECIMAL | YES for TRAILING_STOP_MARKET | Trailing callback ∈ [0.1, 10] (percent) |
| clientAlgoId | STRING | NO | Custom client-side ID |
| newOrderRespType | ENUM | NO | ACK, RESULT. Default ACK |
| goodTillDate | LONG | YES if timeInForce=GTD | Auto-cancel timestamp in ms. Must be ≥ now + 600s |
| recvWindow | LONG | NO | Accepted but ignored — the server enforces a fixed ±60 second timestamp window instead |
| timestamp | LONG | YES | Request timestamp (ms) |
Response Example
{
"algoId": 12345,
"clientAlgoId": "myStopLoss-001",
"algoType": "CONDITIONAL",
"orderType": "STOP_MARKET",
"symbol": "BTCUSDT",
"side": "SELL",
"positionSide": "BOTH",
"timeInForce": "GTC",
"quantity": "600",
"algoStatus": "NEW",
"triggerPrice": "60000",
"price": "0",
"closePosition": false,
"priceProtect": false,
"reduceOnly": true,
"activatePrice": null,
"callbackRate": null,
"workingType": "CONTRACT_PRICE",
"createTime": 1716000000000,
"updateTime": 1716000000000,
"triggerTime": 0,
"goodTillDate": 0
}
Note on
quantity: the response reports the order's USD notional size (request quantity × reference price), not the base-currency amount that was sent. In the example above, a request withquantity=0.01andtriggerPrice=60000comes back as"quantity": "600".
Errors
| Code | Cause |
|---|---|
| -1100 | Invalid numeric value (e.g. negative price, callbackRate out of range) |
| -1102 | Missing required parameter |
| -1106 | quantity / closePosition / reduceOnly combination invalid |
| -1121 | Unknown symbol |
| -1130 | Unsupported type / side / positionSide |
| -2010 | Per-user / per-position trigger-order limit reached |
No immediate-trigger rejection: unlike
POST /fapi/v1/order, this endpoint does not pre-check whether the trigger condition is already satisfied at submission. An order whosetriggerPriceis already met is accepted normally and fires on the next price tick — no-2021is returned.