Perpetuals: advanced orders
Server-side execution algorithms and trigger structures: TWAP, VWAP, POV, scale, iceberg, pegged, conditional, OCO, bracket, trailing stop and sniper.
Advanced orders are execution algorithms and trigger structures that the exchange runs for you: you submit the intent, a server-side executor slices, watches or arms it, and child orders hit the book on your behalf. They survive client disconnects.
Every type follows the same shape:
POST /api/v1/perp/orders/{type} create
GET /api/v1/perp/orders/{type} list
DELETE /api/v1/perp/orders/{type}/{id} cancel
GET /api/v1/perp/orders/advanced list every type in one call{type} is one of twap, vwap, pov, scale, iceberg, oco, bracket, pegged, sniper, conditional, trailing-stop. Each create call costs weight 2 against your rate budget (Rate limits). All of them accept clientOrderId, leverage, positionSide and (where it makes sense) reduceOnly.
Scheduled execution
TWAP — spread a size evenly over a window.
| Field | Required | Notes |
|---|---|---|
market, side, totalSize, durationSeconds | ✓ | |
intervalSeconds | slice cadence | |
randomizeSeconds | jitter each slice to avoid a predictable footprint | |
slippageTolerance | per-slice bound |
VWAP — same idea, weighted toward expected volume.
| Field | Required | Notes |
|---|---|---|
market, side, totalSize, endTime | ✓ | endTime is UTC ms |
startTime, intervalSeconds | ||
useHistoricalProfile | weight slices by the market's historical volume curve instead of evenly |
POV — participate at a share of market volume.
| Field | Required | Notes |
|---|---|---|
market, side, totalSize, participationRate, maxDurationSeconds | ✓ | participationRate is a fraction of observed volume |
minSliceSize, maxSliceSize, priceLimit | bound each child order |
maxDurationSeconds is what stops a POV order from running forever in a market that stops trading — it is required for that reason.
Passive placement
Scale — a ladder of resting orders.
| Field | Required | Notes |
|---|---|---|
market, side, totalSize, numOrders, startPrice, endPrice | ✓ | |
sizeSkew | weight size toward one end of the ladder | |
postOnly, timeInForce |
Iceberg — show a slice, hide the rest.
| Field | Required | Notes |
|---|---|---|
market, side, totalSize, visibleSize, price | ✓ | only visibleSize is ever on the book |
Pegged — track the book instead of a fixed price.
| Field | Required | Notes |
|---|---|---|
market, side, size, pegType, offset | ✓ | offset from the pegged reference |
minPrice, maxPrice | hard bounds the peg may not cross |
Always set minPrice / maxPrice on a pegged order. Without them the peg follows the book wherever it goes.
Triggers and exits
Conditional — fire an order when a trigger price prints.
| Field | Required | Notes |
|---|---|---|
market, side, triggerPrice, size | ✓ | |
orderType, limitPrice, timeInForce | market or limit on trigger | |
triggerPriceType | which price arms the trigger (mark / last / index) |
OCO — two exits, either one cancels the other.
| Field | Required | Notes |
|---|---|---|
market, side, tpTriggerPrice, slTriggerPrice | ✓ | |
tpLimitPrice, slLimitPrice, tpSize, slSize | limit-priced and partial exits | |
positionId | bind the pair to a specific position |
Bracket — entry plus both exits, submitted as one structure.
| Field | Required | Notes |
|---|---|---|
market, side, size, takeProfitPrice, stopLossPrice | ✓ | |
entryType, entryPrice | omit for a market entry | |
takeProfitLimitPrice, stopLossLimitPrice, triggerPriceType |
Trailing stop — a stop that follows the favourable side.
| Field | Required | Notes |
|---|---|---|
market, side, size | ✓ | |
callbackRate or callbackDistance | trail by percentage or by absolute price | |
activationPrice | do not start trailing until this prints | |
useMarketOrder, limitOffsetRate, expiresAt |
Sniper — wait for a condition, then take aggressively.
| Field | Required | Notes |
|---|---|---|
market, side, size | ✓ | |
sniperType, targetPrice, breakoutDirection | what to watch for | |
minDepthQty, minSpreadBps | only fire into a book worth taking | |
maxExecutions, cooldownSeconds, validUntil | bound how often and how long it may fire |
Interaction with TP/SL
Bracket exits and OCO legs are protection on a position, the same slot that POST /perp/positions/{market}/tpsl writes to. Setting position TP/SL while a bracket or OCO is live is refused with POS_TPSL_EXISTS (14005), listing the order ids that hold that protection — send replace: true to cancel them and take over. The protection array on the position shows what is currently armed and which engine owns it.
Failure codes
| Code | Num | Meaning |
|---|---|---|
ADV_ORDER_NOT_FOUND | 18001 | unknown id for that type |
ADV_TYPE_NOT_SUPPORTED | 18002 | type not enabled on that market |
ADV_INVALID_DURATION | 18003 | duration outside allowed bounds |
ADV_INVALID_INTERVAL | 18004 | slice interval incompatible with the duration |
ADV_TRIGGER_PRICE | 18005 | trigger on the wrong side of the current price |
ADV_ALREADY_TRIGGERED / ADV_ALREADY_COMPLETED / ADV_ALREADY_CANCELLED | 18006–18008 | terminal state; cancels are no-ops |
ADV_MAX_CHILD_ORDERS | 18009 | the slicing plan would exceed the child-order ceiling |
Updated 9 days ago
