Get Order Information

About 7 min

Get Orders

Request:TigerRequest(TradeApiService.ORDERS)

Description

Get details for orders that you placed

Argument

Get a single order

ArgumentTypeRequiredDescription
accountstringYesAccount id: 572386
idintYesorder id, this id is used to identify an order on the server
secret_keystringNoSecret key for the trader of institutions, please config in client_config, ignore if you are a individual user
show_chargesboolNoreturn commission and fee details

Get a list of orders

ArgumentTypeRequiredDescription
accountstringYesAccount id:572386
seg_typeSegmentTypeNoAccount 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_typestringNoALL/STK/OPT/FUT/FOP/CASH, ALL by default
marketstringNoALL/US/HK/CN, defaul value is ALL
symbolstringNoStock ticker symbol
expirystringNoExpiration data for options, warrants and CBBC
strikestringNoStrike price for options, warrants and CBBC
rightstringNoPUT/CALL for options, warrants and CBBC
start_datestringNoThe 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_datestringNoThe 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
statesarrayNoOrder status, open orders by default, Please refer to: Order Status for possible states
isBriefbooleanNo0 for detailed information, 1 for concise information
limitintegerNoMaximum number of orders returned. Default value is 100. Maximum possible value is 300
sort_byOrderSortByNoFields used to sort and filter start_date and end_date,LATEST_CREATED/LATEST_STATUS_UPDATED; Default:LATEST_CREATED
secret_keystringNoSecret key for the trader of institutions, please config in client_config, ignore if you are a indiviual user
langstringNoLanguage: zh_CN,zh_TW,en_US, By default: en_US
page_tokenstringNoToken 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:

NameTypeDescription
nextPageTokenstringpage token for next query
itemsList<TradeOrder>An array of orders, please refer to the description below for detailed fields

items has the following attributes:

NameExampleDescription
id135482687464472583unique order id assigned by the server
orderId1000003917order id assigned by the user, not unique
externalId1000003917external id, The value is the same as 'orderId' when placing an order through the API
parentId0order id of the main (parent) order
account572386Account id
actionBUYOrder direction: BUY/SELL
orderTypeLMTOrder Types,'MKT'-Market Order / 'LMT'-Limit Order / 'STP'-Stop Order / 'STP_LMT'-Stop-Limit Order / 'TRAIL'-Trailing Stop Order
limitPrice108.62Limit price
auxPrice0.0Auxilary price. it represents the stop price if placing a stop price, trailing price if placing a trailing stop order
trailingPercent5Trailing activation price for trailing stop orders (by percentage)
totalQuantity50Order's quantity
totalQuantityScale0The 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
timeInForceDAYDAY/GTC/GTD
expireTime1669000183188supported by GTD order
outsideRthTrueif trade outside regular trading hours (only applicable to U.S. market)
filledQuantity50filled quantity
filledQuantityScale0filled quantity scale,For example, the filledQuantity value is 2135, the filledQuantityScale is 2, and the actual number of filledQuantity is 21.35
totalCashAmount100Total order cash amount, null when ordering by shares
filledCashAmount100Filled order amount, null when ordering by shares
refundCashAmount0Refunded amount, equal to 'totalCashAmount' minus 'filledCashAmount'. Null when ordering by shares or when the order is not terminated.
avgFillPrice108.62average fill price
liquidationfalseif the order has been cleared
remarkOrder is expirederror message
statusFilledorder status, refer to:Order status
attrDescExerciseOptions status, refer to:Options status
commission0.99Total commission
commissionCurrencyUSDCurrency of the commision
realizedPnl0.0Realized PNL
percentOffset0.0Percent offset
openTime1657667486000Time when order is placed
updateTime1657670428000Last time when the order is updated
latestTime1657670428000Last status update time
symbolBABAStock ticker symbol
currencyUSDCurrency
marketUSMarket
multiplier0.0lotsize
secTypeSTKSecurity Type (STK-stocks, OPT-US Options, WAR-Warrants, IOPT-CBBC)
userMarkmy_strategy_1order's remark info,max length is 200
canModifyfalseWhether the order can be modified
canCancelfalseWhether the order can be cancelled
liquidationfalseis it a forced liquidation order
isOpentrueIs it an opening order
replaceStatusNONEOrder replace status
cancelStatusNONEOrder cancel status
chargescommission and fee details(Only valid when querying order by ID and 'show_charges' = true). refer to Charge details.
commissionDiscountAmount0commission discount amount(Only valid when querying order by ID)
orderDiscountAmount0order discount amount(Only valid when querying order by ID)
orderDiscount0order discount status. 1:unfinished;2:finished;0:default

ChargeDescription:

NameExampleDescription
categoryTIGERfee category:TIGER/THIRD_PARTY
categoryDescTiger Chargefee category desc:Tiger Charge; Third Parties
total18tatal amount
detailsfee details. refer to ChargeDetails details.

ChargeDetailsDescription:

NameExampleDescription
typeSETTLEMENT_FEEfee type:SETTLEMENT_FEE/STAMP_DUTY/TRANSACTION_LEVY/EXCHANGE_FEE/FRC_TRANSACTION_LEVY
typeDescSettlement Feefee type desc:Settlement Fee; Stamp Duty; Transaction Levy; Exchange Fee; AFRC Transaction Levy
originalAmount4original amount
afterDiscountAmount4amount 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

ArgumentTypeRequiredDescription
accountStringYesAccount id, prime account only
order_idlongYesOrder 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
symbolStringYesticker symbol. order_id and symbol, at least one needs to have a value
sec_typeStringNo, required if search by symbolSTK:stocks/FUT:futures/OPT:options/WAR:warrants/IOPT:CBBC, ALL if not specify
expiryStringNo, required when sect_type is OPT/WAR/IOPTExpiration Date
rightStringNo, required when sec_type is OPT/WAR/IOPTCALL/PUT
start_datelongNostart date
end_datelongNoend date
limitintNoMaximum number of orders returned, 20 by default, maximum is 100
secretKeyStringNoSecret key for the trader of institutions, please config in client_config, ignore if you are a indiviual user

Response

NameExampleDescription
id24653027221308416transaction ID
accountId402190account ID
orderId24637316162520064order ID
secTypeSTKsecurity type
symbolCIIsymbol
currencyUSDcurrency
marketUSmarket
actionBUYorder direction, BUY/SELL
filledQuantity100filled quantity
filledPrice21filled price
filledAmount2167.0filled amount
transactedAt2021-11-15 22:34:30transaction time
transactionTime1636986870000transaction 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="
}
Last update: