twapOrder
Places a time-weighted average price (TWAP) order on a perp. The node splits the total size s into market slices sent every interval seconds until the m-minute duration ends. The action is signed by an approved agent.
twapOrderExecute a large perp order in slices at a fixed interval over 5 minutes to 24 hours.Agent-signed
The TWAP parameters.
Perp instrument's external id — the `index` value from `perpMeta`.
`true` to buy, `false` to sell.
Seconds between slices.
510153060Total duration in **minutes**, from `5` to `1440`.
Reduce-only. Every slice inherits it.
Total size to execute across all slices, in base units.
Randomize slice timing. Always `false`.
falseMargin mode for the slices. When omitted, the account's current margin mode for this instrument applies.
"cross""isolated"Must be `twapOrder`.
"twapOrder"curl -X POST https://rpc.txflow-testnet.xyz/exchange \
-H "Content-Type: application/json" \
-H "x-api-version: 2026-08-16" \
-d '{
"action": {
"type": "twapOrder",
"twap": {
"a": 1,
"b": true,
"s": "0.1",
"r": false,
"m": 30,
"t": false,
"interval": 30,
"marginMode": "cross"
}
},
"signature": {
"r": "0x<r>",
"s": "0x<s>",
"v": 27
},
"nonce": 1757992743994,
"vaultAddress": null,
"signatureChainId": null
}'`0` on success.
The action's internal name, which does not always match the request `type`.
"twapOrder"A rejected request returns `err` with a non-zero `code` and the reason in `message` (or `response`).
"ok"{
"status": "ok",
"code": 0,
"data": {
"type": "twapOrder",
"data": {
"status": {
"running": {
"twapId": "8642097531"
}
}
}
}
}TWAP body
Perp instrument's external id — the `index` value from `perpMeta`.
`true` to buy, `false` to sell.
Seconds between slices.
510153060Total duration in **minutes**, from `5` to `1440`.
Reduce-only. Every slice inherits it.
Total size to execute across all slices, in base units.
Randomize slice timing. Always `false`.
falseMargin mode for the slices. When omitted, the account's current margin mode for this instrument applies.
"cross""isolated"Inside twap, m is the duration in minutes and t is the randomize flag.
Signing
Hash the body as { "twap": { … } } with the keys in the order shown in the request example: a, b, s, r, m, t, interval, then marginMode if you send it. Send the envelope vaultAddress as null. See Signing.
Next steps
The response returns the new TWAP's id in data.data.status.running.twapId. Pass it to twapCancel to stop the TWAP early.
- Follow progress with
twapStatesand slice fills withuserTwapSliceFills. - Finished and cancelled TWAPs are listed by
twapHistory.