Order History
info
- If startTime and endTime are both not specified, it returns last 7 days records by default.
- Supports fetching 3 months worth of data per request. Returns data up to 6 months old.
- Market maker can only get recent 3 days orders.
HTTP Request
GET /spot/v3/private/history-orders
Request Parameters
| Parameter | Required | Type | Comments |
|---|---|---|---|
| symbol | false | string | Name of the trading pair |
| orderId | false | string | Specify orderId to return all the orders that orderId of which are smaller than this particular one for pagination purpose |
| limit | false | integer | Limit for data size. [1, 500]. Default: 100 |
| startTime | false | integer | The start timestamp (ms) |
| endTime | false | integer | The end timestamp (ms) |
| orderCategory | false | integer | Order category. 0:normal order by default; 1:TP/SL order, Required for TP/SL order. |
Response Parameters
| Parameter | Type | Comments |
|---|---|---|
| accountId | string | Account ID |
| symbol | string | Name of the trading pair |
| orderLinkId | string | User-generated order ID |
| orderId | string | Order ID |
| orderPrice | string | Last traded price |
| orderQty | string | Order quantity |
| execQty | string | Executed quantity |
| cummulativeQuoteQty | string | Total order quantity |
| avgPrice | string | Average filled price |
| status | string | Order status |
| timeInForce | string | Time in force |
| orderType | string | Order type |
| side | string | Side. BUY, SELL |
| stopPrice | string | Stop price |
| icebergQty | string | Please ignore |
| createTime | number | Order created time in the match engine |
| updateTime | number | Last time order was updated |
| isWorking | string | Is working. 0:valid, 1:invalid |
| orderCategory | integer | Order category. 0:normal order; 1:TP/SL order. TP/SL order has this field |
| triggerPrice | string | Trigger price. TP/SL order has this field |
| blockTradeId | string | Paradigm block trade ID |
| cancelType | string | Cancel type. CancelBySmp |
| smpType | string | SMP execution type |
| smpGroup | integer | Smp group ID. If the uid has no group, it is 0 by default |
| smpOrderId | string | The counterparty's orderID which triggers this SMP execution |
Request Example
curl --location --request GET 'https://api-testnet.bybit.com/spot/v3/private/history-orders?symbol=BTCUSDT&limit=2&startTime=1658246400000&endTime=1659110400000' \
--header 'X-BAPI-SIGN: XXXXX' \
--header 'X-BAPI-API-KEY: {api key}' \
--header 'X-BAPI-TIMESTAMP: 1659082629976' \
--header 'X-BAPI-RECV-WINDOW: 5000'
Response Example
- Normal order
- Stop order
{
"retCode": 0,
"retMsg": "OK",
"result": {
"list": [
{
"accountId": "533287",
"symbol": "BTCUSDT",
"orderLinkId": "spotx003",
"orderId": "1210856408331857664",
"orderPrice": "23800",
"orderQty": "0.02",
"execQty": "0",
"cummulativeQuoteQty": "0",
"avgPrice": "0",
"status": "REJECTED",
"timeInForce": "GTC",
"orderType": "LIMIT_MAKER",
"side": "BUY",
"stopPrice": "0.0",
"icebergQty": "0.0",
"createTime": 1659081332185,
"updateTime": 1659081332225,
"isWorking": "1",
"blockTradeId": "",
"cancelType": "UNKNOWN"
"smpGroup": 0,
"smpOrderId": "",
"smpType": "None"
}
]
},
"retExtInfo": {},
"time": 1659082630638
}
{
"retCode": 0,
"retMsg": "OK",
"result": {
"list": [
{
"accountId": "533287",
"symbol": "BTCUSDT",
"orderLinkId": "testSpot_21",
"orderId": "1261593545444244992",
"orderPrice": "20000",
"orderQty": "0.1",
"status": "ORDER_CANCELED",
"timeInForce": "GTC",
"orderType": "LIMIT",
"side": "BUY",
"stopPrice": "0.0",
"icebergQty": "0.0",
"createTime": 1665129670254,
"updateTime": 1665130043196,
"isWorking": "1",
"executedOrderId": "1261593545444244993",
"triggerPrice": "22000",
"orderCategory": 1
}
]
},
"retExtInfo": {},
"time": 1665131956061
}