Query Account Information

Account List

Request class: TigerHttpRequest(MethodName.ACCOUNTS)

Description

Returns the trading accounts available to the current user. For an institutional user, the response includes the master account and all subaccounts.

Parameters

ParameterTypeRequiredDescription
accountstringNoAuthorized trading account. Paper trading accounts are not supported for this filter. If omitted, the response includes all Prime, Global, and paper trading accounts.

Response

The data.items array contains the following fields:

FieldExampleDescription
accountPrime: 50129912, Global: U5755619, Paper trading: 20191221901212121Trading account ID. A Prime account ID contains 5 to 10 digits, a paper trading account ID contains 17 digits, and a Global account ID begins with U.
capabilityRegTMarginAccount capability: CASH for a cash account, RegTMargin for a Reg T margin account, or PMGRN for a portfolio margin account.
statusFundedAccount status: Funded, Open, Pending, Rejected, or Closed. Most accounts have the Funded status.
accountTypeSTANDARDAccount classification: GLOBAL for a Global account, STANDARD for a Prime account, or PAPER for a 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 accounts.
// 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");

Example Response

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

Account Positions

Request class: PositionsRequest

Description

Returns positions held in a trading account.

Parameters

ParameterTypeRequiredDescription
accountstringYesUser's authorized account: 13810712
sec_typestringNoSecurity type, including: STK/OPT/FUT/WAR/IOPT/CASH/FOP/FUND/CC, default STK
currencystringNoCurrency type, including: ALL/USD/HKD/CNH, default ALL
marketstringNoMarket classification, including: ALL/US/HK/CN, default ALL
symbolstringNoInstrument symbol, such as 600884 or SNAP. For futures, use a contract symbol such as CL1901. For options, use either the underlying symbol or a 21-character option identifier such as AAPL 190111C00095000; the underlying occupies six characters and is padded with spaces. For warrants and CBBCs, use the five-digit symbol.
secret_keystringNoTrader key, for institutional users only
expirystringNoExpiration date (for options, warrants, bull-bear). Format 'yyyyMMdd', e.g. '20230818'
strikedoubleNoStrike price (for options, warrants, bull-bear), e.g. 100.5
rightstringNoCall or put (for options, warrants, bull-bear). 'PUT' or 'CALL'
asset_quote_typestringNoAsset quote mode (only for prime account), see Asset Quote Type Enum

Response

Returns com.tigerbrokers.stock.openapi.client.https.response.trade.PositionsResponse. Access the position list with List<PositionDetail> items = response.getItem().getPositions().

PositionDetail fields

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, global account is intra-day close
level0PricebooleanWhether this is Level 0 (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 right (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());
}

Example Response

{
  "code": 0,
  "data": {
    "items": [
      {
        "account": "13810712",
        "averageCost": 295.8904,
        "averageCostByAverage": 295.8904,
        "averageCostOfCarry": 591.7807,
        "categories": [
        ],
        "currency": "USD",
        "identifier": "AAPL",
        "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": "AAPL",
        "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
}

Global Account Assets

Request class: TigerHttpRequest(MethodName.ASSETS)

Description

Returns asset data for a Global account. Prime and paper trading accounts may return many empty fields from this endpoint; use PrimeAssetRequest for those accounts.

Parameters

ParameterTypeRequiredDescription
accountstringYesUser's authorized account: DU000001
segmentbooleanNoWhether to include securities/futures classification, default False
market_valuebooleanNoWhether to include market capitalization by market, default False, only supported by global accounts
secret_keystringNoTrader key, for institutional users only

Response

com.tigerbrokers.stock.openapi.client.https.response.TigerHttpResponse. The data is JSON; see the parsing example below.

NameExampleDescription
accountDU000001Trading account
capabilityRegTMarginAccount type, margin: RegTMargin, cash: Cash
netLiquidation1233662.93Net liquidation value
equityWithLoan1233078.69Equity with loan (including assets with loan value). Securities Segment: cash value + stock value, Futures Segment: cash value - maintenance margin
initMarginReq292046.91Initial margin requirement
maintMarginReq273170.84Maintenance margin requirement
availableFunds941031.78Available funds (usable for trading), calculated as equity_with_loan - initial_margin_requirement
dayTradesRemaining-1Remaining intraday trading times, -1 means no limit
excessLiquidity960492.09Remaining liquidity, used to represent the intraday risk value. Securities Segment calculation method: equity_with_loan - maintenance_margin_requirement. Futures Segment calculation method: net_liquidation - maintenance_margin_requirement
buyingPower6273545.18Buying power. Estimated how much more stock assets you can buy in USD. 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
cashValue469140.39Cash in securities account + cash in futures account
accruedCash-763.2Accrued interest for the current month, updated daily
accruedDividend0.0Accumulated dividends. Refers to the accumulated value of all dividends executed but still unpaid
grossPositionValue865644.18Total value of securities: value of long stocks + value of short stocks + value of long options + value of short options.
SMA0.0Special memorandum account, overnight risk value (App)
regTEquity0.0Only for securities Segment, i.e., equity with loan calculated according to Regulation T Act
regTMargin0.0Only for securities Segment, i.e., initial margin requirements calculated according to Regulation T Act
cushion0.778569Remaining liquidity as a proportion of total assets, calculated as: excess_liquidity/net_liquidation
currencyUSDCurrency
realizedPnl-248.72Actual P&L
unrealizedPnl-17039.09Unrealized P&L
updateTime0Update time
segmentsAccount information by transaction type. Content is a Map, with two keys, 'S' for securities, 'C' for futures; value is an Account object
marketValuesMarket capitalization information. Content is a Map, 'USD' for US market, 'HKD' for Hong Kong market; value is a MarketValue object

segments fields

NameExampleDescription
accountDU000001Trading account
categorySIndustry classification of underlying securities C(US Commodities futures) or S(US Securities securities)
titleUS SecuritiesTitle
netLiquidation1233662.93Net liquidation value
cashValue469140.39Cash in securities account + cash in futures account
availableFunds941031.78Available funds (usable for trading)
equityWithLoan1233078.69Equity with loan
excessLiquidity960492.09Remaining liquidity, to maintain the current position, must maintain a buffer margin. Intraday risk value (App)
accruedCash-763.2Net accrued interest
accruedDividend0.0Net accrued dividends
initMarginReq292046.91Initial margin requirement
maintMarginReq273170.84Maintenance margin requirement
regTEquity0.0RegT assets
regTMargin0.0RegT margin
SMA0.0Special memorandum account, overnight risk value (App)
grossPositionValue865644.18Position value
leverage1Leverage
updateTime1526368181000Update time

marketValues fields

NameExampleDescription
accountDU000001Trading account
currencyUSDCurrency
netLiquidation1233662.93Total assets (net liquidation value)
cashBalance469140.39Cash
exchangeRate0.1273896Exchange rate for the account's base currency
netDividend0.0Net dividend between payable and receivable
futuresPnl0.0P&L from holding futures
realizedPnl-248.72Realized P&L
unrealizedPnl-17039.09Unrealized P&L
updateTime1526368181000Update time
stockMarketValue943588.78Stock market value
optionMarketValue0.0Option market value
futureOptionValue0.0Future option market value
warrantValue10958.0Warrant market value

Example

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

String bizContent = AccountParamBuilder.instance()
        .account("DU000001")
        .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, "C" future

Example Response

{
	"code": 0,
	"message": "success",
	"data": {
		"items": [{
			"account": "DU000001",
			"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": "DU000001",
				"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
			}],
			"marketValues": [{
				"account": "DU000001",
				"accruedCash": 0.0,
				"cashBalance": -943206.03,
				"currency": "HKD",
				"exchangeRate": 0.1273896,
				"futureOptionValue": 0.0,
				"futuresPnl": 0.0,
				"netDividend": 0.0,
				"netLiquidation": 11223.29,
				"optionMarketValue": 0.0,
				"realizedPnl": -248.72,
				"stockMarketValue": 943588.78,
				"unrealizedPnl": -17039.09,
				"updateTime": 1526368181000,
				"warrantValue": 10958.0
			},{
				"account": "DU000001",
				"accruedCash": 0.0,
				"cashBalance": -1635.23,
				"currency": "GBP",
				"exchangeRate": 1.35566495,
				"futureOptionValue": 0.0,
				"futuresPnl": 0.0,
				"netDividend": 0.0,
				"netLiquidation": 170.39,
				"optionMarketValue": 0.0,
				"realizedPnl": 0.0,
				"stockMarketValue": 1805.62,
				"unrealizedPnl": 177.58,
				"updateTime": 1526368181000,
				"warrantValue": 0.0
			},{
				"account": "DU000001",
				"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": "DU000001",
				"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

Request class: PrimeAssetRequest

Description

Returns asset data for a Prime or paper trading account.

Parameters

ParameterTypeRequiredDescription
accountstringYesUser's authorized account: 123123
base_currencystringNoCurrency, HKD/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

Response

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

Use PrimeAssetItem.Segment segment = primeAssetResponse.getSegment(Category.S) to get assets by transaction type. For each segment, use PrimeAssetItem.CurrencyAssets assetByCurrency = segment.getAssetByCurrency(Currency.USD) to get assets in a specific currency.

PrimeAssetItem.Segment fields

NameTypeExampleDescription
accountString123123Trading account
currencyStringUSDCurrency, such as USD or HKD
categoryStringSTransaction category: C (commodity futures), S (securities), F (funds), or D (crypto)
capabilityStringRegTMarginAccount type: RegTMargin for margin accounts or Cash for cash accounts. Margin accounts support margin trading, unlimited intraday trades, up to 4x buying power intraday, and up to 2x overnight.
buyingPowerDouble6273545.18Estimated maximum purchase amount. It is capped at 4 * available funds intraday and two times available funds overnight, but the instrument's initial margin rate may impose a lower limit. For 100,000 USD of available funds, a 30% initial margin rate allows 333,333.33 USD, while a 25% rate reaches the 400,000 USD intraday cap.
cashAvailableForTradeDouble1233662.1Funds available to open positions or subscribe to IPOs; this differs from available cash. Available funds = Total assets - US stock option market value - Current total position initial margin - Frozen funds. Position initial margin = Σ(Current stock market value × Opening initial margin ratio). A positive value permits opening positions; available funds_4 is the maximum buying power, equal to 4x available funds. Example: 10,000 USD in assets, 1,000 USD in US stock options, 2,000 USD in Apple stock at a 45% initial margin ratio, and no frozen funds gives 10,000 - 1,000 - 2,000 × 45% = 8,100 USD.
cashAvailableForWithdrawalDouble1233662.1Cash available for withdrawal from the current account
cashBalanceDouble469140.39Sum of cash balances in all currencies. Financing interest normally accrues daily and is deducted around the fifth day of the following month, so the balance may become negative when accrued interest is posted.
grossPositionValueDouble865644.18Sum of all position market values, converted to the account's base currency. Long and short values retain their signs. For example, a 3,000 USD long position and a -1,000 USD short position produce a value of 2,000 USD.
initMarginDouble292046.91Sum of initial margin requirements for all positions. A position may be opened only when equity with loan exceeds initial margin. Initial and maintenance margin requirements rise to at least 50% near market close to meet regulatory requirements.
maintainMarginDouble273170.84Sum of maintenance margin requirements for all positions. Forced liquidation occurs when equity with loan falls below maintenance margin. Initial and maintenance margin requirements rise to at least 50% near market close to meet regulatory requirements.
overnightMarginDouble273170.84Margin required near market close = Σ(Maintenance margin for each stock held overnight). Tiger International's overnight margin ratio is above 50%. Equity with loan below overnight margin creates a risk of forced liquidation. Initial and maintenance margin requirements rise to at least 50% near market close to meet regulatory requirements.
excessLiquidationDouble960492.09Current remaining liquidity, an indicator of forced-liquidation risk. The lower the value, the higher the risk; a value below 0 may trigger forced liquidation. It is calculated as equityWithLoan - maintainMargin. Margin requirements may be raised near market close to meet regulatory requirements.
overnightLiquidationDouble1233662.93Overnight remaining liquidity, calculated as equityWithLoan - overnightMargin. Margin requirements may rise to at least 50% near market close. A value below 0 indicates a risk of broker-directed liquidation at the market price.
netLiquidationDouble1233662.93Net liquidation value: securities market value + cash balance + accrued dividends - accrued interest. A 1,000 USD cash balance and a 1,000 USD long position produce 2,000 USD; 2,000 USD cash and a -1,000 USD short position produce 1,000 USD.
equityWithLoanDouble1233078.69Equity with loan value (ELV), used to assess whether positions may be opened or maintained. For a cash account, ELV equals the cash balance. For a margin account, it equals cash balance plus securities market value minus US option market value; equivalently, total assets minus US option market value.
realizedPLDouble-248.72Realized P&L for the day; for futures only, calculated from all unsettled orders
totalTodayPLDouble0.0Total P&L for the day
unrealizedPLDouble-17039.09Unrealized P&L for individual stocks and derivatives = Current price × Number of shares - Position cost
leverageDouble0.5sum(abs(securities market value)) / total assets. Margin accounts support up to 4x intraday and 2x overnight leverage, subject to each instrument's margin rate. Long margin rates generally range from 25% to 100%; short margin rates may exceed 100%. For 100,000 USD of assets, a 50% rate allows 200,000 USD, a 200% rate allows 50,000 USD, and a 100% rate allows 100,000 USD.
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, HKD-Hong Kong dollars, SGD-Singapore dollars, CNH-Renminbi
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
forexRate0.128The exchange rate of the current currency pair to the baseCurrency. For example, baseCurrency=USD, currency=HKD, forexRate=0.128

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));
}

Example Response

{
    "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"
                    },
                    {
                        "cashAvailableForTrade":5351.53,
                        "cashBalance":5351.53,
                        "currency":"HKD"
                    },
                    {
                        "cashAvailableForTrade":1123.95,
                        "cashBalance":1123.95,
                        "currency":"CNH"
                    },
                    {
                        "cashAvailableForTrade":0.12,
                        "cashBalance":0.12,
                        "currency":"EUR"
                    }
                ],
                "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

Request class: PrimeAnalyticsAssetRequest

Description

Retrieve historical asset analysis for prime/paper trading accounts

Parameters

ParameterTypeRequiredDescription
accountstringYesUser's authorized trading 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.FUT represents futures
currencyCurrencyNoCurrency, including ALL/USD/HKD/CNH
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

Response

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());
    }

Example Response

{
    "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

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, FUT or SEC
currencystringNoTransfer currency, USD or HKD

Response

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, FUT or SEC
currencystringTransfer currency, USD or HKD
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.HKD);

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));
}

Example Response

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

Prime/Paper Trading Account Internal Funds Transfer

Request class: SegmentFundTransferRequest

Description

Transfer funds between different segments of the account, such as from the securities segment to the futures segment

Parameters

ParameterTypeRequiredDescription
accountstringYesUser's authorized account, including prime, paper trading account
from_segmentstringYesTransfer segment, FUT or SEC
to_segmentstringYesTransfer segment, FUT or SEC, must be different from from_segment
currencystringYesTransfer currency, USD or HKD
amountdoubleYesTransfer amount, in the unit of the corresponding currency

Response

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

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

SegmentFundItem Description:

NameTypeDescription
idlongTransfer record ID
fromSegmentstringTransfer segment, FUT or SEC
toSegmentstringTransfer segment, FUT or SEC
currencystringTransfer currency, USD or HKD
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);
SegmentFundTransferRequest request = SegmentFundTransferRequest.buildRequest(
        SegmentType.SEC, SegmentType.FUT, Currency.HKD, 1000D);

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

Example Response

{
    "code":0,
    "data":{
        "amount":1000,
        "createdAt":1680076000672,
        "currency":"HKD",
        "fromSegment":"SEC",
        "id":30300805635506176,
        "status":"NEW",
        "statusDesc":"committed",
        "toSegment":"FUT",
        "updatedAt":1680076000672
    },
    "message":"success",
    "sign":"eBhM+F2Kmc1QA0LX5R5yAoz/Ugi1kizUFjjaY378zsXPj69XkMunOOmmOcUR0evo/toHIG1Scd4AlVameVDE7SWQsVt6B+L7UBjI1iU9top79ewxbXkGTc/e4ketQgHfqqF9aR/eHIdZRZjKOvNEdfWfjzKTmQJiAaHhXNVfFJ0=",
    "success":true,
    "timestamp":1680076000819
}

Prime/Paper Trading Account Cancel Internal Funds Transfer

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

Response

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, FUT or SEC
toSegmentstringTransfer segment, FUT or SEC
currencystringTransfer currency, USD or HKD
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));
}

Example Response

{
    "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

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

Response

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, FUT or SEC
toSegmentstringTransfer segment, FUT or SEC
currencystringTransfer currency, USD or HKD
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));
}

Example Response

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

Get Maximum Tradable Quantity

Request class: EstimateTradableQuantityRequest

Description

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

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/FUT: futures/OPT: options/WAR: warrants/IOPT: bull-bear, futures are not supported temporarily
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

Response

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, "AAPL", 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));
}

Example Response

{
    "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

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

Response

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 the transfer is complete
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));
}

Example Response

{
    "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

Request class: FundDetailsRequest

Description

Retrieve fund details

Parameters

ParameterTypeRequiredDescription
segTypesList<String>YesList of segment types, e.g.: ["SEC", "FUT"]
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, FOREX foreign exchange, 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

Response

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("HKD");
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));
}

Example Response

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

Did this page help you?