OrdersService
Modify Order
Modify a single open order by order ID or client order ID. Supports amend-or-replace behavior policies, price and quantity updates, and attached risk updates.
Request
curl --request POST \ \
--url 'https://api.testnet.polyester.com/v1/orders/modify' \
--header 'Accept: */*' \
--header 'X-API-KEY-ID: YOUR_API_KEY_ID' \
--header 'X-API-TIMESTAMP: YOUR_API_TIMESTAMP' \
--header 'X-API-SIGNATURE: YOUR_API_SIGNATURE' \
--header 'Content-Type: application/json' \
--data '{
"behavior": "AMEND_OR_REPLACE",
"newAttachedRisk": {
"oco": false,
"stopLoss": {
"child": {
"marketIoc": {}
},
"triggerPrice": "0.005"
},
"takeProfit": {
"child": {
"marketIoc": {}
},
"triggerPrice": "0.005"
}
},
"newClientOrderId": "cli-ord-20250101-001",
"newPrice": "0.005",
"newQtyScaled": 100000,
"orderId": "5USXJZmk",
"requestId": "request_01J0EXAMPLE",
"subaccountId": "45LUmqjT",
"symbol": "BTC-USDT"
}'Responses
{
"actionTaken": "AMENDED",
"code": "INVALID_ORDER_STATE",
"finalOrderId": "5USXJZmk",
"oldOrderId": "5USXJZmk",
"stopLossTriggerId": "4U4q9P7z",
"takeProfitTriggerId": "2ZodcFeg",
"trailingStopTriggerId": "24cncW7T",
"ts": "2025-01-01T00:00:00Z",
"tsNs": "1735689600000000000"
}Modify behavior policy. MODIFY_BEHAVIOR_UNSPECIFIED is treated as AMEND_OR_REPLACE.
Client order ID to resolve within the caller account.
If true, take-profit and the configured stop leg (stop-loss or trailing-stop) form an OCO pair: when one fires, the other is canceled. Default is false (no mutual cancellation).
Limit price in quote units scaled by 1e9.
Market child with implicit IOC behavior.
Trigger price in quote units scaled by 1e9.
Limit price in quote units scaled by 1e9.
Market child with implicit IOC behavior.
Trigger price in quote units scaled by 1e9.
Optional activation price: trailing only starts after this price is reached. If omitted, trailing starts immediately after the parent order fills. Expressed in quote units scaled by 1e9.
Maximum allowed slippage in basis points (1 bp = 0.01%).
Positive maximum absolute price delta in Q9 execution-price ticks (1 tick = 1e-9 quote units).
Trailing distance in basis points (1 bp = 0.01%).
Trailing distance as a price delta in 1e-9 quote-unit ticks.
Optional new client order id when replace path is taken.
Patch fields (presence-based). New limit price in quote units scaled by 1e9. Required for price changes.
Target total quantity after modify/replace, scaled by the pair's base_quantity_scale from GetSpotConfig.
Order ID as fixed64.
Idempotency key (required).
Target sub-account numeric ID. When omitted, uses caller's root account.
Trading pair symbol, e.g. BTC-USDT.
Action applied; unspecified when rejected.
AMENDEDError code if rejected.
INVALID_ORDER_STATEFinal active order ID; same as old_order_id for amendments.
5USXJZmkOriginal order ID that was amended or replaced.
5USXJZmkTrigger ID for attached stop-loss after modification, when configured.
4U4q9P7zTrigger ID for attached take-profit after modification, when configured.
2ZodcFegTrigger ID for attached trailing stop after modification, when configured.
24cncW7TServer timestamp.
2025-01-01T00:00:00ZServer timestamp as epoch nanoseconds (for bots).
1735689600000000000| Key | Status | Error | When |
|---|---|---|---|
| unauthenticated | 401 | Unauthenticated | Authentication required. |
| permission-denied | 403 | Permission Denied | Permission denied. |
| invalid-argument | 400 | Invalid Argument | Invalid argument. |
| not-found | 404 | Not Found | Not found. |
| unavailable | 503 | Unavailable | Service unavailable. |