Get Order Information
Preview Order
Corresponding request class TradeOrderPreviewRequest
Description
Preview an order, returns whether the order can be submitted (i.e., whether the order can be executed), as well as asset information.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| account | string | Yes | User authorized account |
| symbol | string | Yes | Stock code, e.g., AAPL |
| sec_type | string | Yes | Contract type (STK stocks, OPT US stock options, WAR HK warrants, IOPT HK bull/bear certificates) |
| action | string | Yes | Trade direction BUY/SELL |
| order_type | string | Yes | Order type MKT(market order), LMT(limit order), STP(stop order), STP_LMT(stop limit order), TRAIL(trailing stop order) |
| total_quantity | int | Yes | Order quantity (HK stocks, Shanghai-HK Stock Connect, warrants, bull/bear certificates have minimum quantity limits) |
| limit_price | double | No | Limit price, required when order_type is LMT, STP, STP_LMT |
| aux_price | double | No | Stock stop price. Required when order_type is STP, STP_LMT; when order_type is TRAIL, this is the trailing amount |
| trailing_percent | double | No | Trailing stop order percentage, when order_type is TRAIL, aux_price and trailing_percent are mutually exclusive |
| outside_rth | boolean | No | true: Allow pre-market and after-hours trading (US stocks only), false: Not allowed, default allows |
| market | string | No | Market (US stocks US, HK stocks HK, Shanghai-HK Stock Connect CN) |
| currency | string | No | Currency (US stocks USD, HK stocks HKD, Shanghai-HK Stock Connect CNH) |
| time_in_force | string | No | Order validity period, can only be DAY (valid for the day) and GTC (valid until cancelled), default is DAY |
| exchange | string | No | Exchange (US stocks SMART, HK stocks SEHK, Shanghai-HK Stock Connect SEHKNTL, Shenzhen-HK Stock Connect SEHKSZSE) |
| expiry | string | No | Expiry date (options, warrants, bull/bear certificates only) |
| strike | string | No | Strike price (options, warrants, bull/bear certificates only) |
| right | string | No | Option direction PUT/CALL (options, warrants, bull/bear certificates only) |
| multiplier | float | No | Multiplier, quantity per lot (options, warrants, bull/bear certificates only) |
| local_symbol | string | No | Required for warrants and bull/bear certificates, the 5-digit number under the name in the warrant/bull bear certificate list in the APP |
Response
| Field | Type | Description |
|---|---|---|
| account | String | Account ID |
| initMargin | Double | Initial margin after placing order, does not support futures |
| maintMargin | Double | Maintenance margin after placing order, does not support futures |
| equityWithLoan | Double | Loanable assets after placing order, does not support futures |
| initMarginBefore | Double | Initial margin before placing order, does not support futures |
| maintMarginBefore | Double | Maintenance margin before placing order, does not support futures |
| equityWithLoanBefore | Double | Loanable assets before placing order, does not support futures |
| marginCurrency | String | Margin currency |
| commission | Double | Estimated commission |
| gst | Double | Estimated goods and services tax |
| commissionCurrency | String | Estimated commission currency |
| availableEe | Double | Available remaining assets, does not support futures |
| excessLiquidity | Double | Excess liquidity, does not support futures |
| overnightLiquidation | Double | Overnight excess liquidity, does not support futures |
| isPass | Boolean | Whether the order can be submitted |
| message | String | Error reason for non-submittable order |
Example
ContractItem contract = ContractItem.buildStockContract("SPY", "USD");
TradeOrderPreviewRequest request = TradeOrderPreviewRequest.buildLimitOrder(contract, ActionType.BUY, 1, 100.0d);
TradeOrderPreviewResponse response = client.execute(request);
System.out.println(JSONObject.toJSONString(response));Response Example
{
"code": 0,
"message": "success",
"timestamp": 1748413352204,
"data": {
"account": "123456",
"initMargin": 432.617714,
"maintMargin": 424.264714,
"equityWithLoan": 1111.3237541,
"initMarginBefore": 387.617714,
"maintMarginBefore": 386.764714,
"equityWithLoanBefore": 1111.3237541,
"marginCurrency": "USD",
"commission": 0.0,
"commissionCurrency": "USD",
"availableEe": 677.8311632,
"excessLiquidity": 687.05904,
"overnightLiquidation": 687.05904,
"gst": 0.0,
"isPass": true
}
}Get Orders
Corresponding request class: TigerHttpRequest(MethodName.ORDERS)
Description
Get orders
Parameters
Get a specific single order
| Parameter | Type | Required | Description |
|---|---|---|---|
| account | string | Yes | User authorized account: 572386 |
| id | int | Yes | Order number returned after successful order placement |
| secret_key | string | No | Trader secret key, for institutional users only |
| show_charges | bool | No | Whether to return order fee details |
Get order list
| Parameter | Type | Required | Description |
|---|---|---|---|
| account | string | Yes | User authorized account: 572386 |
| seg_type | SegmentType | No | Account segment type, optional values: SegmentType.SEC for securities; SegmentType.FUT for futures; SegmentType.FUND for funds, SegmentType.ALL: represents securities+futures+funds. Default is SegmentType.SEC |
| sec_type | string | No | ALL/STK/OPT/FUT/FOP/CASH default ALL |
| market | string | No | ALL/US/HK/CN default ALL |
| symbol | string | No | Stock code |
| expiry | string | No | Expiry date (options, warrants, bull/bear certificates only) |
| strike | string | No | Strike price (options, warrants, bull/bear certificates only) |
| right | string | No | Option direction PUT/CALL (options, warrants, bull/bear certificates only) |
| start_date | string | No | Start time of order placement (when sort_by=LATEST_STATUS_UPDATED, filter by order status update time), format '2018-05-01' or "2018-05-01 10:00:00" (default GMT+8, can specify timezone), closed interval |
| end_date | string | No | End time of order placement (when sort_by=LATEST_STATUS_UPDATED, filter by order status update time), format '2018-05-15' or "2018-05-01 10:00:00" (default GMT+8, can specify timezone), open interval |
| states | array | No | Only supports global accounts Order status, default queries valid orders, reference: Order Status (hyperlink) |
| isBrief | boolean | No | Only supports global accounts Whether to return simplified order information |
| limit | integer | No | Default is 100, maximum limit is 300 |
| sort_by | OrderSortBy | No | Only supports omnibus accounts Sort and start/end time action field, LATEST_CREATED/LATEST_STATUS_UPDATED; default: LATEST_CREATED |
| secret_key | string | No | Trader secret key, for institutional users only |
| lang | string | No | Language support (Language enum): zh_CN, zh_TW, en_US, default: en_US |
| page_token | string | No | Pagination query token, other query conditions cannot change when using pageToken for pagination |
Response
com.tigerbrokers.stock.openapi.client.https.response.trade.SingleOrderResponse or
com.tigerbrokers.stock.openapi.client.https.response.trade.BatchOrderResponse
| Field | Type | Description |
|---|---|---|
| nextPageToken | string | Token for querying the next page |
| items | array | Order array, refer to field descriptions below |
Order data items properties:
| Name | Example | Description |
|---|---|---|
| id | 27363676799501312 | Global unique order ID, returned after successful order placement |
| orderId | 830154374 | User local auto-increment order ID, not globally unique |
| externalId | 830154374 | Extended ID, for API orders it's the orderId value |
| parentId | 0 | Parent order's order ID |
| account | 572386 | Trading account |
| action | BUY | Trade direction, BUY or SELL |
| orderType | LMT | Order type |
| limitPrice | 108.62 | Limit order price |
| auxPrice | 0.0 | Stop order auxiliary price - trailing amount |
| trailingPercent | 5 | Trailing stop order trailing percentage |
| totalQuantity | 111 | Order quantity |
| totalQuantityScale | 0 | Order quantity offset, default 0. For fractional shares, totalQuantity and totalQuantityScale combined represent real order quantity |
| timeInForce | DAY | DAY/GTC/GTD |
| expireTime | 1669000183188 | Only has value when timeInForce is GTD |
| outsideRth | true | Whether to allow pre-market and after-hours trading |
| filledQuantity | 50 | Filled quantity |
| filledQuantityScale | 0 | Filled quantity offset |
| totalCashAmount | 100 | Total order amount, null when ordering by shares |
| filledCashAmount | 100 | Filled amount, null when ordering by shares |
| refundCashAmount | 0 | Refund amount, equals total order amount minus filled amount |
| avgFillPrice | 108.62 | Average fill price including commission |
| remark | Order is expired | Error description |
| status | Filled | Order status, reference: Order Status |
| attrDesc | Exercise | Order description information, reference: Order Description |
| commission | 0.99 | Includes commission, stamp duty, regulatory fees, etc. |
| commissionCurrency | USD | Commission currency |
| gst | 1.34 | Goods and services tax (only for TBSG license users) |
| realizedPnl | 0.0 | Realized P&L |
| openTime | 1657667486000 | Order placement time |
| updateTime | 1657670428000 | Last update time |
| latestTime | 1657670428000 | Status update time |
| symbol | BABA | Stock code |
| currency | USD | Currency |
| market | US | Trading market |
| multiplier | 0.0 | Multiplier, quantity per lot |
| secType | STK | Trading type |
| userMark | my_strategy_1 | Order remark parameter, returns the set value, length cannot exceed 200 |
| canModify | false | Whether the order can be modified |
| canCancel | false | Whether the order can be cancelled |
| liquidation | false | Whether it's forced liquidation |
| isOpen | true | Whether it's an opening position |
| replaceStatus | NONE | Order Replace Status |
| cancelStatus | NONE | Order Cancel Status |
| charges | Order commission and fee details (single order query only) | |
| commissionDiscountAmount | 0 | Commission discount amount (single order query only) |
| orderDiscountAmount | 0 | Order deduction amount |
| orderDiscount | 0 | Order discount status (single order query only). 1: Pending discount; 2: Applied; 0: Default |
| attrList | ["EXERCISE"] | Order attribute list. Various attributes mean: LIQUIDATION forced liquidation, FRACTIONAL_SHARE fractional shares order, EXERCISE exercise, etc. |
Charge Description:
| Name | Example | Description |
|---|---|---|
| category | TIGER | Fee category: TIGER/THIRD_PARTY |
| categoryDesc | Tiger Charge | Fee category description |
| total | 18 | Total fee for current category |
| details | Fee details. See ChargeDetails below |
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 description |
| originalAmount | 4 | Fee amount |
| afterDiscountAmount | 4 | Fee after discount |
Example
Get single order
TigerHttpClient client = TigerHttpClient.getInstance().clientConfig(
ClientConfig.DEFAULT_CONFIG);
QuerySingleOrderRequest request = new QuerySingleOrderRequest();
String bizContent = AccountParamBuilder.instance()
.account("572386")
.id(31227598058424320L)
.isShowCharges(true)
.lang(Language.en_US)
.buildJson();
request.setBizContent(bizContent);
SingleOrderResponse response = client.execute(request);
if (response.isSuccess()) {
System.out.println(JSONObject.toJSONString(response));
Long id = response.getItem().getId();
String action = response.getItem().getAction();
// ...
} else {
System.out.println(response.getMessage());
}Get order list
TigerHttpClient client = TigerHttpClient.getInstance().clientConfig(
ClientConfig.DEFAULT_CONFIG);
QueryOrderRequest request = new QueryOrderRequest();
String bizContent = AccountParamBuilder.instance()
.account("572386")
.startDate("2023-04-01 00:00:00", TimeZoneId.NewYork)
.endDate("2023-06-20 23:59:59", TimeZoneId.NewYork)
.secType(SecType.STK)
.sortBy(OrderSortBy.LATEST_CREATED)
.limit(5)
.buildJson();
request.setBizContent(bizContent);
BatchOrderResponse response = client.execute(request);
if (response.isSuccess()) {
System.out.println(JSONObject.toJSONString(response));
List<TradeOrder> orders = response.getItem().getOrders();
TradeOrder order1 = orders.get(0);
String symbol = order1.getString("symbol");
Long id = order1.getLong("id");
// ...
} else {
System.out.println(response.getMessage());
}Use pageToken for paginated order retrieval
List<JSONObject> results = new ArrayList<>();
int page = 1;
String pageToken = "";
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
long startTime = sdf.parse("2023-01-01").getTime();
long endTime = sdf.parse("2025-08-01").getTime();
while (true) {
TigerHttpRequest request = new TigerHttpRequest(MethodName.ORDERS);
String bizContent = AccountParamBuilder.instance()
.account("402501")
.symbol("AAPL")
.startDate(String.valueOf(startTime))
.endDate(String.valueOf(endTime))
.limit(10)
.pageToken(pageToken)
.buildJson();
request.setBizContent(bizContent);
TigerHttpResponse response = client.execute(request);
JSONObject responseData = JSON.parseObject(response.getData());
JSONArray items = responseData.getJSONArray("items");
System.out.println("page " + page + ", size " + items.size() +
", next_page_token: " + responseData.getString("nextPageToken"));
page++;
if (items != null && !items.isEmpty()) {
for (int i = 0; i < items.size(); i++) {
results.add(items.getJSONObject(i));
}
}
pageToken = responseData.getString("nextPageToken");
if (StringUtils.isEmpty(pageToken)) {
break;
}
}
System.out.println("total: " + results.size() + ", results: " + results);
Response Example
Single order
{
"code": 0,
"data": {
"account": "572386",
"action": "SELL",
"algoStrategy": "LMT",
"attrDesc": "",
"attrList": [
"SETTLED"
],
"avgFillPrice": 3.54,
"canCancel": false,
"canModify": false,
"cancelStatus": "NONE",
"charges": [
{
"category": "TIGER",
"categoryDesc": "Tiger Charge",
"details": [
{
"afterDiscountAmount": 18,
"originalAmount": 18,
"type": "USER_COMMISSION",
"typeDesc": "Commission"
}
],
"total": 18
},
{
"category": "THIRD_PARTY",
"categoryDesc": "Third Parties",
"details": [
{
"afterDiscountAmount": 4,
"originalAmount": 4,
"type": "SETTLEMENT_FEE",
"typeDesc": "Settlement Fee"
},
{
"afterDiscountAmount": 22,
"originalAmount": 22,
"type": "STAMP_DUTY",
"typeDesc": "Stamp Duty"
},
{
"afterDiscountAmount": 0.58,
"originalAmount": 0.58,
"type": "TRANSACTION_LEVY",
"typeDesc": "Transaction Levy"
},
{
"afterDiscountAmount": 1.2,
"originalAmount": 1.2,
"type": "EXCHANGE_FEE",
"typeDesc": "Exchange Fee"
},
{
"afterDiscountAmount": 0.04,
"originalAmount": 0.04,
"type": "FRC_TRANSACTION_LEVY",
"typeDesc": "AFRC Transaction Levy"
}
],
"total": 27.82
}
],
"commission": 45.82,
"currency": "HKD",
"discount": 0,
"externalId": "710344498739626686",
"filledCashAmount": 21240,
"filledQuantity": 6000,
"filledQuantityScale": 0,
"gst": 0,
"id": 36810407788938240,
"identifier": "01177",
"isOpen": false,
"latestTime": 1729740324000,
"limitPrice": 3.54,
"liquidation": false,
"market": "HK",
"name": "SINO BIOPHARM",
"openTime": 1729740323000,
"orderDiscount": 0,
"orderId": 0,
"orderType": "LMT",
"outsideRth": false,
"realizedPnl": -6388.735,
"remark": "",
"replaceStatus": "NONE",
"secType": "STK",
"source": "android",
"status": "Filled",
"symbol": "01177",
"timeInForce": "GTC",
"totalQuantity": 6000,
"totalQuantityScale": 0,
"tradingSessionType": "RTH",
"updateTime": 1730045103000,
"userMark": ""
},
"message": "success",
"sign": "F9xRzsjqgFlfaUJVajSber2jfCOVt1DIovKcE3yxWK9DFqfTPXHxKqCJ3aT8bGPl/8THViWW0A62LlRL1RB41cLt6bsMUyG7+nSQOE2vPIdo29SyZGcPAiSdRHbY8h3Nq9V1PzVQVqs07joUOw5dUuO5M3TgY/R0UHFV0lwxkBM=",
"success": true,
"timestamp": 1730971141181
}Order List
{
"code":0,
"data":{
"items":[
{
"account":"572386",
"action":"BUY",
"algoStrategy":"MKT",
"attrDesc":"",
"avgFillPrice":9.36,
"canCancel":false,
"canModify":false,
"commission":2.4,
"currency":"USD",
"discount":0,
"externalId":"980",
"filledQuantity":10,
"id":31227598058424320,
"identifier":"NIO.SI",
"isOpen":true,
"latestTime":1687146866000,
"liquidation":false,
"market":"SG",
"name":"NIO Inc.",
"openTime":1687146865000,
"orderId":980,
"orderType":"MKT",
"outsideRth":false,
"realizedPnl":0,
"remark":"",
"secType":"STK",
"source":"OpenApi",
"status":"Filled",
"symbol":"NIO.SI",
"timeInForce":"DAY",
"totalQuantity":10,
"updateTime":1687146866000,
"userMark":""
},
{
"account":"572386",
"action":"BUY",
"algoStrategy":"LMT",
"attrDesc":"",
"avgFillPrice":0,
"canCancel":false,
"canModify":false,
"commission":0,
"currency":"USD",
"discount":0,
"externalId":"979",
"filledQuantity":0,
"id":31227591745209344,
"identifier":"NIO.SI",
"isOpen":true,
"latestTime":1687146817000,
"limitPrice":2,
"liquidation":false,
"market":"SG",
"name":"NIO Inc.",
"openTime":1687146817000,
"orderId":979,
"orderType":"LMT",
"outsideRth":true,
"realizedPnl":0,
"remark":"Order Price exceed max price step (30) limit. For more information, please contact customer service at 400-603-7555.",
"secType":"STK",
"source":"OpenApi",
"status":"Invalid",
"symbol":"NIO.SI",
"timeInForce":"DAY",
"totalQuantity":10,
"updateTime":1687146817000,
"userMark":""
},
{
"account":"572386",
"action":"BUY",
"algoStrategy":"LMT",
"attrDesc":"",
"avgFillPrice":0,
"canCancel":false,
"canModify":false,
"commission":0,
"currency":"USD",
"discount":0,
"externalId":"978",
"filledQuantity":0,
"id":31227575457809408,
"identifier":"NIO.SI",
"isOpen":true,
"latestTime":1687146693000,
"limitPrice":9,
"liquidation":false,
"market":"SG",
"name":"NIO Inc.",
"openTime":1687146693000,
"orderId":978,
"orderType":"LMT",
"outsideRth":true,
"realizedPnl":0,
"remark":"Order Price exceed max price step (30) limit. For more information, please contact customer service at 400-603-7555.",
"secType":"STK",
"source":"OpenApi",
"status":"Invalid",
"symbol":"NIO.SI",
"timeInForce":"DAY",
"totalQuantity":10,
"updateTime":1687146693000,
"userMark":""
},
{
"account":"572386",
"action":"BUY",
"algoStrategy":"LMT",
"attrDesc":"",
"avgFillPrice":0,
"canCancel":false,
"canModify":false,
"commission":0,
"currency":"USD",
"discount":0,
"externalId":"977",
"filledQuantity":0,
"id":31175091790938112,
"identifier":"JD",
"isOpen":true,
"latestTime":1686788253000,
"limitPrice":35,
"liquidation":false,
"market":"US",
"name":"JD.com",
"openTime":1686746274000,
"orderId":977,
"orderType":"LMT",
"outsideRth":true,
"realizedPnl":0,
"remark":"Order is expired",
"secType":"STK",
"source":"OpenApi",
"status":"Inactive",
"symbol":"JD",
"timeInForce":"DAY",
"totalQuantity":1,
"updateTime":1686788253000,
"userMark":""
},
{
"account":"572386",
"action":"BUY",
"algoStrategy":"LMT",
"attrDesc":"",
"avgFillPrice":0,
"canCancel":false,
"canModify":false,
"commission":0,
"currency":"USD",
"discount":0,
"externalId":"976",
"filledQuantity":0,
"id":31175084828133376,
"identifier":"JD",
"isOpen":true,
"latestTime":1686788253000,
"limitPrice":35.9,
"liquidation":false,
"market":"US",
"name":"JD.com",
"openTime":1686746221000,
"orderId":976,
"orderType":"LMT",
"outsideRth":true,
"realizedPnl":0,
"remark":"Order is expired",
"secType":"STK",
"source":"OpenApi",
"status":"Inactive",
"symbol":"JD",
"timeInForce":"DAY",
"totalQuantity":1,
"updateTime":1686788253000,
"userMark":""
}
],
"nextPageToken":"b3JkZXJzfDE2ODAzMjE2MDAwMDB8MTY4NzMxOTk5OTAwMHwzMTE3NTA4NDgyODEzMzM3Ng=="
},
"message":"success",
"sign":"u59vLeh+5Wvim9SwxaW16k9nvTXfnSkZqPqUcq0p0CBtfXQNUFk4nxJXXA6jKXF2RcdfzZn+lkODMpxiI8dGC2bi+/4MoqpnkWGQFAlur/YCSSgTG+TUv1p2mfwZ2CLpKzzNaDk1NEcni+AX1JBeWJeo0GS6bgo8ic22hdS5BLE=",
"success":true,
"timestamp":1687251914180
}Get Filled Orders List
Corresponding Request Class: QueryOrderRequest(MethodName.FILLED_ORDERS)
Description
Get list of orders with filled status
Parameters
Refer to Get Orders, where start_date and end_date are required parameters.
Example
TigerHttpClient client = TigerHttpClient.getInstance().clientConfig(
ClientConfig.DEFAULT_CONFIG);
QueryOrderRequest request = new QueryOrderRequest(MethodName.FILLED_ORDERS);
String bizContent = AccountParamBuilder.instance()
.account("402901")
.secType(SecType.STK)
.startDate("2023-05-15 22:34:30")
.endDate("2023-06-06 22:34:31")
.buildJson();
request.setBizContent(bizContent);
BatchOrderResponse response = client.execute(request);Response
Refer to Get Orders
Get Active Orders List
Corresponding Request Class: QueryOrderRequest(MethodName.ACTIVE_ORDERS)
Parameters
Refer to Get Orders, may include partially filled orders
Example
TigerHttpClient client = TigerHttpClient.getInstance().clientConfig(
ClientConfig.DEFAULT_CONFIG);
QueryOrderRequest request = new QueryOrderRequest(MethodName.ACTIVE_ORDERS);
String bizContent = AccountParamBuilder.instance()
.account("DU575569")
.secType(SecType.STK)
.buildJson();
request.setBizContent(bizContent);
BatchOrderResponse response = client.execute(request);Response
Refer to Get Orders
Get Inactive Orders List
Corresponding Request Class: QueryOrderRequest(MethodName.INACTIVE_ORDERS)
Parameters
Refer to Get Orders
Example
TigerHttpClient client = TigerHttpClient.getInstance().clientConfig(
ClientConfig.DEFAULT_CONFIG);
QueryOrderRequest request = new QueryOrderRequest(MethodName.INACTIVE_ORDERS);
String bizContent = AccountParamBuilder.instance()
.account("DU575569")
.secType(SecType.STK)
.buildJson();
request.setBizContent(bizContent);
BatchOrderResponse response = client.execute(request);Response
Refer to Get Orders
Get Transaction Records
Corresponding Request Class: TigerHttpRequest(MethodName.ORDER_TRANSACTIONS)
Description
Get transaction records of orders
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| account | String | Yes | Account, currently only supports integrated accounts |
| order_id | long | Yes | Global order ID returned after successful order placement, not local order ID. Either order_id or symbol is required. When using orderId, symbol parameter doesn't take effect |
| symbol | String | Yes | Stock symbol. Either order_id or symbol is required. |
| sec_type | String | No, required when querying by symbol | STK:Stock/FUT:Futures/OPT:Options/WAR:Warrants/IOPT:Bull/Bear Certificates, query all if not specified. |
| expiry | String | No, required when sect_type is OPT/WAR/IOPT | Expiry date |
| right | String | No, required when sect_type is OPT/WAR/IOPT | CALL/PUT |
| start_date | long | No | Start time (yyyy-MM-dd HH-mm-ss format needs to be converted to millisecond timestamp) |
| end_date | long | No | End time (yyyy-MM-dd HH-mm-ss format needs to be converted to millisecond timestamp) |
| limit | int | No | Limit on number of returned data, default 20, maximum 100 |
| secretKey | String | No | Trader secret key, for institutional users only |
| page_token | String | No | Pagination query token, when using this field for pagination, other query conditions cannot be changed |
Response
| Field | Example | Description |
|---|---|---|
| id | 24653027221308416 | Transaction record ID |
| accountId | 402190 | Account |
| orderId | 24637316162520064 | Order ID |
| secType | STK | Security type |
| symbol | CII | Symbol |
| currency | USD | Currency |
| market | US | Market |
| action | BUY | Action, 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 |
| nextPageToken | xxxxxx | Next page token |
Example
// Query by symbol
TigerHttpRequest request = new TigerHttpRequest(MethodName.ORDER_TRANSACTIONS);
String bizContent = AccountParamBuilder.instance()
.account("402501")
.secType(SecType.STK)
.symbol("CII")
.limit(30)
.startDate("2021-11-15 22:34:30")
.endDate("2021-11-15 22:34:31")
.buildJson();
request.setBizContent(bizContent);
TigerHttpResponse response = client.execute(request);
JSONArray data = JSON.parseObject(response.getData()).getJSONArray("items");
JSONObject trans1 = data.getJSONObject(0);
// Query by orderId
TigerHttpRequest request = new TigerHttpRequest(MethodName.ORDER_TRANSACTIONS);
String bizContent = AccountParamBuilder.instance()
.account("402501")
.orderId(24637316162520064L)
.limit(30)
.buildJson();
request.setBizContent(bizContent);
TigerHttpResponse response = client.execute(request);
JSONArray data = JSON.parseObject(response.getData()).getJSONArray("items");
JSONObject trans1 = data.getJSONObject(0);
Using pageToken for paginated transaction record retrieval
List<JSONObject> results = new ArrayList<>();
int page = 1;
String pageToken = "";
// Build query parameters
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
long startTime = sdf.parse("2023-01-01").getTime();
long endTime = sdf.parse("2025-08-01").getTime();
while (true) {
TigerHttpRequest request = new TigerHttpRequest(MethodName.ORDER_TRANSACTIONS);
String bizContent = AccountParamBuilder.instance()
.account("402501")
.secType(SecType.STK)
.startDate(String.valueOf(startTime))
.endDate(String.valueOf(endTime))
.limit(10)
.pageToken(pageToken)
.buildJson();
request.setBizContent(bizContent);
TigerHttpResponse response = client.execute(request);
JSONObject responseData = JSON.parseObject(response.getData());
JSONArray items = responseData.getJSONArray("items");
System.out.println("page " + page + ", size " + items.size() +
", next_page_token: " + responseData.getString("nextPageToken"));
page++;
if (items != null && !items.isEmpty()) {
for (int i = 0; i < items.size(); i++) {
results.add(items.getJSONObject(i));
}
}
pageToken = responseData.getString("nextPageToken");
if (StringUtils.isEmpty(pageToken)) {
break;
}
}
System.out.println("total: " + results.size() + ", results: " + results);Response Example
{
"items": [
{
"id": 24653027221308416,
"accountId": 402901,
"orderId": 24637316162520064,
"secType": "STK",
"symbol": "CII",
"currency": "USD",
"market": "US",
"action": "BUY",
"filledQuantity": 100,
"filledPrice": 21.67,
"filledAmount": 2167,
"transactedAt": "2021-11-15 22:34:30",
"transactionTime": 1636986870000
}
],
"nextPageToken": "xxxxxx"
}Updated 9 days ago
