Get Account Information

About 14 min

Account List

Request:TigerRequest(TradeApiService.ACCOUNTS)

Description

Fetch a list of managed accounts of the current user, along with account information.

Argument

ArgumentTypeRequiredDescription
accountstringNoAccount id. Optional,Default value is to return all managed accounts

ResponseTigerOpenAPI.Trade.Response.AccountsResponsesourceopen in new window

Use AccountsResponse.Data to access returned data. This method will return a dictionary which include AccountItem object, whereTigerOpenAPI.Trade.Response.AccountItem has the following attributes:

AttributeExampleDescription
account50129912Account id
capabilityMRGNAccount Types (CASH: cash account, RegTMargin: Reg T Margin Account, PMGRN: Portfolio Margin)
statusFundedStatus (New, Funded, Open, Pending, Abandoned, Rejected, Closed, Unknown)
accountTypeSTANDARDAccount Type. GLOBAL or STANDARD (Prime), PAPER Account

Example

  static async Task<AccountsResponse?> GetAccountsAsync(TradeClient tradeClient)
  {
    TigerRequest<AccountsResponse> request = new TigerRequest<AccountsResponse>()
    {
      ApiMethodName = TradeApiService.ACCOUNTS,
      ModelValue = new ApiModel() {}
    };
    return await tradeClient.ExecuteAsync(request);
  }

Return Example

{
    "data":{
        "items":[
            {
                "account":"U10010705",
                "capability":"CASH",
                "accountType":"GLOBAL",
                "status":"Funded"
            },
            {
                "account":"572386",
                "capability":"CASH",
                "accountType":"STANDARD",
                "status":"Funded"
            },
            {
                "account":"20200821144442583",
                "capability":"RegTMargin",
                "accountType":"PAPER",
                "status":"Funded"
            }
        ]
    },
    "message":"success",
    "timestamp":1678256819942,
    "sign":"GRqdliGzHYXU/LbLk5+S5HxHQ10hv2ERmMPGPrVGzPiIsT69TS4XkTE6I9PfxUtsnYDWfxlMgfHLZslT8PtYITfw9E6GjSrk5u7fokMsxpi6DD+EyTlvXoAuchppkc55uMPBMrFD4zkJBT+tn79sp/OiudLPnISKuUa69b08Qm0="
}

Get Account Positions

Request:TigerRequest(TradeApiService.POSITIONS)

Description

Get the position information of the account

Argument

ArgumentTypeRequiredDescription
accountstringYesAccount id. Example :13810712
sec_typestringNoSecurity Type. Possible values are STK-Stocks/OPT-Options/FUT-Futures/FUND-Funds, default value is STK.
currencystringNoCurrency. Possible values areALL/USD/HKD/CNH, etc., default value is ALL
marketstringNoMarket, including: ALL/US/HK/C. Default value isALL
symbolstringNoTicker symbol, for example: 600884 / SNAP (stocks), CL1901 (futures),'AAPL 190111C00095000' (Options). For option contracts,fill in identifier instead. A option contract identifier is a 21 digit string, where symbol of the underlying assets has 6 digits (fill with space if less than 6).
secret_keystringNoInstitutional trader key. Only applicable to institutional users. It needs to be configured in client_config. Ignore if you are a individual developer
expirystringNoOptions/warrant/CBBC expiration date, format: 'yyyyMMdd', example: '20230818'
strikedoubleNoOptions/warrant/CBBC strike price, example: 100.5
rightstringNo'PUT' / 'CALL' for options/warrant/CBBC

Response

TigerOpenAPI.Trade.Response.PositionsResponsesourceopen in new window

Use PositionsResponse.Data to access returned data. This method will return a dictionary which include PositionsItem object, whereTigerOpenAPI.Trade.Response.PositionDetail has the following attributes:

ArgumentTypeDescription
accountstringAccount id
positionQtydoublePosition quantity
salableQtydoubleSaleable quantity
positionlongPosition quantity(deprecated, please use 'positionQty')
positionScaleintPosition quantity scale(deprecated, please use 'positionQty''), For example, the position value is 11123, the positionScale is 2, and the actual number of positions is 11123*10^(-2)=111.23
averageCostdoubleAverage holding cost
averageCostByAveragedoubleAverage holding cost under the average price mode
averageCostOfCarrydoubleCumulative average holding cost
latestPricedoubleLatest market price
isLevel0Pricebooleanis lv0(delay) quote
marketValuedoubleMarket Value
realizedPnldoubleRealized profit and loss
realizedPnlByAveragedoubleRealized profit and loss under the average price mode
unrealizedPnldoubleunrealized profit and loss
unrealizedPnlByAveragedoubleunrealized profit and loss under the average price cost mode
unrealizedPnlPercentdoubleunrealized rate of return
unrealizedPnlPercentByAveragedoubleUnrealized rate of return under average price cost
unrealizedPnlByCostOfCarrydoubleunrealized profit and loss
unrealizedPnlPercentByCostOfCarrydoubleunrealized rate of return
multiplierdoublemultiplier or lotsize
marketstringmarket
currencystringCurrency
secTypestringSecurity type, STK/OPT/FUT
identifierstringasset identifier
symbolstringTicker symbol/identifier of the asset
strikedoubleStrike price of the option
expirystringOption expiration date
rightstringWhether an option contract is put or call
updateTimestamplongupdate timestamp
mmPercentdoublemaintenance margin percent
mmValuedoublemaintenance margin value
todayPnldoubletoday's profit and loss
todayPnlPercentdoubletoday's profit and loss
yesterdayPnldoubleyesterday's profit and loss, Fund only
lastClosePricedoubleThe closing price on the last trading day (pre-adjusted for stock rights)
categoriesList<string>contract categories

Example

  static async Task<PositionsResponse?> GetPositionsAsync(TradeClient tradeClient)
  {
    TigerRequest<PositionsResponse> request = new TigerRequest<PositionsResponse>()
    {
      ApiMethodName = TradeApiService.POSITIONS,
      ModelValue = new PositionsModel() {
        SecType = SecType.STK,
        Market = Market.US }
    };
    return await tradeClient.ExecuteAsync(request);
  }

Response Example

{
    "code": 0,
    "message": "success",
    "timestamp": 1720700158597,
    "data": {
        "items": [
            {
                "symbol": "AAPL",
                "market": "US",
                "contractId": 14,
                "secType": "STK",
                "account": "13810712",
                "position": -1,
                "positionScale": 0,
                "positionQty": -1,
                "salableQty": -1,
                "averageCost": 295.8904,
                "averageCostByAverage": 295.8904,
                "unrealizedPnl": 63.8904,
                "unrealizedPnlByAverage": 63.8904,
                "unrealizedPnlPercent": 0.2159,
                "unrealizedPnlPercentByAverage": 0.2159,
                "unrealizedPnlByCostOfCarry": 359.7807,
                "unrealizedPnlPercentByCostOfCarry": 0.608,
                "realizedPnl": 0,
                "realizedPnlByAverage": 0,
                "averageCostOfCarry": 591.7807,
                "marketValue": -232,
                "currency": "USD",
                "multiplier": 1,
                "status": 0,
                "identifier": "AAPL",
                "latestPrice": 232,
                "isLevel0Price": false,
                "updateTimestamp": 1720700169189,
                "comboTypeMap": {

                },
                "mmPercent": 0,
                "mmValue": 92.8,
                "todayPnl": 0.98,
                "todayPnlPercent": 0.0042064,
                "categories": [

                ],
                "lastClosePrice": 232.98
            },
            {
                "symbol": "BABA",
                "market": "US",
                "contractId": 592,
                "secType": "STK",
                "account": "13810712",
                "position": 3725,
                "positionScale": 3,
                "positionQty": 3.725,
                "salableQty": 3.725,
                "averageCost": 65.3544,
                "averageCostByAverage": 65,
                "unrealizedPnl": 43.827,
                "unrealizedPnlByAverage": 45.147,
                "unrealizedPnlPercent": 0.18,
                "unrealizedPnlPercentByAverage": 0.1865,
                "unrealizedPnlByCostOfCarry": 43.827,
                "unrealizedPnlPercentByCostOfCarry": 0.18,
                "realizedPnl": 0,
                "realizedPnlByAverage": -1.32,
                "averageCostOfCarry": 65.3544,
                "marketValue": 287.272,
                "currency": "USD",
                "multiplier": 1,
                "status": 0,
                "identifier": "BABA",
                "latestPrice": 77.12,
                "isLevel0Price": false,
                "updateTimestamp": 1720700169189,
                "comboTypeMap": {

                },
                "mmPercent": 0,
                "mmValue": 172.3632,
                "todayPnl": 4.13475,
                "todayPnlPercent": 0.0146033,
                "categories": [

                ],
                "lastClosePrice": 76.01
            }
        ]
    },
    "sign": "k5iFwEi79vYme05OiHfn8q8yqpf634QhPvOa+xLOyIE1L4+/oBwf9zSA2dgWqYg8KwX7GAWVp/Nus/aVNaRT4dbE7tk6tJDbZEDBRM4o/6CqsoZUHIr0YnDYarMcGEw3Nyvhc8+EmbifNmvcTo4v5o3I+lHen+qPC3rWBcj+W1Q="
}

Get Account Summary

Request:TigerRequest(TradeApiService.ASSETS)

Description

Get account summary,this method is only recommended for Global Account. You can also get the account summary of your standard, or paper trading account using this method. However, because different account types have different account structures, Please use PrimeAssetRequest to get assets for prime and paper acount.

Argument

ArgumentTypeRequiredDescription
accountstringYesAccount id: DU575569
segmentbooleanNohether to return data grouped by segments (securities, futures). Default value is False. When set to True, a dict will be returned, where 'C' means futures, 'S' means stocks
market_valuebooleanNoWhether to return data grouped by currency (USD, HKD, RMB). Default is False
secret_keystringNoInstitutional trader key. Only applicable to institutional users. Configured in client_config

ResponseTigerOpenAPI.Model.TigerDictResponsesourceopen in new window

Use TigerDictResponse.Data to access returned data. This method will return a dictionary which has the following attributes:

NameExampleDescription
accountU10010705account id
capabilityRegTMarginAccount type. Margin account:RegTMargin,cash account:Cash
netLiquidation1233662.93Net liquidation, equivalent to total asset in the TigerTrade APP
equityWithLoan1233078.69Equity with loan value (including loan value assets). Securities Segment: Cash value + stock value, Futures Segment: Cash value - maintenance margin
initMarginReq292046.91Initial margin requirement
maintMarginReq273170.84Maintenance margin requirement
availableFunds941031.78Available_funds for trading, equals to equity_with_loan - initial_margin_requirement
dayTradesRemaining-1amount of trade you can make today, -1 stands for unlimited
excessLiquidity960492.09Excess liquidity, used to represent intraday risk value. Calculation method for securities segment: equity_with_loan - maintenance_margin_requirement. Calculation method for futures segment: net_liquidation - maintenance_margin_requirement
buyingPower6273545.18buying power. Estimate how many more dollars you can buy in stock assets. The margin account has a maximum of four times the purchasing power of the funds (funds that are not used for margin) during the day. Up to twice the purchasing power overnight
cashValue469140.39cash value in stock account+ cash value in futures account
accruedCash-763.2The accumulated interest payable in the current month, updated daily.
accruedDividend0.0Cumulative dividends. Refers to the cumulative value of all dividends that have been executed but not paid
grossPositionValue865644.18Total value of securities: long stock value + short stock value + long option value + short option value. The above items are calculated as absolute values.
SMA0.0For security segments only. Overnight risk control value, the overnight risk of account positions is checked about 10 minutes before the close of each trading day. The overnight risk control value needs to be greater than 0, otherwise some positions in the account will be forced to close before the market closes. If the overnight risk control value is lower than 0 during the trading day, and the time is not 10 minutes before the closing time, the account will not be liquidated.
regTEquity0.0float
regTMargin0.0For security segments only, i.e. initial margin requirements calculated under Regulation T
cushion0.778569The ratio of remaining liquidity to total assets, calculated as: excess_liquidity/net_liquidation
currencyUSDCurrency
realizedPnl-248.72Realized PNL
unrealizedPnl-17039.09Unrealized PNL
updateTime0Update at
segmentsAccount information grouped by different asset types. It is a Map with two keys: 'S' stands for stocks, 'C' stands for futures. The corresponding values are Account objects
marketValuesMarket Values. It is a Map with currency names as keys: for example: 'USD' or 'HKD'; corresponding values are MarketValue objects.

segmentsDescription:

NameExampleDescription
accountU10010705Account id
categorySSegment category C (Futures) or S (Securities)
titleUS Securitiestile
netLiquidation1233662.93Net Liquidation Value
cashValue469140.39cash value in stock account+ cash value in futures account
availableFunds941031.78Amount of cash that can be traded in the current account
equityWithLoan1233078.69Equity with loan value (including loan value assets). Securities Segment: cash value + stock value, futures Segment: cash value - maintenance margin
excessLiquidity960492.09Excess liquidity, used to represent intraday risk value. Calculation method for securities segment: equity_with_loan - maintenance_margin_requirement. Calculation method for futures segment: net_liquidation - maintenance_margin_requirement
accruedCash-763.2The accumulated interest payable in the current month, updated according to the daily
accruedDividend0.0Accumulated dividends. Refers to the accumulated value of all dividends that have been executed but not paid
initMarginReq292046.91Initial Margin
maintMarginReq273170.84Maintenance Margin
regTEquity0.0Only for the securities segment, that is, the equity with loan (including the loan equity value) calculated according to the Regulation T Act
regTMargin0.0For security segments only, i.e. initial margin requirements calculated under Regulation T
SMA0.0For security segments only. Overnight risk control value, the overnight risk of account positions is checked about 10 minutes before the close of each trading day. The overnight risk control value needs to be greater than 0, otherwise some positions in the account will be forced to close before the market closes. If the overnight risk control value is lower than 0 during the trading day, and the time is not 10 minutes before the closing time, the account will not be liquidated.
grossPositionValue865644.18Total value of securities: long stock value + short stock value + long option value + short option value. The above items are calculated as absolute values.
leverage1leverage
updateTime1526368181000last update at

marketValues Descirption:

NameTypeDescription
accountU10010705Account
currencyUSDCurrency
netLiquidation1233662.93Net Liquidation(Equivalent to Total Asset in TigerTrade APP)
cashBalance469140.39Cash
exchangeRate0.1273896Exchange rate to USD (or primary currency of your account)
netDividend0.0Net dividend
futuresPnl0.0Futures profit and loss
realizedPnl-248.72Realized profit and loss
unrealizedPnl-17039.09Unrealized profit and loss
updateTime1526368181000Updated at
stockMarketValue943588.78market value of stock positions
optionMarketValue0.0market value of option postions
futureOptionValue0.0total market value of futures positions
warrantValue10958.0total market value of warrant positions

Example

  static async Task<TigerDictResponse?> GetGlobalAssetsAsync(TradeClient tradeClient)
  {
    TigerRequest<TigerDictResponse> request = new TigerRequest<TigerDictResponse>()
    {
      ApiMethodName = TradeApiService.ASSETS,
      ModelValue = new GlobalAssetsModel() {
        Account = "U10010705",
        Segment = true, MarketValue = true
      }
    };
    return await tradeClient.ExecuteAsync(request);
  }

Response Example

{
    "data":{
        "items":[
            {
                "account":"U10010705",
                "capability":"Reg T Margin",
                "accruedCash":0,
                "accruedDividend":0,
                "buyingPower":38988.82,
                "equityWithLoan":10220.44,
                "grossPositionValue":1302.78,
                "regTEquity":10220.53,
                "initMarginReq":473.24,
                "maintMarginReq":390.35,
                "availableFunds":9747.2,
                "excessLiquidity":9830.17,
                "cushion":0.9618,
                "dayTradesRemaining":-1,
                "realizedPnL":0,
                "unrealizedPnL":-597.19,
                "netLiquidation":10220.53,
                "cashValue":8917.75,
                "currency":"USD",
                "updateTime":1678258433,
                "segments":[
                    {
                        "account":"U10010705",
                        "category":"S",
                        "title":"US Securities",
                        "netLiquidation":10220.53,
                        "cashValue":8917.75,
                        "availableFunds":9747.2,
                        "equityWithLoan":10220.44,
                        "excessLiquidity":9830.17,
                        "accruedDividend":0,
                        "initMarginReq":473.24,
                        "maintMarginReq":390.35,
                        "grossPositionValue":1302.78,
                        "leverage":0.13,
                        "updateTime":1678258433,
                        "regTEquity":10220.53,
                        "regTMargin":651.39,
                        "sma":12098.83
                    },
                    {
                        "account":"U10010705",
                        "category":"C",
                        "title":"US Commodities",
                        "netLiquidation":0,
                        "cashValue":0,
                        "availableFunds":0,
                        "equityWithLoan":0,
                        "excessLiquidity":0,
                        "accruedDividend":0,
                        "initMarginReq":0,
                        "maintMarginReq":0,
                        "grossPositionValue":0,
                        "leverage":0,
                        "updateTime":1662226983
                    }
                ],
                "marketValues":[
                    {
                        "account":"U10010705",
                        "currency":"HKD",
                        "netLiquidation":896.32,
                        "cashBalance":-1890.41,
                        "accruedCash":0,
                        "stockMarketValue":2786.73,
                        "optionMarketValue":0,
                        "futureOptionValue":0,
                        "warrantValue":0,
                        "netDividend":0,
                        "futuresPnl":0,
                        "realizedPnl":0,
                        "unrealizedPnl":-815.88,
                        "exchangeRate":0.12738895,
                        "updateTime":1678258160
                    },
                    {
                        "account":"U10010705",
                        "currency":"JPY",
                        "netLiquidation":827.81,
                        "cashBalance":828,
                        "accruedCash":0,
                        "stockMarketValue":0,
                        "optionMarketValue":0,
                        "futureOptionValue":0,
                        "warrantValue":0,
                        "netDividend":0,
                        "futuresPnl":0,
                        "realizedPnl":0,
                        "unrealizedPnl":0,
                        "exchangeRate":0.00713265,
                        "updateTime":1662226983
                    },
                    {
                        "account":"U10010705",
                        "currency":"GBP",
                        "netLiquidation":66.68,
                        "cashBalance":66.69,
                        "accruedCash":0,
                        "stockMarketValue":0,
                        "optionMarketValue":0,
                        "futureOptionValue":0,
                        "warrantValue":0,
                        "netDividend":0,
                        "futuresPnl":0,
                        "realizedPnl":0,
                        "unrealizedPnl":0,
                        "exchangeRate":1.15129995,
                        "updateTime":1662226983
                    },
                    {
                        "account":"U10010705",
                        "currency":"USD",
                        "netLiquidation":270.58,
                        "cashBalance":-0.78,
                        "accruedCash":0,
                        "stockMarketValue":271.36,
                        "optionMarketValue":0,
                        "futureOptionValue":0,
                        "warrantValue":0,
                        "netDividend":0,
                        "futuresPnl":0,
                        "realizedPnl":0,
                        "unrealizedPnl":-639,
                        "exchangeRate":1,
                        "updateTime":1678237280
                    },
                    {
                        "account":"U10010705",
                        "currency":"CNH",
                        "netLiquidation":68031.13,
                        "cashBalance":63312.18,
                        "accruedCash":0,
                        "stockMarketValue":4719.29,
                        "optionMarketValue":0,
                        "futureOptionValue":0,
                        "warrantValue":0,
                        "netDividend":0,
                        "futuresPnl":0,
                        "realizedPnl":0,
                        "unrealizedPnl":1016.82,
                        "exchangeRate":0.1433296,
                        "updateTime":1678258433
                    }
                ],
                "sma":12098.83
            }
        ]
    },
    "message":"success",
    "timestamp":1678258561486,
    "sign":"VcI8Hvzkzr5wJ3DKfamj+/S5QeRt5jI1ifeulqX4OigRAvLrbUy135wG0tT2PVHoGtfjATDEwXk3cmrsSwQnVOgPuJaq69G7Odox036PUt01ZUj9NPK1g1qCHPxs4YthHKHnpQ5Yt7qGmZfvlucL5T8EvjqWpM/JL3xYt5YyMjE="
}

Get Asset for Prime Account

Request:TigerRequest(TradeApiService.PRIME_ASSETS)

Description

Get asset information for prime and paper trading account

Argument

ArgumentTypeRequiredDescription
accountstringYesAccount id, example: 123123
base_currencystringNoCurrency, HKD/USD
secret_keystringNoSecret key for the trader of institutions, please config in client_config, ignore if you are a indiviual user
consolidatedbooleanNoWhether to display consolidated segment indicators, only SEC and FUND category assets will be aggregated. Default value is true

ResponseTigerOpenAPI.Trade.Response.PrimeAssetResponsesourceopen in new window

Use PrimeAssetResponse.Data to access returned data. This method will return a PrimeAssetItem object, whereTigerOpenAPI.Trade.Response.Segment has the following attributes:

PrimeAssetItem.Segment Description:

NameTypeExampleDescription
accountString123123Account id
currencyStringUSDCurrency
categoryStringSSecurities Category C: (Commodities Futures), S: (Securities Stocks), F: (Funds)
capabilityStringRegTMarginAccount Type, Margin: RegTMargin, Cash: Cash RegTMargin,
buyingPowerDouble6273545.18buying power. Estimate how many more dollars you can buy in stock assets. The margin account has a maximum of four times the purchasing power of the funds (funds that are not used for margin) during the day. Up to twice the purchasing power overnight
cashAvailableForTradeDouble1233662.1Amount of cash and margin that can be traded in the current account
cashAvailableForWithdrawalDouble1233662.1Amount of cash that can be withdrawn in the current account
cashBalanceDouble469140.39The cash that can be traded, plus the cash that has been locked (such as stocks that have been purchased but not yet traded, and some other situations will also have locked cash)
grossPositionValueDouble865644.18Total value of securities: long stock value + short stock value + long option value + short option value. The above items are calculated as absolute values
initMarginDouble292046.91initial margin requirement.
maintainMarginDouble273170.84Maintenance margin requirement
overnightMarginDouble273170.84Overnight margin requirement
excessLiquidationDouble960492.09Excess liquidity, used to represent intraday risk value. Calculation method for securities segment: equity_with_loan - maintenance_margin_requirement. Calculation method for futures segment: net_liquidation - maintenance_margin_requirement
overnightLiquidationDouble1233662.93Overnight risk control value, when it is less than 0, account positions will be forced to liquidate, you need to pay attention to the risks
netLiquidationDouble1233662.93Total Assets (Net Liquidation Value) - Securities Segment: Cash Value + Stock Value + Stock Option Value - Futures Segment: Cash Value + Mark-to-Market Profit and Loss
equityWithLoanDouble1233078.69Equity with loan value (asset with loan value) - Securities Segment: Cash Value + Stock Value - Futures Segment: Cash Value - Maintenance Margin
realizedPLDouble-248.72Today's Realized P&L
unrealizedPLDouble-17039.09Unrealized profit and loss
leverageDouble0.5leverage
currencyAssetsCurrencyAssetsshow asset information according to different currencies
consolidatedSegTypesstringconsolidated Segment. The following are the fields of consolidated Segment:cashAvailableForTrade、initMargin、maintainMargin、overnightMargin、excessLiquidation、overnightLiquidation、buyingPower、lockedFunds、leverage

PrimeAssetItem.CurrencyAssets

NameExampleDescription
currencyUSDCurrent currency, commonly used currencies include: USD-US dollar, HKD-Hong Kong dollar, SGD-Singapore dollar, CNH-RMB
cashBalance469140.39Cash that can be traded, plus the cash that has been locked (such as stocks that have been purchased but not yet traded, and some other situations will also have locked cash)
cashAvailableForTrade0.1273896The amount of cash that can be traded in the current account
realizedPL-248.72realizd profit and loss of the account
unrealizedPL-17039.09Unrealizd profit and loss of the account
stockMarketValue943588.78Market value of the stocks in this account
optionMarketValue0.0Market value of the options in this account
futuresMarketValue0.0Market value of futures in this account, 0 when category='S'(stocks)

Example

  static async Task<PrimeAssetResponse?> GetPrimeAssetsAsync(TradeClient tradeClient)
  {
    TigerRequest<PrimeAssetResponse> request = new TigerRequest<PrimeAssetResponse>()
    {
      ApiMethodName = TradeApiService.PRIME_ASSETS,
      ModelValue = new PrimeAssetsModel()
      {
        Account = "572386",
        BaseCurrency = Currency.USD.ToString(),
        Consolidated = true
      }
    };
    return await tradeClient.ExecuteAsync(request);
  }

Response Example

{
    "data":{
        "accountId":"572386",
        "updateTimestamp":1704356640023,
        "segments":[
            {
                "capability":"CASH",
                "category":"S",
                "currency":"USD",
                "cashBalance":6850.83,
                "cashAvailableForTrade":878.56,
                "cashAvailableForWithdrawal":0,
                "grossPositionValue":438.99,
                "equityWithLoan":8892,
                "netLiquidation":7289.82,
                "initMargin":2041.17,
                "maintainMargin":2041.17,
                "overnightMargin":2041.17,
                "unrealizedPL":73.49,
                "realizedPL":0,
                "excessLiquidation":6850.83,
                "overnightLiquidation":6850.83,
                "buyingPower":878.56,
                "leverage":0.23,
                "totalTodayPL":-1.35,
                "lockedFunds":5972.27,
                "currencyAssets":[
                    {
                        "currency":"USD",
                        "cashBalance":6008.16,
                        "cashAvailableForTrade":35.89,
                        "grossPositionValue":0,
                        "stockMarketValue":0,
                        "optionMarketValue":0,
                        "futuresMarketValue":0,
                        "unrealizedPL":0,
                        "realizedPL":0
                    },
                    {
                        "currency":"HKD",
                        "cashBalance":5351.53,
                        "cashAvailableForTrade":5351.53,
                        "grossPositionValue":0,
                        "stockMarketValue":0,
                        "optionMarketValue":0,
                        "futuresMarketValue":0,
                        "unrealizedPL":0,
                        "realizedPL":0
                    },
                    {
                        "currency":"CNH",
                        "cashBalance":1123.95,
                        "cashAvailableForTrade":1123.95,
                        "grossPositionValue":0,
                        "stockMarketValue":0,
                        "optionMarketValue":0,
                        "futuresMarketValue":0,
                        "unrealizedPL":0,
                        "realizedPL":0
                    },
                    {
                        "currency":"EUR",
                        "cashBalance":0.12,
                        "cashAvailableForTrade":0.12,
                        "grossPositionValue":0,
                        "stockMarketValue":0,
                        "optionMarketValue":0,
                        "futuresMarketValue":0,
                        "unrealizedPL":0,
                        "realizedPL":0
                    }
                ],
                "consolidatedSegTypes":[
                    "SEC",
                    "FUND"
                ]
            },
            {
                "capability":"CASH",
                "category":"F",
                "currency":"USD",
                "cashBalance":0,
                "cashAvailableForTrade":878.56,
                "cashAvailableForWithdrawal":0,
                "grossPositionValue":1602.18,
                "equityWithLoan":8892,
                "netLiquidation":1602.18,
                "initMargin":2041.17,
                "maintainMargin":2041.17,
                "overnightMargin":2041.17,
                "unrealizedPL":89.35,
                "realizedPL":1.25,
                "excessLiquidation":6850.83,
                "overnightLiquidation":6850.83,
                "buyingPower":878.56,
                "leverage":0.23,
                "totalTodayPL":-11.78,
                "lockedFunds":5972.27,
                "currencyAssets":[
                    {
                        "currency":"USD",
                        "cashBalance":0,
                        "cashAvailableForTrade":0,
                        "grossPositionValue":0,
                        "stockMarketValue":0,
                        "optionMarketValue":0,
                        "futuresMarketValue":0,
                        "unrealizedPL":0,
                        "realizedPL":0
                    },
                    {
                        "currency":"HKD",
                        "cashBalance":0,
                        "cashAvailableForTrade":0,
                        "grossPositionValue":0,
                        "stockMarketValue":0,
                        "optionMarketValue":0,
                        "futuresMarketValue":0,
                        "unrealizedPL":0,
                        "realizedPL":0
                    },
                    {
                        "currency":"CNH",
                        "cashBalance":0,
                        "cashAvailableForTrade":0,
                        "grossPositionValue":0,
                        "stockMarketValue":0,
                        "optionMarketValue":0,
                        "futuresMarketValue":0,
                        "unrealizedPL":0,
                        "realizedPL":0
                    }
                ],
                "consolidatedSegTypes":[
                    "SEC",
                    "FUND"
                ]
            }
        ]
    },
    "code":0,
    "message":"success",
    "timestamp":1704356640023,
    "sign":"jNmgtsOWiLu35nEV922Jsyx9OfHYBtAXNG/Fo5U2yk/KTOwVb9+IMJRDY7Z1sSEpHGQ1rN7VqBRutb9xV3HrrTk4CaAkApVyl/JglvW6dnstMWcdq1chr0eZWXQbo520ZTFlZzef9oBu6pBMYJgNKMhUFK/QeBKDlq44hWylRog="
}

Get Asset Analytics for Prime Account

Request:TigerRequest(TradeApiService.ANALYTICS_ASSET)

Description Get historical asset analysis data for prime and paper trading account.

Argument

ArgumentTypeRequiredDescription
accountstringYesAccount id
start_datestringNostart date, format yyyy-MM-dd, like '2022-01-01', end_date
end_datestringNoend date, format yyyy-MM-dd, like '2022-02-01', if missing, use current date
seg_typeSegmentTypeNoAccount segment. Available: SegmentType.SEC for Securities; SegmentType.FUT for Commodities
currencyCurrencyNocurrency,include ALL/USD/HKD/CNH
sub_accountstrNoSub-account (for institutional accounts only), if this field is setted, the assets of the sub-account will be returned
secret_keystringNoSecret key for the trader of institutions, please config in client_config, ignore if you are a indiviual user

Response TigerOpenAPI.Trade.Response.PrimeAssetResponse`sourceopen in new window

Use PrimeAnalyticsAssetResponse.Data to access returned data. This method will return a PrimeAnalyticsAssetItem object, whereTigerOpenAPI.Trade.Response.Summary and TigerOpenAPI.Trade.Response.HistoryItem has the following attributes:

PrimeAnalyticsAssetItem.SummaryDescription:

FieldTypeDescription
pnldoubleprofit and loss
pnlPercentagedoubleprofit and loss's percentage
annualizedReturndoubleannualized return
overUserPercentagedoubleover user's percentage

PrimeAnalyticsAssetItem.HistoryItemDescription:

FieldTypeDescription
datelongDate timestamp in milliseconds
pnldoubleAmount of profit or loss compared to the previous day
pnlPercentagedoubleYield compared to the previous day
assetdoubleTotal assets amount
cashBalancedoubleCash balance
grossPositionValuedoubleposition market value
depositdoubledeposit amount
withdrawaldoublewithdrawal amount

Example

  static async Task<PrimeAnalyticsAssetResponse?> GetAssetsAnalyticsAsync(TradeClient tradeClient)
  {
    TigerRequest<PrimeAnalyticsAssetResponse> request = new TigerRequest<PrimeAnalyticsAssetResponse>()
    {
      ApiMethodName = TradeApiService.ANALYTICS_ASSET,
      ModelValue = new PrimeAnalyticsAssetModel()
      {
        Account = "572386",
        StartDate = "2023-02-26"
      }
    };
    return await tradeClient.ExecuteAsync(request);
  }

Response Example

{
    "data":{
        "summary":{
            "pnl":11.95,
            "pnlPercentage":0.14,
            "annualizedReturn":6.39,
            "overUserPercentage":80
        },
        "history":[
            {
                "date":1677387600000,
                "asset":8496.26,
                "pnl":"NaN",
                "cashBalance":8236.66,
                "grossPositionValue":259.59
            },
            {
                "date":1677474000000,
                "asset":8498.54,
                "pnl":2.28,
                "pnlPercentage":0.03,
                "cashBalance":8237.04,
                "grossPositionValue":261.5
            },
            {
                "date":1677560400000,
                "asset":8495.41,
                "pnl":-0.85,
                "pnlPercentage":-0.01,
                "cashBalance":8236.94,
                "grossPositionValue":258.47
            },
            {
                "date":1677646800000,
                "asset":8500.93,
                "pnl":4.67,
                "pnlPercentage":0.05,
                "cashBalance":8238.07,
                "grossPositionValue":262.86
            },
            {
                "date":1677733200000,
                "asset":8499.22,
                "pnl":2.96,
                "pnlPercentage":0.03,
                "cashBalance":8237.44,
                "grossPositionValue":261.78
            },
            {
                "date":1677819600000,
                "asset":8506.96,
                "pnl":10.7,
                "pnlPercentage":0.13,
                "cashBalance":8237.78,
                "grossPositionValue":269.18
            },
            {
                "date":1677906000000,
                "asset":8507.04,
                "pnl":10.78,
                "pnlPercentage":0.13,
                "cashBalance":8237.83,
                "grossPositionValue":269.2
            },
            {
                "date":1677992400000,
                "asset":8506.77,
                "pnl":10.51,
                "pnlPercentage":0.12,
                "cashBalance":8237.58,
                "grossPositionValue":269.18
            },
            {
                "date":1678078800000,
                "asset":8508.21,
                "pnl":11.95,
                "pnlPercentage":0.14,
                "cashBalance":8236.98,
                "grossPositionValue":271.23
            }
        ]
    },
    "message":"success",
    "timestamp":1678260763093,
    "sign":"ReuiDxqXjA0gAk523tOn9kAi/cr+naPzC4O9WA6xpXqUBHL1AbbZ04IgTpy2HcRcZEoSA9KNlokbdJekAWvtyYxtoSAd6Bsc4a2+b+RoNHDNaaVPOQv97AQXTWgNOKbcQF7dYN2N2GlJiRuRFBEkpvWe2XjhhGyGaYl+d1WokHE="
}

Get Available Fund for Prime Account

Request:TigerRequest(TradeApiService.SEGMENT_FUND_AVAILABLE)

Description

Get available fund for prime and paper trading account

Argument

ArgumentTypeRequiredDescription
accountstringYesAccount id
from_segmentstringNofrom segment, FUT/SEC
currencystringNocurrency,USD/HKD

Response

TigerOpenAPI.Trade.Response.SegmentFundAvailableResponse

Use SegmentFundAvailableResponse.Data to get a list of the amount of funds that can be transferred out of each segment. See examples below

SegmentFundAvailableItemDescription:

NameTypeDescription
fromSegmentlstringfrom segment, FUT/SEC
currencystringcurrency,USD/HKD
amountdoubletransferable funds

Example

  static async Task<SegmentFundAvailableResponse?> QueryAvailableSegmentFundAsync(TradeClient tradeClient)
  {
    TigerRequest<SegmentFundAvailableResponse> request = new TigerRequest<SegmentFundAvailableResponse>()
    {
      ApiMethodName = TradeApiService.SEGMENT_FUND_AVAILABLE,
      ModelValue = new SegmentFundModel()
      {
        Account = tradeClient.GetDefaultAccount,// "20200821144442583",
        FromSegment = SegmentType.SEC,
        Currency = Currency.HKD,
      }
    };
    return await tradeClient.ExecuteAsync(request);
  }

Response Example

{
    "data":[
        {
            "fromSegment":"SEC",
            "currency":"HKD",
            "amount":17595363.61
        }
    ],
    "message":"success",
    "timestamp":1680526884978,
    "sign":"TNfWuz1DjasvBUuDBabmmZZ2yXpUWsSbwkjFuKamdouqO7KnW0Yaa9YYOq9nR03t0cCirVYAjS1KHMJNh6WMxI+BTo1eOXz6ZmuCtRaI5uAk71JW6Ft3MQb/fgYGro7DmqntuabUZXQzVU2JeeHPjZwjdqTFiFUT14HU+51VTXk="
}

Transfer Fund for Prime Account

Request:TigerRequest(TradeApiService.TRANSFER_SEGMENT_FUND)

Description

Transfer funds under different segments of the account

Argument

ArgumentTypeRequiredDescription
accountstringYesAccount id
from_segmentstringYesfrom segment, FUT/SEC
to_segmentstringYestarget segment, FUT/SEC,must be different from 'from_segment'
currencystringYescurrency,USD/HKD
amountdoubleYesamount

Response

TigerOpenAPI.Trade.Response.SegmentFundResponse

Use SegmentFundResponse.Data to get transfer result. See examples below

SegmentFundItemDescription:

NameTypeDescription
idlongTransfer record ID
fromSegmentlstringfrom segment, FUT/SEC
toSegmentlstringtarget segment, FUT/SEC
currencystringcurrency, USD/HKD
amountdoubletransfer amount
statusstringstatus(NEW/PROC/SUCC/FAIL/CANC)
statusDescstringstatus description
messagestringfail message
settledAtlongsettled timestamp
updatedAtlongupdated timestamp
createdAtlongcreated timestamp

Example

  static async Task<SegmentFundResponse?> TransferSegmentFundAsync(TradeClient tradeClient)
  {
    TigerRequest<SegmentFundResponse> request = new TigerRequest<SegmentFundResponse>()
    {
      ApiMethodName = TradeApiService.TRANSFER_SEGMENT_FUND,
      ModelValue = new SegmentFundModel()
      {
        Account = tradeClient.GetDefaultAccount,// "20200821144442583",
        FromSegment = SegmentType.SEC,
        ToSegment = SegmentType.FUT,
        Currency = Currency.HKD,
        Amount = 1000D,
      }
    };
    return await tradeClient.ExecuteAsync(request);
  }

Response Example

{
    "data":{
        "id":30359957871001600,
        "fromSegment":"SEC",
        "toSegment":"FUT",
        "currency":"HKD",
        "amount":1000,
        "status":"NEW",
        "statusDesc":"NEW",
        "updatedAt":1680527296445,
        "createdAt":1680527296445
    },
    "message":"success",
    "timestamp":1680527201025,
    "sign":"CCKYzvfew5GoF8XeNhfd/CzOZH6iCTnHcGGxSF8QgNkupHeMMAxQfmL0oeJ15T1HYL/m4cPciTQFtcXHezDjAf+vfV2kaPnlwXmAZCoCXD5pir4ppObFEBYISRqJls271zbJJ5PnZPCCtdm/osDWxEYgf6yp3LCQdjoT958gm2A="
}

Cancel Funds Transfer for Prime Account

Request:TigerRequest(TradeApiService.CANCEL_SEGMENT_FUND)

Description

Cancel the submitted fund transfer. If the transfer has been successful and cannot be cancelled, can swap 'from_segment' and 'to_segment', transfer again.

Argument

ArgumentTypeRequiredDescription
accountstringYesAccount id
idlongYesTransfer record ID

Response

TigerOpenAPI.Trade.Response.SegmentFundResponse

Use SegmentFundResponse.Data to get transfer result. See examples below

SegmentFundItemDescription:

NameTypeDescription
idlongTransfer record ID
fromSegmentlstringfrom segment, FUT/SEC
toSegmentlstringtarget segment, FUT/SEC
currencystringcurrency, USD/HKD
amountdoubletransfer amount
statusstringstatus(NEW/PROC/SUCC/FAIL/CANC)
statusDescstringstatus description
messagestringfail message
settledAtlongsettled timestamp
updatedAtlongupdated timestamp
createdAtlongcreated timestamp

Example

  static async Task<SegmentFundResponse?> CancelSegmentFundAsync(TradeClient tradeClient, Int64 id)
  {
    TigerRequest<SegmentFundResponse> request = new TigerRequest<SegmentFundResponse>()
    {
      ApiMethodName = TradeApiService.CANCEL_SEGMENT_FUND,
      ModelValue = new SegmentFundModel()
      {
        Account = tradeClient.GetDefaultAccount,// "20200821144442583",
        Id = id,
      }
    };
    return await tradeClient.ExecuteAsync(request);
  }

Response Example

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

Query Historical Funds Transfer for Prime Account

Request:TigerRequest(TradeApiService.SEGMENT_FUND_HISTORY)

Description

Query historical transfer records between account segments.in reverse chronological order

Argument

ArgumentTypeRequiredDescription
accountstringYesAccount id
limitIntegerNoReturns the number of records. The default is 100, the maximum is 500

Response

TigerOpenAPI.Trade.Response.SegmentFundsResponse

Use SegmentFundsResponse.Data to get a list of the historical transfer records between account segments. See examples below

SegmentFundItemDescription:

NameTypeDescription
idlongTransfer record ID
fromSegmentlstringfrom segment, FUT/SEC
toSegmentlstringtarget segment, FUT/SEC
currencystringcurrency, USD/HKD
amountdoubletransfer amount
statusstringstatus(NEW/PROC/SUCC/FAIL/CANC)
statusDescstringstatus description
messagestringfail message
settledAtlongsettled timestamp
updatedAtlongupdated timestamp
createdAtlongcreated timestamp

Example

  static async Task<SegmentFundsResponse?> QueryTransferFundsAsync(TradeClient tradeClient)
  {
    TigerRequest<SegmentFundsResponse> request = new TigerRequest<SegmentFundsResponse>()
    {
      ApiMethodName = TradeApiService.SEGMENT_FUND_HISTORY,
      ModelValue = new SegmentFundModel()
      {
        Account = tradeClient.GetDefaultAccount,// "20200821144442583",
        Limit = 50,
      }
    };
    return await tradeClient.ExecuteAsync(request);
  }

Response Example

{
    "data":[
        {
            "id":30359957871001600,
            "fromSegment":"SEC",
            "toSegment":"FUT",
            "currency":"HKD",
            "amount":1000,
            "status":"SUCC",
            "statusDesc":"SUCCESS",
            "settledAt":1680527297000,
            "updatedAt":1680527296000,
            "createdAt":1680527296000
        },
        {
            "id":30300805635506176,
            "fromSegment":"SEC",
            "toSegment":"FUT",
            "currency":"HKD",
            "amount":1000,
            "status":"SUCC",
            "statusDesc":"SUCCESS",
            "settledAt":1680076001000,
            "updatedAt":1680076001000,
            "createdAt":1680076001000
        },
        {
            "id":30200015261794304,
            "fromSegment":"SEC",
            "toSegment":"FUT",
            "currency":"HKD",
            "amount":1000,
            "status":"SUCC",
            "statusDesc":"SUCCESS",
            "settledAt":1679307032000,
            "updatedAt":1679307031000,
            "createdAt":1679307031000
        }
    ],
    "message":"success",
    "timestamp":1680527722804,
    "sign":"WmjP2HKxmuK+s9yHi2NwEhKlNJX9f+643R3UsJuSkiFb8RkHnTiYabsXzAIuWYzHm1y9bM9l0mdv827zS6/ZjAludr1fmpKmgILnUIxm/6n4ljZvYm+8pu576Jjl1zNV6I8yXI7EO7vQk1agpNdw/4v4xXj1efTG5MujmHJWPHk="
}

Get Max Tradable Quantity

Request:TigerRequest(TradeApiService.ESTIMATE_TRADABLE_QUANTITY)

Description

Get the maximum quantity that can be bought or sold. Support stocks, options, excluding futures.

Argument

ArgumentTypeRequiredDescription
accountStringYesAccount id, prime account only
symbolStringYesticker symbol
expiryStringNo, required when sec_type is OPT/WAR/IOPTExpiration Date,yyyyMMdd
rightStringNo, required when sec_type is OPT/WAR/IOPTCALL/PUT
strikeStringNo, required when sec_type is OPT/WAR/IOPTStrike price
seg_typeSegmentTypeNoAccount segment. Available: SegmentType.SEC for Securities
sec_typeSecTypeNoSTK/WAR/IOPT/OPT
actionActionTypeYesOrder direction: BUY/SELL
order_typeOrderTypeYesOrder Types,'MKT'-Market Order / 'LMT'-Limit Order / 'STP'-Stop Order / 'STP_LMT'-Stop-Limit Order
limit_pricedoubleNoLimit price, required if order_type is LMT or STP_LMT
stop_pricedoubleNoStop price, required if order_type is STP or STP_LMT
secretKeyStringNoSecret key for the trader of institutions, please config in client_config, ignore if you are a indiviual user

Response

TigerOpenAPI.Trade.Response.EstimateTradableQuantityResponse

Use EstimateTradableQuantityResponse.Data to get TradableQuantityItem object. See examples below

TradableQuantityItemDescription:

NameExampleDescription
tradableQuantityDoubletradable quantity for cash
financingQuantityDoubletradable quantity for margin
positionQuantityDoubleposition quantity
tradablePositionQuantityDoubletradable quantity in the position

Example

  static async Task<EstimateTradableQuantityResponse?> GetMaxTradableQuantityAsync(TradeClient tradeClient)
  {
    TigerRequest<EstimateTradableQuantityResponse> request = new TigerRequest<EstimateTradableQuantityResponse>()
    {
      ApiMethodName = TradeApiService.ESTIMATE_TRADABLE_QUANTITY,
      ModelValue = new EstimateTradableQuantityModel()
      {
        Account = tradeClient.GetDefaultAccount,// "20200821144442583",
        SecType = SecType.STK,
        Symbol = "AAPL",
        Action = ActionType.BUY,
        OrderType = OrderType.LMT,
        LimitPrice = 150,
      }
    };
    return await tradeClient.ExecuteAsync(request);
  }

Response Example

{
    "data":{
        "tradableQuantity":45,
        "financingQuantity":"NaN",
        "positionQuantity":1,
        "tradablePositionQuantity":1
    },
    "code":0,
    "message":"success",
    "timestamp":1681798582434,
    "sign":"nAQLlyEZqhbOF+/4QxGZgXEsbhaHX6lv4XmytES+ytqxrCpg7yG3Sjgnu3vglSYWtsKYRO23XCgVQIGzQnQSykqxyamC8abPi2HtqGAE1Pbn1B/1JDxZ9rGm0J4t7B2aj7WSnGUDr1cIPctjM8yaEAnUC1m+6Jq7v2DhBgTD4xc="
}
Last update: