Query Account Information

Account List

Corresponding request class: TigerHttpRequest(MethodName.ACCOUNTS)

Description

Retrieve the list of managed accounts. Institutional accounts will return the master account and all sub-accounts.

Parameters

ParameterTypeRequiredDescription
accountstringNoThe user's authorized account (paper trading accounts are not supported), if not provided, all accounts will be returned, including: Prime, Global, Paper trading.

Return

The specific data is saved in the returned data field, with the following meanings:

FieldExampleDescription
accountPrime: 50129912, Global: U5755619, Paper trading: 20191221901212121Trading capital account. Prime account is 5 to 10 digits, Paper trading account is 17 digits
capabilityRegTMarginAccount type (CASH: cash account, RegTMargin: Reg T margin account)
statusFundedAccount status, "Funded" for most cases. Status includes: Funded, Open, Pending, Rejected, Closed
accountTypeSTANDARDAccount classification (STANDARD: prime account, PAPER: paper trading account)

Example

TigerHttpClient client = TigerHttpClient.getInstance().clientConfig(
      ClientConfig.DEFAULT_CONFIG);
TigerHttpRequest request = new TigerHttpRequest(MethodName.ACCOUNTS);

String bizContent = AccountParamBuilder.instance()
        .account("123456")
        .buildJsonWithoutDefaultAccount();
# Query the default account configured in ClientConfig.DEFAULT_CONFIG
# String bizContent = AccountParamBuilder.instance().buildJson();
# Query all account lists
# String bizContent = AccountParamBuilder.instance().buildJsonWithoutDefaultAccount();

request.setBizContent(bizContent);
TigerHttpResponse response = client.execute(request);

# Get specific field data
JSONArray accounts = JSON.parseObject(response.getData()).getJSONArray("items");
JSONObject account1 = accounts.getJSONObject(0);
String capability = account1.getString("capability");
String accountType = account1.getString("accountType");
String account = account1.getString("account");
String status = account1.getString("status");

Return Example

{
  "code": 0,
  "message": "success",
  "data": {
    "items": [
      {
        "account": "123456",
        "capability": "RegTMargin",
        "status": "Funded",
        "accountType": "STANDARD"
      }
    ]
  }
}

Account Positions

Corresponding request class: PositionsRequest

Description

Query account positions

Parameters

ParameterTypeRequiredDescription
accountstringYesUser's authorized account: 13810712
sec_typestringNoSecurity type, including: STK/OPT/WAR/IOPT/CASH/FOP, default STK
currencystringNoCurrency type, including: ALL/USD default ALL
marketstringNoMarket classification, including: ALL/US default ALL
symbolstringNoStock symbol such as: 600884 / SNAP., for options: symbol can be underlying stock code or identifier, format is fixed as 21 chars, 6 chars for symbol, fill with spaces if less. Bull-Bear send 5 digit code, options send
secret_keystringNoTrader key, for institutional users only
expirystringNoExpiration date (for options, bull-bear). Format 'yyyyMMdd', e.g. '20230818'
strikedoubleNoStrike price (for options, bull-bear), e.g. 100.5
rightstringNoCall or put (for options, bull-bear). 'PUT' or 'CALL'
asset_quote_typestringNoAsset quote mode (only for prime account), see Asset Quote Type Enum

Return

com.tigerbrokers.stock.openapi.client.https.response.trade.PositionsResponse Positions list can be obtained with List<PositionDetail> items = response.getItem().getPositions(). See example code for details

PositionDetail Description:

NameTypeDescription
accountstringTrading account
positionQtydoublePosition quantity
salableQtydoubleSellable quantity
positionlongPosition quantity (deprecated)
positionScaleintPosition scale (deprecated), e.g. position=11123, positionScale=2, actual position=11123*10^(-2)=111.23
averageCostdoubleAverage FIFO cost
averageCostByAveragedoubleAverage price cost
averageCostOfCarrydoubleDiluted position cost (A-shares mode calculation)
latestPricedoubleMarket price (during trading session), for US stocks non-trading, prime account is after-market close
isLevel0PricebooleanWhether is lv0 (delayed) market data
marketValuedoubleMarket value
realizedPnldoubleRealized P&L in pattern mode
realizedPnlByAveragedoubleRealized P&L in average mode
unrealizedPnldoubleUnrealized P&L
unrealizedPnlByAveragedoubleUnrealized P&L by average cost
unrealizedPnlPercentdoubleUnrealized yield rate (Return on Investment)
unrealizedPnlPercentByAveragedoubleUnrealized yield rate by average cost
unrealizedPnlByCostOfCarrydoubleUnrealized P&L (A-share mode calculation)
unrealizedPnlPercentByCostOfCarrydoubleUnrealized yield rate (A-share mode calculation)
multiplierdoubleQuantity per lot
marketstringMarket
currencystringTrading currency
secTypestringTrading type
identifierstringSecurity identifier
symbolstringStock symbol
strikedoubleOption underlying price (options only)
expirystringOption expiry (options only)
rightstringOption direction (options only)
updateTimestamplongUpdate timestamp
mmPercentdoubleMargin ratio
mmValuedoubleMaintenance margin
todayPnldoubleToday's P&L
todayPnlPercentdoubleToday's P&L rate
yesterdayPnldoubleYesterday's fund P&L
lastClosePricedoubleLast intra-day close price (pre-adjusted), US stocks last trading day close during market
categoriesList<string>Contract types

Example

TigerHttpClient client = TigerHttpClient.getInstance().clientConfig(
      ClientConfig.DEFAULT_CONFIG);
PositionsRequest request = new PositionsRequest();

String bizContent = AccountParamBuilder.instance()
        .account("13810712")
        .secType(SecType.STK)
        .buildJson();

request.setBizContent(bizContent);
PositionsResponse response = client.execute(request);

if (response.isSuccess()) {
    System.out.println(JSONObject.toJSONString(response));
    for (PositionDetail detail : response.getItem().getPositions()) {
      String account = detail.getAccount();
      String symbol = detail.getSymbol();
      long position = detail.getPosition();
      // ...
    }
} else {
    System.out.println(response.getMessage());
}

Return Example

{
  "code": 0,
  "data": {
    "items": [
      {
        "account": "13810712",
        "averageCost": 295.8904,
        "averageCostByAverage": 295.8904,
        "averageCostOfCarry": 591.7807,
        "categories": [
        ],
        "currency": "USD",
        "identifier": "XYZX",
        "lastClosePrice": 232.98,
        "latestPrice": 232.44,
        "level0Price": false,
        "market": "US",
        "marketValue": -232.44,
        "mmPercent": 0,
        "mmValue": 92.976,
        "multiplier": 1,
        "position": -1,
        "positionQty": -1,
        "positionScale": 0,
        "realizedPnl": 0,
        "realizedPnlByAverage": 0,
        "salableQty": -1,
        "secType": "STK",
        "symbol": "XYZX",
        "todayPnl": 0.54,
        "todayPnlPercent": 0.0023178,
        "unrealizedPnl": 63.4504,
        "unrealizedPnlByAverage": 63.4504,
        "unrealizedPnlByCostOfCarry": 359.3407,
        "unrealizedPnlPercent": 0.2144,
        "unrealizedPnlPercentByAverage": 0.2144,
        "unrealizedPnlPercentByCostOfCarry": 0.6072,
        "updateTimestamp": 1720685551097
      }
    ]
  },
  "message": "success",
  "sign": "Wjndi3ZrsxQYWWdkrNKSPMASGfkG5trdHbVujTKrcGoVE5cN0QZBInJggnVL2rMgKd5TS00mnGcOov96iR5K5gZKRA0iQmZHUjJHTmK9JY/rEP9A18xDaljFNHMqmJ8vydFjMQXLebXTVzafbkZoI9LS1LIdoiSCD+6VocogpB0=",
  "success": true,
  "timestamp": 1720685551132
}


TigerHttpClient client = TigerHttpClient.getInstance().clientConfig(
      ClientConfig.DEFAULT_CONFIG);
TigerHttpRequest request = new TigerHttpRequest(MethodName.ASSETS);

String bizContent = AccountParamBuilder.instance()
        .account("DU575569")
        .buildJson();

request.setBizContent(bizContent);
TigerHttpResponse response = client.execute(request);

JSONArray assets = JSON.parseObject(response.getData()).getJSONArray("items");
JSONObject asset1 = assets.getJSONObject(0);
String account = asset1.getString("account");
Double cashBalance = asset1.getDouble("cashBalance");
JSONArray segments = asset1.getJSONArray("segments");
JSONObject segment = segments.getJSONObject(0);
String category = segment.getString("category"); // "S" stock

Return Example

{
	"code": 0,
	"message": "success",
	"data": {
		"items": [{
			"account": "DU575569",
			"accruedCash": -763.2,
			"accruedDividend": 0.0,
			"availableFunds": 941031.78,
			"buyingPower": 6273545.18,
			"capability": "Reg T Margin",
			"cashBalance": 469140.39,
			"cashValue": 469140.39,
			"currency": "USD",
			"cushion": 0.778569,
			"dayTradesRemaining": -1,
			"equityWithLoan": 1233078.69,
			"excessLiquidity": 960492.09,
			"grossPositionValue": 865644.18,
			"initMarginReq": 292046.91,
			"maintMarginReq": 273170.84,
			"netLiquidation": 1233662.93,
			"netLiquidationUncertainty": 583.55,
			"previousEquityWithLoanValue": 1216291.68,
			"previousNetLiquidation": 1233648.34,
			"realizedPnl": -31.68,
			"unrealizedPnl": 1814.01,
			"regTEquity": 0.0,
			"regTMargin": 0.0,
			"SMA": 0.0,
			"segments": [{
				"account": "DU575569",
				"accruedDividend": 0.0,
				"availableFunds": 65.55,
				"cashValue": 65.55,
				"category": "S",
				"equityWithLoan": 958.59,
				"excessLiquidity": 65.55,
				"grossPositionValue": 893.04,
				"initMarginReq": 893.04,
				"leverage": 0.93,
				"maintMarginReq": 893.04,
				"netLiquidation": 958.59,
				"previousDayEquityWithLoan": 969.15,
				"regTEquity": 958.59,
				"regTMargin": 446.52,
				"sMA": 2172.47,
				"title": "US Securities",
				"tradingType": "STKMRGN",
				"updateTime": 1541124813
		
			},{
				"account": "DU575569",
				"accruedCash": 0.0,
				"cashBalance": 703542.12,
				"currency": "USD",
				"exchangeRate": 1.0,
				"futureOptionValue": 0.0,
				"futuresPnl": 0.0,
				"netDividend": 0.0,
				"netLiquidation": 1208880.15,
				"optionMarketValue": -64.18,
				"realizedPnl": 0.0,
				"stockMarketValue": 505780.03,
				"unrealizedPnl": 19886.87,
				"updateTime": 1526359227000,
				"warrantValue": 0.0
			}, {
				"account": "DU575569",
				"accruedCash": 0.0,
				"cashBalance": -714823.64,
				"currency": "CNH",
				"exchangeRate": 0.1576904,
				"futureOptionValue": 0.0,
				"futuresPnl": 0.0,
				"netDividend": 0.0,
				"netLiquidation": 142250.72,
				"optionMarketValue": 0.0,
				"realizedPnl": 0.0,
				"stockMarketValue": 859152.75,
				"unrealizedPnl": -102371.43,
				"updateTime": 1526368181000,
				"warrantValue": 0.0
		}]
	},
	"timestamp": 1527830042620
}

Prime/Paper Trading Account Asset Query

Corresponding request class: PrimeAssetRequest

Description

Query prime/paper trading account assets

Parameters

ParameterTypeRequiredDescription
accountstringYesUser's authorized account: 123123
base_currencystringNoCurrency, USD
secret_keystringNoTrader key, for institutional users only
consolidatedbooleanNoWhether to display aggregated Segment asset indicators. Only SEC and FUND categories of assets will be aggregated. Default is true

Return

com.tigerbrokers.stock.openapi.client.https.response.trade.PrimeAssetResponse

PrimeAssetItem.Segment segment can be obtained with PrimeAssetItem.Segment segment = primeAssetResponse.getSegment(Category.S) to get assets by transaction type; For each type of asset, PrimeAssetItem.CurrencyAssets assetByCurrency = segment.getAssetByCurrency(Currency.USD)` can be used to get assets in corresponding currency. See example code for details

PrimeAssetItem.Segment Description:

NameTypeExampleDescription
accountString123123Trading account
currencyStringUSDCurrency of the currency
categoryStringSTransaction type classification C(Commodities 期货) or S(Securities 证券)、F(Funds 基金)
capabilityStringRegTMarginAccount type, margin account: RegTMargin, cash account: Cash. Margin accounts support margin trading, T+0 trading times are not limited, maximum purchasing power is 4 times the daily highest, up to 2 times the next day
buyingPowerDouble6273545.18Maximum purchasing power. Maximum purchasing power is the maximum available purchase amount for the account. The value of maximum purchasing power can be used to estimate how much money the account can buy, but since the maximum leverage multiple for each stock is different, the actual purchasing power for purchasing a single stock should be calculated based on the specific margin ratio of the stock. Algorithm, maximum purchasing power = 4*available funds. Example: Little Tiger's available funds are 100,000 USD, then Little Tiger's maximum purchasing power is 400,000 USD. Assuming the current price of Apple stock is 250 USD per share, and the initial margin ratio of Apple is 30%, Little Tiger can buy 100,000/30%=333,333.33 USD of Apple. Assuming the initial margin ratio of Apple is 25%, Little Tiger can buy 100,000/25%=400,000 USD of Apple. Margin accounts can have up to four times the amount of funds (funds not occupied as margin) in a day. Overnight, up to two times the buying power
cashAvailableForTradeDouble1233662.1Available funds. Available funds are used to check whether it is possible to open a position or subscribe to new shares. Opening a position refers to buying stocks, short selling securities, etc. Note that available funds are not equal to available cash, but are calculated from total assets, option position market value, frozen funds, and initial margin, etc. When available funds are greater than 0, it means that the account can open a position, and available funds_4 is the maximum available purchase power for the account. Algorithm, available funds = total assets - US stock option market value - initial margin of the current total position - frozen funds. The algorithm for initial margin is ∑(current stock market value_initial margin ratio of the stock when opening a position). Example: Little Tiger's current total assets are 10,000 USD, holding 1,000 USD of US stock options, holding a total market value of 2,000 USD of apples, and the current initial margin ratio of apples is 45%, no frozen funds, Little Tiger's available funds = 10,000-1,000-2,000*45%=8,100 USD
cashAvailableForWithdrawalDouble1233662.1Cash available for withdrawal from the current account
cashBalanceDouble469140.39Current cash balance. Current cash balance is the sum of cash balances of all currencies. If you have incurred financing or borrowing, please note that interest is usually calculated on a daily basis, settled monthly, and the specific calculation method depends on the number of financing days. Daily accumulation, deduction around the 5th of the next month, so before deduction of interest, the cash balance you see is not deducted, if the cash balance before deduction of interest is zero, it may result in a negative balance after deduction, i.e., the cash balance becomes negative
grossPositionValueDouble865644.18Total value of securities, the sum of market value of all securities held in the account, i.e., the total market value of all positions. Algorithm, sum of market value of securities; Note: All position market values will be calculated in the main currency; Example 1, if Little Tiger holds market value of 3,000 USD of apples (i.e., long position) at the same time, holding market value of -1,000 USD of Google (i.e., short position), Little Tiger's total securities value = 3,000 USD apples + (-1,000 USD Google) = 2,000 USD; Example 2, Little Tiger holds market value of 10,000 USD of apples, market value of 5,000 USD of apple call options, Little Tiger's total securities value = 10,000+5,000=15,000 USD
initMarginDouble292046.91Initial margin. The sum of initial margin requirements for all positions held in the current account. When executing the first transaction, only when the equity with loan is greater than the initial margin requirement is allowed to open a position. To meet the margin requirements of regulatory authorities, we will increase the initial margin and maintenance margin requirements to the minimum 50% just before the close of trading
maintainMarginDouble273170.84Maintenance margin. The sum of maintenance margin requirements for all positions held in the current account. When holding positions, when the equity with loan is less than the maintenance margin requirement, forced liquidation will occur. To meet the margin requirements of regulatory authorities, we will increase the initial margin and maintenance margin requirements to the minimum 50% just before the close of trading
overnightMarginDouble273170.84Overnight margin. Overnight margin is checked just before the close of trading to determine the margin required for the account. To meet the margin requirements of regulatory authorities, we will increase the initial margin and maintenance margin requirements to the minimum 50% just before the close of trading. The overnight margin ratio of Tiger International is above 50%. If the account's equity with loan is less than the overnight margin, there is a risk of forced liquidation before the close of trading. Algorithm, ∑(maintenance margin of individual stocks held overnight)
excessLiquidationDouble960492.09Current remaining liquidity. Current remaining liquidity is an indicator of the potential risk of forced liquidation of the current account. The higher the current remaining liquidity, the higher the risk of forced liquidation of the account. When less than 0, forced liquidation will occur. The specific algorithm is: current remaining liquidity = equity with loan (equityWithLoan) - account maintenance margin (maintainMargin). To meet the margin requirements of regulatory authorities, we will increase the initial margin and maintenance margin requirements to the minimum 50% just before the close of trading
overnightLiquidationDouble1233662.93Overnight remaining liquidity. Overnight remaining liquidity is calculated using equity with loan (equityWithLoan) - overnight margin (overnightMargin). To meet the margin requirements of regulatory authorities, we will increase the initial margin and maintenance margin requirements to the minimum 50% just before the close of trading. If the overnight remaining liquidity of the account is less than 0, there is a risk of forced liquidation of part of the position before the close of trading. If your account is forced to liquidate, it will be sold at market price when forced liquidation occurs, and the object of forced liquidation will be determined by the broker. Please note the risk control value and leverage indicators
netLiquidationDouble1233662.93Total assets (net liquidation value). Total assets are the sum of net liquidation cash balance and total market value of securities in our account, usually used to represent how much assets are currently in the account. Algorithm, total assets = market value of securities + cash balance + accrued dividends - accrued interest; Example: Little Tiger has 1,000 USD in cash, holding a position worth 1,000 USD of apples (i.e., long position), no dividends and financing interest and no interest deduction, then Little Tiger's total assets = cash 1,000 + position value 1,000 = 2,000 USD. If Little Tiger has 1,000 USD in cash, short selling 1,000 USD of apples, then the market value of securities -1,000 USD, cash 2,000 USD, user total assets = cash 2,000 + (position market value -1,000), account total assets are 1,000 USD
equityWithLoanDouble1233078.69Equity with loan, i.e., ELV, ELV is used as a data indicator for opening and closing positions; Algorithm, cash account = cash balance, margin account = cash balance + market value of securities - US stock option market value; ELV = total assets - US stock option market value
realizedPLDouble-248.72Realized P&L for the day
totalTodayPLDouble0.0Total P&L for the day
unrealizedPLDouble-17039.09Position P&L. Definition, unrealized P&L for individual stocks and derivatives; Algorithm, current price * number of shares - position cost
leverageDouble0.5Leverage. Leverage is an important indicator to measure the risk level of the account. It helps users quickly understand the financing ratio and risk level of the account. Algorithm, leverage = sum of absolute value of market value of securities / total assets; Note 1, maximum leverage of 4 times for margin accounts in a day, 2 times overnight; Note 2, Tiger considers historical volatility, liquidity, and risk factors, not every stock can be bought at 4 times leverage, generally speaking, the margin ratio for long position is between 25%-100%, the stock with a margin ratio of 25% can be understood as 4 times leverage, the stock with a margin ratio of 100% can be understood as 0 times leverage, i.e., all cash is used for purchase. Note 3, the margin ratio for short position may be greater than 100%. Note 4, the margin ratio for individual stocks can be checked on "Stock Details Page-Quotation Area-Click on Margin Trading Identifier"; Example, Little Tiger's total assets are 100,000 USD, wants to buy apples, the current individual long initial margin ratio of apples is 50% (1/50%=2 times leverage), Little Tiger can only buy 200,000 USD worth of apple stock; Little Tiger wants to short sell Google, the short selling margin ratio is 200%, Little Tiger can short sell 10/200%=50,000 USD worth of Google stock; Little Tiger wants to buy Microsoft, the initial margin ratio is 100% (1/100%=1 times leverage), Little Tiger can only buy 100,000 USD worth of Microsoft stock
currencyAssetsCurrencyAssetsAccount asset information by transaction currency. Detailed description below
consolidatedSegTypesstringAggregated Segment, currently only SEC and FUND will be aggregated. The following fields are for aggregated Segment values: cashAvailableForTrade, initMargin, maintainMargin, overnightMargin, excessLiquidation, overnightLiquidation, buyingPower, lockedFunds, leverage
lockedFundsDouble0.0Locked assets
uncollectedDouble0.0In transit funds

PrimeAssetItem.CurrencyAssets Description:

NameExampleDescription
currencyUSDCurrent currency of the currency, commonly used currencies include: USD-US dollars
cashBalance469140.39Cash available for trading, plus cash locked (e.g., stocks purchased but not yet settled, other situations may also lock cash)
cashAvailableForTrade0.1273896Cash available for trading from the current account

Example

PrimeAssetRequest assetRequest = PrimeAssetRequest.buildPrimeAssetRequest("572386", Currency.USD);
assetRequest.setConsolidated(Boolean.TRUE);
PrimeAssetResponse primeAssetResponse = client.execute(assetRequest);
// Query asset information related to securities
PrimeAssetItem.Segment segment = primeAssetResponse.getSegment(Category.S);
System.out.println("segment: " + JSONObject.toJSONString(segment));
// Query asset information related to USD in the account
if (segment != null) {
  PrimeAssetItem.CurrencyAssets assetByCurrency = segment.getAssetByCurrency(Currency.USD);
  System.out.println("assetByCurrency: " + JSONObject.toJSONString(assetByCurrency));
}

Return Example

{
    "code":0,
    "data":{
        "accountId":"572386",
        "segments":[
            {
                "buyingPower":878.52,
                "capability":"CASH",
                "cashAvailableForTrade":878.52,
                "cashBalance":6850.79,
                "category":"S",
                "consolidatedSegTypes":[
                    "SEC",
                    "FUND"
                ],
                "currency":"USD",
                "currencyAssets":[
                    {
                        "cashAvailableForTrade":35.89,
                        "cashBalance":6008.16,
                        "currency":"USD"
                  
                    }
                ],
                "equityWithLoan":8891.76,
                "excessLiquidation":6850.79,
                "grossPositionValue":438.78,
                "initMargin":2040.96,
                "leverage":0.23,
                "maintainMargin":2040.96,
                "netLiquidation":7289.57,
                "overnightLiquidation":6850.79,
                "overnightMargin":2040.96,
                "realizedPL":0,
                "unrealizedPL":73.29
            },
            {
                "buyingPower":878.52,
                "capability":"CASH",
                "cashAvailableForTrade":878.52,
                "cashBalance":0,
                "category":"F",
                "consolidatedSegTypes":[
                    "SEC",
                    "FUND"
                ],
                "currency":"USD",
                "currencyAssets":[
                    {
                        "cashAvailableForTrade":0,
                        "cashBalance":0,
                        "currency":"USD"
                    },
                    {
                        "cashAvailableForTrade":0,
                        "cashBalance":0,
                        "currency":"HKD"
                    },
                    {
                        "cashAvailableForTrade":0,
                        "cashBalance":0,
                        "currency":"CNH"
                    }
                ],
                "equityWithLoan":8891.76,
                "excessLiquidation":6850.79,
                "grossPositionValue":1602.18,
                "initMargin":2040.96,
                "leverage":0.23,
                "maintainMargin":2040.96,
                "netLiquidation":1602.18,
                "overnightLiquidation":6850.79,
                "overnightMargin":2040.96,
                "realizedPL":1.25,
                "unrealizedPL":89.35
            }
        ],
        "updateTimestamp":1704355652720
    },
    "message":"success",
    "sign":"ZBp+e3IAcPbujB/BIijAh9F1PXQaIiqn5pxldBTPdz88W/hz6rezJsnmuvG+kLbieBWmRiVCt5Ah3eTM9ynLK4BZjRixo2OGJ0XcKotZf0qGDAF3E34acQSbH1te6xCEZMeDunptXNGUcveTgNW2dscLt121MtsLwoXh8T5bUS0=",
    "success":true,
    "timestamp":1704355652720
}

Prime/Paper Trading Account Asset History Analysis Data Query

Corresponding request class: PrimeAnalyticsAssetRequest

Description

Retrieve historical asset analysis for prime/paper trading accounts

Parameters

ParameterTypeRequiredDescription
accountstringYesUser's authorized fund account: 123123
start_datestringNoStart date, format yyyy-MM-dd, e.g. '2022-01-01'. If not provided, the date 30 days before end_date will be used
end_datestringNoEnd date, format yyyy-MM-dd, e.g. '2022-02-01'. If not provided, the current date will be used
seg_typeSegmentTypeNoType of account segmentation, possible values: SegmentType.SEC represents securities; SegmentType.
currencyCurrencyNoCurrency, including ALL/USD
sub_accountstrNoSub-account (only applicable to institutional accounts), if this field is passed, the assets of this sub-account will be returned
secret_keystringNoInstitutional user-specific, trader key. Configured in ClientConfig.DEFAULT_CONFIG, personal developers do not need to specify

Return

com.tigerbrokers.stock.openapi.client.https.response.trade.PrimeAnalyticsAssetResponse

PrimeAnalyticsAssetItem.Summary summary can be obtained with PrimeAnalyticsAssetItem.Summary summary = primeAssetResponse.getSummary() to get asset analysis summary data; Use List<PrimeAnalyticsAssetItem.HistoryItem> historyItems = primeAssetResponse.getHistory() to get historical asset list. See example code for details

PrimeAnalyticsAssetItem.Summary Description:

NameTypeDescription
pnldoubleProfit and loss amount
pnlPercentagedoubleRate of return
annualizedReturndoubleAnnualized return (calculated)
overUserPercentagedoublePercentage of users exceeding

PrimeAnalyticsAssetItem.HistoryItem Description:

NameExampleDescription
datelongTimestamp in milliseconds
pnldoubleProfit and loss amount compared to the previous day
pnlPercentagedoubleRate of return compared to the previous day
assetdoubleTotal asset amount
cashBalancedoubleCash balance
grossPositionValuedoubleMarket value
depositdoubleDeposit amount
withdrawaldoubleWithdrawal amount

Example

    PrimeAnalyticsAssetRequest assetRequest = PrimeAnalyticsAssetRequest.buildPrimeAnalyticsAssetRequest(
        "402901").segType(SegmentType.SEC).startDate("2021-12-01").endDate("2021-12-07");
    PrimeAnalyticsAssetResponse primeAssetResponse = client.execute(assetRequest);
    if (primeAssetResponse.isSuccess()) {
      JSONObject.toJSONString(primeAssetResponse.getSummary());
      JSONObject.toJSONString(primeAssetResponse.getHistory());
    }

Return Example

{
    "code":0,
    "message":"success",
    "timestamp":1657616435212,
    "data":{
        "summary":{
            "pnl":691.18,
            "pnlPercentage":0,
            "annualizedReturn":0,
            "overUserPercentage":0
        },
        "history":[
            {
                "date":1638334800000,
                "asset":48827609.65,
                "pnl":0,
                "pnlPercentage":0,
                "cashBalance":48811698.59,
                "grossPositionValue":15911.06,
                "deposit":0,
                "withdrawal":0
            },
            {
                "date":1638421200000,
                "asset":48827687.69,
                "pnl":78.04,
                "pnlPercentage":0,
                "cashBalance":48811698.59,
                "grossPositionValue":15989.1,
                "deposit":0,
                "withdrawal":0
            },
            {
                "date":1638507600000,
                "asset":48827583.18,
                "pnl":-26.47,
                "pnlPercentage":0,
                "cashBalance":48811698.59,
                "grossPositionValue":15884.58,
                "deposit":0,
                "withdrawal":0
            },
            {
                "date":1638766800000,
                "asset":48827804.28,
                "pnl":194.63,
                "pnlPercentage":0,
                "cashBalance":48811698.59,
                "grossPositionValue":16105.68,
                "deposit":0,
                "withdrawal":0
            },
            {
                "date":1638853200000,
                "asset":48828300.83,
                "pnl":691.18,
                "pnlPercentage":0,
                "cashBalance":48811723,
                "grossPositionValue":16577.82,
                "deposit":0,
                "withdrawal":0
            }
        ]
    },
    "sign":"BFcQVHP4Rh0WAoQMAkVErZq1LKLlhPHx5X+77xNjpsIJF62Zr3T8UXDNvT3fSRA/Pt8cV8Ju3scYq/ollZU169ckh7rVpmeXSxJBaJ8Wfq5tOex7K1BkyHVEcH8i1c6aSph00Nm1yUqcTss/jVvN8uAXYoIBFCELV9nu7r1T4wA="
}

Prime/Paper Trading Account Asset Transferable Funds Query

Corresponding request class: SegmentFundAvailableRequest

Description

Retrieve transferable funds for the account in the corresponding Segment

Parameters

ParameterTypeRequiredDescription
accountstringYesUser's authorized account, including prime, paper trading account
from_segmentstringYesTransfer segment, SEC
currencystringNoTransfer currency, USD

Return

com.tigerbrokers.stock.openapi.client.https.response.trade.SegmentFundAvailableResponse

SegmentFundAvailableItem items can be obtained with List<SegmentFundAvailableItem> items = response.getSegmentFundAvailableItems() to get the list of transferable funds for each Segment. See example code for details

SegmentFundAvailableItem Description:

NameTypeDescription
fromSegmentstringTransfer segment, SEC
currencystringTransfer currency, USD
amountdoubleTransferable funds, in the unit of the corresponding currency

Example

TigerHttpClient client = TigerHttpClient.getInstance().clientConfig(
      ClientConfig.DEFAULT_CONFIG);

SegmentFundAvailableRequest request = SegmentFundAvailableRequest.buildRequest(
        SegmentType.SEC, Currency.USD);

SegmentFundAvailableResponse response = client.execute(request);
System.out.println(JSONObject.toJSONString(response));

// Get specific data
for (SegmentFundAvailableItem item : response.getSegmentFundAvailableItems()) {
  System.out.println(JSONObject.toJSONString(item));
}

Return Example

{
  "code": 0,
  "data": [
    {
      "amount": 17607412.84,
      "currency": "USD",
      "fromSegment": "SEC"
    }
  ],
  "message": "success",
  "sign": "jbxGKQiv5staJJOsN9CnMz25TxWk9jq6iZLksLg09aeP60QfFoSkNIGrnwdv3x0cgYc+SHj6vWdJGQ8FRo/DubxR6pyb6N6iiLl+TANQkvct0MERk7nygEhvQiYXD2q5gj2jPuDAfS6fVzkrYLWEaXQp3RrfqBDNJj+TRVhLRiw=",
  "success": true,
  "timestamp": 1679902705608
}


Prime/Paper Trading Account Cancel Internal Funds Transfer

Corresponding request class: SegmentFundCancelRequest

Description

Cancel the submitted funds transfer. If the transfer has been successful, it cannot be canceled. It can be exchanged back to the opposite segment.

Parameters

ParameterTypeRequiredDescription
accountstringYesUser's authorized account, including prime, paper trading account
idlongYesTransfer record ID

Return

com.tigerbrokers.stock.openapi.client.https.response.trade.SegmentFundResponse

SegmentFundItem item can be obtained with SegmentFundItem item = response.getSegmentFundItem() to get the cancellation transfer result object. See example code for details

SegmentFundItem Description:

NameTypeDescription
idlongTransfer record ID
fromSegmentstringTransfer segment, SEC
toSegmentstringTransfer segment, SEC
currencystringTransfer currency, USD
amountdoubleTransfer amount, in the unit of the corresponding currency
statusstringStatus (NEW/PROC/SUCC/FAIL/CANC)
statusDescstringStatus description (Submitted/Processing/Credited/Transfer failed/Cancelled)
messagestringFailure information
settledAtlongTimestamp of credit
updatedAtlongUpdate timestamp
createdAtlongCreate timestamp

Example

TigerHttpClient client = TigerHttpClient.getInstance().clientConfig(
      ClientConfig.DEFAULT_CONFIG);
SegmentFundCancelRequest request = SegmentFundCancelRequest.buildRequest(30300805635506176L);

SegmentFundResponse response = client.execute(request);
if (response.isSuccess()) {
  System.out.println(JSONObject.toJSONString(response));
} else {
  System.out.println("cancel fail." + JSONObject.toJSONString(response));
}

Return Example

{
    "code":1200,
    "message":"standard account response error(fail:The transfer cannot be cancelled now)",
    "timestamp":1680077452633
}

Prime/Paper Trading Account Internal Funds Transfer History Query

Corresponding request class: SegmentFundHistoryRequest

Description

Query historical transfer records between different Segments of the account. Ordered by time

Parameters

ParameterTypeRequiredDescription
accountstringYesUser's authorized account, including prime, paper trading account
limitIntegerNoNumber of recent transfer records to return. Default is 100, maximum 500

Return

com.tigerbrokers.stock.openapi.client.https.response.trade.SegmentFundsResponse

SegmentFundItem items can be obtained with List<SegmentFundItem> items = response.getSegmentFundItems() to get the list of transfer records between different Segments. See example code for details

SegmentFundItem Description:

NameTypeDescription
idlongTransfer record ID
fromSegmentstringTransfer segment, SEC
toSegmentstringTransfer segment, SEC
currencystringTransfer currency, USD
amountdoubleTransfer amount, in the unit of the corresponding currency
statusstringStatus (NEW/PROC/SUCC/FAIL/CANC)
statusDescstringStatus description (Submitted/Processing/Credited/Transfer failed/Cancelled)
messagestringFailure information
settledAtlongTimestamp of credit
updatedAtlongUpdate timestamp
createdAtlongCreate timestamp

Example

TigerHttpClient client = TigerHttpClient.getInstance().clientConfig(
      ClientConfig.DEFAULT_CONFIG);

SegmentFundHistoryRequest request = SegmentFundHistoryRequest.buildRequest(30);
SegmentFundsResponse response = client.execute(request);
if (response.isSuccess()) {
  System.out.println(JSONObject.toJSONString(response));
} else {
  System.out.println("cancel fail." + JSONObject.toJSONString(response));
}

Return Example

{
    "code":0,
    "data":[
        {
            "amount":1000,
            "createdAt":1680076001000,
            "currency":"USD",
            "fromSegment":"SEC",
            "id":30300805635506176,
            "settledAt":1680076001000,
            "status":"SUCC",
            "statusDesc":"已到账",
            "toSegment":"FUT",
            "updatedAt":1680076001000
        },
        {
            "amount":1000,
            "createdAt":1679307031000,
            "currency":"USD",
            "fromSegment":"SEC",
            "id":30200015261794304,
            "settledAt":1679307032000,
            "status":"SUCC",
            "statusDesc":"已到账",
            "toSegment":"FUT",
            "updatedAt":1679307031000
        }
    ],
    "message":"success",
    "sign":"g9B9Q20F56qoUVs1ULaWZMC5h1DYp7E7GeQnkd2TR5tw2R85TnO7xVb79sqB4EFZEEtI+So8gqh71hABiz31VrQy32zGmYGSgFA94jI6sFh4//BJA0IG9vGx1PmO/rv9aomK+17XGJ4PDrqxHBuGczaX4i65Wvoyt5wHdAx2qoU=",
    "success":true,
    "timestamp":1680085312913
}

Get Maximum Tradable Quantity

Corresponding request class: EstimateTradableQuantityRequest

Description

Query the maximum tradable quantity for a specific target under the account, supporting stocks and options

Parameters

ParameterTypeRequiredDescription
accountStringYesAccount, currently only supports consolidated accounts
symbolStringYesStock symbol
expiryStringNoExpiry date, must be provided when the transaction type is OPT/WAR/IOPT
rightStringNoCALL/PUT, must be provided when the transaction type is OPT/WAR/IOPT
strikeStringNoStrike price, must be provided when the transaction type is OPT/WAR/IOPT
seg_typeSegmentTypeNoSEC, currently only SEC is supported
sec_typeSecTypeNoSTK: stock/OPT: options/IOPT: bull-bear
actionActionTypeYesTransaction direction BUY/SELL
order_typeOrderTypeYesOrder type
limit_pricedoubleNoLimit price, required when order_type is LMT,STP_LMT
stop_pricedoubleNoStop loss price, required when order_type is STP,STP_LMT
secretKeyStringNoInstitutional user-specific, trader key

Return

FieldTypeDescription
tradableQuantityDoubleCash tradable quantity (if action is BUY, return tradable quantity, otherwise return sellable quantity)
financingQuantityDoubleFinancing and margin trading tradable quantity (not applicable to cash accounts)
positionQuantityDoublePosition quantity
tradablePositionQuantityDoubleTradable position quantity

Example

EstimateTradableQuantityRequest request = EstimateTradableQuantityRequest.buildRequest(
        SecType.STK, "XYZX", ActionType.BUY, OrderType.LMT, 150D, null);

EstimateTradableQuantityResponse response = client.execute(request);
if (response.isSuccess()) {
  System.out.println(JSONObject.toJSONString(response));
} else {
  System.out.println("fail." + JSONObject.toJSONString(response));
}

Return Example

{
    "code":0,
    "data":{
        "positionQuantity":1,
        "tradablePositionQuantity":1,
        "tradableQuantity":45
    },
    "message":"success",
    "sign":"mBmBqdIum+F8PE9yHis8v64My2P9rBorsYwtLNAr/Hei6oRedvl5YyfBV2H9zHUHOYcJJDukrD74IfnUsJW1PS6YUQdt+MirNc3Bm51gMrjiVFed8JTto4wRqXvuX57wcA3gMCLVDJkbqjU5VD64cCl28A38N8vdgRo7HgcS8pM=",
    "success":true,
    "timestamp":1681789228649
}

Get Deposit and Withdrawal Records

Corresponding request class: DepositWithdrawRequest

Description

Query deposit and withdrawal records for the account

Parameters

ParameterTypeRequiredDescription
accountStringYesAccount, currently only supports consolidated accounts
secretKeyStringNoInstitutional user-specific, trader key
langLanguageNoLanguage enumeration value: en_US, zh_CN, zh_TW, default: en_US, see Language Enumeration for details

Return

FieldTypeDescription
idlongID
refIdstringAssociated business ID
typeintType of funds (1: deposit; 3: withdrawal; 20: withdrawal fee; 21: withdrawal refund; 22: withdrawal failure-refund; 23: withdrawal fee-refund)
typeDescstringDescription of fund type
currencystringCurrency
amountdoubleAmount
businessDatestringBusiness date
completedStatusboolWhether completed
createdAtlongCreate timestamp
updatedAtlongUpdate timestamp

Example

DepositWithdrawRequest request = DepositWithdrawRequest.newRequest();
request.lang(Language.en_US);

DepositWithdrawResponse response = client.execute(request);
if (response.isSuccess()) {
  System.out.println(JSONObject.toJSONString(response));
} else {
  System.out.println("fail." + JSONObject.toJSONString(response));
}

Return Example

{
    "code": 0,
    "data": [
        {
            "amount": 3000,
            "businessDate": "2024/11/15",
            "completedStatus": true,
            "createdAt": 1731663420532,
            "currency": "SGD",
            "id": 24924145879575127,
            "refId": "TEST_API-37062471908982784",
            "type": 1,
            "typeDesc": "Deposit",
            "updatedAt": 1731663420532
        },
        {
            "amount": 300000,
            "businessDate": "2024/11/15",
            "completedStatus": true,
            "createdAt": 1731664787127,
            "currency": "USD",
            "id": 24924145879575129,
            "refId": "TEST_API-37062651031584768",
            "type": 1,
            "typeDesc": "Deposit",
            "updatedAt": 1731664787127
        }
    ],
    "message": "success",
    "sign": "LTccL5hUIEYzqmQsev2X8gVzwlEJar8/ybIUHMNd9H6K48XrJiG2LgC17GvFhVy1lKUabrV2GZ9YsBvJQlEoDEe1d6EtnbBWn7bAMdJktsUhlAxJiEqS/aVIIdGe6u7Fo/laKqmxx5n1caYIVaU17TvJxjHufD7pfkoPbOoWwbM=",
    "success": true,
    "timestamp": 1735134267185
}

Get Fund Details

Corresponding request class: FundDetailsRequest

Description

Retrieve fund details

Parameters

ParameterTypeRequiredDescription
segTypesList<String>YesList of segment types, e.g.: ["SEC"]
accountStringYesAccount, currently only supports consolidated accounts
fundTypeFundTypeNoType of funds, including: ALL all, DEPOSIT_WITHDRAW deposit and withdrawal, TRADE trading, FEE fees, FUNDS_TRANSFER funds transfer, CORPORATE_ACTION corporate actions, ACTIVITY_AWARD activities, OTHER other. Default ALL
currencyStringNoCurrency
startDateStringNoStart date, format yyyy-MM-dd
endDateStringNoEnd date, format yyyy-MM-dd
startLongNoStart serial number, starting from 0, e.g., if limit is set to 50, the first two pages return 100 records, then start needs to be 100 when requesting the 3rd page, i.e., continue from the 101st record
limitLongNoMaximum number of records to return, default 50, maximum 100
secretKeyStringNoInstitutional user-specific, trader key
langLanguageNoLanguage enumeration value: en_US, zh_CN, zh_TW, default: en_US, see Language Enumeration for details

Return

FieldTypeDescription
idLongRecord ID
descStringDescription
currencyStringCurrency
segTypeStringSegment type
typeStringType of funds
amountDoubleAmount
businessDateStringBusiness date defined by Tiger, all market funds changes for the same trading day will be recorded in the same business date
updatedAtLongTimestamp of flow update
pageIntegerCurrent page number
limitIntegerNumber of records per page
itemCountIntegerTotal number of records
pageCountIntegerTotal number of pages
timestampLongTimestamp
contractNameStringContract name

Example

FundDetailsRequest request = FundDetailsRequest.buildFundDetailsRequest(account,
    Lists.newArrayList(SegmentType.SEC.name()), 0L, 5L);
request.setCurrency("USD");
request.setFundType("ALL");
request.setStartDate("2025-01-01");
request.setEndDate("2025-04-01");
FundDetailsResponse response = client.execute(request);

if (response.isSuccess()) {
  System.out.println(JSONObject.toJSONString(response));
} else {
  System.out.println("fail." + JSONObject.toJSONString(response));
}

Return Example

{
  "code": 0,
  "message": "success",
  "timestamp": 1745840017490,
  "data": {
    "page": 1,
    "limit": 5,
    "itemCount": 5,
    "pageCount": 1,
    "timestamp": 1745840017495,
    "items": [
      {
        "id": "3969803304",
        "currency": "USD",
        "type": "Internal Funds Transfer Out",
        "segType": "SEC",
        "amount": -1,
        "businessDate": "2025-03-25",
        "updatedAt": 1742875771000
      },
      {
        "id": "3942009038",
        "currency": "USD",
        "type": "Financing Tnterest",
        "segType": "SEC",
        "amount": -2.43,
        "businessDate": "2025-03-06",
        "updatedAt": 1741247923000
      },
      {
        "id": "3897595901",
        "currency": "USD",
        "type": "Financing Tnterest",
        "segType": "SEC",
        "amount": -2.67,
        "businessDate": "2025-02-06",
        "updatedAt": 1738828190000
      },
      {
        "id": "3877434674",
        "currency": "USD",
        "type": "Currency Exchange - Quotation Currency",
        "segType": "SEC",
        "amount": 7.77,
        "businessDate": "2025-01-17",
        "updatedAt": 1737117790000
      },
      {
        "id": "3865693144",
        "currency": "USD",
        "type": "Financing Tnterest",
        "segType": "SEC",
        "amount": -2.75,
        "businessDate": "2025-01-07",
        "updatedAt": 1736236455000
      }
    ]
  }
}