Contracts and Orders

Example context

import { createClientConfig, TradeClient } from '@tigeropenapi/tigeropen';

const config = createClientConfig();
const tradeClient = TradeClient.fromConfig(config, config.account, config.secretKey);

fromConfig

Signature

static fromConfig(config: ClientConfig, account: string, secretKey?: string): TradeClient

Purpose

Creates a client from ClientConfig.

Parameters, defaults, and constraints

ParameterTypeRequiredSDK defaultConstraints
configClientConfigYesNoneNone.
config.tigerIdstringYesNoneNone.
config.privateKeystringYesNoneNone.
config.accountstringYesNoneNone.
config.secretKeystring | undefinedNoNoneInstitution secret key for trade authentication (institution accounts only)
config.licensestring | undefinedNoNoneNone.
config.languagestringYesNoneNone.
config.timezonestring | undefinedNoNoneNone.
config.timeoutnumberYesNoneNone.
config.tokenstring | undefinedNoNoneNone.
config.tokenRefreshDurationnumber | undefinedNoNoneNone.
config.tokenCheckIntervalnumber | undefinedNoNoneBackground token check interval in milliseconds; active only when tokenRefreshDuration > 0; default 5 minutes
config.tokenLoaderOptional function returning a string or a string PromiseNoNoneCustom token loader replacing default file loading; see ClientConfig in the signature above for the exact type
config.tokenWriter((token: string) => void) | undefinedNoNoneOptional callback after writing a refreshed token
config.serverUrlstringYesNoneNone.
config.quoteServerUrlstringYesNoneQuote server URL for quote-specific requests; falls back to serverUrl
config.deviceIdstringYesNoneDevice identifier (auto-detected MAC address)
config.tigerPublicKeystringYesNoneNone.
accountstringYesNoneNone.
secretKeystringNoNoneNone.

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

Signature

async getContract(symbol: string, secType: string): Promise<Contract[]>

Purpose

Gets contract.

Parameters, defaults, and constraints

ParameterTypeRequiredSDK defaultConstraints
symbolstringYesNoneNone.
secTypestringYesNoneNone.

Returns

Promise<Contract[]>

FieldTypeDescription
contractIdnumberContract ID
symbolstringSymbol code
secTypestringSecurity type
currencystringCurrency
exchangestringExchange
primaryExchangestringPrimary exchange
localSymbolstringLocal symbol
tradingClassstringTrading class
expirystringExpiration date
strikenumberStrike price
rightstringOption right (CALL/PUT)
multipliernumberContract multiplier
identifierstringIdentifier
namestringName
marketstringMarket
tradeablebooleanWhether tradeable
conidnumberContract sequence number
statusnumberTrading status
marginablebooleanWhether marginable
shortablebooleanWhether shortable
closeOnlybooleanWhether close-only
isEtfbooleanWhether ETF
supportOvernightTradingbooleanWhether supports overnight trading
supportFractionalSharebooleanWhether supports fractional shares
shortMarginnumberShort margin
shortInitialMarginnumberShort initial margin
shortMaintenanceMarginnumberShort maintenance margin
longInitialMarginnumberLong initial margin
longMaintenanceMarginnumberLong maintenance margin
tickSizesTickSize[]Tick sizes list
lotSizenumberLot 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
  }
]

Rate limit: The base limit is 60 requests per minute.


getContracts

Signature

async getContracts(symbols: string[], secType: string): Promise<Contract[]>

Purpose

Gets contracts.

Parameters, defaults, and constraints

ParameterTypeRequiredSDK defaultConstraints
symbolsstring[]YesNoneNone.
secTypestringYesNoneNone.

Returns

Promise<Contract[]>

FieldTypeDescription
contractIdnumberContract ID
symbolstringSymbol code
secTypestringSecurity type
currencystringCurrency
exchangestringExchange
primaryExchangestringPrimary exchange
localSymbolstringLocal symbol
tradingClassstringTrading class
expirystringExpiration date
strikenumberStrike price
rightstringOption right (CALL/PUT)
multipliernumberContract multiplier
identifierstringIdentifier
namestringName
marketstringMarket
tradeablebooleanWhether tradeable
conidnumberContract sequence number
statusnumberTrading status
marginablebooleanWhether marginable
shortablebooleanWhether shortable
closeOnlybooleanWhether close-only
isEtfbooleanWhether ETF
supportOvernightTradingbooleanWhether supports overnight trading
supportFractionalSharebooleanWhether supports fractional shares
shortMarginnumberShort margin
shortInitialMarginnumberShort initial margin
shortMaintenanceMarginnumberShort maintenance margin
longInitialMarginnumberLong initial margin
longMaintenanceMarginnumberLong maintenance margin
tickSizesTickSize[]Tick sizes list
lotSizenumberLot 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
  }
]

Rate limit: The base limit is 60 requests per minute.


getQuoteContract

Signature

async getQuoteContract(symbol: string, secType: string, expiry: string): Promise<Contract[]>

Purpose

Gets quote contract.

Parameters, defaults, and constraints

ParameterTypeRequiredSDK defaultConstraints
symbolstringYesNoneNone.
secTypestringYesNoneNone.
expirystringYesNoneNone.

Returns

Promise<Contract[]>

FieldTypeDescription
contractIdnumberContract ID
symbolstringSymbol code
secTypestringSecurity type
currencystringCurrency
exchangestringExchange
primaryExchangestringPrimary exchange
localSymbolstringLocal symbol
tradingClassstringTrading class
expirystringExpiration date
strikenumberStrike price
rightstringOption right (CALL/PUT)
multipliernumberContract multiplier
identifierstringIdentifier
namestringName
marketstringMarket
tradeablebooleanWhether tradeable
conidnumberContract sequence number
statusnumberTrading status
marginablebooleanWhether marginable
shortablebooleanWhether shortable
closeOnlybooleanWhether close-only
isEtfbooleanWhether ETF
supportOvernightTradingbooleanWhether supports overnight trading
supportFractionalSharebooleanWhether supports fractional shares
shortMarginnumberShort margin
shortInitialMarginnumberShort initial margin
shortMaintenanceMarginnumberShort maintenance margin
longInitialMarginnumberLong initial margin
longMaintenanceMarginnumberLong maintenance margin
tickSizesTickSize[]Tick sizes list
lotSizenumberLot 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
  }
]

Rate limit: The base limit is 60 requests per minute.


getDerivativeContracts

Signature

async getDerivativeContracts(req: DerivativeContractsRequest): Promise<Contract[]>

Purpose

Gets derivative contracts.

Parameters, defaults, and constraints

ParameterTypeRequiredSDK defaultConstraints
reqDerivativeContractsRequestYesNoneNone.
req.accountstring | undefinedNoTradeClient account when omitted or emptyNone.
req.secretKeystring | undefinedNoNoneInstitution account secret key. Overrides the default set in ClientConfig; omit to use the config default.
req.symbolsstring[]YesNoneNone.
req.secTypestringYesNoneNone.
req.expirystring | undefinedNoNoneNone.
req.langstring | undefinedNoNoneNone.

Returns

Promise<Contract[]>

FieldTypeDescription
contractIdnumberContract ID
symbolstringSymbol code
secTypestringSecurity type
currencystringCurrency
exchangestringExchange
primaryExchangestringPrimary exchange
localSymbolstringLocal symbol
tradingClassstringTrading class
expirystringExpiration date
strikenumberStrike price
rightstringOption right (CALL/PUT)
multipliernumberContract multiplier
identifierstringIdentifier
namestringName
marketstringMarket
tradeablebooleanWhether tradeable
conidnumberContract sequence number
statusnumberTrading status
marginablebooleanWhether marginable
shortablebooleanWhether shortable
closeOnlybooleanWhether close-only
isEtfbooleanWhether ETF
supportOvernightTradingbooleanWhether supports overnight trading
supportFractionalSharebooleanWhether supports fractional shares
shortMarginnumberShort margin
shortInitialMarginnumberShort initial margin
shortMaintenanceMarginnumberShort maintenance margin
longInitialMarginnumberLong initial margin
longMaintenanceMarginnumberLong maintenance margin
tickSizesTickSize[]Tick sizes list
lotSizenumberLot 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
  }
]

Rate limit: The base limit is 60 requests per minute.


placeOrder

Signature

async placeOrder(order: OrderRequest): Promise<PlaceOrderResult | undefined>

Purpose

Submits a order request.

Parameters, defaults, and constraints

ParameterTypeRequiredSDK defaultConstraints
orderOrderRequestYesNoneNone.

Returns

Promise<PlaceOrderResult | undefined>

FieldTypeDescription
idnumber | stringGlobal order ID; required by the SDK model
order_id?number | stringAccount-level order ID
subIds?(number | string)[]Sub-order IDs, returned only for applicable order structures
orders?Order[]Orders, present only when returned by the server

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": "31234567890123456",
  "order_id": 10423876
}

Rate limit: The base limit is 120 requests per minute.


previewOrder

Signature

async previewOrder(order: OrderRequest): Promise<PreviewResult | undefined>

Purpose

Performs preview order.

Parameters, defaults, and constraints

ParameterTypeRequiredSDK defaultConstraints
orderOrderRequestYesNoneNone.

Returns

Promise<PreviewResult | undefined>

FieldTypeDescription
accountstringAccount
isPassbooleanWhether passed
commissionnumberCommission; may be omitted; 0 is numeric zero
commissionCurrencystringCommission currency
marginCurrencystringMargin currency
initMarginnumberInitial margin
initMarginBeforenumberInitial margin before
maintMarginnumberMaintenance margin
maintMarginBeforenumberMaintenance margin before
equityWithLoannumberEquity with loan
equityWithLoanBeforenumberEquity with loan before
availableEEnumberAvailable excess equity after the hypothetical fill, in marginCurrency; may be omitted when not applicable
excessLiquiditynumberExcess liquidity after the hypothetical fill, in marginCurrency; may be omitted when not applicable
overnightLiquidationnumberOvernight excess liquidity after the hypothetical fill, in marginCurrency; may be omitted when not applicable
gstnumberGoods and services tax; may be omitted; 0 is numeric zero
messagestringMessage

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

Signature

async modifyOrder(id: number | string, order: OrderRequest): Promise<OrderIdResult | undefined>

Purpose

Modifies order.

Parameters, defaults, and constraints

ParameterTypeRequiredSDK defaultConstraints
idnumber | stringYesNoneNone.
orderOrderRequestYesNoneNone.

Returns

Promise<OrderIdResult | undefined>

FieldTypeDescription
idnumber | stringOrder ID

The returned ID confirms only that the modify request was submitted. Continue querying the order: replaceStatus=REPLACED confirms success, FAILED confirms failure, and other values remain intermediate and must be interpreted with status.

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
}

Rate limit: The base limit is 120 requests per minute.


cancelOrder

Signature

async cancelOrder(id: number | string, secretKey?: string): Promise<OrderIdResult | undefined>

Purpose

Cancels order.

Parameters, defaults, and constraints

ParameterTypeRequiredSDK defaultConstraints
idnumber | stringYesNoneNone.
secretKeystringNoNoneNone.

Returns

Promise<OrderIdResult | undefined>

FieldTypeDescription
idnumber | stringOrder ID

The returned ID confirms only that the cancellation request was submitted. Continue querying until status=Cancelled or the order reaches another final state, such as a fill that completed first; do not treat cancelStatus=RECEIVED as completion.

Type-checked example

const result = await tradeClient.cancelOrder(1, config.secretKey);
console.log(result);

Response example

{
  "id": 12345
}

Rate limit: The base limit is 120 requests per minute.


getOrders

Signature

async getOrders(req?: OrdersRequest): Promise<Order[]>

Purpose

Gets orders.

Parameters, defaults, and constraints

ParameterTypeRequiredSDK defaultConstraints
reqOrdersRequestNoNoneNone.
req.accountstring | undefinedNoTradeClient account when omitted or emptyNone.
req.secretKeystring | undefinedNoNoneInstitution account secret key. Overrides the default set in ClientConfig; omit to use the config default.
req.secTypestring | undefinedNoNoneNone.
req.marketstring | undefinedNoNoneNone.
req.symbolstring | undefinedNoNoneNone.
req.startDatenumber | undefinedNoNoneUnix timestamp in milliseconds
req.endDatenumber | undefinedNoNoneUnix timestamp in milliseconds
req.limitnumber | undefinedNoNoneNone.
req.isBriefboolean | undefinedNoNoneNone.
req.statesstring[] | undefinedNoNoneOrder status filter: Invalid / Initial / PendingCancel / Cancelled / Submitted / Filled / Inactive / PendingSubmit
req.sortBystring | undefinedNoNoneOmnibus accounts only. LATEST_CREATED: sorts descending and filters startDate/endDate by order creation/submission time. LATEST_STATUS_UPDATED: sorts descending and filters them by the most recent order status update time. The server defaults to LATEST_CREATED when omitted.
req.segTypestring | undefinedNoNoneNone.
req.langstring | undefinedNoNoneNone.
req.pageTokenstring | undefinedNoNoneNone.
req.parentIdnumber | undefinedNoNoneUsed only by getActiveOrders to filter attached orders by parent ID

Time range: startDate and endDate are optional; an omitted bound adds no filter for that side. The interface has no maximum time span, but per-response result limits still apply. Use a reasonably bounded range.

Returns

Promise<Order[]>

FieldTypeDescription
accountstringAccount
idnumber | stringOrder ID
orderIdnumber | stringAccount-level order ID
externalIdstringExternal ID
actionstringTrade direction (BUY/SELL)
orderTypestringOrder type
totalQuantitynumberTotal quantity
totalQuantityScalenumberTotal quantity scale
filledQuantitynumberFilled quantity
filledQuantityScalenumberFilled quantity scale
filledCashAmountnumberFilled cash amount
limitPricenumberLimit price
auxPricenumberAuxiliary price
trailingPercentnumberTrailing percent
statusstringTrading status
avgFillPricenumberVolume-weighted average of fill prices, excluding commissions and other fees
timeInForcestringTime in force
outsideRthbooleanOutside regular trading hours
orderLegsOrderLeg[]Order legs
algoParamsAlgoParamsAlgorithm parameters
algoStrategystringAlgorithm strategy
symbolstringSymbol code
secTypestringSecurity type
marketstringMarket
currencystringCurrency
expirystringExpiration date
strikestringStrike price
rightstringOption right (CALL/PUT)
identifierstringIdentifier
namestringName
commissionnumberCommission; may be omitted; 0 is numeric zero
gstnumberGoods and services tax; may be omitted; 0 is numeric zero
realizedPnlnumberRealized P&L; commission and GST are returned separately. Refer to the account statement for the exact calculation basis and currency
openTimenumberOpen time
updateTimenumberUpdate time
latestTimenumberLatest trade time (ms timestamp)
latestPricenumberLatest price
remarkstringRemark
sourcestringSource
userMarkstringUser mark
liquidationbooleanLiquidation value
discountnumberDiscount
replaceStatusstringModify status; REPLACED is final success, FAILED is failure, and RECEIVED only means accepted
cancelStatusstringCancellation-request status; RECEIVED only means accepted, and the final result comes from order status
canModifybooleanWhether modifiable
canCancelbooleanWhether cancellable
isOpenbooleanWhether opening position
orderDiscountnumberOrder discount
tradingSessionTypestringTrading session type
attrDescstringAttribute description
attrListstring[]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"
    ]
  }
]

Rate limit: The base limit is 120 requests per minute.


getActiveOrders

Signature

async getActiveOrders(req?: OrdersRequest): Promise<Order[]>

Purpose

Gets active orders.

Parameters, defaults, and constraints

ParameterTypeRequiredSDK defaultConstraints
reqOrdersRequestNoNoneNone.
req.accountstring | undefinedNoTradeClient account when omitted or emptyNone.
req.secretKeystring | undefinedNoNoneInstitution account secret key. Overrides the default set in ClientConfig; omit to use the config default.
req.secTypestring | undefinedNoNoneNone.
req.marketstring | undefinedNoNoneNone.
req.symbolstring | undefinedNoNoneNone.
req.startDatenumber | undefinedNoNoneOptional start boundary, as a Unix timestamp in milliseconds
req.endDatenumber | undefinedNoNoneOptional end boundary, as a Unix timestamp in milliseconds
req.limitnumber | undefinedNoNoneNone.
req.isBriefboolean | undefinedNoNoneNone.
req.statesstring[] | undefinedNoNoneOrder status filter: Invalid / Initial / PendingCancel / Cancelled / Submitted / Filled / Inactive / PendingSubmit
req.sortBystring | undefinedNoNoneOmnibus accounts only. LATEST_CREATED: sorts descending and filters startDate/endDate by order creation/submission time. LATEST_STATUS_UPDATED: sorts descending and filters them by the most recent order status update time. The server defaults to LATEST_CREATED when omitted.
req.segTypestring | undefinedNoNoneNone.
req.langstring | undefinedNoNoneNone.
req.pageTokenstring | undefinedNoNoneNone.
req.parentIdnumber | undefinedNoNoneUsed only by getActiveOrders to filter attached orders by parent ID

Returns

Promise<Order[]>

FieldTypeDescription
accountstringAccount
idnumber | stringOrder ID
orderIdnumber | stringAccount-level order ID
externalIdstringExternal ID
actionstringTrade direction (BUY/SELL)
orderTypestringOrder type
totalQuantitynumberTotal quantity
totalQuantityScalenumberTotal quantity scale
filledQuantitynumberFilled quantity
filledQuantityScalenumberFilled quantity scale
filledCashAmountnumberFilled cash amount
limitPricenumberLimit price
auxPricenumberAuxiliary price
trailingPercentnumberTrailing percent
statusstringTrading status
avgFillPricenumberVolume-weighted average of fill prices, excluding commissions and other fees
timeInForcestringTime in force
outsideRthbooleanOutside regular trading hours
orderLegsOrderLeg[]Order legs
algoParamsAlgoParamsAlgorithm parameters
algoStrategystringAlgorithm strategy
symbolstringSymbol code
secTypestringSecurity type
marketstringMarket
currencystringCurrency
expirystringExpiration date
strikestringStrike price
rightstringOption right (CALL/PUT)
identifierstringIdentifier
namestringName
commissionnumberCommission; may be omitted; 0 is numeric zero
gstnumberGoods and services tax; may be omitted; 0 is numeric zero
realizedPnlnumberRealized P&L; commission and GST are returned separately. Refer to the account statement for the exact calculation basis and currency
openTimenumberOpen time
updateTimenumberUpdate time
latestTimenumberLatest trade time (ms timestamp)
latestPricenumberLatest price
remarkstringRemark
sourcestringSource
userMarkstringUser mark
liquidationbooleanLiquidation value
discountnumberDiscount
replaceStatusstringModify status; REPLACED is final success, FAILED is failure, and RECEIVED only means accepted
cancelStatusstringCancellation-request status; RECEIVED only means accepted, and the final result comes from order status
canModifybooleanWhether modifiable
canCancelbooleanWhether cancellable
isOpenbooleanWhether opening position
orderDiscountnumberOrder discount
tradingSessionTypestringTrading session type
attrDescstringAttribute description
attrListstring[]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"
    ]
  }
]

Rate limit: The base limit is 120 requests per minute.


getInactiveOrders

Signature

async getInactiveOrders(req?: OrdersRequest): Promise<Order[]>

Purpose

Gets inactive orders.

Parameters, defaults, and constraints

ParameterTypeRequiredSDK defaultConstraints
reqOrdersRequestNoNoneNone.
req.accountstring | undefinedNoTradeClient account when omitted or emptyNone.
req.secretKeystring | undefinedNoNoneInstitution account secret key. Overrides the default set in ClientConfig; omit to use the config default.
req.secTypestring | undefinedNoNoneNone.
req.marketstring | undefinedNoNoneNone.
req.symbolstring | undefinedNoNoneNone.
req.startDatenumber | undefinedNoNoneOptional start boundary, as a Unix timestamp in milliseconds
req.endDatenumber | undefinedNoNoneOptional end boundary, as a Unix timestamp in milliseconds
req.limitnumber | undefinedNoNoneNone.
req.isBriefboolean | undefinedNoNoneNone.
req.statesstring[] | undefinedNoNoneOrder status filter: Invalid / Initial / PendingCancel / Cancelled / Submitted / Filled / Inactive / PendingSubmit
req.sortBystring | undefinedNoNoneOmnibus accounts only. LATEST_CREATED: sorts descending and filters startDate/endDate by order creation/submission time. LATEST_STATUS_UPDATED: sorts descending and filters them by the most recent order status update time. The server defaults to LATEST_CREATED when omitted.
req.segTypestring | undefinedNoNoneNone.
req.langstring | undefinedNoNoneNone.
req.pageTokenstring | undefinedNoNoneNone.
req.parentIdnumber | undefinedNoNoneUsed only by getActiveOrders to filter attached orders by parent ID

Returns

Promise<Order[]>

FieldTypeDescription
accountstringAccount
idnumber | stringOrder ID
orderIdnumber | stringAccount-level order ID
externalIdstringExternal ID
actionstringTrade direction (BUY/SELL)
orderTypestringOrder type
totalQuantitynumberTotal quantity
totalQuantityScalenumberTotal quantity scale
filledQuantitynumberFilled quantity
filledQuantityScalenumberFilled quantity scale
filledCashAmountnumberFilled cash amount
limitPricenumberLimit price
auxPricenumberAuxiliary price
trailingPercentnumberTrailing percent
statusstringTrading status
avgFillPricenumberVolume-weighted average of fill prices, excluding commissions and other fees
timeInForcestringTime in force
outsideRthbooleanOutside regular trading hours
orderLegsOrderLeg[]Order legs
algoParamsAlgoParamsAlgorithm parameters
algoStrategystringAlgorithm strategy
symbolstringSymbol code
secTypestringSecurity type
marketstringMarket
currencystringCurrency
expirystringExpiration date
strikestringStrike price
rightstringOption right (CALL/PUT)
identifierstringIdentifier
namestringName
commissionnumberCommission; may be omitted; 0 is numeric zero
gstnumberGoods and services tax; may be omitted; 0 is numeric zero
realizedPnlnumberRealized P&L; commission and GST are returned separately. Refer to the account statement for the exact calculation basis and currency
openTimenumberOpen time
updateTimenumberUpdate time
latestTimenumberLatest trade time (ms timestamp)
latestPricenumberLatest price
remarkstringRemark
sourcestringSource
userMarkstringUser mark
liquidationbooleanLiquidation value
discountnumberDiscount
replaceStatusstringModify status; REPLACED is final success, FAILED is failure, and RECEIVED only means accepted
cancelStatusstringCancellation-request status; RECEIVED only means accepted, and the final result comes from order status
canModifybooleanWhether modifiable
canCancelbooleanWhether cancellable
isOpenbooleanWhether opening position
orderDiscountnumberOrder discount
tradingSessionTypestringTrading session type
attrDescstringAttribute description
attrListstring[]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"
    ]
  }
]

Rate limit: The base limit is 120 requests per minute.


getFilledOrders

Signature

async getFilledOrders(req?: OrdersRequest): Promise<Order[]>

Purpose

Gets filled orders.

Parameters, defaults, and constraints

ParameterTypeRequiredSDK defaultConstraints
reqOrdersRequestNoNoneNone.
req.accountstring | undefinedNoTradeClient account when omitted or emptyNone.
req.secretKeystring | undefinedNoNoneInstitution account secret key. Overrides the default set in ClientConfig; omit to use the config default.
req.secTypestring | undefinedNoNoneNone.
req.marketstring | undefinedNoNoneNone.
req.symbolstring | undefinedNoNoneNone.
req.startDatenumber | undefinedYesNoneUnix timestamp in milliseconds; required together with endDate; maximum range: 90 days
req.endDatenumber | undefinedYesNoneUnix timestamp in milliseconds; required together with startDate; maximum range: 90 days
req.limitnumber | undefinedNoNoneNone.
req.isBriefboolean | undefinedNoNoneNone.
req.statesstring[] | undefinedNoNoneOrder status filter: Invalid / Initial / PendingCancel / Cancelled / Submitted / Filled / Inactive / PendingSubmit
req.sortBystring | undefinedNoNoneOmnibus accounts only. LATEST_CREATED: sorts descending and filters startDate/endDate by order creation/submission time. LATEST_STATUS_UPDATED: sorts descending and filters them by the most recent order status update time. The server defaults to LATEST_CREATED when omitted.
req.segTypestring | undefinedNoNoneNone.
req.langstring | undefinedNoNoneNone.
req.pageTokenstring | undefinedNoNoneNone.
req.parentIdnumber | undefinedNoNoneUsed only by getActiveOrders to filter attached orders by parent ID

Returns

Promise<Order[]>

FieldTypeDescription
accountstringAccount
idnumber | stringOrder ID
orderIdnumber | stringAccount-level order ID
externalIdstringExternal ID
actionstringTrade direction (BUY/SELL)
orderTypestringOrder type
totalQuantitynumberTotal quantity
totalQuantityScalenumberTotal quantity scale
filledQuantitynumberFilled quantity
filledQuantityScalenumberFilled quantity scale
filledCashAmountnumberFilled cash amount
limitPricenumberLimit price
auxPricenumberAuxiliary price
trailingPercentnumberTrailing percent
statusstringTrading status
avgFillPricenumberVolume-weighted average of fill prices, excluding commissions and other fees
timeInForcestringTime in force
outsideRthbooleanOutside regular trading hours
orderLegsOrderLeg[]Order legs
algoParamsAlgoParamsAlgorithm parameters
algoStrategystringAlgorithm strategy
symbolstringSymbol code
secTypestringSecurity type
marketstringMarket
currencystringCurrency
expirystringExpiration date
strikestringStrike price
rightstringOption right (CALL/PUT)
identifierstringIdentifier
namestringName
commissionnumberCommission; may be omitted; 0 is numeric zero
gstnumberGoods and services tax; may be omitted; 0 is numeric zero
realizedPnlnumberRealized P&L; commission and GST are returned separately. Refer to the account statement for the exact calculation basis and currency
openTimenumberOpen time
updateTimenumberUpdate time
latestTimenumberLatest trade time (ms timestamp)
latestPricenumberLatest price
remarkstringRemark
sourcestringSource
userMarkstringUser mark
liquidationbooleanLiquidation value
discountnumberDiscount
replaceStatusstringModify status; REPLACED is final success, FAILED is failure, and RECEIVED only means accepted
cancelStatusstringCancellation-request status; RECEIVED only means accepted, and the final result comes from order status
canModifybooleanWhether modifiable
canCancelbooleanWhether cancellable
isOpenbooleanWhether opening position
orderDiscountnumberOrder discount
tradingSessionTypestringTrading session type
attrDescstringAttribute description
attrListstring[]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"
    ]
  }
]

Rate limit: The base limit is 120 requests per minute.


getOrder

Signature

async getOrder(req: GetOrderRequest): Promise<Order | undefined>

Purpose

Gets order.

Parameters, defaults, and constraints

ParameterTypeRequiredSDK defaultConstraints
reqGetOrderRequestYesNoneNone.
req.accountstring | undefinedNoTradeClient account when omitted or emptyNone.
req.secretKeystring | undefinedNoNoneInstitution account secret key. Overrides the default set in ClientConfig; omit to use the config default.
req.idnumber | undefinedNoNoneNone.
req.orderIdnumber | undefinedNoNoneNone.
req.isBriefboolean | undefinedNoNoneNone.
req.showChargesboolean | undefinedNoNoneNone.
req.langstring | undefinedNoNoneNone.

Returns

Promise<Order | undefined>

FieldTypeDescription
accountstringAccount
idnumber | stringOrder ID
orderIdnumber | stringAccount-level order ID
externalIdstringExternal ID
actionstringTrade direction (BUY/SELL)
orderTypestringOrder type
totalQuantitynumberTotal quantity
totalQuantityScalenumberTotal quantity scale
filledQuantitynumberFilled quantity
filledQuantityScalenumberFilled quantity scale
filledCashAmountnumberFilled cash amount
limitPricenumberLimit price
auxPricenumberAuxiliary price
trailingPercentnumberTrailing percent
statusstringTrading status
avgFillPricenumberVolume-weighted average of fill prices, excluding commissions and other fees
timeInForcestringTime in force
outsideRthbooleanOutside regular trading hours
orderLegsOrderLeg[]Order legs
algoParamsAlgoParamsAlgorithm parameters
algoStrategystringAlgorithm strategy
symbolstringSymbol code
secTypestringSecurity type
marketstringMarket
currencystringCurrency
expirystringExpiration date
strikestringStrike price
rightstringOption right (CALL/PUT)
identifierstringIdentifier
namestringName
commissionnumberCommission; may be omitted; 0 is numeric zero
gstnumberGoods and services tax; may be omitted; 0 is numeric zero
realizedPnlnumberRealized P&L; commission and GST are returned separately. Refer to the account statement for the exact calculation basis and currency
openTimenumberOpen time
updateTimenumberUpdate time
latestTimenumberLatest trade time (ms timestamp)
latestPricenumberLatest price
remarkstringRemark
sourcestringSource
userMarkstringUser mark
liquidationbooleanLiquidation value
discountnumberDiscount
replaceStatusstringModify status; REPLACED is final success, FAILED is failure, and RECEIVED only means accepted
cancelStatusstringCancellation-request status; RECEIVED only means accepted, and the final result comes from order status
canModifybooleanWhether modifiable
canCancelbooleanWhether cancellable
isOpenbooleanWhether opening position
orderDiscountnumberOrder discount
tradingSessionTypestringTrading session type
attrDescstringAttribute description
attrListstring[]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"
  ]
}

Rate limit: The base limit is 120 requests per minute.


getOrderTransactions

Signature

async getOrderTransactions(req: OrderTransactionsRequest): Promise<Transaction[]>

Purpose

Gets order transactions.

Parameters, defaults, and constraints

ParameterTypeRequiredSDK defaultConstraints
reqOrderTransactionsRequestYesNoneNone.
req.accountstring | undefinedNoTradeClient account when omitted or emptyNone.
req.secretKeystring | undefinedNoNoneInstitution account secret key. Overrides the default set in ClientConfig; omit to use the config default.
req.orderIdnumber | undefinedNoNoneNone.
req.symbolstring | undefinedNoNoneNone.
req.secTypestring | undefinedNoNoneNone.
req.startDatenumber | undefinedNoNoneUnix timestamp in milliseconds
req.endDatenumber | undefinedNoNoneUnix timestamp in milliseconds
req.limitnumber | undefinedNoNoneNone.
req.expirystring | undefinedNoNoneNone.
req.strikenumber | undefinedNoNoneNone.
req.putCallstring | undefinedNoNoneNone.
req.langstring | undefinedNoNoneNone.
req.pageTokenstring | undefinedNoNoneNone.

Returns

Promise<Transaction[]>

FieldTypeDescription
idnumberOrder ID
orderIdnumberOrder ID
accountIdnumberAccount ID
accountstringAccount
symbolstringSymbol code
secTypestringSecurity type
marketstringMarket
currencystringCurrency
identifierstringIdentifier
actionstringTrade direction (BUY/SELL)
pricenumberPrice
filledPricenumberFilled price
quantitynumberQuantity
filledQuantitynumberFilled quantity
filledQuantityScalenumberFilled quantity scale
amountnumberTrading amount
filledAmountnumberFilled amount
commissionnumberCommission
transactedAtstringTransacted at
transactionTimenumberTransaction time
timenumberTime (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
  }
]

Rate limit: The base limit is 60 requests per minute.


Did this page help you?