账户与持仓
获取账户列表
操作名
TradeApiService.ACCOUNTS = accounts。该常量用于设置 TigerRequest.ApiMethodName。
请求
TigerRequest<AccountsResponse>ModelValue: ApiModel.
参数
| SDK property | C# type | API field | SDK default | Required | Constraints |
|---|---|---|---|---|---|
Lang | Language | lang | CLR 默认值;序列化时省略 | no | — |
Account | string (nullable) | account | null | no | ACCOUNTS 豁免默认账户注入和账户必填校验 |
返回
AccountsResponse 继承 TigerResponse;其 Data 为 Dictionary<string, List<AccountItem>>。
示例
TigerRequest<AccountsResponse> request = new()
{
ApiMethodName = TradeApiService.ACCOUNTS,
ModelValue = new ApiModel()
};
AccountsResponse? response = await tradeClient.ExecuteAsync(request);响应类型
Dictionary<string, List<AccountItem>>? data = response?.Data; // response 或 data 缺失时为 nullData 字段
| 响应数据结构 | SDK 约定 |
|---|---|
Dictionary<string, List<AccountItem>> | 键由服务端决定;每个值为 List<AccountItem>。 |
AccountItem 字段 | API 字段 | C# 类型 | 说明 |
|---|---|---|---|
Account | account | string | 账户号 |
Capability | capability | string | 账户交易能力 |
AccountType | accountType | string | 账户类型 |
Status | status | string | 账户状态 |
返回示例
{
"code": 0,
"message": "success",
"timestamp": 1785528000000,
"data": {
"accounts": [
{
"account": "DU12345678",
"capability": "RegTMargin",
"status": "Active"
}
]
}
}频率限制
基础额度:每分钟 60 次。
获取环球账户资产
操作名
TradeApiService.ASSETS = assets。该常量用于设置 TigerRequest.ApiMethodName。
请求
TigerRequest<TigerDictResponse>ModelValue: GlobalAssetsModel.
参数
| SDK property | C# type | API field | SDK default | Required | Constraints |
|---|---|---|---|---|---|
Lang | Language | lang | CLR 默认值;序列化时省略 | no | — |
Account | string (nullable) | account | null | Auto-filled if empty | 为空时 TradeClient 从 TigerConfig.DefaultAccount 注入;若仍为空则验证失败 |
SecretKey | string | secret_key | null | no | — |
Segment | Boolean | segment | CLR 默认值;序列化时省略 | Optional | — |
MarketValue | Boolean | market_value | CLR 默认值;序列化时省略 | Optional | — |
返回
TigerDictResponse 继承 TigerResponse;其 Data 为 Dictionary<string, object>。
示例
TigerRequest<TigerDictResponse> request = new()
{
ApiMethodName = TradeApiService.ASSETS,
ModelValue = new GlobalAssetsModel { Account = tradeClient.GetDefaultAccount }
};
TigerDictResponse? response = await tradeClient.ExecuteAsync(request);响应类型
Dictionary<string, object>? data = response?.Data; // response 或 data 缺失时为 nullData 字段
| 类型 | SDK 约定 |
|---|---|
Dictionary<string, object> | 动态字典;SDK 未定义固定键或嵌套对象类型。 |
返回示例
{
"code": 0,
"message": "success",
"timestamp": 1785528000000,
"data": [
{
"account": "DU12345678",
"summary": {
"netLiquidation": 125000.0,
"totalCashValue": 50000.0,
"grossPositionValue": 75000.0,
"initMarginReq": 25000.0,
"maintMarginReq": 20000.0,
"buyingPower": 100000.0,
"unrealizedPnl": 15866.0,
"realizedPnl": 3200.0
}
}
]
}频率限制
基础额度:每分钟 60 次。
获取综合/模拟账户资产
操作名
TradeApiService.PRIME_ASSETS = prime_assets。该常量用于设置 TigerRequest.ApiMethodName。
请求
TigerRequest<PrimeAssetResponse>ModelValue: PrimeAssetsModel.
参数
| SDK property | C# type | API field | SDK default | Required | Constraints |
|---|---|---|---|---|---|
Lang | Language | lang | CLR 默认值;序列化时省略 | no | — |
Account | string (nullable) | account | null | Auto-filled if empty | 为空时 TradeClient 从 TigerConfig.DefaultAccount 注入;若仍为空则验证失败 |
SecretKey | string | secret_key | null | no | — |
BaseCurrency | string | base_currency | null | Optional | — |
Consolidated | Boolean | consolidated | CLR 默认值;序列化时省略 | Optional | — |
返回
PrimeAssetResponse 继承 TigerResponse;其 Data 为 PrimeAssetItem。
示例
TigerRequest<PrimeAssetResponse> request = new()
{
ApiMethodName = TradeApiService.PRIME_ASSETS,
ModelValue = new PrimeAssetsModel { Account = tradeClient.GetDefaultAccount }
};
PrimeAssetResponse? response = await tradeClient.ExecuteAsync(request);响应类型
PrimeAssetItem? data = response?.Data; // response 或 data 缺失时为 nullData 字段(PrimeAssetItem)
| 字段 | API 字段 | C# 类型 | 说明 |
|---|---|---|---|
Account | accountId | string | 账户标识 |
UpdateTimestamp | updateTimestamp | long | 资产更新时间戳 |
Segments | segments | List<Segment> | 分区资产列表 |
每个 Segment:
| 字段 | API 字段 | C# 类型 | 说明 |
|---|---|---|---|
Capability | capability | string | 分区交易能力 |
Category | category | string | 分区类别 |
Currency | currency | string | 计价币种 |
CashBalance | cashBalance | Double | 现金余额 |
CashAvailableForTrade | cashAvailableForTrade | Double | 可交易现金 |
CashAvailableForWithdrawal | cashAvailableForWithdrawal | Double | 可取现金 |
GrossPositionValue | grossPositionValue | Double | 持仓总市值 |
EquityWithLoan | equityWithLoan | Double | 含贷款权益 |
NetLiquidation | netLiquidation | Double | 净清算价值 |
InitMargin | initMargin | Double | 初始保证金 |
MaintainMargin | maintainMargin | Double | 维持保证金 |
OvernightMargin | overnightMargin | Double | 隔夜保证金 |
UnrealizedPL | unrealizedPL | Double | 未实现盈亏 |
RealizedPL | realizedPL | Double | 已实现盈亏 |
ExcessLiquidation | excessLiquidation | Double | 超额流动性 |
OvernightLiquidation | overnightLiquidation | Double | 隔夜流动性 |
BuyingPower | buyingPower | Double | 购买力 |
Leverage | leverage | Double | 杠杆倍数 |
UnrealizedPLByCostOfCarry | unrealizedPLByCostOfCarry | Double | 按持仓成本计算的未实现盈亏 |
TotalTodayPL | totalTodayPL | Double | 当日总盈亏 |
LockedFunds | lockedFunds | Double | 锁定资金 |
Uncollected | uncollected | Double | 在途资产 |
CurrencyAssets | currencyAssets | List<CurrencyAssets> | 按币种划分的资产列表 |
ConsolidatedSegTypes | consolidatedSegTypes | List<string> | 合并的账户分区类型 |
每个 CurrencyAssets:
| 字段 | API 字段 | C# 类型 | 说明 |
|---|---|---|---|
Currency | currency | string | 币种 |
CashBalance | cashBalance | Double | 现金余额 |
CashAvailableForTrade | cashAvailableForTrade | Double | 可交易现金 |
GrossPositionValue | grossPositionValue | Double | 持仓总市值 |
StockMarketValue | stockMarketValue | Double | 股票市值 |
OptionMarketValue | optionMarketValue | Double | 期权市值 |
FuturesMarketValue | futuresMarketValue | Double | 期货市值 |
UnrealizedPL | unrealizedPL | Double | 未实现盈亏 |
RealizedPL | realizedPL | Double | 已实现盈亏 |
返回示例
{
"code": 0,
"message": "success",
"timestamp": 1785528000000,
"data": [
{
"account": "DU12345678",
"segments": [
{"category": "S", "currency": "USD", "cashBalance": 50000.0, "grossPositionValue": 75000.0, "netLiquidation": 125000.0}
]
}
]
}频率限制
基础额度:每分钟 60 次。
获取历史资产分析
操作名
TradeApiService.ANALYTICS_ASSET = analytics_asset。该常量用于设置 TigerRequest.ApiMethodName。
请求
TigerRequest<PrimeAnalyticsAssetResponse>ModelValue: PrimeAnalyticsAssetModel.
参数
| SDK property | C# type | API field | SDK default | Required | Constraints |
|---|---|---|---|---|---|
Lang | Language | lang | CLR 默认值;序列化时省略 | no | — |
Account | string (nullable) | account | null | Auto-filled if empty | 为空时 TradeClient 从 TigerConfig.DefaultAccount 注入;若仍为空则验证失败 |
SecretKey | string | secret_key | null | no | — |
SegType | SegmentType | seg_type | CLR 默认值;序列化时省略 | Optional | — |
Currency | Currency | currency | CLR 默认值;序列化时省略 | Optional | — |
SubAccount | string | sub_account | null | Optional | — |
StartDate | string | start_date | null | Optional | Timestamp or date format; maintain chronological order |
EndDate | string | end_date | null | Optional | Timestamp or date format; maintain chronological order |
返回
PrimeAnalyticsAssetResponse 继承 TigerResponse;其 Data 为 PrimeAnalyticsAssetItem。
示例
TigerRequest<PrimeAnalyticsAssetResponse> request = new()
{
ApiMethodName = TradeApiService.ANALYTICS_ASSET,
ModelValue = new PrimeAnalyticsAssetModel { Account = tradeClient.GetDefaultAccount, SegType = SegmentType.SEC, Currency = Currency.USD, StartDate = "2026-01-01", EndDate = "2026-01-31" }
};
PrimeAnalyticsAssetResponse? response = await tradeClient.ExecuteAsync(request);响应类型
PrimeAnalyticsAssetItem? data = response?.Data; // response 或 data 缺失时为 nullData 字段(PrimeAnalyticsAssetItem)
| 字段 | API 字段 | C# 类型 | 说明 |
|---|---|---|---|
Summary | summary | Summary | 历史资产汇总 |
History | history | List<HistoryItem> | 历史资产明细列表 |
Summary:
| 字段 | API 字段 | C# 类型 | 说明 |
|---|---|---|---|
Pnl | pnl | Double | 盈亏 |
PnlPercentage | pnlPercentage | Double | 盈亏比例 |
AnnualizedReturn | annualizedReturn | Double | 年化收益率 |
OverUserPercentage | overUserPercentage | Double | 相对用户百分比 |
HistoryItem 字段 | API 字段 | C# 类型 | 说明 |
|---|---|---|---|
Date | date | long | 日期时间戳 |
Asset | asset | Double | 资产值 |
Pnl | pnl | Double | 盈亏 |
PnlPercentage | pnlPercentage | Double | 盈亏比例 |
CashBalance | cashBalance | Double | 现金余额 |
GrossPositionValue | grossPositionValue | Double | 持仓总市值 |
Deposit | deposit | Double | 入金金额 |
Withdrawal | withdrawal | Double | 出金金额 |
获取聚合资产
操作名
TradeApiService.AGGREGATE_ASSETS = aggregate_assets。该常量用于设置 TigerRequest.ApiMethodName。
请求
TigerRequest<AggregateAssetResponse>ModelValue: AggregateAssetModel.
参数
| SDK property | C# type | API field | SDK default | Required | Constraints |
|---|---|---|---|---|---|
Lang | Language | lang | CLR 默认值;序列化时省略 | no | — |
Account | string (nullable) | account | null | Auto-filled if empty | 为空时 TradeClient 从 TigerConfig.DefaultAccount 注入;若仍为空则验证失败 |
SecretKey | string | secret_key | null | no | — |
SegType | string | seg_type | null | Optional | — |
BaseCurrency | string | base_currency | null | Optional | — |
返回
AggregateAssetResponse 继承 TigerResponse;其 Data 为 AggregateAssetItem。
示例
TigerRequest<AggregateAssetResponse> request = new()
{
ApiMethodName = TradeApiService.AGGREGATE_ASSETS,
ModelValue = new AggregateAssetModel { Account = tradeClient.GetDefaultAccount, SegType = "SEC" }
};
AggregateAssetResponse? response = await tradeClient.ExecuteAsync(request);响应类型
AggregateAssetItem? data = response?.Data; // response 或 data 缺失时为 nullData 字段(AggregateAssetItem)
| 字段 | API 字段 | C# 类型 | 说明 |
|---|---|---|---|
Currency | currency | string | 计价币种 |
CashBalance | cashBalance | double | 现金余额 |
CashBalanceWithInTransit | cashBalanceWithInTransit | double | 含在途资金的现金余额 |
EquityWithLoan | equityWithLoan | double | 含贷款权益 |
NetLiquidation | netLiquidation | double | 净清算价值 |
InitMargin | initMargin | double | 初始保证金 |
MaintainMargin | maintainMargin | double | 维持保证金 |
TradeCurrencyMargin | tradeCurrencyMargin | double | 交易币种保证金 |
IntradayRiskRatio | intradayRiskRatio | double | 日内风险比率 |
GrossPositionValue | grossPositionValue | double | 持仓总市值 |
OptionMarketValue | optionMarketValue | double | 期权市值 |
StockMarketValue | stockMarketValue | double | 股票市值 |
CashAvailableForTrade | cashAvailableForTrade | double | 可交易现金 |
AvailableCash | availableCash | double | 可用现金 |
LockedFunds | lockedFunds | double | 锁定资金 |
LockedCash | lockedCash | double | 锁定现金 |
CreditLimit | creditLimit | double | 信用额度 |
ExcessEquity | excessEquity | double | 超额权益 |
ExcessLiquidity | excessLiquidity | double | 超额流动性 |
频率限制
基础额度:每分钟 60 次。
获取持仓
操作名
TradeApiService.POSITIONS = positions。该常量用于设置 TigerRequest.ApiMethodName。
请求
TigerRequest<PositionsResponse>ModelValue: PositionsModel.
参数
| SDK property | C# type | API field | SDK default | Required | Constraints |
|---|---|---|---|---|---|
Lang | Language | lang | CLR 默认值;序列化时省略 | no | — |
Account | string (nullable) | account | null | Auto-filled if empty | 为空时 TradeClient 从 TigerConfig.DefaultAccount 注入;若仍为空则验证失败 |
SecretKey | string | secret_key | null | no | — |
SecType | SecType | sec_type | CLR 默认值;序列化时省略 | Optional | — |
Market | Market | market | CLR 默认值;序列化时省略 | Optional | Enum value |
Currency | Currency | currency | CLR 默认值;序列化时省略 | Optional | — |
Symbol | string | symbol | null | Required | — |
Right | string | right | null | Optional | — |
Strike | Double | strike | CLR 默认值;序列化时省略 | Optional | — |
Expiry | string | expiry | null | Optional | — |
AssetQuoteType | AssetQuoteType | asset_quote_type | CLR 默认值;序列化时省略 | Optional | — |
返回
PositionsResponse 继承 TigerResponse;其 Data 为 PositionsItem。
示例
TigerRequest<PositionsResponse> request = new()
{
ApiMethodName = TradeApiService.POSITIONS,
ModelValue = new PositionsModel { Account = tradeClient.GetDefaultAccount, SecType = SecType.STK, Market = Market.US, Currency = Currency.USD, Symbol = "AAPL" }
};
PositionsResponse? response = await tradeClient.ExecuteAsync(request);响应类型
PositionsItem? data = response?.Data; // response 或 data 缺失时为 nullData 字段(PositionsItem)
| 字段 | API 字段 | C# 类型 | 说明 |
|---|---|---|---|
Items | items | List<PositionDetail> | 持仓明细列表 |
每个 PositionDetail:
| 字段 | API 字段 | C# 类型 | 说明 |
|---|---|---|---|
Account | account | string | 账户号 |
PositionQty | positionQty | Double | 持仓数量 |
SalableQty | salableQty | Double | 可卖数量 |
Position | position | long | 整数持仓数量 |
positionScale | positionScale | int | 持仓数量小数位数 |
AverageCost | averageCost | Double | 平均成本 |
AverageCostByAverage | averageCostByAverage | Double | 按平均价计算的平均成本 |
AverageCostOfCarry | averageCostOfCarry | Double | 持仓成本 |
MarketValue | marketValue | Double | 持仓市值 |
LatestPrice | latestPrice | Double | 最新价 |
IsLevel0Price | isLevel0Price | Boolean | 是否为 Level 0 行情价格 |
RealizedPnl | realizedPnl | Double | 已实现盈亏 |
RealizedPnlByAverage | realizedPnlByAverage | Double | 按平均价计算的已实现盈亏 |
UnrealizedPnl | unrealizedPnl | Double | 未实现盈亏 |
UnrealizedPnlByAverage | unrealizedPnlByAverage | Double | 按平均价计算的未实现盈亏 |
UnrealizedPnlPercent | unrealizedPnlPercent | Double | 未实现盈亏比例 |
UnrealizedPnlPercentByAverage | unrealizedPnlPercentByAverage | Double | 按平均价计算的未实现盈亏比例 |
UnrealizedPnlByCostOfCarry | unrealizedPnlByCostOfCarry | Double | 按持仓成本计算的未实现盈亏 |
UnrealizedPnlPercentByCostOfCarry | unrealizedPnlPercentByCostOfCarry | Double | 按持仓成本计算的未实现盈亏比例 |
SecType | secType | string | 证券类型 |
Market | market | string | 所属市场 |
Currency | currency | string | 计价币种 |
Identifier | identifier | string | 合约标识 |
Symbol | symbol | string | 合约代码 |
Expiry | expiry | string | 到期日 |
Strike | strike | Double | 行权价 |
Right | right | string | 期权方向 |
Multiplier | multiplier | Double | 合约乘数 |
UpdateTimestamp | updateTimestamp | long | 持仓更新时间戳 |
MmPercent | mmPercent | Double | 维持保证金比例 |
MmValue | mmValue | Double | 维持保证金金额 |
TodayPnl | todayPnl | Double | 当日盈亏 |
TodayPnlPercent | todayPnlPercent | Double | 当日盈亏比例 |
YesterdayPnl | yesterdayPnl | Double | 昨日盈亏,仅基金适用 |
LastClosePrice | lastClosePrice | Double | 上一交易日收盘价,已前复权 |
Categories | categories | List<string> | 合约分类列表 |
positionScale 是 SDK 中的精确小写属性名;SalableQty 对应的响应 JSON 字段为 salableQty。
返回示例
{
"code": 0,
"message": "success",
"timestamp": 1785528000000,
"data": [
{
"account": "DU12345678",
"symbol": "AAPL",
"position": 100,
"averageCost": 150.25,
"latestPrice": 308.91,
"marketValue": 30891.0,
"unrealizedPnl": 15866.0,
"secType": "STK",
"currency": "USD"
}
]
}频率限制
基础额度:每分钟 60 次。
预估可交易数量
操作名
TradeApiService.ESTIMATE_TRADABLE_QUANTITY = estimate_tradable_quantity。该常量用于设置 TigerRequest.ApiMethodName。
请求
TigerRequest<EstimateTradableQuantityResponse>ModelValue: EstimateTradableQuantityModel.
参数
| SDK property | C# type | API field | SDK default | Required | Constraints |
|---|---|---|---|---|---|
Lang | Language | lang | CLR 默认值;序列化时省略 | no | — |
Account | string (nullable) | account | null | Auto-filled if empty | 为空时 TradeClient 从 TigerConfig.DefaultAccount 注入;若仍为空则验证失败 |
SecretKey | string | secret_key | null | no | — |
Symbol | string | symbol | null | Required | — |
Right | string (nullable) | right | null | Optional | — |
Strike | string (nullable) | strike | null | Optional | — |
Expiry | string (nullable) | expiry | null | Optional | — |
SegType | SegmentType | seg_type | CLR 默认值;序列化时省略 | Optional | — |
SecType | SecType | sec_type | CLR 默认值;序列化时省略 | Optional | — |
Action | ActionType | action | CLR 默认值;序列化时省略 | Optional | — |
OrderType | OrderType | order_type | CLR 默认值;序列化时省略 | Optional | price fields are conditionally required by order type |
LimitPrice | Double | limit_price | CLR 默认值;序列化时省略 | Optional | conditional order-price field |
StopPrice | Double | stop_price | CLR 默认值;序列化时省略 | Optional | — |
返回
EstimateTradableQuantityResponse 继承 TigerResponse;其 Data 为 TradableQuantityItem。
示例
TigerRequest<EstimateTradableQuantityResponse> request = new()
{
ApiMethodName = TradeApiService.ESTIMATE_TRADABLE_QUANTITY,
ModelValue = new EstimateTradableQuantityModel { Account = tradeClient.GetDefaultAccount, Symbol = "AAPL", Strike = "200", SegType = SegmentType.SEC, SecType = SecType.STK }
};
EstimateTradableQuantityResponse? response = await tradeClient.ExecuteAsync(request);响应类型
TradableQuantityItem? data = response?.Data; // response 或 data 缺失时为 nullData 字段(TradableQuantityItem)
| 字段 | API 字段 | C# 类型 | 说明 |
|---|---|---|---|
TradableQuantity | tradableQuantity | Double | 现金账户可交易数量 |
FinancingQuantity | financingQuantity | Double | 保证金账户可交易数量 |
PositionQuantity | positionQuantity | Double | 持仓数量 |
TradablePositionQuantity | tradablePositionQuantity | Double | 持仓中可交易数量 |
频率限制
基础额度:每分钟 60 次。
Updated about 1 month ago
