OrdersService
Batch Replace Orders
Replace up to 50 orders for one symbol and return an admission receipt for status and private realtime reconciliation.
Request
curl --request POST \ \
--url 'https://api.testnet.polyester.com/v1/orders/replace-batch' \
--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 '{
"items": [
{
"newAttachedRisk": {
"oco": false,
"stopLoss": {
"child": {
"marketIoc": {}
},
"triggerPrice": "61000.25",
"triggerPriceSource": "LAST_PRICE"
},
"takeProfit": {
"child": {
"marketIoc": {}
},
"triggerPrice": "61000.25",
"triggerPriceSource": "LAST_PRICE"
}
},
"newClientOrderId": "cli-ord-20250101-001",
"newPrice": "61000.25",
"newQtyScaled": 100000,
"orderId": "5USXJZmk"
}
],
"requestId": "request_01J0EXAMPLE",
"subaccountId": "45LUmqjT",
"symbol": "BTC-USDT"
}'Responses
{
"acceptedCount": 1,
"acceptedTs": "2025-01-01T00:00:00Z",
"acceptedTsNs": "1735689600000000000",
"batchRequestId": "2",
"rejectedCount": 1,
"results": [
{
"actionTaken": "AMENDED",
"clientOrderId": "cli-ord-20250101-001",
"code": "value",
"error": {
"code": "BAD_REQUEST",
"rateLimit": {
"limit": 100,
"operationId": "value",
"policyClass": "AUTH_PUBLIC",
"policyVersion": 1,
"reason": "QUOTA_EXCEEDED",
"refillModel": "CONTINUOUS",
"remaining": 1,
"retryAfterMs": 1,
"scope": "CLIENT_IP"
},
"violations": [
{
"fieldPath": "value",
"message": "value",
"ruleId": "value"
}
]
},
"itemIndex": 1,
"oldOrderId": "5USXJZmk",
"replacementOrderId": "5USXJZmk",
"status": "ADMITTED"
}
],
"status": "ADMITTED"
}Replacement items.
Client idempotency key (required).
Optional public subaccount ID. When omitted, subaccount-scoped API keys use their bound subaccount; other callers use their authenticated root account.
Trading pair symbol, e.g. BTC-USDT.
Number of items admitted and handed to execution.
1Server acceptance timestamp.
2025-01-01T00:00:00ZServer acceptance timestamp as epoch nanoseconds.
1735689600000000000Server-issued opaque identity used for status and private realtime correlation.
2Number of items rejected before execution handoff.
1REPLACED admits a successor under replacement_order_id, with queue priority reset. AMENDED keeps the order under old_order_id with no successor: the order is amended in place and keeps its queue priority, or, when the new total quantity is at or below its filled quantity, ends at its filled quantity. Keep tracking old_order_id for an AMENDED item. Not set for rejected items; JSON and REST responses then omit it.
AMENDEDClient order ID assigned to the successor, for a REPLACED item only.
cli-ord-20250101-001Stable rejection code. Empty for admitted items.
valueStable error code matching the REST problem+json "code" field.
BAD_REQUESTActive weighted quota. Present for quota-exhaustion responses.
100Stable operation identifier shared by all aliases of the same action.
valueMutable quota family used for the decision.
AUTH_PUBLICPolicy version used for the decision, when available.
1Machine-readable failure reason.
QUOTA_EXCEEDEDRefill behavior used by the active limiter.
CONTINUOUSWeighted capacity remaining when the request was rejected.
1Minimum relative delay before retrying, in milliseconds.
1Caller dimension that owns the exhausted capacity.
CLIENT_IPREST path of the request field the violation names, for example order.baseQty or items[2].limitGtc.price; when no choice of a one-of group was sent, the group, for example order.execution.
valueHuman-readable explanation of the violation.
valueStable validation rule identifier suitable for programmatic matching.
valueZero-based index in the request.
1Original order targeted by the replacement: the requested order ID, or the order the requested client order ID names. Rejected items keep it too. Unset only when the requested client order ID names no order.
5USXJZmkAssigned successor order ID, for a REPLACED item only. Unset for an AMENDED item, whose order keeps old_order_id, and for rejected items.
5USXJZmkAdmission result for this item.
ADMITTEDAggregate admission status.
ADMITTED| Key | HTTP status | Connect code | Error | When |
|---|---|---|---|---|
| unauthenticated | 401 | unauthenticated | Unauthenticated | Authentication required. |
| permission-denied | 403 | permission_denied | Permission Denied | Permission denied. |
| invalid-argument | 400 | invalid_argument | Invalid Argument | Invalid argument. |
| not-found | 404 | not_found | Not Found | Not found. |
| unavailable | 503 | unavailable | Unavailable | Service unavailable. |