OrdersService
Create Order
Create a single order with side, type, quantity, and optional price fields. Supports optional client order IDs and attached risk instructions (take-profit, stop-loss, trailing stop). Each submission is independent and has no exact-replay guarantee. Reusing a retained client order ID conflicts, even with identical payload. Do not automatically retry an ambiguous timeout: reconcile through GetOrder by client order ID if supplied; otherwise accept ambiguity. An immediate lookup miss does not prove rejection.
Request
curl --request POST \ \
--url 'https://api.testnet.polyester.com/v1/orders' \
--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 '{
"order": {
"attachedRisk": {
"oco": false,
"stopLoss": {
"child": {
"marketIoc": {}
},
"triggerPrice": "61000.25",
"triggerPriceSource": "LAST_PRICE"
},
"takeProfit": {
"child": {
"marketIoc": {}
},
"triggerPrice": "61000.25",
"triggerPriceSource": "LAST_PRICE"
}
},
"baseQty": "0.001",
"clientOrderId": "cli-ord-20250101-001",
"feeAsset": "QUOTE",
"marketIoc": {
"clientRefPrice": "61000.25",
"maxSlippageTicks": 1
},
"selfTradePreventionMode": "EXPIRE_MAKER",
"side": "BUY",
"symbol": "BTC-USDT"
},
"subaccountId": "45LUmqjT"
}'Responses
{
"acceptedAt": "2025-01-01T00:00:00Z",
"acceptedAtTsNs": "1735689600000000000",
"clientOrderId": "cli-ord-20250101-001",
"orderId": "5USXJZmk",
"resolvedBaseQty": "0.001",
"stopLossTriggerId": "4xSAAbhk",
"submittedMaxQuoteDebit": "100",
"takeProfitTriggerId": "24nxLcBt",
"trailingStopTriggerId": "59VD7Lat"
}If true, the take-profit and the configured stop leg (stop-loss or trailing stop) are linked and shown as one-cancels-the-other. Requires a take-profit and exactly one stop leg. The legs of every parent share one position and end together as described on RiskPolicy, so this setting does not change when exits are submitted. It decides what canceling an exit order ends: with oco set, canceling one leg's exit ends both legs; without it, only that leg ends and the other keeps protecting the remaining position. Changing only this setting with ModifyOrder keeps the existing legs, with their IDs, arming and a trailing stop's tracked peak; changing a leg's terms, such as its trigger price, limit price or trailing distance, still replaces that leg. Default is false.
Limit price as a decimal string in quote asset units per base asset unit, for example '61000.25'.
Market child with implicit IOC behavior.
Trigger price as a decimal string in quote asset units per base asset unit, for example '60000'.
Price the stop-loss watches. Unspecified or LAST_PRICE watches the last traded price. INDEX_PRICE watches the market's index price; on a market without an index price the order is rejected with terminal reason INDEX_PRICE_UNAVAILABLE before any fill, and a modify that adds such a leg is refused with ERROR_CODE_TRIGGER_PRICE_SOURCE_UNSUPPORTED, leaving the order and its legs unchanged. MARK_PRICE is not supported. A modify naming another source replaces the leg.
Limit price as a decimal string in quote asset units per base asset unit, for example '61000.25'.
Market child with implicit IOC behavior.
Trigger price as a decimal string in quote asset units per base asset unit, for example '60000'.
Price the take-profit watches. Unspecified or LAST_PRICE watches the last traded price. INDEX_PRICE watches the market's index price; on a market without an index price the order is rejected with terminal reason INDEX_PRICE_UNAVAILABLE before any fill, and a modify that adds such a leg is refused with ERROR_CODE_TRIGGER_PRICE_SOURCE_UNSUPPORTED, leaving the order and its legs unchanged. MARK_PRICE is not supported. A modify naming another source replaces the leg.
Optional activation price as a decimal string in quote asset units per base asset unit, for example '62000': trailing only starts after this price is reached. If omitted, trailing starts immediately after the parent order fills.
Maximum price of a trailing stop that buys back, as a decimal string in quote asset units per base asset unit, for example '65000': the most its exit pays, at which the quote it may spend is reserved. Required when the parent order sells; must be omitted when the parent order buys.
Maximum allowed slippage in basis points (1 bp = 0.01%), from 1 to 9999 whichever side the exit trades. An order whose trailing stop sets 10000 is rejected with ERROR_CODE_MAX_SLIPPAGE_INVALID, because a 100% cap would leave an exit that sells no positive price to sell at.
Positive maximum absolute price delta in Q9 execution-price ticks (1 tick = 1e-9 quote units).
Trailing distance as a decimal price delta in quote asset units, for example '0.5'.
Trailing distance in basis points (1 bp = 0.01%).
Price the trailing stop watches and trails: its peak or trough, activation and fire all follow this price. Unspecified or LAST_PRICE watches the last traded price. INDEX_PRICE watches the market's index price; on a market without an index price the order is rejected with terminal reason INDEX_PRICE_UNAVAILABLE before any fill, and a modify that adds such a leg is refused with ERROR_CODE_TRIGGER_PRICE_SOURCE_UNSUPPORTED, leaving the order and its legs unchanged. MARK_PRICE is not supported. A modify naming another source replaces the leg.
Exact gross base quantity as a human-readable decimal using the pair's base quantity scale.
Optional account-scoped identifier for correlation, lookup, and cancellation. While this identifier is retained, reuse returns CONFLICT_DUPLICATE_CLIENT_ORDER_ID for every new submission, even with the same payload. This identifier enables GetOrder reconciliation after a timeout; it does not provide exact replay.
Asset charged for fees. Defaults to QUOTE. BASE is available only for BUY orders; SELL orders must use QUOTE.
Limit price as a decimal string in quote asset units per base asset unit, for example '61000.25'.
Reject the order instead of taking liquidity. Post-only is available only on this resting limit-order variant.
Limit price as a decimal string in quote asset units per base asset unit, for example '61000.25'.
Exact expiry time in UTC. It must be at least 1 second and at most 30 days after validation time. The order cannot execute when the current time equals this value.
Reject the order instead of taking liquidity.
Limit price as a decimal string in quote asset units per base asset unit, for example '61000.25'.
Limit price as a decimal string in quote asset units per base asset unit, for example '61000.25'.
Optional client reference price as a decimal string in quote asset units per base asset unit, for example '61000.25'. When omitted, admission uses server-side reference pricing.
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).
Hard all-in quote debit limit as a decimal string in quote asset units, for example '100'. Valid only for BUY market IOC and BUY limit IOC.
Self-trade prevention mode against orders of the same root account, including all its subaccounts. Defaults to EXPIRE_MAKER if unspecified.
Order side.
Trading pair symbol, e.g. BTC-USDT.
Optional public subaccount ID. When omitted, subaccount-scoped API keys use their bound subaccount; other callers use their authenticated root account.
Time admission completed.
2025-01-01T00:00:00ZAdmission completion time as epoch nanoseconds (UTC).
1735689600000000000Echoed client order ID when one was supplied.
cli-ord-20250101-001Assigned order ID.
5USXJZmkGross base quantity resolved for execution as a decimal string in base asset units, for example '0.001'.
0.001Trigger ID for attached stop-loss.
4xSAAbhkSubmitted hard all-in quote debit limit as a decimal string in quote asset units, for example '100'. Present only when that sizing method was submitted.
100Trigger ID for attached take-profit.
24nxLcBtTrigger ID for attached trailing stop.
59VD7Lat| 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. |