Order History
Note: Post Aug 1st, 2022, orderId has the format of uniform 17 digits whereas in the legacy system, orderId followed a natural growth pattern.
Orders History
- GET
https://api.poloniex.com/orders/history
Get a list of historical orders in an account. Interval between startTime and endTime cannot exceed 30 days. If only endTime is populated then startTime will default to 7 days before endTime. If only startTime is populated then endTime will be defaulted to 7 days after startTime. Please note that canceled orders that are before 7 days from current time will be archived. Rest of the orders will be archived before 90 days from current time.
Request Parameter | Data Type | Required | Description |
---|---|---|---|
accountType | String | false | SPOT is the default and only supported one. |
type | String | false | MARKET, LIMIT, LIMIT_MAKER (Default: all types) |
side | String | false | BUY, SELL (Default: both sides) |
symbol | String | false | Any supported symbol (Default: all symbols) |
from | Long | false | An 'orderId'. The query begins at ‘from'. |
direction | String | false | PRE, NEXT The direction before or after ‘from'. |
states | String | false | FAILED, FILLED, CANCELED. PARTIALLY_CANCELED Multiple states can be specified and separated with comma. (Default: all states) |
limit | Integer | false | Max number of orders to return. Default is 500. Max value is 1000. |
hideCancel | Boolean | false | true or false. Whether canceled orders should not be retrieved. (Default: false) |
startTime | Long | false | (milliseconds since UNIX epoch) orders updated before startTime will not be retrieved. |
endTime | Long | false | (milliseconds since UNIX epoch) orders updated after endTime will not be retrieved. |
Response Field | Data Type | Description |
---|---|---|
id | String | order id |
clientOrderId | String | user specified id |
symbol | String | The symbol to trade, like BTC_USDT |
accountType | String | SPOT |
side | String | BUY, SELL |
type | String | MARKET, LIMIT, LIMIT_MAKER |
timeInForce | String | GTC, IOC, FOK |
price | String | |
avgPrice | String | avgPrice = filledAmount/filledQuantity |
quantity | String | base units for the order |
amount | String | quote units for the order |
filledQuantity | String | |
filledAmount | String | |
state | String | FAILED, FILLED, CANCELED, PARTIALLY_CANCELED |
orderSource | String | source of the order e.g API, APP, WEB |
createTime | Long | |
updateTime | Long | |
loan | Boolean | true if borrowed funds, false otherwise |
cancelReason | Integer | code specified to provide reason for cancelation if applicable; 0: "Not applicable"; 1: "As requested by user"; 1000-1999: "Due to breach of controls in matching engine; 1004: "Due to self-trade"; 1012: "exceed slippage tolerance"; 2000: "Due to margin liquidation"; 2001: "Due to margin threshold breach"; 2002: "Due to symbol marked as offline" |
Example output:
[
{
"id": 35490370041151490,
"clientOrderId": "Try1",
"symbol": "TRX_USDC",
"accountType": "SPOT",
"side": "SELL",
"type": "LIMIT_MAKER",
"timeInForce": "GTC",
"price": "3333",
"avgPrice": "0",
"quantity": "5",
"amount": "0",
"filledQuantity": "0",
"filledAmount": "0",
"state": "CANCELED",
"orderSource": "API",
"createTime": 1649427963597,
"updateTime": 1649427963597,
"loan": false,
"cancelReason": 1
},
{
"id": 34141303381950464,
"clientOrderId": "223ABD",
"symbol": "TRX_USDC",
"accountType": "SPOT",
"side": "BUY",
"type": "LIMIT",
"timeInForce": "GTC",
"price": "1.05",
"avgPrice": "0.06023436",
"quantity": "10",
"amount": "0",
"filledQuantity": "10",
"filledAmount": "0.6023436",
"state": "FILLED",
"orderSource": "API",
"createTime": 1649106321041,
"updateTime": 16491063210417,
"loan": false,
"cancelReason": 0
}
]
Smart Orders History
- GET
https://api.poloniex.com/smartorders/history
Get a list of historical smart orders in an account. Interval between startTime and endTime cannot exceed 30 days. If only endTime is populated then startTime will default to 7 days before endTime. If only startTime is populated then endTime will be defaulted to 7 days after startTime.
Request Parameter | Data Type | Required | Description |
---|---|---|---|
accountType | String | false | SPOT is the default and only supported one. |
type | String | false | STOP, STOP_LIMIT (Default: all types) |
side | String | false | BUY, SELL (Default: both sides) |
symbol | String | false | Any supported symbol (Default: all symbols) |
from | Long | false | An 'smart orderId'. The query begins at ‘from'. |
direction | String | false | PRE, NEXT The direction before or after ‘from'. |
states | String | false | FAILED, FILLED, CANCELED. PARTIALLY_CANCELED. Multiple states can be specified and separated with comma. (Default: all states) |
limit | Integer | false | Max number of orders to return. Default is 500. Max value is 2000. |
hideCancel | Boolean | false | true or false. Whether canceled smart orders should not be retrieved. (Default: false) |
startTime | Long | false | (milliseconds since UNIX epoch) smart orders updated before startTime will not be retrieved. |
endTime | Long | false | (milliseconds since UNIX epoch) smart orders updated after endTime will not be retrieved. |
Response Field | Data Type | Description |
---|---|---|
id | String | smart order's id |
clientOrderId | String | smart order's clientOrderId |
symbol | String | The symbol to trade, like BTC_USDT |
state | String | FAILED, FILLED, CANCELED, PARTIALLY_CANCELED |
accountType | String | SPOT |
side | String | BUY, SELL |
type | String | STOP, STOP_LIMIT |
timeInForce | String | GTC, IOC, FOK |
quantity | String | base units for the order |
price | String | |
amount | String | quote units for the order |
stopPrice | String | |
createTime | Long | |
updateTime | Long |
Example output:
[
{
"id": "25444163851911168",
"clientOrderId": "",
"symbol": "TRX_USDC",
"state": "CANCELED",
"accountType": "SPOT",
"side": "BUY",
"type": "STOP_LIMIT",
"timeInForce": "GTC",
"quantity": "2",
"price": "100",
"amount": "200",
"stopPrice": "125",
"createTime": 1647032761392,
"updateTime": 1647032874275
},
{
"id": "42745705164439552",
"clientOrderId": "777111",
"symbol": "BTC_USDT",
"state": "FAILED",
"accountType": "SPOT",
"side": "BUY",
"type": "STOP_LIMIT",
"timeInForce": "GTC",
"quantity": "0.1",
"price": "39000",
"amount": "100",
"stopPrice": "40000",
"createTime": 1651157770288,
"updateTime": 1651157770345
}
]