查询账户信息

大约 25 分钟

账户列表

对应的请求类:TigerRequest(TradeApiService.ACCOUNTS)

说明

获取管理的账户列表

参数

参数类型是否必填描述
accountstringNo用户授权账号(不支持传入模拟账号),不传会返回全部账号,包括综合,环球,模拟。

返回TigerOpenAPI.Trade.Response.AccountsResponsesourceopen in new window

返回数据可通过AccountsResponse.Data属性访问,返回AccountItem对象的字典,其中TigerOpenAPI.Trade.Response.AccountItem 属性如下:

字段示例说明
account综合账号:50129912,环球:U5755619,模拟账号:20191221901212121交易的资金账户,其中综合账号为5到10位数字,模拟账号为17位数字,环球账号以字母U开头
capabilityRegTMargin账户类型(CASH:现金账户, RegTMargin: Reg T 保证金账户, PMGRN: 投资组合保证金)
statusFunded账号状态,大部分场景会返回已入金(Funded)状态。状态包括: Funded(已入金), Open(已开户), Pending(待开户), Rejected(开户被拒绝), Closed(已注销)
accountTypeSTANDARD账户分类, GLOBAL:环球账号;STANDARD:综合账号;PAPER:模拟账号

示例

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

返回示例

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

账户持仓

对应的请求类:TigerRequest(TradeApiService.POSITIONS)

说明

查询账户持仓

参数

参数类型是否必填描述
accountstringYes用户授权账户:13810712
sec_typestringNo证券类型,包括:STK/OPT/FUT/WAR/IOPT/CASH/FOP/FUND, 默认 STK
currencystringNo货币类型,包括:ALL/USD/HKD/CNH 默认 ALL
marketstringNo市场分类,包括:ALL/US/HK/CN 默认 ALL
symbolstringNo股票代码 如:600884 / SNAP,期货类型时:CL1901,期权类型时 symbol格式可以传底层股票代码,也可以为identifier,如:'AAPL 190111C00095000',格式固定为21位,symbol为6位,不足的补空格;窝轮/牛熊证传5位代码、期权传
secret_keystringNo机构用户专用,交易员密钥
expirystringNo过期日(适用于期权、窝轮、牛熊证)。 形式 'yyyyMMdd', 比如 '20230818'
strikedoubleNo行权价(适用于期权、窝轮、牛熊证)。如 100.5
rightstringNo看涨或看跌(适用于期权、窝轮、牛熊证)。'PUT' 或 'CALL'

返回

TigerOpenAPI.Trade.Response.PositionsResponsesourceopen in new window

返回数据可通过PositionsResponse.Data属性访问,返回PositionsItem对象,其中TigerOpenAPI.Trade.Response.PositionDetail 属性如下:

名称类型说明
accountstring交易账户
positionQtydouble持仓数量
salableQtydouble可卖数量
positionlong持仓数量(废弃)
positionScaleint持仓数量偏移量(废弃),如 position=11123, positionScale=2,那么实际 position=11123*10^(-2)=111.23
averageCostdouble平均成本
averageCostByAveragedouble均价成本
averageCostOfCarrydouble累计持仓成本(A股模式计算方式)
latestPricedouble市价
isLevel0Priceboolean是否为lv0(延迟)行情
marketValuedouble市值
realizedPnldoublefifo模式下已实现盈亏
realizedPnlByAveragedouble均价模式下已实现盈亏
unrealizedPnldouble浮动盈亏
unrealizedPnlByAveragedouble均价成本浮动盈亏
unrealizedPnlPercentdouble浮动收益率(投资回报率)
unrealizedPnlPercentByAveragedouble均价成本浮动盈亏率
unrealizedPnlByCostOfCarrydouble浮动盈亏(A股模式计算方式)
unrealizedPnlPercentByCostOfCarrydouble浮动盈亏率(A股模式计算方式)
multiplierdouble每手数量
marketstring市场
currencystring交易货币币种
secTypestring交易类型
identifierstring标的标识
symbolstring股票代码
strikedouble期权底层价格(仅限期权)
expirystring期权过期日(仅限期权)
rightstring期权方向(仅限期权)
updateTimestamplong更新时间
mmPercentdouble保证金占比
mmValuedouble维持保证金
todayPnldouble今日盈亏额
todayPnlPercentdouble今日盈亏率
yesterdayPnldouble基金昨日盈亏
lastClosePricedouble最后盘中收盘价(前复权),美股盘中为上个交易日的收盘价
categoriesList<string>合约类型

示例

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

返回示例

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

环球账户资产

对应的请求类:TigerRequest(TradeApiService.ASSETS)

说明

获取环球账户资产 主要适用于环球账户,综合/模拟账号虽然也可使用此接口,但有较多字段为空,请使用 PrimeAssetRequest 查询综合/模拟账户资产

参数

参数类型是否必填描述
accountstringYes用户授权账户:DU575569
segmentbooleanNo是否包含证券/期货分类, 默认 False
market_valuebooleanNo是否包含分市场市值,默认 False,仅环球账户支持
secret_keystringNo机构用户专用,交易员密钥

返回TigerOpenAPI.Model.TigerDictResponsesourceopen in new window

返回数据可通过TigerDictResponse.Data属性访问,返回数据字典,其中value属性如下:

名称示例说明
accountU10010705交易账户
capabilityRegTMargin账户类型,保证金:RegTMargin,现金:Cash
netLiquidation1233662.93净清算值
equityWithLoan1233078.69含借贷值股权(含贷款价值资产)。 证券 Segment: 现金价值 + 股票价值, 期货 Segment: 现金价值 - 维持保证金
initMarginReq292046.91初始保证金要求
maintMarginReq273170.84维持保证金要求
availableFunds941031.78可用资金(可用于交易),计算方法为 equity_with_loan - initial_margin_requirement
dayTradesRemaining-1剩余日内交易次数,-1表示无限制
excessLiquidity960492.09剩余流动性,用来表示日内风险数值。 证券 Segment 计算方法: equity_with_loan - maintenance_margin_requirement。 期货 Segment 计算方法: net_liquidation - maintenance_margin_requirement
buyingPower6273545.18购买力。 预估您还可以购入多少美元的股票资产。保证金账户日内最多有四倍于资金(未被占用做保证金的资金)的购买力。隔夜最多有两倍的购买力。
cashValue469140.39证券账户金额+期货账户金额
accruedCash-763.2当前月份的累积应付利息,按照日频更新。
accruedDividend0.0累计分红. 指的是所有已执行但仍未支付的分红累加值
grossPositionValue865644.18证券总价值: 做多股票的价值+做空股票价值+做多期权价值+做空期权价值。
SMA0.0特殊备忘录账户,隔夜风险数值(App)
regTEquity0.0仅针对证券Segment,即根据 Regulation T 法案计算的 equity with loan(含借贷股权值)
regTMargin0.0仅针对证券Segment, 即根据 Regulation T 法案计算的 initial margin requirements(初始保证金)
cushion0.778569剩余流动性占总资产的比例,计算方法为: excess_liquidity/net_liquidation
currencyUSD货币币种
realizedPnl-248.72实际盈亏
unrealizedPnl-17039.09浮动盈亏
updateTime0更新时间
segments按照交易品种区分的账户信息。内容是一个Map,分别有两个key,'S'表示证券, 'C' 表示期货; value 是一个 Account 对象。
marketValues分市场的市值信息。内容是一个Map, 'USD' 表示美国市场, 'HKD' 表示香港市场; value 是一个 MarketValue 对象。

segments说明:

名称示例说明
accountU10010705交易账户
categoryS底层证券的行业分类 C(US Commodities 期货) or S(US Securities 证券)
titleUS Securities标题
netLiquidation1233662.93净清算值
cashValue469140.39证券账户金额+期货账户金额
availableFunds941031.78可用资金(可用于交易)
equityWithLoan1233078.69含借贷值股权
excessLiquidity960492.09剩余流动性,为保持当前拥有的头寸,必须维持的缓冲保证金的数额,日内风险数值(App)
accruedCash-763.2净累计利息
accruedDividend0.0净累计分红
initMarginReq292046.91初始保证金要求
maintMarginReq273170.84维持保证金要求
regTEquity0.0RegT资产
regTMargin0.0RegT保证金
SMA0.0特殊备忘录账户,隔夜风险数值(App)
grossPositionValue865644.18持仓市值
leverage1杠杆
updateTime1526368181000更新时间

marketValues说明:

名称示例说明
accountU10010705交易账户
currencyUSD货币币种
netLiquidation1233662.93总资产(净清算价值)
cashBalance469140.39现金
exchangeRate0.1273896对账户主币种的汇率
netDividend0.0应付股息与应收股息的净值
futuresPnl0.0盯市盈亏
realizedPnl-248.72已实现盈亏
unrealizedPnl-17039.09浮动盈亏
updateTime1526368181000更新时间
stockMarketValue943588.78股票市值
optionMarketValue0.0期权市值
futureOptionValue0.0期货市值
warrantValue10958.0窝轮市值

示例

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

返回示例

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

综合/模拟账号获取资产

对应的请求类:PrimeAssetRequestTigerRequest(TradeApiService.PRIME_ASSETS)

说明 查询综合/模拟账户的资产。

参数

参数类型是否必填描述
accountstringYes用户授权账户: 123123
base_currencystringNoCurrency, HKD/USD
secret_keystringNo机构用户专用,交易员密钥
consolidatedbooleanNo是否展示聚合Segment指标,只会聚合SEC和FUND类别资产。默认为true

返回TigerOpenAPI.Trade.Response.PrimeAssetResponsesourceopen in new window

返回数据可通过PrimeAssetResponse.Data属性访问,返回PrimeAssetItem对象,其中TigerOpenAPI.Trade.Response.Segment 属性如下:

PrimeAssetItem.Segment说明:

名称类型示例说明
accountString123123交易账户
currencyStringUSD货币的币种
categoryStringS交易品种分类 C(Commodities 期货) or S(Securities 证券)、F(Funds 基金)
capabilityStringRegTMargin账户类型, 保证金账户: RegTMargin, 现金账户: Cash。保证金账户支持融资融券功能,T+0交易次数不受限制,最大购买力于日内最高4倍,隔日最高2倍。
buyingPowerDouble6273545.18最大购买力。 最大购买力是账户最大的可用购买金额。可以用最大购买力的值来估算账户最多可以买多少金额的股票,但是由于每只股票的最多可加的杠杆倍数不一样,所以实际购买单支股票时可用的购买力要根据具体股票保证金比例来计算。算法,最大购买力=4*可用资金。举例:小虎的可用资金是10万美元,那么小虎的最大购买力是40万美元,假设当前苹果股价是250美元一股,苹果的初始保证金比例是30%,小虎最多可以买100000/30%=33.34万美金的苹果,假设苹果的初始保证金比例为25%,小虎最多可以买100000/25%=40万美金的苹果。保证金账户日内最多有四倍于资金(未被占用做保证金的资金)的购买力 隔夜最多有两倍的购买力
cashAvailableForTradeDouble1233662.1可用资金,包含现金与融资。可用资金用来检查是否可以开仓或打新。开仓是指做多买入股票、做空融券卖出股票等交易行为。需要注意的是可用资金不等于可用现金,是用总资产、期权持仓市值、冻结资金和初始保证金等指标算出来的一个值,当可用资金大于0时,代表该账户可以开仓,可用资金*4 为账户的最大可用购买力。算法,可用资金=总资产-美股期权市值-当前总持仓的初始保证金-冻结资金。其中初始保证金的算法是∑(持仓个股市值*当前股票的开仓保证金比例)。举例:小虎当前账户总资产为10000美元,持有1000美元美股期权,持有总市值为2000美元的苹果,苹果的初始保证金比例当前为45%,没有冻结资金,小虎的可用资金=10000-1000-2000*45%=8100美元
cashAvailableForWithdrawalDouble1233662.1当前账号内可以出金的现金金额
cashBalanceDouble469140.39现金额。现金额就是当前所有币种的现金余额之和。如果您当前帐户产生了融资或借款,需要注意的是利息一般是按天算,按月结,具体以融资天数计算。每日累计,下个月初5号左右统一扣除,所以在扣除利息之前,用户看到的现金余额是没有扣除利息的,如果扣除利息前现金余额为零,可能扣除后会产生欠款,即现金余额变为负值。
grossPositionValueDouble865644.18证券总价值,是账户持仓证券的总市值之和,即全部持仓的总市值。算法,持仓证券总市值之和;备注:所有持仓市值都会按主币种计算;举例1,若小虎同时持有市值3000美元苹果(也就是做多),持有市值-1000美元的谷歌(也就是做空),小虎证券总价值=3000美元苹果+(-1000美元谷歌)=2000美元;举例2,小虎持有市值1万美元的苹果,市值5000美元的苹果做多期权,小虎证券总价值=10000+5000=15000美元
initMarginDouble292046.91初始保证金。当前所有持仓合约所需的初始保证金要求之和。初次执行交易时,只有当含贷款价值总权益大于初始保证金才允许开仓。为满足监管机构的保证金要求,我们会在临近收盘前15分钟提升初始保证金与维持保证金要求至最低50%。
maintainMarginDouble273170.84维持保证金。当前所有持仓合约所需的维持保证金要求之和。持有头寸时,当含贷款价值总权益小于维持保证金会引发强平。为满足监管机构的保证金要求,我们会在临近收盘前15分钟提升初始保证金与维持保证金要求至最低50%。
overnightMarginDouble273170.84隔夜保证金。隔夜保证金是在收盘前15分钟开始检查账户所需的保证金,为满足监管机构的保证金要求,我们会在临近收盘前15分钟提升初始保证金与维持保证金要求至最低50%。老虎国际的隔夜保证金比例均在50%以上。如果账户含货款价值总权益低于隔夜保证金,账户在收盘前15分钟存在被强制平仓的风险。算法,∑(持仓个股隔夜时段的维持保证金)。个股的维持保证金率用户能够在“个股详情页-报价区-点击融资融券标识"查询。举例:小虎账户总资产为10万美元,苹果开仓保证金比例是40%,日内维持保证金是20%,日内全仓买入苹果共25万美元,到收盘前15分钟(隔夜时段)维持保证金比例将被提高到50%,此时的用户隔夜保证金为:25万*50%=12.5万,用户的含贷款价值总权益为10万小于12.5万,用户将会被平仓部分股票。
excessLiquidationDouble960492.09当前剩余流动性。当前剩余流动性是衡量当前账户潜在的被平仓风险的指标,当前剩余流动性越低账户被平仓的风险越高,当小于0时会被强制平掉部分持仓。具体的算法为:当前剩余流动性=含货款价值总权益(equityWithLoan)-账户维持保证金(maintainMargin) 。为满足监管机构的保证金要求,我们会在临近收盘前15分钟提升初始保证金与维持保证金要求至最低50%。举例:(1)、客户总资产1万美金,买入苹果12000美金(假设苹果开仓和维持保证金比例为50%)。当前剩余流动性=总资产10000-账户维持保证金6000=4000。(2)、随着股票的下跌,假设股票市值跌到8000,这个时候当前剩余流动性=总资产 (-2000+8000)-账户维持保证金4000=2000。(3)、此时用户又买入了1000美金的美股期权,那么账户的当前剩余流动性还剩下2000-1000=1000。若您的账户被强制平仓,则会以市价单在强制平仓时进行成交,强平的股票对象由券商自行决定,请您注意风控值和杠杆等指标。
overnightLiquidationDouble1233662.93隔夜剩余流动性。隔夜剩余流动性是指用 含货款价值总权益(equityWithLoan)-隔夜保证金(overnightMargin) 算出来的值。为满足监管机构的保证金要求,我们会在临近收盘前15分钟提升初始保证金与维持保证金要求至最低50%。如果账户的隔夜剩余流动性低于0,在收盘前15分钟起账户存在被强行平掉部分持仓的风险。若您的账户被强制平仓,则会以市价单在强制平仓时进行成交,强平的股票对象由券商自行决定,请您注意风控值和杠杆等指标。
netLiquidationDouble1233662.93总资产(净清算值)。总资产就是我们账户的净清算现金余额和证券总市值之和,通常用来表示目前账户中有多少资产。算法,总资产=证券总市值+现金余额+应计分红-应计利息;举例:小虎账户有1000美元现金,持仓价值1000美元的苹果(即做多苹果),没有待发放的股息和融资利息和未扣除的利息,那么小虎的总资产=现金1000+持仓价值1000=2000美元,若小虎账户有1000美元现金,做空1000美元的苹果,此时证券总市值-1000美元,现金2000美元,用户总资产=现金2000+(持仓市值-1000),账户总资产共计1000美元。
equityWithLoanDouble1233078.69含贷款价值总权益,即ELV,ELV是用来计算开仓和平仓的数据指标;算法,现金账户=现金余额,保证金账户=现金余额+证券总市值-美股期权市值;ELV = 总资产 - 美股期权
realizedPLDouble-248.72已实现盈亏
unrealizedPLDouble-17039.09持仓盈亏。定义,持仓个股、衍生品的未实现盈亏金额;算法,当前价*股数-持仓成本
leverageDouble0.5杠杆。杠杆是衡量账户风险程度的重要指标,可以帮助用户快速了解账户融资比例和风险程度;算法,杠杆=证券市值绝对值之和/总资产;备注1,保证金账户日内最大杠杆4倍,隔夜2倍;备注2,老虎考虑到历史波动、流动性和风险等因素,并不是每只股票都能4倍杠杆买入,一般做多保证金比例范围在25%-100%之间,保证金比例等于25%的股票,可以理解为4倍杠杆买入,保证金比例等于100%的股票,可以理解为0倍杠杆买入,即全部用现金买入。需要留意做空保证金可能会大于100%。备注3,个股保证金比例用户能够在“个股详情页-报价区-点击融资融券标识”查询;举例,小虎账户总资产10万美元,想买苹果,苹果当前个股做多初始保证金比例50%(1/50%=2倍杠杆),小虎最多只能买入20万市值的苹果股票;小虎想做空谷歌,谷歌做空保证金比例200%,小虎最多能做空10/200%=5万谷歌股票;小虎想买入微软,微软初始保证金100%(1/100%=1倍杠杆),小虎最多只能买入10万美元的微软股票
currencyAssetsCurrencyAssets按照交易币种区分的账户资产信息。详细说明见下方描述。
consolidatedSegTypesstring聚合的Segment,现只有SEC和FUND会聚合。下面字段为聚合Segment数值的字段:cashAvailableForTrade、initMargin、maintainMargin、overnightMargin、excessLiquidation、overnightLiquidation、buyingPower、lockedFunds、leverage。

PrimeAssetItem.CurrencyAssets说明:

名称示例说明
currencyUSD当前的货币币种,常用货币包括: USD-美元,HKD-港币,SGD-新加坡币,CNH-人民币
cashBalance469140.39可以交易的现金,加上已锁定部分的现金(如已购买但还未成交的股票,还包括其他一些情形也会有锁定现金情况)
cashAvailableForTrade0.1273896当前账号内可以交易的现金金额

示例

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

返回示例

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

综合/模拟账号获取历史资产分析数据

对应的请求类:PrimeAssetRequestTigerRequest(TradeApiService.ANALYTICS_ASSET)

说明 获取综合/模拟账户的历史资产分析。

参数

参数类型是否必填描述
accountstringYes用户授权资金账户: 123123
start_datestringNo起始日期, 格式 yyyy-MM-dd, 如 '2022-01-01'。如不传则使用end_date往前30天的日期
end_datestringNo截止日期, 格式 yyyy-MM-dd, 如 '2022-02-01'。如不传则使用当前日期
seg_typeSegmentTypeNo账户划分类型, 可选值有: SegmentType.SEC 代表证券; SegmentType.FUT 代表期货
currencyCurrencyNo币种,包括 ALL/USD/HKD/CNH
sub_accountstrNo子账户(仅适用于机构账户), 若传该字段,则返回该子账户的资产
secret_keystringNo机构用户专用,交易员密钥。在ClientConfig.DEFAULT_CONFIG中配置,个人开发者无需指定

返回TigerOpenAPI.Trade.Response.PrimeAnalyticsAssetResponsesourceopen in new window

返回数据可通过PrimeAnalyticsAssetResponse.Data属性访问,返回PrimeAnalyticsAssetItem对象,其中TigerOpenAPI.Trade.Response.SummaryTigerOpenAPI.Trade.Response.HistoryItem 属性如下:

PrimeAnalyticsAssetItem.Summary说明:

名称类型说明
pnldouble盈亏金额
pnlPercentagedouble收益率
annualizedReturndouble年化收益率(推算)
overUserPercentagedouble超过用户的百分比

PrimeAnalyticsAssetItem.HistoryItem说明:

名称示例说明
datelong日期时间戳,单位毫秒
pnldouble与上一日比的盈亏金额
pnlPercentagedouble与上一日比的收益率
assetdouble总资产金额
cashBalancedouble现金余额
grossPositionValuedouble市值
depositdouble入金金额
withdrawaldouble出金金额

示例

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

返回示例

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

综合/模拟账号获取可转出资金

对应的请求类:TigerRequest(TradeApiService.SEGMENT_FUND_AVAILABLE)

说明

获取账户对应segment下的可以转出的资金

参数

参数类型是否必填描述
accountstringYes用户授权账号,包括标准,模拟账号
from_segmentstringNo转出segment, FUT或SEC
currencystringNo转出币种,USD或HKD

返回

TigerOpenAPI.Trade.Response.SegmentFundAvailableResponse

可用 SegmentFundAvailableResponse.Data 获取各Segment可以转出资金金额的列表。 具体参见示例代码

SegmentFundAvailableItem说明:

名称类型说明
fromSegmentlstring转出segment, FUT或SEC
currencystring转出币种,USD或HKD
amountdouble可转资金,单位:元

示例

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

返回示例

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

综合/模拟账号内部资金转账

对应的请求类:TigerRequest(TradeApiService.TRANSFER_SEGMENT_FUND)

说明

对账户不同segment下的资金转账

参数

参数类型是否必填描述
accountstringYes用户授权账号,包括标准,模拟账号
from_segmentstringYes转出segment, FUT或SEC
to_segmentstringYes转入segment, FUT或SEC,必须与from_segment不同
currencystringYes转出币种,USD或HKD
amountdoubleYes转账金额,单位:元

返回

TigerOpenAPI.Trade.Response.SegmentFundResponse

可用 SegmentFundResponse.Data 获取转账结果对象。 具体参见示例代码

SegmentFundItem说明:

名称类型说明
idlong转账记录ID
fromSegmentlstring转出segment, FUT或SEC
toSegmentlstring转入segment, FUT或SEC
currencystring转出币种,USD或HKD
amountdouble转账金额,单位:元
statusstring状态(NEW/PROC/SUCC/FAIL/CANC)
statusDescstring状态描述(已提交/处理中/已到账/转账失败/已取消)
messagestring失败信息
settledAtlong到账时间戳
updatedAtlong更新时间戳
createdAtlong创建时间戳

示例

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

返回示例

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

综合/模拟账号取消内部资金转账

对应的请求类:TigerRequest(TradeApiService.CANCEL_SEGMENT_FUND)

说明

取消提交的资金转账,如果转账已经成功无法取消,可以交换segment反向转回来。

参数

参数类型是否必填描述
accountstringYes用户授权账号,包括标准,模拟账号
idlongYes转账记录id

返回

TigerOpenAPI.Trade.Response.SegmentFundResponse

可用 SegmentFundResponse.Data 获取取消转账结果对象。 具体参见示例代码

SegmentFundItem说明:

名称类型说明
idlong转账记录ID
fromSegmentlstring转出segment, FUT或SEC
toSegmentlstring转入segment, FUT或SEC
currencystring转出币种,USD或HKD
amountdouble转账金额,单位:元
statusstring状态(NEW/PROC/SUCC/FAIL/CANC)
statusDescstring状态描述(已提交/处理中/已到账/转账失败/已取消)
messagestring失败信息
settledAtlong到账时间戳
updatedAtlong更新时间戳
createdAtlong创建时间戳

示例

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

返回示例

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

综合/模拟账号内部资金转账历史记录查询

对应的请求类:TigerRequest(TradeApiService.SEGMENT_FUND_HISTORY)

说明

查询账号segment间的历史转账记录。按时间倒序排列

参数

参数类型是否必填描述
accountstringYes用户授权账号,包括标准,模拟账号
limitIntegerNo返回最近转账记录数。默认为100,最大500

返回

TigerOpenAPI.Trade.Response.SegmentFundsResponse

可用 SegmentFundsResponse.Data 获取各Segment间的历史转账记录列表。 具体参见示例代码

SegmentFundItem说明:

名称类型说明
idlong转账记录ID
fromSegmentlstring转出segment, FUT或SEC
toSegmentlstring转入segment, FUT或SEC
currencystring转出币种,USD或HKD
amountdouble转账金额,单位:元
statusstring状态(NEW/PROC/SUCC/FAIL/CANC)
statusDescstring状态描述(已提交/处理中/已到账/转账失败/已取消)
messagestring失败信息
settledAtlong到账时间戳
updatedAtlong更新时间戳
createdAtlong创建时间戳

示例

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

返回示例

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

获取最大可交易数量

对应的请求类:TigerRequest(TradeApiService.ESTIMATE_TRADABLE_QUANTITY)

说明

查询账户下的对某个标的的最大可买卖数量,支持股票、期权,暂不支持期货。

参数

参数类型是否必填描述
accountStringYes账户,目前仅支持综合账户
symbolStringYes股票代码
expiryStringNo到期日,交易品种是OPT/WAR/IOPT类型时必传时必传 yyyyMMdd
rightStringNoCALL/PUT, 交易品种是OPT/WAR/IOPT类型时必传时必传
strikeStringNo行权价, 交易品种是OPT/WAR/IOPT类型时必传时必传
seg_typeSegmentTypeNoSEC, 暂只支持SEC。
sec_typeSecTypeNoSTK:股票/FUT:期货/OPT:期权/WAR:窝轮/IOPT:牛熊证, 期货暂不支持。
actionActionTypeYes交易方向 BUY/SELL
order_typeOrderTypeYes订单类型
limit_pricedoubleNo限价,当 order_type 为LMT,STP_LMT时该参数必需
stop_pricedoubleNo止损价,当 order_type 为STP,STP_LMT时该参数必需
secretKeyStringNo机构用户专用,交易员密钥

返回

TigerOpenAPI.Trade.Response.EstimateTradableQuantityResponse

可用 EstimateTradableQuantityResponse.Data 获取最大可交易数量。 具体参见示例代码

TradableQuantityItem说明:

字段类型说明
tradableQuantityDouble现金可买卖数量(如action为BUY,返回为可买数量,反之为可卖数量)
financingQuantityDouble融资融券可买卖数量(现金账号没有)
positionQuantityDouble持仓数量
tradablePositionQuantityDouble持仓可交易数量

示例

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

返回示例

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