Get Order Information
Get Orders
Request:TigerRequest(TradeApiService.ORDERS)
Description
Get details for orders that you placed
Argument
Get a single order
Argument | Type | Required | Description |
---|---|---|---|
account | string | Yes | Account id: 572386 |
id | int | Yes | order id, this id is used to identify an order on the server |
secret_key | string | No | Secret key for the trader of institutions, please config in client_config, ignore if you are a individual user |
show_charges | bool | No | return commission and fee details |
Get a list of orders
Argument | Type | Required | Description |
---|---|---|---|
account | string | Yes | Account id:572386 |
seg_type | SegmentType | No | Account segment. Available: SegmentType.SEC for Securities; SegmentType.FUT for Commodities; SegmentType.FUND for funds, SegmentType.ALL for Securities + Commodities + Funds. defaul value is SegmentType.SEC |
sec_type | string | No | ALL/STK/OPT/FUT/FOP/CASH, ALL by default |
market | string | No | ALL/US/HK/CN, defaul value is ALL |
symbol | string | No | Stock ticker symbol |
expiry | string | No | Expiration data for options, warrants and CBBC |
strike | string | No | Strike price for options, warrants and CBBC |
right | string | No | PUT/CALL for options, warrants and CBBC |
start_date | string | No | The starting time of the order placing time (when sort_by=LATEST_STATUS_UPDATED, the starting time of the order status updated time), the format is '2018-05-01'/ "2018-05-01 10:00:00"(Default 'GMT +8', can set the value of TimeZoneId to 'NewYork'), close interval |
end_date | string | No | The ending time of the order placing time (when sort_by=LATEST_STATUS_UPDATED, the ending time of the order status updated time), the format is '2018-05-15' /"2018-05-01 10:00:00"(Default 'GMT +8', can set the value of TimeZoneId to 'NewYork'), open interval |
states | array | No | Order status, open orders by default, Please refer to: Order Status for possible states |
isBrief | boolean | No | 0 for detailed information, 1 for concise information |
limit | integer | No | Maximum number of orders returned. Default value is 100. Maximum possible value is 300 |
sort_by | OrderSortBy | No | Fields used to sort and filter start_date and end_date,LATEST_CREATED/LATEST_STATUS_UPDATED; Default:LATEST_CREATED |
secret_key | string | No | Secret key for the trader of institutions, please config in client_config, ignore if you are a indiviual user |
lang | string | No | Language: zh_CN,zh_TW,en_US, By default: en_US |
page_token | string | No | Token for paging query |
Response
query by ID,return TigerOpenAPI.Trade.Response.SingleOrderResponse
, Use SingleOrderResponse.Data
to access order data. query without ID,return TigerOpenAPI.Trade.Response.OrderBatchResponse
, Use OrderBatchResponse.Data
to access data. This method will return a OrderBatchItem
object, whereTigerOpenAPI.Trade.Response.OrderBatchItem
has the following attributes:
Name | Type | Description |
---|---|---|
nextPageToken | string | page token for next query |
items | List<TradeOrder> | An array of orders, please refer to the description below for detailed fields |
items has the following attributes:
Name | Example | Description |
---|---|---|
id | 135482687464472583 | unique order id assigned by the server |
orderId | 1000003917 | order id assigned by the user, not unique |
externalId | 1000003917 | external id, The value is the same as 'orderId' when placing an order through the API |
parentId | 0 | order id of the main (parent) order |
account | 572386 | Account id |
action | BUY | Order direction: BUY/SELL |
orderType | LMT | Order Types,'MKT'-Market Order / 'LMT'-Limit Order / 'STP'-Stop Order / 'STP_LMT'-Stop-Limit Order / 'TRAIL'-Trailing Stop Order |
limitPrice | 108.62 | Limit price |
auxPrice | 0.0 | Auxilary price. it represents the stop price if placing a stop price, trailing price if placing a trailing stop order |
trailingPercent | 5 | Trailing activation price for trailing stop orders (by percentage) |
totalQuantity | 50 | Order's quantity |
totalQuantityScale | 0 | The offset of the order quantity, default is 0. The combination of 'totalQuantity' and 'totalQuantityScale' of odd lot orders represents the actual order quantity. For example, totalQuantity=111 totalQuantityScale=2, then the real quantity=111*10^(-2)=1.11 |
timeInForce | DAY | DAY/GTC/GTD |
expireTime | 1669000183188 | supported by GTD order |
outsideRth | True | if trade outside regular trading hours (only applicable to U.S. market) |
filledQuantity | 50 | filled quantity |
filledQuantityScale | 0 | filled quantity scale,For example, the filledQuantity value is 2135, the filledQuantityScale is 2, and the actual number of filledQuantity is 21.35 |
totalCashAmount | 100 | Total order cash amount, null when ordering by shares |
filledCashAmount | 100 | Filled order amount, null when ordering by shares |
refundCashAmount | 0 | Refunded amount, equal to 'totalCashAmount' minus 'filledCashAmount'. Null when ordering by shares or when the order is not terminated. |
avgFillPrice | 108.62 | average fill price |
liquidation | false | if the order has been cleared |
remark | Order is expired | error message |
status | Filled | order status, refer to:Order status |
attrDesc | Exercise | Options status, refer to:Options status |
commission | 0.99 | Total commission |
commissionCurrency | USD | Currency of the commision |
realizedPnl | 0.0 | Realized PNL |
percentOffset | 0.0 | Percent offset |
openTime | 1657667486000 | Time when order is placed |
updateTime | 1657670428000 | Last time when the order is updated |
latestTime | 1657670428000 | Last status update time |
symbol | BABA | Stock ticker symbol |
currency | USD | Currency |
market | US | Market |
multiplier | 0.0 | lotsize |
secType | STK | Security Type (STK-stocks, OPT-US Options, WAR-Warrants, IOPT-CBBC) |
userMark | my_strategy_1 | order's remark info,max length is 200 |
canModify | false | Whether the order can be modified |
canCancel | false | Whether the order can be cancelled |
liquidation | false | is it a forced liquidation order |
isOpen | true | Is it an opening order |
replaceStatus | NONE | Order replace status |
cancelStatus | NONE | Order cancel status |
charges | commission and fee details(Only valid when querying order by ID and 'show_charges' = true). refer to Charge details. | |
commissionDiscountAmount | 0 | commission discount amount(Only valid when querying order by ID) |
orderDiscountAmount | 0 | order discount amount(Only valid when querying order by ID) |
orderDiscount | 0 | order discount status. 1:unfinished;2:finished;0:default |
Charge
Description:
Name | Example | Description |
---|---|---|
category | TIGER | fee category:TIGER/THIRD_PARTY |
categoryDesc | Tiger Charge | fee category desc:Tiger Charge; Third Parties |
total | 18 | tatal amount |
details | fee details. refer to ChargeDetails details. |
ChargeDetails
Description:
Name | Example | Description |
---|---|---|
type | SETTLEMENT_FEE | fee type:SETTLEMENT_FEE/STAMP_DUTY/TRANSACTION_LEVY/EXCHANGE_FEE/FRC_TRANSACTION_LEVY |
typeDesc | Settlement Fee | fee type desc:Settlement Fee; Stamp Duty; Transaction Levy; Exchange Fee; AFRC Transaction Levy |
originalAmount | 4 | original amount |
afterDiscountAmount | 4 | amount after deduction |
Example
Get an Order
static async Task<SingleOrderResponse?> QueryOrderByIdAsync(TradeClient tradeClient)
{
TigerRequest<SingleOrderResponse> request = new TigerRequest<SingleOrderResponse>()
{
ApiMethodName = TradeApiService.ORDERS,
ModelValue = new QueryOrderModel()
{
Account = "572386",// tradeClient.GetDefaultAccount,
IsShowCharges = true,
Id = 29360305075913728
}
};
return await tradeClient.ExecuteAsync(request);
}
Get Order List
static async Task<OrderBatchResponse?> QueryOrderAsync(TradeClient tradeClient)
{
TigerRequest<OrderBatchResponse> request = new TigerRequest<OrderBatchResponse>()
{
ApiMethodName = TradeApiService.ORDERS,
ModelValue = new QueryOrderModel()
{
Account = "20200821144442583",// tradeClient.GetDefaultAccount,
StartDate = DateUtil.ConvertTimestamp("2022-12-20 00:00:00", tradeClient.GetConfigTimeZone),
EndDate = DateUtil.CurrentTimeMillis(),
SortBy = OrderSortBy.LATEST_CREATED,
Limit = 5
}
};
return await tradeClient.ExecuteAsync(request);
}
Response Example
Single Order
{
"code": 0,
"message": "success",
"timestamp": 1730979366565,
"data": {
"symbol": "01177",
"market": "HK",
"secType": "STK",
"currency": "HKD",
"identifier": "01177",
"id": 36810407788938240,
"externalId": "710344498739626686",
"orderId": 0,
"account": "572386",
"action": "SELL",
"orderType": "LMT",
"limitPrice": 3.54,
"totalQuantity": 6000,
"totalQuantityScale": 0,
"filledQuantity": 6000,
"filledQuantityScale": 0,
"filledCashAmount": 21240,
"avgFillPrice": 3.54,
"timeInForce": "GTC",
"outsideRth": false,
"commission": 45.82,
"gst": 0,
"realizedPnl": -6388.735,
"remark": "",
"liquidation": false,
"openTime": 1729740323000,
"updateTime": 1730045103000,
"latestTime": 1729740324000,
"name": "SINO BIOPHARM",
"attrDesc": "",
"userMark": "",
"attrList": [
"SETTLED"
],
"charges": [
{
"category": "TIGER",
"categoryDesc": "Tiger Charge",
"total": 18,
"details": [
{
"type": "USER_COMMISSION",
"typeDesc": "Commission",
"originalAmount": 18,
"afterDiscountAmount": 18
}
]
},
{
"category": "THIRD_PARTY",
"categoryDesc": "Third Parties",
"total": 27.82,
"details": [
{
"type": "SETTLEMENT_FEE",
"typeDesc": "Settlement Fee",
"originalAmount": 4,
"afterDiscountAmount": 4
},
{
"type": "STAMP_DUTY",
"typeDesc": "Stamp Duty",
"originalAmount": 22,
"afterDiscountAmount": 22
},
{
"type": "TRANSACTION_LEVY",
"typeDesc": "Transaction Levy",
"originalAmount": 0.58,
"afterDiscountAmount": 0.58
},
{
"type": "EXCHANGE_FEE",
"typeDesc": "Exchange Fee",
"originalAmount": 1.2,
"afterDiscountAmount": 1.2
},
{
"type": "FRC_TRANSACTION_LEVY",
"typeDesc": "AFRC Transaction Levy",
"originalAmount": 0.04,
"afterDiscountAmount": 0.04
}
]
}
],
"algoStrategy": "LMT",
"status": "Filled",
"source": "android",
"discount": 0,
"replaceStatus": "NONE",
"cancelStatus": "NONE",
"canModify": false,
"canCancel": false,
"isOpen": false,
"orderDiscount": 0,
"tradingSessionType": "RTH"
},
"sign": "qTgxt2K5t10LDbmAc+7onHOMEMORKO/qfWJw05O+YIM/mdohUhO4FR+nbe7COIhoJyTwuLGcFSKEowWRjWDwA+cMt/bKx3mj+6A754kaxmtjY4b76tYmjzuH33JmkiIcigeiDYQU1qjziRwK5EKAJRhTXIQefQIh2NzyVCXZjyk="
}
List of orders
{
"data":{
"nextPageToken":"b3JkZXJzfDE2NzE0NjU2MDAwMDB8MTY3MjkyMDk2MTU5MXwyOTM2MDM2Nzk4MzY1Njk2MA==",
"items":[
{
"symbol":"01810",
"market":"HK",
"secType":"STK",
"currency":"HKD",
"identifier":"01810",
"id":29360396894077952,
"orderId":1466,
"parentId":29360396893815808,
"account":"20200821144442583",
"action":"SELL",
"orderType":"TRAIL",
"trailingPercent":10,
"totalQuantity":200,
"timeInForce":"DAY",
"remark":"The primary order has expired",
"openTime":1672901251000,
"updateTime":1672901251000,
"latestTime":1672901252000,
"name":"XIAOMI-W",
"attrDesc":"",
"userMark":"test-attach-stoplosstrail",
"algoStrategy":"TRAIL",
"status":"Invalid"
},
{
"symbol":"01810",
"market":"HK",
"secType":"STK",
"currency":"HKD",
"identifier":"01810",
"id":29360396893815808,
"orderId":1465,
"account":"20200821144442583",
"action":"BUY",
"orderType":"LMT",
"limitPrice":11,
"totalQuantity":200,
"timeInForce":"DAY",
"outsideRth":true,
"remark":"The current order is cross-trading with your pending sell order of the same holders account",
"openTime":1672901251000,
"updateTime":1672901251000,
"latestTime":1672901252000,
"name":"XIAOMI-W",
"attrDesc":"",
"userMark":"test-attach-stoplosstrail",
"algoStrategy":"LMT",
"status":"Invalid"
},
{
"symbol":"01810",
"market":"HK",
"secType":"STK",
"currency":"HKD",
"identifier":"01810",
"id":29360379940570112,
"orderId":1464,
"parentId":29360379940044800,
"account":"20200821144442583",
"action":"SELL",
"orderType":"STP",
"auxPrice":10,
"totalQuantity":200,
"timeInForce":"DAY",
"remark":"The primary order has expired",
"openTime":1672901122000,
"updateTime":1672901122000,
"latestTime":1672901122000,
"name":"XIAOMI-W",
"attrDesc":"",
"userMark":"test001",
"algoStrategy":"STP",
"status":"Invalid"
},
{
"symbol":"01810",
"market":"HK",
"secType":"STK",
"currency":"HKD",
"identifier":"01810",
"id":29360379940044800,
"orderId":1463,
"account":"20200821144442583",
"action":"BUY",
"orderType":"LMT",
"limitPrice":11,
"totalQuantity":200,
"timeInForce":"DAY",
"outsideRth":true,
"remark":"The current order is cross-trading with your pending sell order of the same holders account",
"openTime":1672901122000,
"updateTime":1672901122000,
"latestTime":1672901122000,
"name":"XIAOMI-W",
"attrDesc":"",
"userMark":"test001",
"algoStrategy":"LMT",
"status":"Invalid"
},
{
"symbol":"01810",
"market":"HK",
"secType":"STK",
"currency":"HKD",
"identifier":"01810",
"id":29360367983656960,
"orderId":1462,
"parentId":29360367983789056,
"account":"20200821144442583",
"action":"SELL",
"orderType":"LMT",
"limitPrice":13,
"totalQuantity":200,
"timeInForce":"DAY",
"outsideRth":true,
"remark":"The primary order has expired",
"openTime":1672901030000,
"updateTime":1672901030000,
"latestTime":1672901031000,
"name":"XIAOMI-W",
"attrDesc":"",
"userMark":"",
"algoStrategy":"LMT",
"status":"Invalid"
}
]
},
"message":"success",
"timestamp":1672920984579,
"sign":"iHos8Cj27VV64rMsmHweSOk8n6dAPgGWoRaGVqzA0+MLiNZv1MlBLfhg+UdhGyL4znuALK+KtRZ8TI0LhrcCHsZWeqVIajYN6Vyvx7vn9lshUmzhZ8f+a7DLrk3lkqLay8HnMM+j6BuRSaDaUWfsIHeT/1mYM586nhskIrZnFVU="
}
Get Filled Orders
Request:TigerRequest(TradeApiService.FILLED_ORDERS)
Description
Get a list of orders that has been filled
Argument
Refer to get orders, start_date and end_date are required argument.
Example
static async Task<OrderBatchResponse?> QueryFilledOrderAsync(TradeClient tradeClient)
{
TigerRequest<OrderBatchResponse> request = new TigerRequest<OrderBatchResponse>()
{
ApiMethodName = TradeApiService.FILLED_ORDERS,
ModelValue = new QueryOrderModel()
{
Account = "20200821144442583",// tradeClient.GetDefaultAccount,
StartDate = DateUtil.ConvertTimestamp("2022-12-20 00:00:00", tradeClient.GetConfigTimeZone),
EndDate = DateUtil.CurrentTimeMillis(),
SortBy = OrderSortBy.LATEST_CREATED,
Limit = 3
}
};
return await tradeClient.ExecuteAsync(request);
}
Response
See get orders
Get Open Orders
Request:TigerRequest(TradeApiService.ACTIVE_ORDERS)
Argument
See get orders
Example
static async Task<OrderBatchResponse?> QueryActiveOrderAsync(TradeClient tradeClient)
{
TigerRequest<OrderBatchResponse> request = new TigerRequest<OrderBatchResponse>()
{
ApiMethodName = TradeApiService.ACTIVE_ORDERS,
ModelValue = new QueryOrderModel()
{
Account = "20200821144442583",// tradeClient.GetDefaultAccount,
StartDate = DateUtil.ConvertTimestamp("2022-12-20 00:00:00", tradeClient.GetConfigTimeZone),
EndDate = DateUtil.CurrentTimeMillis(),
SortBy = OrderSortBy.LATEST_CREATED,
Limit = 3
}
};
return await tradeClient.ExecuteAsync(request);
}
Response
See get orders
Get inactive orders
Request:TigerRequest(TradeApiService.INACTIVE_ORDERS)
Argument
See get orders
Response
static async Task<OrderBatchResponse?> QueryInactiveOrderAsync(TradeClient tradeClient)
{
TigerRequest<OrderBatchResponse> request = new TigerRequest<OrderBatchResponse>()
{
ApiMethodName = TradeApiService.INACTIVE_ORDERS,
ModelValue = new QueryOrderModel()
{
Account = tradeClient.GetDefaultAccount, // "20200821144442583",
StartDate = DateUtil.ConvertTimestamp("2022-12-20 00:00:00", tradeClient.GetConfigTimeZone),
EndDate = DateUtil.CurrentTimeMillis(),
SecType = SecType.STK,
SortBy = OrderSortBy.LATEST_CREATED,
Limit = 3
}
};
return await tradeClient.ExecuteAsync(request);
}
Response
See get orders
Get Transaction History
Request:TigerRequest(TradeApiService.ORDER_TRANSACTIONS)
Description
Get the transaction record of the order
Argument
Argument | Type | Required | Description |
---|---|---|---|
account | String | Yes | Account id, prime account only |
order_id | long | Yes | Order ID. order_id and symbol, at least one needs to have a value. if orderId is assigned, you are not able to search orders by order id |
symbol | String | Yes | ticker symbol. order_id and symbol, at least one needs to have a value |
sec_type | String | No, required if search by symbol | STK:stocks/FUT:futures/OPT:options/WAR:warrants/IOPT:CBBC, ALL if not specify |
expiry | String | No, required when sect_type is OPT/WAR/IOPT | Expiration Date |
right | String | No, required when sec_type is OPT/WAR/IOPT | CALL/PUT |
start_date | long | No | start date |
end_date | long | No | end date |
limit | int | No | Maximum number of orders returned, 20 by default, maximum is 100 |
secretKey | String | No | Secret key for the trader of institutions, please config in client_config, ignore if you are a indiviual user |
Response
Name | Example | Description |
---|---|---|
id | 24653027221308416 | transaction ID |
accountId | 402190 | account ID |
orderId | 24637316162520064 | order ID |
secType | STK | security type |
symbol | CII | symbol |
currency | USD | currency |
market | US | market |
action | BUY | order direction, BUY/SELL |
filledQuantity | 100 | filled quantity |
filledPrice | 21 | filled price |
filledAmount | 2167.0 | filled amount |
transactedAt | 2021-11-15 22:34:30 | transaction time |
transactionTime | 1636986870000 | transaction timestamp |
Example
// search by symbol
static async Task<OrderTransactionsResponse?> QueryOrderTransactionsAsync(TradeClient tradeClient)
{
TigerRequest<OrderTransactionsResponse> request = new TigerRequest<OrderTransactionsResponse>()
{
ApiMethodName = TradeApiService.ORDER_TRANSACTIONS,
ModelValue = new OrderTransactionsModel()
{
Account = tradeClient.GetDefaultAccount,// "20200821144442583",
Symbol = "01810",
StartDate = DateUtil.ConvertTimestamp("2022-11-01 00:00:00", tradeClient.GetConfigTimeZone),
EndDate = DateUtil.CurrentTimeMillis(),
Limit = 20
}
};
return await tradeClient.ExecuteAsync(request);
}
// Search by orderId
static async Task<OrderTransactionsResponse?> QueryOrderTransactionsAsync(TradeClient tradeClient)
{
TigerRequest<OrderTransactionsResponse> request = new TigerRequest<OrderTransactionsResponse>()
{
ApiMethodName = TradeApiService.ORDER_TRANSACTIONS,
ModelValue = new OrderTransactionsModel()
{
Account = tradeClient.GetDefaultAccount,// "20200821144442583",
OrderId = 29358459894498304
}
};
return await tradeClient.ExecuteAsync(request);
}
Response Example
{
"data":{
"items":[
{
"id":28805813759117312,
"orderId":28805688059365376,
"accountId":"572386",
"secType":"STK",
"market":"HK",
"currency":"HKD",
"symbol":"01810",
"right":"PUT",
"action":"SELL",
"filledQuantity":200,
"filledPrice":10.32,
"filledAmount":2064,
"transactedAt":"2022-11-17 15:28:37",
"transactionTime":1668670117000
}
]
},
"code":0,
"message":"success",
"timestamp":1672977133300,
"sign":"mfQ7wBB785UReYysC2TcD+1Wo6+sz8l5NzQKofvxD5uSNdAs+Jl/qaiYSwEobQBE1gvJ3bH1JPynlN2DyEG3E6WfD1Lbsqdy4XDcO2UKWIbUpbioW0SLT0WTT/Wr9hX6/uH1xgg3FitL40IX7sR2e40+fa1AmyTaRZkRrGIENk0="
}