OrdersService
Get Order History
Retrieve terminal order history for an account. Supports optional subaccount, trigger, symbol, side, status, and time-range filters with cursor pagination. While the current state of an order on the page is temporarily unavailable, the call fails with a retryable 503 UNAVAILABLE rather than returning a stale state; retry the same request.
Request
curl --request GET \ \ --url 'https://api.testnet.polyester.com/v1/orders/history?endTime=2025-01-01T00%3A00%3A00Z&includeAttachedRisk=false&includeAttachedRiskState=false&limit=100&side=BUY&startTime=2025-01-01T00%3A00%3A00Z&status=PENDING&subaccountId=45LUmqjT&symbol=BTC-USDT&triggerId=59VD7Lar' \ --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'
Responses
{
"nextPageToken": "eyJvZmZzZXQiOjIwMH0",
"orders": [
{
"attachedRisk": {
"oco": false,
"stopLoss": {
"policy": {
"child": {},
"triggerPrice": "61000.25",
"triggerPriceSource": "LAST_PRICE"
},
"state": {
"armedAt": "2025-01-01T00:00:00Z",
"childOrderId": "5USXJZmk",
"status": "NOT_CONFIGURED",
"terminalAt": "2025-01-01T00:00:00Z",
"triggerId": "59VD7Lar"
}
},
"takeProfit": {
"policy": {
"child": {},
"triggerPrice": "61000.25",
"triggerPriceSource": "LAST_PRICE"
},
"state": {
"armedAt": "2025-01-01T00:00:00Z",
"childOrderId": "5USXJZmk",
"status": "NOT_CONFIGURED",
"terminalAt": "2025-01-01T00:00:00Z",
"triggerId": "59VD7Lar"
}
},
"trailingStop": {
"policy": {
"activationPrice": "61000.25",
"limitPrice": "61000.25",
"maxSlippageTicks": 1,
"trailingDistance": "0.000000001",
"triggerPriceSource": "LAST_PRICE"
},
"state": {
"armedAt": "2025-01-01T00:00:00Z",
"childOrderId": "5USXJZmk",
"status": "NOT_CONFIGURED",
"terminalAt": "2025-01-01T00:00:00Z",
"triggerId": "59VD7Lar"
}
}
},
"avgPx": "18.446744073709551617",
"batchRequestId": "2",
"cancelReason": "USER_REQUEST",
"clientOrderId": "cli-ord-20250101-001",
"createdAt": "2025-01-01T00:00:00Z",
"cumQty": "0.001",
"cumQuote": "184.46744073709551617",
"expireAt": "2025-01-01T00:00:00Z",
"feeAsset": "QUOTE",
"feeTotal": {
"amount": "18.446744073709551617",
"isRebate": false,
"qty": "0.001"
},
"inheritedCumQty": "0.001",
"leavesQty": "0.001",
"lineage": {
"generation": 1,
"id": "2"
},
"marketClientRefPrice": "61000.25",
"marketMaxSlippageBps": 1,
"marketMaxSlippageTicks": 1,
"orderId": "5USXJZmk",
"orderType": "LIMIT",
"origQty": "0.001",
"origin": {
"childSeq": 1,
"parentOrderId": "5USXJZmk",
"scope": "DIRECT",
"triggerId": "59VD7Lar",
"triggerType": "STOP_LOSS"
},
"postOnly": false,
"price": "61000.25",
"rejectReason": "BAD_REQUEST",
"side": "BUY",
"status": "PENDING",
"stpMode": "EXPIRE_MAKER",
"submittedMaxQuoteDebit": "100",
"symbol": "BTC-USDT",
"terminalAt": "2025-01-01T00:00:00Z",
"tif": "GTC",
"version": 0
}
]
}RFC3339 timestamp (nanosecond precision supported)
Include attached-risk policy fields in each order. Defaults to false when omitted.
Include attached-risk state fields in each order. Defaults to false when omitted.
RFC3339 timestamp (nanosecond precision supported)
OrderStatus enum name (e.g. FILLED, CANCELED)
Filter by symbol(s): use repeated params (?symbol=BTC-USDT&symbol=ETH-USDT) or comma-separated values.
Filter by trigger public ID (base58).
Opaque cursor for the next page. A page may hold fewer orders than requested, or none; continue while this token is non-empty. Empty when no more results exist.
eyJvZmZzZXQiOjIwMH0True while the parent's legs were placed with oco and both the take-profit and a stop leg (stop-loss or trailing stop) are present. False once either leg is removed. A leg that ended, including one canceled with TRIGGER_CANCEL_REASON_OCO, stays present.
falseLimit 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'.
61000.25Price 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.
LAST_PRICETime the leg was armed, in nanoseconds since epoch (UTC). Zero if not armed.
2025-01-01T00:00:00ZChild order ID created by this leg after it fires.
5USXJZmkCurrent runtime lifecycle status for this attached-risk leg.
NOT_CONFIGUREDTime the leg reached a terminal state, in nanoseconds since epoch (UTC). Zero if not terminal.
2025-01-01T00:00:00ZTrigger identifier for this attached-risk leg.
59VD7LarLimit 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'.
61000.25Price 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.
LAST_PRICETime the leg was armed, in nanoseconds since epoch (UTC). Zero if not armed.
2025-01-01T00:00:00ZChild order ID created by this leg after it fires.
5USXJZmkCurrent runtime lifecycle status for this attached-risk leg.
NOT_CONFIGUREDTime the leg reached a terminal state, in nanoseconds since epoch (UTC). Zero if not terminal.
2025-01-01T00:00:00ZTrigger identifier for this attached-risk leg.
59VD7LarOptional 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.
61000.25Maximum 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. Present when the parent order sells; omitted when the parent order buys.
61000.25Maximum 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).
1Trailing distance as a decimal price delta in quote asset units, for example '0.5'.
0.000000001Trailing 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.
LAST_PRICETime the leg was armed, in nanoseconds since epoch (UTC). Zero if not armed.
2025-01-01T00:00:00ZChild order ID created by this leg after it fires.
5USXJZmkCurrent runtime lifecycle status for this attached-risk leg.
NOT_CONFIGUREDTime the leg reached a terminal state, in nanoseconds since epoch (UTC). Zero if not terminal.
2025-01-01T00:00:00ZTrigger identifier for this attached-risk leg.
59VD7LarAverage execution price across the lineage through this generation, as a decimal string in quote asset units per base asset unit, for example '0.000002908714285714': the exact executed quote amount divided by cumQty, rounded half to even at 18 decimal places, trailing zeros trimmed. '0' if no fills.
18.446744073709551617Batch-replace identity that admitted this order. Zero for other origins.
2For a CANCELED order, why it ended. Not set for every other status; JSON and REST responses then omit it.
USER_REQUESTClient-provided, account-scoped identifier for correlation, lookup, and cancellation. Empty when none was supplied.
cli-ord-20250101-001Creation timestamp in nanoseconds since epoch (UTC).
2025-01-01T00:00:00ZCumulative filled quantity across the lineage through this generation, as a decimal string in base asset units, for example '0.0005'.
0.001Exact quote amount of the fills across the lineage through this generation, before fees, as a decimal string in quote asset units, for example '3215.5809531728'. For a BUY sized by submittedMaxQuoteDebit, the quote it used is cumQuote plus feeTotal.amount when feeAsset is QUOTE, or minus it when feeTotal.isRebate is true, since a rebate is credited, and cumQuote alone when feeAsset is BASE; submittedMaxQuoteDebit less the quote it used is what it left unspent. '0' if no fills. Each fill settles its quote rounded down to 18 decimal places, so cumQuote is exactly the quote the fills settled when the base asset's quantity scale is at most 9; above that, cumQuote can exceed it by less than 1e-18 per fill.
184.46744073709551617Exact UTC expiry time for GTD orders, within the supported signed Unix-nanosecond range from 1677-09-21T00:12:43.145224193Z through 2262-04-11T23:47:16.854775807Z. Omitted for all other time-in-force policies. The order cannot execute when the current time equals this value.
2025-01-01T00:00:00ZFee asset selected for fills.
QUOTENet fee of the fills the total covers, their fees less their rebates, as a decimal string in feeAsset units, for example '0.96467428595184'. '0' when they charged no fee.
18.446744073709551617True when the covered fills' rebates exceed their fees, so the amount was credited to the account rather than charged.
falseExecuted quantity of the fills the total covers, as a decimal string in base asset units, for example '0.04148504'. Equal to the order's cumQty once every fill's fee is recorded; while a fill is still being recorded the two differ, and a later read includes it.
0.001Cumulative filled base quantity inherited from predecessors when this replacement was accepted, as a decimal string in base asset units, for example '0.0005'. '0' for the original order and immutable within a generation. cumQty minus this value is the quantity executed by this generation, not the quantity new to a client session.
0.001Remaining working quantity as a decimal string in base asset units, for example '0.001'. '0' for terminal orders.
0.001One-based replacement generation, distinct from per-order state version.
1Stable logical-order ID: the first generation's public order ID. Replace preserves this ID; an independent new order starts a new lineage.
2Optional client-side reference price used for MARKET slippage protection, as a decimal string in quote asset units per base asset unit, for example '61000.25'.
61000.25Optional MARKET max slippage in basis points (1 bp = 0.01%).
1Non-negative MARKET maximum absolute price delta in Q9 execution-price ticks (1 tick = 1e-9 quote units). Zero means no absolute cap is configured.
1Public order identifier as fixed64.
5USXJZmkOrder type.
LIMITCurrent accepted total order quantity, updated by successful modifies, as a decimal string in base asset units, for example '0.001'.
0.001Child sequence number for multi-child trigger strategies. Zero when not applicable.
1Parent order ID for attached-risk child orders.
5USXJZmkBroad class describing how the order was created.
DIRECTTrigger identifier when the order was created by a trigger.
59VD7LarTrigger strategy that created this order. Not set for direct orders; JSON and REST responses then omit it.
STOP_LOSSTrue if the order was submitted as post-only (maker-only).
falseLimit price as a decimal string in quote asset units per base asset unit, for example '61000.25'. '0' for MARKET orders.
61000.25For a REJECTED order, why it was refused: the same error code the Orders API returns for the same refusal. Not set for every other status; JSON and REST responses then omit it.
BAD_REQUESTOrder side.
BUYCurrent order lifecycle status.
PENDINGSelf-trade prevention mode.
EXPIRE_MAKERSubmitted 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.
100Trading symbol numeric identifier.
BTC-USDTTerminal timestamp in nanoseconds since epoch (UTC). Zero for open orders.
2025-01-01T00:00:00ZTime-in-force policy.
GTCPer-order state version: 0 while the order is accepted but not yet on the book (status PENDING), then 1 from its first book state and higher for every later published execution-state change. Higher values identify newer execution state. Fee totals and requested enrichments are not covered by this version and may differ between responses with the same version.
0| 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. |