modify2
Amends the price and size of a resting order in place. The order is not canceled and re-placed: it keeps its order id, its already-filled quantity, and its original sequence number, so it is not sent to the back of the queue at the new price. The action can also attach, change, or clear the order's take-profit / stop-loss children in the same signed request.
modify2Amend price / size of a resting order in place; it keeps its id and queue priority.Agent-signed
The amendment for the resting order.
Order to amend, as an integer. A numeric string is parsed too, but the node hashes the value as an integer, so sign it as one. Long form: `oid`.
New limit price. `"bbo"` is **not** accepted. Long form: `limitPx`.
New total size in base units, not a delta. Long form: `sz`.
Only used by `tpsl` entries, where it carries the `trigger` body. Long form: `orderType`.
Must be `modify2`.
"modify2"Exactly two bodies, one take-profit and one stop-loss. Omitted, `null`, or empty clears the order’s existing TPSL children.
Order to amend, as an integer. A numeric string is parsed too, but the node hashes the value as an integer, so sign it as one. Long form: `oid`.
New limit price. `"bbo"` is **not** accepted. Long form: `limitPx`.
New total size in base units, not a delta. Long form: `sz`.
Only used by `tpsl` entries, where it carries the `trigger` body. Long form: `orderType`.
curl -X POST https://rpc.txflow-testnet.xyz/exchange \
-H "Content-Type: application/json" \
-H "x-api-version: 2026-08-16" \
-d '{
"action": {
"type": "modify2",
"order": {
"o": 444555666,
"p": "52000.0",
"s": "0.03"
}
},
"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`.
"Modify2"A rejected request returns `err` with a non-zero `code` and the reason in `message` (or `response`).
"ok"{
"status": "ok",
"code": 0,
"data": {
"type": "Modify2",
"data": {
"statuses": [
"success"
]
}
}
}Modify body
Order to amend, as an integer. A numeric string is parsed too, but the node hashes the value as an integer, so sign it as one. Long form: `oid`.
New limit price. `"bbo"` is **not** accepted. Long form: `limitPx`.
New total size in base units, not a delta. Long form: `sz`.
Only used by `tpsl` entries, where it carries the `trigger` body. Long form: `orderType`.
Only price and size are amendable. Side, instrument, reduce-only, margin mode, and time-in-force stay as they were on the original order — there is no way to change them with modify2.
Outcome resting limit orders use the same action. Their amended price remains
the YES-side book price, including when the UI displays the complementary NO
price. Outcome orders do not use the tpsl extension.
Size changes
s is the new total size, not a delta. The already-filled quantity is preserved:
| New size | Result |
|---|---|
| Larger than the current total | The increase is added to the unfilled remainder |
| Smaller, but still above the filled quantity | The remainder becomes newSize - filled |
| At or below the filled quantity | The order closes as fully filled at the quantity already executed |
A request that changes neither price nor size is accepted and leaves the resting order alone; any tpsl change in the same action still applies.
Take-profit / stop-loss
When tpsl is present it must contain exactly two bodies — one with tpsl: "tp" and one with tpsl: "sl":
{
"o": 444555667,
"p": "0",
"s": "0.03",
"t": { "trigger": { "isMarket": true, "triggerPx": "48000.0", "tpsl": "sl" } }
}If the order already has TPSL children, each o must be one of those two child order ids; otherwise the request is rejected with Invalid TPSL order ID: <oid>. Expected <sl> or <tp>. If the order has no TPSL children yet, the two bodies are created and bound to it, sized from the amended order size.
Because modify2 amends in place rather than canceling and re-placing, the order keeps its existing TP/SL children when you omit tpsl — unlike the cancel-then-place modify / batchModify actions, which delete the protection with the parent order and cannot re-attach it. Use modify2 whenever the order being changed carries protection.
Preconditions
| Error | Cause |
|---|---|
Modify2 does not support BBO price. | p is the literal "bbo" |
Order limit price is invalid / Order size is invalid | p or s is unparsable or not positive |
Order not found | No resting order with that o |
Permission denied: you are not authorized to modify this order. | The order belongs to another account |
This instrument only supports isolated margin mode | The resting order is on cross margin for an isolated-only instrument |
Modify order check failed: <reason> | The amended order fails the leverage or available-balance check |
The new price is additionally checked against the instrument's tick size and the oracle price band, and a size increase is checked against the open-interest cap. Amending is rejected while the instrument is halted or delisted.
Next steps
The response confirms acceptance, not the final book state — read the amended order back with frontendOpenOrders, and its TPSL children with tpslOrders.
For Outcome, read it back with
outcomeFrontendOpenOrders and follow
outcomeOrderUpdates.