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": "0.005"
},
"takeProfit": {
"child": {
"marketIoc": {}
},
"triggerPrice": "0.005"
}
},
"newClientOrderId": "cli-ord-20250101-001",
"newPriceTicks": "0.005",
"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).
Target sub-account numeric ID. When omitted, uses caller's 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. AMENDED cancels the original order's remaining quantity without a successor; keep tracking old_order_id until its terminal state is confirmed. Unspecified for rejected items.
AMENDEDClient order ID assigned to the successor when available.
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_IPProtobuf field path relative to the request, using canonical field names.
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.
5USXJZmkAssigned successor order ID. Zero for cancel-only outcomes or rejection before assignment.
5USXJZmkAdmission result for this item.
ADMITTEDAggregate admission status.
ADMITTED| 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. |