New Algo Order (Conditional)
Description
Create a Binance-compatible conditional (algo) order. Supports take-profit, stop-loss, and trailing-stop variants backed by Primit's trigger-order engine.
HTTP Request
POST /fapi/v1/algoOrder (HMAC SHA256)
Weight
0 (subject to order rate limits)
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 — Primit 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 or quoteOrderQty is sent |
| quoteOrderQty | DECIMAL | NO | USDT-denominated size, alternative to quantity. Mutually exclusive with quantity and closePosition. Converted to a base-currency quantity at the type-appropriate reference price (price for STOP / TAKE_PROFIT, triggerPrice for STOP_MARKET / TAKE_PROFIT_MARKET, activatePrice or mark for TRAILING_STOP_MARKET) and floored to lot_size. Rejected with -1013 Filter failure: LOT_SIZE if it converts below one lot. |
| 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 (≤ 36 chars, [A-Za-z0-9_.-]) |
| 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 | See auth |
| 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": "0.01",
"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
}
Errors
| Code | Cause |
|---|---|
| -1013 | quoteOrderQty converts below the symbol's minimum lot size |
| -1100 | Invalid numeric value (e.g. negative price, callbackRate out of range) |
| -1102 | Missing required parameter |
| -1106 | quantity / quoteOrderQty / closePosition / reduceOnly combination invalid |
| -1121 | Unknown symbol |
| -1130 | Unsupported type / side / positionSide |
| -2010 | Per-user / per-position trigger-order limit reached, or reference price unavailable |
| -2021 | Order would immediately trigger at current price |