Accounts, Positions, and Assets
Example context
import { createClientConfig, TradeClient } from '@tigeropenapi/tigeropen';
const config = createClientConfig();
const tradeClient = TradeClient.fromConfig(config, config.account, config.secretKey);getPositions
getPositionsSignature
async getPositions(req?: PositionsRequest): Promise<Position[]>Purpose
Gets positions.
Parameters, defaults, and constraints
| Parameter | Type | Required | SDK default | Constraints |
|---|---|---|---|---|
req | PositionsRequest | 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.currency | 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.subAccounts | string[] | undefined | No | None | No client-side validation is declared. |
req.expiry | string | undefined | No | None | No client-side validation is declared. |
req.strike | string | undefined | No | None | No client-side validation is declared. |
req.right | string | undefined | No | None | No client-side validation is declared. |
req.assetQuoteType | string | undefined | No | None | No client-side validation is declared. |
req.lang | string | undefined | No | None | No client-side validation is declared. |
Returns
Promise<Position[]>
| Field | Type | Description |
|---|---|---|
| account | string | Account |
| symbol | string | Symbol code |
| secType | string | Security type |
| market | string | Market |
| currency | string | Currency |
| position | number | Position quantity |
| positionScale | number | Position scale |
| positionQty | number | Position share quantity |
| salableQty | number | Salable quantity |
| averageCost | number | Average cost |
| averageCostByAverage | number | Average cost (average method) |
| averageCostOfCarry | number | Average cost (cost of carry method) |
| marketValue | number | Market value |
| realizedPnl | number | Realized P&L |
| realizedPnlByAverage | number | Realized P&L (average method) |
| unrealizedPnl | number | Unrealized P&L |
| unrealizedPnlByAverage | number | Unrealized P&L (average method) |
| unrealizedPnlByCostOfCarry | number | Unrealized P&L (cost of carry) |
| unrealizedPnlPercent | number | Unrealized P&L % |
| unrealizedPnlPercentByAverage | number | Unrealized P&L % (average method) |
| unrealizedPnlPercentByCostOfCarry | number | Unrealized P&L % (cost of carry) |
| contractId | number | Contract ID |
| identifier | string | Identifier |
| name | string | Name |
| latestPrice | number | Latest price |
| lastClosePrice | number | Last close price |
| multiplier | number | Contract multiplier |
| status | number | Trading status |
| updateTimestamp | number | Update timestamp |
| mmPercent | number | Maintenance margin % |
| mmValue | number | Maintenance margin value |
| todayPnl | number | Today's P&L |
| todayPnlPercent | number | Today's P&L % |
| comboTypes | string[] | Combo types |
| categories | string[] | Categories |
Type-checked example
const result = await tradeClient.getPositions({ market: 'US', secType: 'STK' });
console.log(result);Response example
[
{
"account": "string",
"symbol": "string",
"secType": "string",
"market": "string",
"currency": "string",
"position": 0,
"positionScale": 0,
"positionQty": 0,
"salableQty": 0,
"averageCost": 0,
"averageCostByAverage": 0,
"averageCostOfCarry": 0,
"marketValue": 0,
"realizedPnl": 0,
"realizedPnlByAverage": 0,
"unrealizedPnl": 0,
"unrealizedPnlByAverage": 0,
"unrealizedPnlByCostOfCarry": 0,
"unrealizedPnlPercent": 0,
"unrealizedPnlPercentByAverage": 0,
"unrealizedPnlPercentByCostOfCarry": 0,
"contractId": 0,
"identifier": "string",
"name": "string",
"latestPrice": 0,
"lastClosePrice": 0,
"multiplier": 0,
"status": 0,
"updateTimestamp": 0,
"mmPercent": 0,
"mmValue": 0,
"todayPnl": 0,
"todayPnlPercent": 0,
"comboTypes": [
"string"
],
"categories": [
"string"
]
}
]getAssets
getAssetsSignature
async getAssets(req?: AssetsRequest): Promise<Asset[]>Purpose
Gets assets.
Parameters, defaults, and constraints
| Parameter | Type | Required | SDK default | Constraints |
|---|---|---|---|---|
req | AssetsRequest | 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.subAccounts | string[] | undefined | No | None | No client-side validation is declared. |
req.segment | boolean | undefined | No | None | No client-side validation is declared. |
req.marketValue | boolean | undefined | No | None | No client-side validation is declared. |
req.lang | string | undefined | No | None | No client-side validation is declared. |
Returns
Promise<Asset[]>
| Field | Type | Description |
|---|---|---|
| account | string | Account |
| capability | string | Account capability (e.g. RegTMargin) |
| currency | string | Currency |
| buyingPower | number | Buying power |
| cashValue | number | Cash value |
| netLiquidation | number | Net liquidation value |
| realizedPnL | number | Realized P&L |
| unrealizedPnL | number | Unrealized P&L |
| segments | AssetSegment[] | Account segments |
Type-checked example
const result = await tradeClient.getAssets({ segment: true, marketValue: true });
console.log(result);Response example
[
{
"account": "string",
"capability": "string",
"currency": "string",
"buyingPower": 0,
"cashValue": 0,
"netLiquidation": 0,
"realizedPnL": 0,
"unrealizedPnL": 0,
"segments": [
{
"account": "string",
"category": "string",
"title": "string",
"netLiquidation": 0,
"cashValue": 0,
"availableFunds": 0,
"equityWithLoan": 0,
"excessLiquidity": 0,
"accruedCash": 0,
"accruedDividend": 0,
"initMarginReq": 0,
"maintMarginReq": 0,
"grossPositionValue": 0,
"leverage": 0
}
]
}
]getPrimeAssets
getPrimeAssetsSignature
async getPrimeAssets(req?: AssetsRequest): Promise<PrimeAsset | undefined>Purpose
Gets prime assets.
Parameters, defaults, and constraints
| Parameter | Type | Required | SDK default | Constraints |
|---|---|---|---|---|
req | AssetsRequest | 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.subAccounts | string[] | undefined | No | None | No client-side validation is declared. |
req.segment | boolean | undefined | No | None | No client-side validation is declared. |
req.marketValue | boolean | undefined | No | None | No client-side validation is declared. |
req.lang | string | undefined | No | None | No client-side validation is declared. |
Returns
Promise<PrimeAsset | undefined>
| Field | Type | Description |
|---|---|---|
| accountId | string | Account ID |
| updateTimestamp | number | Update timestamp |
| segments | PrimeAssetSegment[] | Account segments |
Type-checked example
const result = await tradeClient.getPrimeAssets({ segment: true, marketValue: true });
console.log(result);Response example
{
"accountId": "string",
"updateTimestamp": 0,
"segments": [
{
"capability": "string",
"category": "string",
"currency": "string",
"cashBalance": 0,
"cashAvailableForTrade": 0,
"grossPositionValue": 0,
"equityWithLoan": 0,
"netLiquidation": 0,
"initMargin": 0,
"maintainMargin": 0,
"overnightMargin": 0,
"unrealizedPL": 0,
"unrealizedPLByCostOfCarry": 0,
"realizedPL": 0,
"totalTodayPL": 0,
"excessLiquidation": 0,
"overnightLiquidation": 0,
"buyingPower": 0,
"lockedFunds": 0,
"leverage": 0,
"uncollected": 0,
"currencyAssets": [
{
"currency": "string",
"cashBalance": 0,
"cashAvailableForTrade": 0,
"forexRate": 0
}
],
"consolidatedSegTypes": [
"string"
]
}
]
}getManagedAccounts
getManagedAccountsSignature
async getManagedAccounts(req?: ManagedAccountsRequest): Promise<ManagedAccount[]>Purpose
Gets managed accounts.
Parameters, defaults, and constraints
| Parameter | Type | Required | SDK default | Constraints |
|---|---|---|---|---|
req | ManagedAccountsRequest | 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.lang | string | undefined | No | None | No client-side validation is declared. |
Returns
Promise<ManagedAccount[]>
| Field | Type | Description |
|---|---|---|
| account | string | Account |
| accountType | string | Account type |
| capability | string | Account capability (e.g. RegTMargin) |
| status | string | Trading status |
Type-checked example
const result = await tradeClient.getManagedAccounts({ lang: 'en_US' });
console.log(result);Response example
[
{
"account": "string",
"accountType": "string",
"capability": "string",
"status": "string"
}
]getAnalyticsAsset
getAnalyticsAssetSignature
async getAnalyticsAsset(req: AnalyticsAssetRequest): Promise<AnalyticsAsset[]>Purpose
Gets analytics asset.
Parameters, defaults, and constraints
| Parameter | Type | Required | SDK default | Constraints |
|---|---|---|---|---|
req | AnalyticsAssetRequest | 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.segType | string | undefined | No | None | No client-side validation is declared. |
req.startDate | string | undefined | No | None | Format: YYYY-MM-DD |
req.endDate | string | undefined | No | None | No client-side validation is declared. |
req.lang | string | undefined | No | None | No client-side validation is declared. |
Returns
Promise<AnalyticsAsset[]>
| Field | Type | Description |
|---|---|---|
| date | string | Date |
| holdingValue | number | Holding value |
| cashBalance | number | Cash balance |
| pnl | number | P&L |
| pnlRate | number | P&L rate |
| netValueIndex | number | Net value index |
| currency | string | Currency |
| segType | string | Segment type |
Type-checked example
const result = await tradeClient.getAnalyticsAsset({ segType: 'SEC', startDate: '2026-01-01', endDate: '2026-01-31' });
console.log(result);Response example
[
{
"date": "string",
"holdingValue": 0,
"cashBalance": 0,
"pnl": 0,
"pnlRate": 0,
"netValueIndex": 0,
"currency": "string",
"segType": "string"
}
]getAggregateAssets
getAggregateAssetsSignature
async getAggregateAssets(req?: AggregateAssetsRequest): Promise<AggregateAssets | undefined>Purpose
Gets aggregate assets.
Parameters, defaults, and constraints
| Parameter | Type | Required | SDK default | Constraints |
|---|---|---|---|---|
req | AggregateAssetsRequest | 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.baseCurrency | string | undefined | No | None | No client-side validation is declared. |
req.segType | string | undefined | No | None | No client-side validation is declared. |
req.lang | string | undefined | No | None | No client-side validation is declared. |
Returns
Promise<AggregateAssets | undefined>
| Field | Type | Description |
|---|---|---|
| accountId | string | Account ID |
| netLiquidation | number | Net liquidation value |
| grossPositionValue | number | Gross position value |
| cashBalance | number | Cash balance |
| baseCurrency | string | Base currency |
| currencyAssets | CurrencyAsset[] | Currency assets |
Type-checked example
const result = await tradeClient.getAggregateAssets({ baseCurrency: 'USD' });
console.log(result);Response example
{
"accountId": "string",
"netLiquidation": 0,
"grossPositionValue": 0,
"cashBalance": 0,
"baseCurrency": "string",
"currencyAssets": [
{
"currency": "string",
"cashBalance": 0,
"cashAvailableForTrade": 0,
"forexRate": 0
}
]
}getEstimateTradableQuantity
getEstimateTradableQuantitySignature
async getEstimateTradableQuantity(req: EstimateTradableQuantityRequest): Promise<EstimateTradableQuantity | undefined>Purpose
Gets estimate tradable quantity.
Parameters, defaults, and constraints
| Parameter | Type | Required | SDK default | Constraints |
|---|---|---|---|---|
req | EstimateTradableQuantityRequest | 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.symbol | string | Yes | None | No client-side validation is declared. |
req.secType | string | Yes | None | No client-side validation is declared. |
req.action | string | Yes | None | No client-side validation is declared. |
req.orderType | string | undefined | No | None | No client-side validation is declared. |
req.limitPrice | number | undefined | No | None | No client-side validation is declared. |
req.market | string | undefined | No | None | No client-side validation is declared. |
req.currency | string | undefined | No | None | No client-side validation is declared. |
req.expiry | string | undefined | No | None | No client-side validation is declared. |
req.strike | string | undefined | No | None | No client-side validation is declared. |
req.right | string | undefined | No | None | No client-side validation is declared. |
req.lang | string | undefined | No | None | No client-side validation is declared. |
Returns
Promise<EstimateTradableQuantity | undefined>
| Field | Type | Description |
|---|---|---|
| tradableQuantity | number | Tradable quantity |
| maxCashBuyQuantity | number | Max cash buy quantity |
| maxMarginBuyQuantity | number | Max margin buy quantity |
| maxShortSellQuantity | number | Max short sell quantity |
| maxPositionSellQuantity | number | Max position sell quantity |
| cashBuyingPower | number | Cash buying power |
| currency | string | Currency |
Type-checked example
const result = await tradeClient.getEstimateTradableQuantity({ symbol: 'AAPL', secType: 'STK', action: 'BUY' });
console.log(result);Response example
{
"tradableQuantity": 0,
"maxCashBuyQuantity": 0,
"maxMarginBuyQuantity": 0,
"maxShortSellQuantity": 0,
"maxPositionSellQuantity": 0,
"cashBuyingPower": 0,
"currency": "string"
}Updated 1 day ago
