Contracts and Orders
Example context
import { createClientConfig, TradeClient } from '@tigeropenapi/tigeropen';
const config = createClientConfig();
const tradeClient = TradeClient.fromConfig(config, config.account, config.secretKey);fromConfig
fromConfigSignature
static fromConfig(config: ClientConfig, account: string, secretKey?: string): TradeClientPurpose
Creates a client from ClientConfig.
Parameters, defaults, and constraints
| Parameter | Type | Required | SDK default | Constraints |
|---|---|---|---|---|
config | ClientConfig | Yes | None | No client-side validation is declared. |
config.tigerId | string | Yes | None | No client-side validation is declared. |
config.privateKey | string | Yes | None | No client-side validation is declared. |
config.account | string | Yes | None | No client-side validation is declared. |
config.secretKey | string | undefined | No | None | Institution secret key for trade authentication (institution accounts only) |
config.license | string | undefined | No | None | No client-side validation is declared. |
config.language | string | Yes | None | No client-side validation is declared. |
config.timezone | string | undefined | No | None | No client-side validation is declared. |
config.timeout | number | Yes | None | No client-side validation is declared. |
config.token | string | undefined | No | None | No client-side validation is declared. |
config.tokenRefreshDuration | number | undefined | No | None | No client-side validation is declared. |
config.tokenCheckInterval | number | undefined | No | None | Background token check interval in milliseconds; active only when tokenRefreshDuration > 0; default 5 minutes |
config.tokenLoader | Optional function returning a string or a string Promise | No | None | Custom token loader replacing default file loading; see ClientConfig in the signature above for the exact type |
config.tokenWriter | ((token: string) => void) | undefined | No | None | Optional callback after writing a refreshed token |
config.serverUrl | string | Yes | None | No client-side validation is declared. |
config.quoteServerUrl | string | Yes | None | Quote server URL for quote-specific requests; falls back to serverUrl |
config.deviceId | string | Yes | None | Device identifier (auto-detected MAC address) |
config.tigerPublicKey | string | Yes | None | No client-side validation is declared. |
account | string | Yes | None | No client-side validation is declared. |
secretKey | string | No | None | No client-side validation is declared. |
Returns
TradeClient
Type-checked example
const result = await TradeClient.fromConfig(config, config.account, config.secretKey);
console.log(result);Response example
"TradeClient instance (not an API response payload)"getContract
getContractSignature
async getContract(symbol: string, secType: string): Promise<Contract[]>Purpose
Gets contract.
Parameters, defaults, and constraints
| Parameter | Type | Required | SDK default | Constraints |
|---|---|---|---|---|
symbol | string | Yes | None | No client-side validation is declared. |
secType | string | Yes | None | No client-side validation is declared. |
Returns
Promise<Contract[]>
| Field | Type | Description |
|---|---|---|
| contractId | number | Contract ID |
| symbol | string | Symbol code |
| secType | string | Security type |
| currency | string | Currency |
| exchange | string | Exchange |
| primaryExchange | string | Primary exchange |
| localSymbol | string | Local symbol |
| tradingClass | string | Trading class |
| expiry | string | Expiration date |
| strike | number | Strike price |
| right | string | Option right (CALL/PUT) |
| multiplier | number | Contract multiplier |
| identifier | string | Identifier |
| name | string | Name |
| market | string | Market |
| tradeable | boolean | Whether tradeable |
| conid | number | Contract sequence number |
| status | number | Trading status |
| marginable | boolean | Whether marginable |
| shortable | boolean | Whether shortable |
| closeOnly | boolean | Whether close-only |
| isEtf | boolean | Whether ETF |
| supportOvernightTrading | boolean | Whether supports overnight trading |
| supportFractionalShare | boolean | Whether supports fractional shares |
| shortMargin | number | Short margin |
| shortInitialMargin | number | Short initial margin |
| shortMaintenanceMargin | number | Short maintenance margin |
| longInitialMargin | number | Long initial margin |
| longMaintenanceMargin | number | Long maintenance margin |
| tickSizes | TickSize[] | Tick sizes list |
| lotSize | number | Lot size |
Type-checked example
const result = await tradeClient.getContract('AAPL', 'STK');
console.log(result);Response example
[
{
"contractId": 0,
"symbol": "string",
"secType": "string",
"currency": "string",
"exchange": "string",
"primaryExchange": "string",
"localSymbol": "string",
"tradingClass": "string",
"expiry": "string",
"strike": 0,
"right": "string",
"multiplier": 0,
"identifier": "string",
"name": "string",
"market": "string",
"tradeable": true,
"conid": 0,
"status": 0,
"marginable": true,
"shortable": true,
"closeOnly": true,
"isEtf": true,
"supportOvernightTrading": true,
"supportFractionalShare": true,
"shortMargin": 0,
"shortInitialMargin": 0,
"shortMaintenanceMargin": 0,
"longInitialMargin": 0,
"longMaintenanceMargin": 0,
"tickSizes": [
"TickSize"
],
"lotSize": 0
}
]getContracts
getContractsSignature
async getContracts(symbols: string[], secType: string): Promise<Contract[]>Purpose
Gets contracts.
Parameters, defaults, and constraints
| Parameter | Type | Required | SDK default | Constraints |
|---|---|---|---|---|
symbols | string[] | Yes | None | No client-side validation is declared. |
secType | string | Yes | None | No client-side validation is declared. |
Returns
Promise<Contract[]>
| Field | Type | Description |
|---|---|---|
| contractId | number | Contract ID |
| symbol | string | Symbol code |
| secType | string | Security type |
| currency | string | Currency |
| exchange | string | Exchange |
| primaryExchange | string | Primary exchange |
| localSymbol | string | Local symbol |
| tradingClass | string | Trading class |
| expiry | string | Expiration date |
| strike | number | Strike price |
| right | string | Option right (CALL/PUT) |
| multiplier | number | Contract multiplier |
| identifier | string | Identifier |
| name | string | Name |
| market | string | Market |
| tradeable | boolean | Whether tradeable |
| conid | number | Contract sequence number |
| status | number | Trading status |
| marginable | boolean | Whether marginable |
| shortable | boolean | Whether shortable |
| closeOnly | boolean | Whether close-only |
| isEtf | boolean | Whether ETF |
| supportOvernightTrading | boolean | Whether supports overnight trading |
| supportFractionalShare | boolean | Whether supports fractional shares |
| shortMargin | number | Short margin |
| shortInitialMargin | number | Short initial margin |
| shortMaintenanceMargin | number | Short maintenance margin |
| longInitialMargin | number | Long initial margin |
| longMaintenanceMargin | number | Long maintenance margin |
| tickSizes | TickSize[] | Tick sizes list |
| lotSize | number | Lot size |
Type-checked example
const result = await tradeClient.getContracts(['AAPL'], 'STK');
console.log(result);Response example
[
{
"contractId": 0,
"symbol": "string",
"secType": "string",
"currency": "string",
"exchange": "string",
"primaryExchange": "string",
"localSymbol": "string",
"tradingClass": "string",
"expiry": "string",
"strike": 0,
"right": "string",
"multiplier": 0,
"identifier": "string",
"name": "string",
"market": "string",
"tradeable": true,
"conid": 0,
"status": 0,
"marginable": true,
"shortable": true,
"closeOnly": true,
"isEtf": true,
"supportOvernightTrading": true,
"supportFractionalShare": true,
"shortMargin": 0,
"shortInitialMargin": 0,
"shortMaintenanceMargin": 0,
"longInitialMargin": 0,
"longMaintenanceMargin": 0,
"tickSizes": [
"TickSize"
],
"lotSize": 0
}
]getQuoteContract
getQuoteContractSignature
async getQuoteContract(symbol: string, secType: string, expiry: string): Promise<Contract[]>Purpose
Gets quote contract.
Parameters, defaults, and constraints
| Parameter | Type | Required | SDK default | Constraints |
|---|---|---|---|---|
symbol | string | Yes | None | No client-side validation is declared. |
secType | string | Yes | None | No client-side validation is declared. |
expiry | string | Yes | None | No client-side validation is declared. |
Returns
Promise<Contract[]>
| Field | Type | Description |
|---|---|---|
| contractId | number | Contract ID |
| symbol | string | Symbol code |
| secType | string | Security type |
| currency | string | Currency |
| exchange | string | Exchange |
| primaryExchange | string | Primary exchange |
| localSymbol | string | Local symbol |
| tradingClass | string | Trading class |
| expiry | string | Expiration date |
| strike | number | Strike price |
| right | string | Option right (CALL/PUT) |
| multiplier | number | Contract multiplier |
| identifier | string | Identifier |
| name | string | Name |
| market | string | Market |
| tradeable | boolean | Whether tradeable |
| conid | number | Contract sequence number |
| status | number | Trading status |
| marginable | boolean | Whether marginable |
| shortable | boolean | Whether shortable |
| closeOnly | boolean | Whether close-only |
| isEtf | boolean | Whether ETF |
| supportOvernightTrading | boolean | Whether supports overnight trading |
| supportFractionalShare | boolean | Whether supports fractional shares |
| shortMargin | number | Short margin |
| shortInitialMargin | number | Short initial margin |
| shortMaintenanceMargin | number | Short maintenance margin |
| longInitialMargin | number | Long initial margin |
| longMaintenanceMargin | number | Long maintenance margin |
| tickSizes | TickSize[] | Tick sizes list |
| lotSize | number | Lot size |
Type-checked example
const result = await tradeClient.getQuoteContract('AAPL', 'STK', '20260619');
console.log(result);Response example
[
{
"contractId": 0,
"symbol": "string",
"secType": "string",
"currency": "string",
"exchange": "string",
"primaryExchange": "string",
"localSymbol": "string",
"tradingClass": "string",
"expiry": "string",
"strike": 0,
"right": "string",
"multiplier": 0,
"identifier": "string",
"name": "string",
"market": "string",
"tradeable": true,
"conid": 0,
"status": 0,
"marginable": true,
"shortable": true,
"closeOnly": true,
"isEtf": true,
"supportOvernightTrading": true,
"supportFractionalShare": true,
"shortMargin": 0,
"shortInitialMargin": 0,
"shortMaintenanceMargin": 0,
"longInitialMargin": 0,
"longMaintenanceMargin": 0,
"tickSizes": [
"TickSize"
],
"lotSize": 0
}
]getDerivativeContracts
getDerivativeContractsSignature
async getDerivativeContracts(req: DerivativeContractsRequest): Promise<Contract[]>Purpose
Gets derivative contracts.
Parameters, defaults, and constraints
| Parameter | Type | Required | SDK default | Constraints |
|---|---|---|---|---|
req | DerivativeContractsRequest | Yes | None | No client-side validation is declared. |
req.account | string | undefined | No | TradeClient account when empty (client) | No client-side validation is declared. |
req.secretKey | string | undefined | No | None | Institution account secret key. Overrides the default set in ClientConfig; omit to use the config default. |
req.symbols | string[] | Yes | None | No client-side validation is declared. |
req.secType | string | Yes | None | No client-side validation is declared. |
req.expiry | string | undefined | No | None | No client-side validation is declared. |
req.lang | string | undefined | No | None | No client-side validation is declared. |
Returns
Promise<Contract[]>
| Field | Type | Description |
|---|---|---|
| contractId | number | Contract ID |
| symbol | string | Symbol code |
| secType | string | Security type |
| currency | string | Currency |
| exchange | string | Exchange |
| primaryExchange | string | Primary exchange |
| localSymbol | string | Local symbol |
| tradingClass | string | Trading class |
| expiry | string | Expiration date |
| strike | number | Strike price |
| right | string | Option right (CALL/PUT) |
| multiplier | number | Contract multiplier |
| identifier | string | Identifier |
| name | string | Name |
| market | string | Market |
| tradeable | boolean | Whether tradeable |
| conid | number | Contract sequence number |
| status | number | Trading status |
| marginable | boolean | Whether marginable |
| shortable | boolean | Whether shortable |
| closeOnly | boolean | Whether close-only |
| isEtf | boolean | Whether ETF |
| supportOvernightTrading | boolean | Whether supports overnight trading |
| supportFractionalShare | boolean | Whether supports fractional shares |
| shortMargin | number | Short margin |
| shortInitialMargin | number | Short initial margin |
| shortMaintenanceMargin | number | Short maintenance margin |
| longInitialMargin | number | Long initial margin |
| longMaintenanceMargin | number | Long maintenance margin |
| tickSizes | TickSize[] | Tick sizes list |
| lotSize | number | Lot size |
Type-checked example
const result = await tradeClient.getDerivativeContracts({ symbols: ['AAPL'], secType: 'STK' });
console.log(result);Response example
[
{
"contractId": 0,
"symbol": "string",
"secType": "string",
"currency": "string",
"exchange": "string",
"primaryExchange": "string",
"localSymbol": "string",
"tradingClass": "string",
"expiry": "string",
"strike": 0,
"right": "string",
"multiplier": 0,
"identifier": "string",
"name": "string",
"market": "string",
"tradeable": true,
"conid": 0,
"status": 0,
"marginable": true,
"shortable": true,
"closeOnly": true,
"isEtf": true,
"supportOvernightTrading": true,
"supportFractionalShare": true,
"shortMargin": 0,
"shortInitialMargin": 0,
"shortMaintenanceMargin": 0,
"longInitialMargin": 0,
"longMaintenanceMargin": 0,
"tickSizes": [
"TickSize"
],
"lotSize": 0
}
]placeOrder
placeOrderSignature
async placeOrder(order: OrderRequest): Promise<PlaceOrderResult | undefined>Purpose
Submits a order request.
Parameters, defaults, and constraints
| Parameter | Type | Required | SDK default | Constraints |
|---|---|---|---|---|
order | OrderRequest | Yes | None | No client-side validation is declared. |
Returns
Promise<PlaceOrderResult | undefined>
| Field | Type | Description |
|---|---|---|
| id | string | number |
| order_id | string | number |
| subIds | (string | number)[] |
| orders | Order[] | Orders list |
Type-checked example
const result = await tradeClient.placeOrder({ action: 'BUY', orderType: 'LMT', totalQuantity: 1, timeInForce: 'DAY', symbol: 'AAPL', secType: 'STK' });
console.log(result);Response example
{
"id": 12345,
"order_id": 12345,
"subIds": [
12345
],
"orders": [
{
"account": "string",
"id": 12345,
"orderId": 12345,
"externalId": "string",
"action": "string",
"orderType": "string",
"totalQuantity": 0,
"totalQuantityScale": 0,
"filledQuantity": 0,
"filledQuantityScale": 0,
"filledCashAmount": 0,
"limitPrice": 0,
"auxPrice": 0,
"trailingPercent": 0,
"status": "string",
"avgFillPrice": 0,
"timeInForce": "string",
"outsideRth": true,
"orderLegs": [
"OrderLeg"
],
"algoParams": "AlgoParams",
"algoStrategy": "string",
"symbol": "string",
"secType": "string",
"market": "string",
"currency": "string",
"expiry": "string",
"strike": "string",
"right": "string",
"identifier": "string",
"name": "string",
"commission": 0,
"gst": 0,
"realizedPnl": 0,
"openTime": 0,
"updateTime": 0,
"latestTime": 0,
"latestPrice": 0,
"remark": "string",
"source": "string",
"userMark": "string",
"liquidation": true,
"discount": 0,
"replaceStatus": "string",
"cancelStatus": "string",
"canModify": true,
"canCancel": true,
"isOpen": true,
"orderDiscount": 0,
"tradingSessionType": "string",
"attrDesc": "string",
"attrList": [
"string"
]
}
]
}previewOrder
previewOrderSignature
async previewOrder(order: OrderRequest): Promise<PreviewResult | undefined>Purpose
Performs preview order.
Parameters, defaults, and constraints
| Parameter | Type | Required | SDK default | Constraints |
|---|---|---|---|---|
order | OrderRequest | Yes | None | No client-side validation is declared. |
Returns
Promise<PreviewResult | undefined>
| Field | Type | Description |
|---|---|---|
| account | string | Account |
| isPass | boolean | Whether passed |
| commission | number | Commission |
| commissionCurrency | string | Commission currency |
| marginCurrency | string | Margin currency |
| initMargin | number | Initial margin |
| initMarginBefore | number | Initial margin before |
| maintMargin | number | Maintenance margin |
| maintMarginBefore | number | Maintenance margin before |
| equityWithLoan | number | Equity with loan |
| equityWithLoanBefore | number | Equity with loan before |
| availableEE | number | Available early exercise amount |
| excessLiquidity | number | Excess liquidity |
| overnightLiquidation | number | Overnight liquidation |
| gst | number | Goods and services tax |
| message | string | Message |
Type-checked example
const result = await tradeClient.previewOrder({ action: 'BUY', orderType: 'LMT', totalQuantity: 1, timeInForce: 'DAY', symbol: 'AAPL', secType: 'STK' });
console.log(result);Response example
{
"account": "string",
"isPass": true,
"commission": 0,
"commissionCurrency": "string",
"marginCurrency": "string",
"initMargin": 0,
"initMarginBefore": 0,
"maintMargin": 0,
"maintMarginBefore": 0,
"equityWithLoan": 0,
"equityWithLoanBefore": 0,
"availableEE": 0,
"excessLiquidity": 0,
"overnightLiquidation": 0,
"gst": 0,
"message": "string"
}modifyOrder
modifyOrderSignature
async modifyOrder(id: number | string, order: OrderRequest): Promise<OrderIdResult | undefined>Purpose
Modifies order.
Parameters, defaults, and constraints
| Parameter | Type | Required | SDK default | Constraints |
|---|---|---|---|---|
id | number | string | Yes | None | No client-side validation is declared. |
order | OrderRequest | Yes | None | No client-side validation is declared. |
Returns
Promise<OrderIdResult | undefined>
| Field | Type | Description |
|---|---|---|
| id | string | number |
Type-checked example
const result = await tradeClient.modifyOrder(1, { action: 'BUY', orderType: 'LMT', totalQuantity: 1, timeInForce: 'DAY', symbol: 'AAPL', secType: 'STK' });
console.log(result);Response example
{
"id": 12345
}cancelOrder
cancelOrderSignature
async cancelOrder(id: number | string, secretKey?: string): Promise<OrderIdResult | undefined>Purpose
Cancels order.
Parameters, defaults, and constraints
| Parameter | Type | Required | SDK default | Constraints |
|---|---|---|---|---|
id | number | string | Yes | None | No client-side validation is declared. |
secretKey | string | No | None | No client-side validation is declared. |
Returns
Promise<OrderIdResult | undefined>
| Field | Type | Description |
|---|---|---|
| id | string | number |
Type-checked example
const result = await tradeClient.cancelOrder(1, config.secretKey);
console.log(result);Response example
{
"id": 12345
}getOrders
getOrdersSignature
async getOrders(req?: OrdersRequest): Promise<Order[]>Purpose
Gets orders.
Parameters, defaults, and constraints
| Parameter | Type | Required | SDK default | Constraints |
|---|---|---|---|---|
req | OrdersRequest | No | None | No client-side validation is declared. |
req.account | string | undefined | No | TradeClient account when empty (client) | No client-side validation is declared. |
req.secretKey | string | undefined | No | None | Institution account secret key. Overrides the default set in ClientConfig; omit to use the config default. |
req.secType | string | undefined | No | None | No client-side validation is declared. |
req.market | string | undefined | No | None | No client-side validation is declared. |
req.symbol | string | undefined | No | None | No client-side validation is declared. |
req.startDate | number | undefined | No | None | Unix timestamp in milliseconds () |
req.endDate | number | undefined | No | None | Unix timestamp in milliseconds () |
req.limit | number | undefined | No | None | No client-side validation is declared. |
req.isBrief | boolean | undefined | No | None | No client-side validation is declared. |
req.states | string[] | undefined | No | None | Order status filter: Invalid / Initial / PendingCancel / Cancelled / Submitted / Filled / Inactive / PendingSubmit |
req.sortBy | string | undefined | No | None | LATEST_CREATED / LATEST_STATUS_UPDATED |
req.segType | string | undefined | No | None | No client-side validation is declared. |
req.lang | string | undefined | No | None | No client-side validation is declared. |
req.pageToken | string | undefined | No | None | No client-side validation is declared. |
req.parentId | number | undefined | No | None | Used only by getActiveOrders to filter attached orders by parent ID |
Returns
Promise<Order[]>
| Field | Type | Description |
|---|---|---|
| account | string | Account |
| id | string | number |
| orderId | string | number |
| externalId | string | External ID |
| action | string | Trade direction (BUY/SELL) |
| orderType | string | Order type |
| totalQuantity | number | Total quantity |
| totalQuantityScale | number | Total quantity scale |
| filledQuantity | number | Filled quantity |
| filledQuantityScale | number | Filled quantity scale |
| filledCashAmount | number | Filled cash amount |
| limitPrice | number | Limit price |
| auxPrice | number | Auxiliary price |
| trailingPercent | number | Trailing percent |
| status | string | Trading status |
| avgFillPrice | number | Average fill price |
| timeInForce | string | Time in force |
| outsideRth | boolean | Outside regular trading hours |
| orderLegs | OrderLeg[] | Order legs |
| algoParams | AlgoParams | Algorithm parameters |
| algoStrategy | string | Algorithm strategy |
| symbol | string | Symbol code |
| secType | string | Security type |
| market | string | Market |
| currency | string | Currency |
| expiry | string | Expiration date |
| strike | string | Strike price |
| right | string | Option right (CALL/PUT) |
| identifier | string | Identifier |
| name | string | Name |
| commission | number | Commission |
| gst | number | Goods and services tax |
| realizedPnl | number | Realized P&L |
| openTime | number | Open time |
| updateTime | number | Update time |
| latestTime | number | Latest trade time (ms timestamp) |
| latestPrice | number | Latest price |
| remark | string | Remark |
| source | string | Source |
| userMark | string | User mark |
| liquidation | boolean | Liquidation value |
| discount | number | Discount |
| replaceStatus | string | Replace status |
| cancelStatus | string | Cancel status |
| canModify | boolean | Whether modifiable |
| canCancel | boolean | Whether cancellable |
| isOpen | boolean | Whether opening position |
| orderDiscount | number | Order discount |
| tradingSessionType | string | Trading session type |
| attrDesc | string | Attribute description |
| attrList | string[] | Attribute list |
Type-checked example
const result = await tradeClient.getOrders({ market: 'US', secType: 'STK', limit: 100, sortBy: 'LATEST_CREATED' });
console.log(result);Response example
[
{
"account": "string",
"id": 12345,
"orderId": 12345,
"externalId": "string",
"action": "string",
"orderType": "string",
"totalQuantity": 0,
"totalQuantityScale": 0,
"filledQuantity": 0,
"filledQuantityScale": 0,
"filledCashAmount": 0,
"limitPrice": 0,
"auxPrice": 0,
"trailingPercent": 0,
"status": "string",
"avgFillPrice": 0,
"timeInForce": "string",
"outsideRth": true,
"orderLegs": [
"OrderLeg"
],
"algoParams": {
"algoStrategy": "string",
"startTime": "string",
"endTime": "string",
"participationRate": 0
},
"algoStrategy": "string",
"symbol": "string",
"secType": "string",
"market": "string",
"currency": "string",
"expiry": "string",
"strike": "string",
"right": "string",
"identifier": "string",
"name": "string",
"commission": 0,
"gst": 0,
"realizedPnl": 0,
"openTime": 0,
"updateTime": 0,
"latestTime": 0,
"latestPrice": 0,
"remark": "string",
"source": "string",
"userMark": "string",
"liquidation": true,
"discount": 0,
"replaceStatus": "string",
"cancelStatus": "string",
"canModify": true,
"canCancel": true,
"isOpen": true,
"orderDiscount": 0,
"tradingSessionType": "string",
"attrDesc": "string",
"attrList": [
"string"
]
}
]getActiveOrders
getActiveOrdersSignature
async getActiveOrders(req?: OrdersRequest): Promise<Order[]>Purpose
Gets active orders.
Parameters, defaults, and constraints
| Parameter | Type | Required | SDK default | Constraints |
|---|---|---|---|---|
req | OrdersRequest | No | None | No client-side validation is declared. |
req.account | string | undefined | No | TradeClient account when empty (client) | No client-side validation is declared. |
req.secretKey | string | undefined | No | None | Institution account secret key. Overrides the default set in ClientConfig; omit to use the config default. |
req.secType | string | undefined | No | None | No client-side validation is declared. |
req.market | string | undefined | No | None | No client-side validation is declared. |
req.symbol | string | undefined | No | None | No client-side validation is declared. |
req.startDate | number | undefined | No | None | Unix timestamp in milliseconds () |
req.endDate | number | undefined | No | None | Unix timestamp in milliseconds () |
req.limit | number | undefined | No | None | No client-side validation is declared. |
req.isBrief | boolean | undefined | No | None | No client-side validation is declared. |
req.states | string[] | undefined | No | None | Order status filter: Invalid / Initial / PendingCancel / Cancelled / Submitted / Filled / Inactive / PendingSubmit |
req.sortBy | string | undefined | No | None | LATEST_CREATED / LATEST_STATUS_UPDATED |
req.segType | string | undefined | No | None | No client-side validation is declared. |
req.lang | string | undefined | No | None | No client-side validation is declared. |
req.pageToken | string | undefined | No | None | No client-side validation is declared. |
req.parentId | number | undefined | No | None | Used only by getActiveOrders to filter attached orders by parent ID |
Returns
Promise<Order[]>
| Field | Type | Description |
|---|---|---|
| account | string | Account |
| id | string | number |
| orderId | string | number |
| externalId | string | External ID |
| action | string | Trade direction (BUY/SELL) |
| orderType | string | Order type |
| totalQuantity | number | Total quantity |
| totalQuantityScale | number | Total quantity scale |
| filledQuantity | number | Filled quantity |
| filledQuantityScale | number | Filled quantity scale |
| filledCashAmount | number | Filled cash amount |
| limitPrice | number | Limit price |
| auxPrice | number | Auxiliary price |
| trailingPercent | number | Trailing percent |
| status | string | Trading status |
| avgFillPrice | number | Average fill price |
| timeInForce | string | Time in force |
| outsideRth | boolean | Outside regular trading hours |
| orderLegs | OrderLeg[] | Order legs |
| algoParams | AlgoParams | Algorithm parameters |
| algoStrategy | string | Algorithm strategy |
| symbol | string | Symbol code |
| secType | string | Security type |
| market | string | Market |
| currency | string | Currency |
| expiry | string | Expiration date |
| strike | string | Strike price |
| right | string | Option right (CALL/PUT) |
| identifier | string | Identifier |
| name | string | Name |
| commission | number | Commission |
| gst | number | Goods and services tax |
| realizedPnl | number | Realized P&L |
| openTime | number | Open time |
| updateTime | number | Update time |
| latestTime | number | Latest trade time (ms timestamp) |
| latestPrice | number | Latest price |
| remark | string | Remark |
| source | string | Source |
| userMark | string | User mark |
| liquidation | boolean | Liquidation value |
| discount | number | Discount |
| replaceStatus | string | Replace status |
| cancelStatus | string | Cancel status |
| canModify | boolean | Whether modifiable |
| canCancel | boolean | Whether cancellable |
| isOpen | boolean | Whether opening position |
| orderDiscount | number | Order discount |
| tradingSessionType | string | Trading session type |
| attrDesc | string | Attribute description |
| attrList | string[] | Attribute list |
Type-checked example
const result = await tradeClient.getActiveOrders({ market: 'US', secType: 'STK', symbol: 'AAPL' });
console.log(result);Response example
[
{
"account": "string",
"id": 12345,
"orderId": 12345,
"externalId": "string",
"action": "string",
"orderType": "string",
"totalQuantity": 0,
"totalQuantityScale": 0,
"filledQuantity": 0,
"filledQuantityScale": 0,
"filledCashAmount": 0,
"limitPrice": 0,
"auxPrice": 0,
"trailingPercent": 0,
"status": "string",
"avgFillPrice": 0,
"timeInForce": "string",
"outsideRth": true,
"orderLegs": [
"OrderLeg"
],
"algoParams": {
"algoStrategy": "string",
"startTime": "string",
"endTime": "string",
"participationRate": 0
},
"algoStrategy": "string",
"symbol": "string",
"secType": "string",
"market": "string",
"currency": "string",
"expiry": "string",
"strike": "string",
"right": "string",
"identifier": "string",
"name": "string",
"commission": 0,
"gst": 0,
"realizedPnl": 0,
"openTime": 0,
"updateTime": 0,
"latestTime": 0,
"latestPrice": 0,
"remark": "string",
"source": "string",
"userMark": "string",
"liquidation": true,
"discount": 0,
"replaceStatus": "string",
"cancelStatus": "string",
"canModify": true,
"canCancel": true,
"isOpen": true,
"orderDiscount": 0,
"tradingSessionType": "string",
"attrDesc": "string",
"attrList": [
"string"
]
}
]getInactiveOrders
getInactiveOrdersSignature
async getInactiveOrders(req?: OrdersRequest): Promise<Order[]>Purpose
Gets inactive orders.
Parameters, defaults, and constraints
| Parameter | Type | Required | SDK default | Constraints |
|---|---|---|---|---|
req | OrdersRequest | No | None | No client-side validation is declared. |
req.account | string | undefined | No | TradeClient account when empty (client) | No client-side validation is declared. |
req.secretKey | string | undefined | No | None | Institution account secret key. Overrides the default set in ClientConfig; omit to use the config default. |
req.secType | string | undefined | No | None | No client-side validation is declared. |
req.market | string | undefined | No | None | No client-side validation is declared. |
req.symbol | string | undefined | No | None | No client-side validation is declared. |
req.startDate | number | undefined | No | None | Unix timestamp in milliseconds () |
req.endDate | number | undefined | No | None | Unix timestamp in milliseconds () |
req.limit | number | undefined | No | None | No client-side validation is declared. |
req.isBrief | boolean | undefined | No | None | No client-side validation is declared. |
req.states | string[] | undefined | No | None | Order status filter: Invalid / Initial / PendingCancel / Cancelled / Submitted / Filled / Inactive / PendingSubmit |
req.sortBy | string | undefined | No | None | LATEST_CREATED / LATEST_STATUS_UPDATED |
req.segType | string | undefined | No | None | No client-side validation is declared. |
req.lang | string | undefined | No | None | No client-side validation is declared. |
req.pageToken | string | undefined | No | None | No client-side validation is declared. |
req.parentId | number | undefined | No | None | Used only by getActiveOrders to filter attached orders by parent ID |
Returns
Promise<Order[]>
| Field | Type | Description |
|---|---|---|
| account | string | Account |
| id | string | number |
| orderId | string | number |
| externalId | string | External ID |
| action | string | Trade direction (BUY/SELL) |
| orderType | string | Order type |
| totalQuantity | number | Total quantity |
| totalQuantityScale | number | Total quantity scale |
| filledQuantity | number | Filled quantity |
| filledQuantityScale | number | Filled quantity scale |
| filledCashAmount | number | Filled cash amount |
| limitPrice | number | Limit price |
| auxPrice | number | Auxiliary price |
| trailingPercent | number | Trailing percent |
| status | string | Trading status |
| avgFillPrice | number | Average fill price |
| timeInForce | string | Time in force |
| outsideRth | boolean | Outside regular trading hours |
| orderLegs | OrderLeg[] | Order legs |
| algoParams | AlgoParams | Algorithm parameters |
| algoStrategy | string | Algorithm strategy |
| symbol | string | Symbol code |
| secType | string | Security type |
| market | string | Market |
| currency | string | Currency |
| expiry | string | Expiration date |
| strike | string | Strike price |
| right | string | Option right (CALL/PUT) |
| identifier | string | Identifier |
| name | string | Name |
| commission | number | Commission |
| gst | number | Goods and services tax |
| realizedPnl | number | Realized P&L |
| openTime | number | Open time |
| updateTime | number | Update time |
| latestTime | number | Latest trade time (ms timestamp) |
| latestPrice | number | Latest price |
| remark | string | Remark |
| source | string | Source |
| userMark | string | User mark |
| liquidation | boolean | Liquidation value |
| discount | number | Discount |
| replaceStatus | string | Replace status |
| cancelStatus | string | Cancel status |
| canModify | boolean | Whether modifiable |
| canCancel | boolean | Whether cancellable |
| isOpen | boolean | Whether opening position |
| orderDiscount | number | Order discount |
| tradingSessionType | string | Trading session type |
| attrDesc | string | Attribute description |
| attrList | string[] | Attribute list |
Type-checked example
const result = await tradeClient.getInactiveOrders({ market: 'US', secType: 'STK', states: ['Cancelled'], limit: 50 });
console.log(result);Response example
[
{
"account": "string",
"id": 12345,
"orderId": 12345,
"externalId": "string",
"action": "string",
"orderType": "string",
"totalQuantity": 0,
"totalQuantityScale": 0,
"filledQuantity": 0,
"filledQuantityScale": 0,
"filledCashAmount": 0,
"limitPrice": 0,
"auxPrice": 0,
"trailingPercent": 0,
"status": "string",
"avgFillPrice": 0,
"timeInForce": "string",
"outsideRth": true,
"orderLegs": [
"OrderLeg"
],
"algoParams": {
"algoStrategy": "string",
"startTime": "string",
"endTime": "string",
"participationRate": 0
},
"algoStrategy": "string",
"symbol": "string",
"secType": "string",
"market": "string",
"currency": "string",
"expiry": "string",
"strike": "string",
"right": "string",
"identifier": "string",
"name": "string",
"commission": 0,
"gst": 0,
"realizedPnl": 0,
"openTime": 0,
"updateTime": 0,
"latestTime": 0,
"latestPrice": 0,
"remark": "string",
"source": "string",
"userMark": "string",
"liquidation": true,
"discount": 0,
"replaceStatus": "string",
"cancelStatus": "string",
"canModify": true,
"canCancel": true,
"isOpen": true,
"orderDiscount": 0,
"tradingSessionType": "string",
"attrDesc": "string",
"attrList": [
"string"
]
}
]getFilledOrders
getFilledOrdersSignature
async getFilledOrders(req?: OrdersRequest): Promise<Order[]>Purpose
Gets filled orders.
Parameters, defaults, and constraints
| Parameter | Type | Required | SDK default | Constraints |
|---|---|---|---|---|
req | OrdersRequest | No | None | No client-side validation is declared. |
req.account | string | undefined | No | TradeClient account when empty (client) | No client-side validation is declared. |
req.secretKey | string | undefined | No | None | Institution account secret key. Overrides the default set in ClientConfig; omit to use the config default. |
req.secType | string | undefined | No | None | No client-side validation is declared. |
req.market | string | undefined | No | None | No client-side validation is declared. |
req.symbol | string | undefined | No | None | No client-side validation is declared. |
req.startDate | number | undefined | No | None | Unix timestamp in milliseconds () |
req.endDate | number | undefined | No | None | Unix timestamp in milliseconds () |
req.limit | number | undefined | No | None | No client-side validation is declared. |
req.isBrief | boolean | undefined | No | None | No client-side validation is declared. |
req.states | string[] | undefined | No | None | Order status filter: Invalid / Initial / PendingCancel / Cancelled / Submitted / Filled / Inactive / PendingSubmit |
req.sortBy | string | undefined | No | None | LATEST_CREATED / LATEST_STATUS_UPDATED |
req.segType | string | undefined | No | None | No client-side validation is declared. |
req.lang | string | undefined | No | None | No client-side validation is declared. |
req.pageToken | string | undefined | No | None | No client-side validation is declared. |
req.parentId | number | undefined | No | None | Used only by getActiveOrders to filter attached orders by parent ID |
Returns
Promise<Order[]>
| Field | Type | Description |
|---|---|---|
| account | string | Account |
| id | string | number |
| orderId | string | number |
| externalId | string | External ID |
| action | string | Trade direction (BUY/SELL) |
| orderType | string | Order type |
| totalQuantity | number | Total quantity |
| totalQuantityScale | number | Total quantity scale |
| filledQuantity | number | Filled quantity |
| filledQuantityScale | number | Filled quantity scale |
| filledCashAmount | number | Filled cash amount |
| limitPrice | number | Limit price |
| auxPrice | number | Auxiliary price |
| trailingPercent | number | Trailing percent |
| status | string | Trading status |
| avgFillPrice | number | Average fill price |
| timeInForce | string | Time in force |
| outsideRth | boolean | Outside regular trading hours |
| orderLegs | OrderLeg[] | Order legs |
| algoParams | AlgoParams | Algorithm parameters |
| algoStrategy | string | Algorithm strategy |
| symbol | string | Symbol code |
| secType | string | Security type |
| market | string | Market |
| currency | string | Currency |
| expiry | string | Expiration date |
| strike | string | Strike price |
| right | string | Option right (CALL/PUT) |
| identifier | string | Identifier |
| name | string | Name |
| commission | number | Commission |
| gst | number | Goods and services tax |
| realizedPnl | number | Realized P&L |
| openTime | number | Open time |
| updateTime | number | Update time |
| latestTime | number | Latest trade time (ms timestamp) |
| latestPrice | number | Latest price |
| remark | string | Remark |
| source | string | Source |
| userMark | string | User mark |
| liquidation | boolean | Liquidation value |
| discount | number | Discount |
| replaceStatus | string | Replace status |
| cancelStatus | string | Cancel status |
| canModify | boolean | Whether modifiable |
| canCancel | boolean | Whether cancellable |
| isOpen | boolean | Whether opening position |
| orderDiscount | number | Order discount |
| tradingSessionType | string | Trading session type |
| attrDesc | string | Attribute description |
| attrList | string[] | Attribute list |
Type-checked example
const result = await tradeClient.getFilledOrders({ market: 'US', secType: 'STK', startDate: Date.now() - 30 * 24 * 60 * 60 * 1000, endDate: Date.now(), limit: 100 });
console.log(result);Response example
[
{
"account": "string",
"id": 12345,
"orderId": 12345,
"externalId": "string",
"action": "string",
"orderType": "string",
"totalQuantity": 0,
"totalQuantityScale": 0,
"filledQuantity": 0,
"filledQuantityScale": 0,
"filledCashAmount": 0,
"limitPrice": 0,
"auxPrice": 0,
"trailingPercent": 0,
"status": "string",
"avgFillPrice": 0,
"timeInForce": "string",
"outsideRth": true,
"orderLegs": [
"OrderLeg"
],
"algoParams": {
"algoStrategy": "string",
"startTime": "string",
"endTime": "string",
"participationRate": 0
},
"algoStrategy": "string",
"symbol": "string",
"secType": "string",
"market": "string",
"currency": "string",
"expiry": "string",
"strike": "string",
"right": "string",
"identifier": "string",
"name": "string",
"commission": 0,
"gst": 0,
"realizedPnl": 0,
"openTime": 0,
"updateTime": 0,
"latestTime": 0,
"latestPrice": 0,
"remark": "string",
"source": "string",
"userMark": "string",
"liquidation": true,
"discount": 0,
"replaceStatus": "string",
"cancelStatus": "string",
"canModify": true,
"canCancel": true,
"isOpen": true,
"orderDiscount": 0,
"tradingSessionType": "string",
"attrDesc": "string",
"attrList": [
"string"
]
}
]getOrder
getOrderSignature
async getOrder(req: GetOrderRequest): Promise<Order | undefined>Purpose
Gets order.
Parameters, defaults, and constraints
| Parameter | Type | Required | SDK default | Constraints |
|---|---|---|---|---|
req | GetOrderRequest | Yes | None | No client-side validation is declared. |
req.account | string | undefined | No | TradeClient account when empty (client) | No client-side validation is declared. |
req.secretKey | string | undefined | No | None | Institution account secret key. Overrides the default set in ClientConfig; omit to use the config default. |
req.id | number | undefined | No | None | No client-side validation is declared. |
req.orderId | number | undefined | No | None | No client-side validation is declared. |
req.isBrief | boolean | undefined | No | None | No client-side validation is declared. |
req.showCharges | boolean | undefined | No | None | No client-side validation is declared. |
req.lang | string | undefined | No | None | No client-side validation is declared. |
Returns
Promise<Order | undefined>
| Field | Type | Description |
|---|---|---|
| account | string | Account |
| id | string | number |
| orderId | string | number |
| externalId | string | External ID |
| action | string | Trade direction (BUY/SELL) |
| orderType | string | Order type |
| totalQuantity | number | Total quantity |
| totalQuantityScale | number | Total quantity scale |
| filledQuantity | number | Filled quantity |
| filledQuantityScale | number | Filled quantity scale |
| filledCashAmount | number | Filled cash amount |
| limitPrice | number | Limit price |
| auxPrice | number | Auxiliary price |
| trailingPercent | number | Trailing percent |
| status | string | Trading status |
| avgFillPrice | number | Average fill price |
| timeInForce | string | Time in force |
| outsideRth | boolean | Outside regular trading hours |
| orderLegs | OrderLeg[] | Order legs |
| algoParams | AlgoParams | Algorithm parameters |
| algoStrategy | string | Algorithm strategy |
| symbol | string | Symbol code |
| secType | string | Security type |
| market | string | Market |
| currency | string | Currency |
| expiry | string | Expiration date |
| strike | string | Strike price |
| right | string | Option right (CALL/PUT) |
| identifier | string | Identifier |
| name | string | Name |
| commission | number | Commission |
| gst | number | Goods and services tax |
| realizedPnl | number | Realized P&L |
| openTime | number | Open time |
| updateTime | number | Update time |
| latestTime | number | Latest trade time (ms timestamp) |
| latestPrice | number | Latest price |
| remark | string | Remark |
| source | string | Source |
| userMark | string | User mark |
| liquidation | boolean | Liquidation value |
| discount | number | Discount |
| replaceStatus | string | Replace status |
| cancelStatus | string | Cancel status |
| canModify | boolean | Whether modifiable |
| canCancel | boolean | Whether cancellable |
| isOpen | boolean | Whether opening position |
| orderDiscount | number | Order discount |
| tradingSessionType | string | Trading session type |
| attrDesc | string | Attribute description |
| attrList | string[] | Attribute list |
Type-checked example
const result = await tradeClient.getOrder({ orderId: 30854, showCharges: true });
console.log(result);Response example
{
"account": "string",
"id": 12345,
"orderId": 12345,
"externalId": "string",
"action": "string",
"orderType": "string",
"totalQuantity": 0,
"totalQuantityScale": 0,
"filledQuantity": 0,
"filledQuantityScale": 0,
"filledCashAmount": 0,
"limitPrice": 0,
"auxPrice": 0,
"trailingPercent": 0,
"status": "string",
"avgFillPrice": 0,
"timeInForce": "string",
"outsideRth": true,
"orderLegs": [
{
"legType": "string",
"price": 0,
"timeInForce": "string",
"quantity": 0
}
],
"algoParams": {
"algoStrategy": "string",
"startTime": "string",
"endTime": "string",
"participationRate": 0
},
"algoStrategy": "string",
"symbol": "string",
"secType": "string",
"market": "string",
"currency": "string",
"expiry": "string",
"strike": "string",
"right": "string",
"identifier": "string",
"name": "string",
"commission": 0,
"gst": 0,
"realizedPnl": 0,
"openTime": 0,
"updateTime": 0,
"latestTime": 0,
"latestPrice": 0,
"remark": "string",
"source": "string",
"userMark": "string",
"liquidation": true,
"discount": 0,
"replaceStatus": "string",
"cancelStatus": "string",
"canModify": true,
"canCancel": true,
"isOpen": true,
"orderDiscount": 0,
"tradingSessionType": "string",
"attrDesc": "string",
"attrList": [
"string"
]
}getOrderTransactions
getOrderTransactionsSignature
async getOrderTransactions(req: OrderTransactionsRequest): Promise<Transaction[]>Purpose
Gets order transactions.
Parameters, defaults, and constraints
| Parameter | Type | Required | SDK default | Constraints |
|---|---|---|---|---|
req | OrderTransactionsRequest | Yes | None | No client-side validation is declared. |
req.account | string | undefined | No | TradeClient account when empty (client) | No client-side validation is declared. |
req.secretKey | string | undefined | No | None | Institution account secret key. Overrides the default set in ClientConfig; omit to use the config default. |
req.orderId | number | undefined | No | None | No client-side validation is declared. |
req.symbol | string | undefined | No | None | No client-side validation is declared. |
req.secType | string | undefined | No | None | No client-side validation is declared. |
req.startDate | number | undefined | No | None | Unix timestamp in milliseconds |
req.endDate | number | undefined | No | None | Unix timestamp in milliseconds |
req.limit | number | undefined | No | None | No client-side validation is declared. |
req.expiry | string | undefined | No | None | No client-side validation is declared. |
req.strike | number | undefined | No | None | No client-side validation is declared. |
req.putCall | string | undefined | No | None | No client-side validation is declared. |
req.lang | string | undefined | No | None | No client-side validation is declared. |
req.pageToken | string | undefined | No | None | No client-side validation is declared. |
Returns
Promise<Transaction[]>
| Field | Type | Description |
|---|---|---|
| id | number | Order ID |
| orderId | number | Order ID |
| accountId | number | Account ID |
| account | string | Account |
| symbol | string | Symbol code |
| secType | string | Security type |
| market | string | Market |
| currency | string | Currency |
| identifier | string | Identifier |
| action | string | Trade direction (BUY/SELL) |
| price | number | Price |
| filledPrice | number | Filled price |
| quantity | number | Quantity |
| filledQuantity | number | Filled quantity |
| filledQuantityScale | number | Filled quantity scale |
| amount | number | Trading amount |
| filledAmount | number | Filled amount |
| commission | number | Commission |
| transactedAt | string | Transacted at |
| transactionTime | number | Transaction time |
| time | number | Time (ms timestamp) |
Type-checked example
const result = await tradeClient.getOrderTransactions({ symbol: 'AAPL', secType: 'STK', limit: 100 });
console.log(result);Response example
[
{
"id": 987654,
"orderId": 100234,
"accountId": 10001,
"account": "402901",
"symbol": "AAPL",
"secType": "STK",
"market": "US",
"currency": "USD",
"identifier": "AAPL",
"action": "BUY",
"price": 195.50,
"filledPrice": 195.48,
"quantity": 100,
"filledQuantity": 100,
"filledQuantityScale": 0,
"amount": 19550.0,
"filledAmount": 19548.0,
"commission": 1.99,
"transactedAt": "2025-06-24T15:30:01Z",
"transactionTime": 1719240601000,
"time": 1719240601000
}
]Updated about 17 hours ago
