订单查询
状态变更操作必须防止重复提交。
TradeOrder 中的 AvgFillPrice 是按成交价格加权计算的平均成交价,不含佣金和其他费用。RealizedPnl 是已实现盈亏;Commission 和 Gst 通过独立字段返回。准确的计算口径和币种请以账户结单为准。Commission、Gst、AvgFillPrice 和 RealizedPnl 在此 SDK 中为非可空 Double,因此无法区分字段缺失和明确返回的 0。ReplaceStatus=REPLACED 表示改单最终成功,FAILED 表示失败;CancelStatus=RECEIVED 仅表示撤单请求受理,最终结果以订单 Status 为准。
获取订单号
操作名
TradeApiService.ORDER_NO = order_no。该常量用于设置 TigerRequest.ApiMethodName。
请求
TigerRequest<TigerDictResponse>ModelValue: TradeModel.
参数
| 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 | — |
返回
TigerDictResponse inherits TigerResponse; its data property is Dictionary<string, object>.
示例
TigerRequest<TigerDictResponse> request = new()
{
ApiMethodName = TradeApiService.ORDER_NO,
ModelValue = new TradeModel { Account = tradeClient.GetDefaultAccount }
};
TigerDictResponse? response = await tradeClient.ExecuteAsync(request);响应类型
Dictionary<string, object>? data = response?.Data; // response 或 data 缺失时为 nullData 字段
| 类型 | SDK 约定 |
|---|---|
Dictionary<string, object> | 动态字典;SDK 未定义固定键或嵌套对象类型。 |
频率限制
基础额度:每分钟 120 次。
获取订单列表
操作名
TradeApiService.ORDERS = orders。该常量用于设置 TigerRequest.ApiMethodName。
请求
TigerRequest<OrderBatchResponse>ModelValue: QueryOrderModel.
参数
| 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 | — |
Id | Int64 | id | CLR 默认值;序列化时省略 | Required | — |
IsShowCharges | Boolean | show_charges | CLR 默认值;序列化时省略 | Optional | — |
SegType | SegmentType | seg_type | CLR 默认值;序列化时省略 | Optional | — |
SecType | SecType | sec_type | CLR 默认值;序列化时省略 | Optional | — |
Market | Market | market | CLR 默认值;序列化时省略 | Optional | Enum value |
Symbol | string | symbol | null | Required | — |
Right | string (nullable) | right | null | Optional | — |
Strike | string (nullable) | strike | null | Optional | — |
Expiry | string (nullable) | expiry | null | Optional | — |
StartDate | Int64 | start_date | CLR 默认值;序列化时省略 | Optional | 时间戳或日期格式;按 SortBy 选定的时间筛选,并保持时间顺序 |
EndDate | Int64 | end_date | CLR 默认值;序列化时省略 | Optional | 时间戳或日期格式;按 SortBy 选定的时间筛选,并保持时间顺序 |
Limit | Int32 | limit | 100 | Optional | Positive integer |
SortBy | OrderSortBy | sort_by | CLR 默认值;序列化时省略 | Optional | 仅支持综合账户。LATEST_CREATED:按订单创建/提交时间降序排序并按该时间筛选;LATEST_STATUS_UPDATED:按最近一次订单状态更新时间降序排序并按该时间筛选。 |
PageToken | string | page_token | null | Optional | — |
时间范围说明:SortBy 决定排序以及 StartDate、EndDate 所筛选的时间:LATEST_CREATED 使用订单创建/提交时间,LATEST_STATUS_UPDATED 使用最近一次订单状态更新时间。NONE 或省略 SortBy 时,C# 序列化器不发送 sort_by 字段,综合账户服务端默认 LATEST_CREATED。StartDate 和 EndDate 均可选;省略任一边界时,该边界不参与筛选。接口不限制最大时间跨度,但分页和单次返回数量限制仍然适用。建议指定合理的起止时间范围。
返回
OrderBatchResponse inherits TigerResponse; its data property is OrderBatchItem.
示例
TigerRequest<OrderBatchResponse> request = new()
{
ApiMethodName = TradeApiService.ORDERS,
ModelValue = new QueryOrderModel { Account = tradeClient.GetDefaultAccount, Id = 1234567890L, SegType = SegmentType.SEC, SecType = SecType.STK, Market = Market.US }
};
OrderBatchResponse? response = await tradeClient.ExecuteAsync(request);响应类型
OrderBatchItem? data = response?.Data; // response 或 data 缺失时为 nullData 字段(OrderBatchItem)
| 字段 | API 字段 | C# 类型 | 说明 |
|---|---|---|---|
NextPageToken | nextPageToken | string | 下一页令牌 |
Items | items | List<TradeOrder> | 订单列表 |
Items 中每个 TradeOrder:
| 字段 | API 字段 | C# 类型 | 说明 |
|---|---|---|---|
Symbol | symbol | string | 合约代码 |
Market | market | string | 所属市场 |
SecType | secType | string | 证券类型 |
Currency | currency | string | 计价币种 |
Expiry | expiry | string | 到期日 |
Strike | strike | string | 行权价 |
Right | right | string | 期权方向 |
Multiplier | multiplier | double | 合约乘数 |
Identifier | identifier | string | 合约标识 |
Id | id | Int64 | 订单标识 |
OrderId | orderId | int | 订单号 |
ExternalId | externalId | string | 外部订单标识 |
ParentId | parentId | Int64 | 父订单标识 |
Account | account | string | 账户号 |
Action | action | string | 买卖方向 |
OrderType | orderType | string | 订单类型 |
LimitPrice | limitPrice | Double | 限价 |
AuxPrice | auxPrice | Double | 辅助价格 |
TrailingPercent | trailingPercent | Double | 跟踪百分比 |
TotalQuantity | totalQuantity | Int64 | 委托总数量 |
TotalQuantityScale | totalQuantityScale | Int32 | 委托数量小数位数 |
FilledQuantity | filledQuantity | Int64 | 已成交数量 |
FilledQuantityScale | filledQuantityScale | Int32 | 成交数量小数位数 |
TotalCashAmount | totalCashAmount | Double | 委托总金额 |
FilledCashAmount | filledCashAmount | Double | 已成交金额 |
RefundCashAmount | refundCashAmount | Double | 已退回金额 |
LastFillPrice | lastFillPrice | Double | 最近成交价 |
AvgFillPrice | avgFillPrice | Double | 平均成交价 |
TimeInForce | timeInForce | string | 有效期类型 |
ExpireTime | expireTime | Int64 | 到期时间戳 |
GoodTillDate | goodTillDate | string | 有效截止日期 |
OutsideRth | outsideRth | Boolean | 是否允许常规交易时段外交易 |
TradingSessionType | tradingSessionType | string | 交易时段类型 |
Commission | commission | Double | 佣金 |
Gst | gst | Double | 商品及服务税 |
RealizedPnl | realizedPnl | Double | 已实现盈亏 |
Remark | remark | string | 订单备注 |
Liquidation | liquidation | Boolean | 是否为强制平仓订单 |
TriggerStatus | triggerStatus | string | 条件单触发状态 |
OpenTime | openTime | Int64 | 订单创建时间戳 |
UpdateTime | updateTime | Int64 | 订单更新时间戳 |
LatestTime | latestTime | Int64 | 最近状态更新时间戳 |
Name | name | string | 合约名称 |
LatestPrice | latestPrice | Double | 最新价 |
AttrDesc | attrDesc | string | 订单属性说明 |
UserMark | userMark | string | 用户标记 |
AttrList | attrList | List<string> | 订单属性列表 |
OcaGroupId | ocaGroupId | int | OCA 订单组标识 |
ComboLegs | comboLegs | string | 组合订单腿信息 |
AllocAccounts | allocAccounts | List<string> | 分配账户列表 |
AllocShares | allocShares | List<Double> | 账户分配数量列表 |
AlgoStrategy | algoStrategy | string | 算法策略 |
AlgoParameters | algoParameters | List<TagValue> | 算法参数列表 |
Status | status | OrderStatus | 订单状态 |
ReplaceStatus | replaceStatus | string | 改单状态 |
CancelStatus | cancelStatus | string | 撤单状态 |
Source | source | string | 订单来源 |
Discount | discount | Int32 | 折扣 |
CanModify | canModify | Boolean | 是否可改单 |
CanCancel | canCancel | Boolean | 是否可撤单 |
IsOpen | isOpen | Boolean | 是否为未完成订单 |
ComboType | comboType | string | 组合订单类型 |
ComboTypeDesc | comboTypeDesc | string | 组合订单类型说明 |
Legs | legs | List<OrderLeg> | 订单腿列表 |
每个 AlgoParameters 元素是 TagValue:
| 字段 | API 字段 | C# 类型 | 说明 |
|---|---|---|---|
Tag | tag | string | 参数名称 |
Value | value | string? | 参数值 |
每个 Legs 元素是 OrderLeg:
| 字段 | API 字段 | C# 类型 | 说明 |
|---|---|---|---|
Market | market | string | 所属市场 |
Currency | currency | string | 计价币种 |
Multiplier | multiplier | Double | 合约乘数 |
TotalQuantity | totalQuantity | Double | 委托总数量 |
FilledQuantity | filledQuantity | Double | 已成交数量 |
AvgFilledPrice | avgFilledPrice | Double | 平均成交价 |
CreatedAt | createdAt | Int64 | 创建时间戳 |
UpdatedAt | updatedAt | Int64 | 更新时间戳 |
返回示例
{
"code": 0,
"message": "success",
"timestamp": 1785528000000,
"data": {
"items": [
{
"id": 123456,
"orderId": 789012,
"symbol": "AAPL",
"action": "BUY",
"orderType": "LMT",
"totalQuantity": 100,
"filledQuantity": 100,
"limitPrice": 150.0,
"avgFillPrice": 149.95,
"status": "Filled",
"openTime": 1785441600000,
"latestTime": 1785441650000
}
]
}
}频率限制
基础额度:每分钟 120 次。
获取待成交订单
操作名
TradeApiService.ACTIVE_ORDERS = active_orders。该常量用于设置 TigerRequest.ApiMethodName。
请求
TigerRequest<OrderBatchResponse>ModelValue: QueryOrderModel.
参数
| 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 | — |
Id | Int64 | id | CLR 默认值;序列化时省略 | Required | — |
IsShowCharges | Boolean | show_charges | CLR 默认值;序列化时省略 | Optional | — |
SegType | SegmentType | seg_type | CLR 默认值;序列化时省略 | Optional | — |
SecType | SecType | sec_type | CLR 默认值;序列化时省略 | Optional | — |
Market | Market | market | CLR 默认值;序列化时省略 | Optional | Enum value |
Symbol | string | symbol | null | Required | — |
Right | string (nullable) | right | null | Optional | — |
Strike | string (nullable) | strike | null | Optional | — |
Expiry | string (nullable) | expiry | null | Optional | — |
StartDate | Int64 | start_date | CLR 默认值;序列化时省略 | Optional | 时间戳或日期格式;按 SortBy 选定的时间筛选,并保持时间顺序 |
EndDate | Int64 | end_date | CLR 默认值;序列化时省略 | Optional | 时间戳或日期格式;按 SortBy 选定的时间筛选,并保持时间顺序 |
Limit | Int32 | limit | 100 | Optional | Positive integer |
SortBy | OrderSortBy | sort_by | CLR 默认值;序列化时省略 | Optional | 仅支持综合账户。LATEST_CREATED:按订单创建/提交时间降序排序并按该时间筛选;LATEST_STATUS_UPDATED:按最近一次订单状态更新时间降序排序并按该时间筛选。NONE 或省略时不序列化该字段,服务端默认 LATEST_CREATED。 |
PageToken | string | page_token | null | Optional | — |
返回
OrderBatchResponse inherits TigerResponse; its data property is OrderBatchItem.
示例
TigerRequest<OrderBatchResponse> request = new()
{
ApiMethodName = TradeApiService.ACTIVE_ORDERS,
ModelValue = new QueryOrderModel { Account = tradeClient.GetDefaultAccount, Id = 1234567890L, SegType = SegmentType.SEC, SecType = SecType.STK, Market = Market.US }
};
OrderBatchResponse? response = await tradeClient.ExecuteAsync(request);响应类型
OrderBatchItem? data = response?.Data; // response 或 data 缺失时为 nullData 字段
| 字段 | API 字段 | C# 类型 | 说明 |
|---|---|---|---|
NextPageToken | nextPageToken | string | 下一页令牌 |
Items | items | List<TradeOrder> | 订单列表 |
TradeOrder 的完整字段见获取订单列表的 Data 字段。
返回示例
{
"code": 0,
"message": "success",
"timestamp": 1785528000000,
"data": {
"items": [
{
"id": 123457,
"orderId": 789013,
"symbol": "TSLA",
"action": "BUY",
"orderType": "LMT",
"totalQuantity": 50,
"filledQuantity": 0,
"limitPrice": 280.0,
"status": "PendingSubmit",
"openTime": 1785527000000
}
]
}
}频率限制
基础额度:每分钟 120 次。
获取已撤销订单
操作名
TradeApiService.INACTIVE_ORDERS = inactive_orders。该常量用于设置 TigerRequest.ApiMethodName。
请求
TigerRequest<OrderBatchResponse>ModelValue: QueryOrderModel.
参数
| 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 | — |
Id | Int64 | id | CLR 默认值;序列化时省略 | Required | — |
IsShowCharges | Boolean | show_charges | CLR 默认值;序列化时省略 | Optional | — |
SegType | SegmentType | seg_type | CLR 默认值;序列化时省略 | Optional | — |
SecType | SecType | sec_type | CLR 默认值;序列化时省略 | Optional | — |
Market | Market | market | CLR 默认值;序列化时省略 | Optional | Enum value |
Symbol | string | symbol | null | Required | — |
Right | string (nullable) | right | null | Optional | — |
Strike | string (nullable) | strike | null | Optional | — |
Expiry | string (nullable) | expiry | null | Optional | — |
StartDate | Int64 | start_date | CLR 默认值;序列化时省略 | Optional | 时间戳或日期格式;按 SortBy 选定的时间筛选,并保持时间顺序 |
EndDate | Int64 | end_date | CLR 默认值;序列化时省略 | Optional | 时间戳或日期格式;按 SortBy 选定的时间筛选,并保持时间顺序 |
Limit | Int32 | limit | 100 | Optional | Positive integer |
SortBy | OrderSortBy | sort_by | CLR 默认值;序列化时省略 | Optional | 仅支持综合账户。LATEST_CREATED:按订单创建/提交时间降序排序并按该时间筛选;LATEST_STATUS_UPDATED:按最近一次订单状态更新时间降序排序并按该时间筛选。NONE 或省略时不序列化该字段,服务端默认 LATEST_CREATED。 |
PageToken | string | page_token | null | Optional | — |
返回
OrderBatchResponse inherits TigerResponse; its data property is OrderBatchItem.
示例
TigerRequest<OrderBatchResponse> request = new()
{
ApiMethodName = TradeApiService.INACTIVE_ORDERS,
ModelValue = new QueryOrderModel { Account = tradeClient.GetDefaultAccount, Id = 1234567890L, SegType = SegmentType.SEC, SecType = SecType.STK, Market = Market.US }
};
OrderBatchResponse? response = await tradeClient.ExecuteAsync(request);响应类型
OrderBatchItem? data = response?.Data; // response 或 data 缺失时为 nullData 字段
| 字段 | API 字段 | C# 类型 | 说明 |
|---|---|---|---|
NextPageToken | nextPageToken | string | 下一页令牌 |
Items | items | List<TradeOrder> | 订单列表 |
TradeOrder 的完整字段见获取订单列表的 Data 字段。
返回示例
{
"code": 0,
"message": "success",
"timestamp": 1785528000000,
"data": {
"items": [
{
"id": 123456,
"orderId": 789012,
"symbol": "AAPL",
"action": "BUY",
"orderType": "LMT",
"totalQuantity": 100,
"filledQuantity": 100,
"limitPrice": 150.0,
"avgFillPrice": 149.95,
"status": "Filled"
}
]
}
}频率限制
基础额度:每分钟 120 次。
获取已成交订单
操作名
TradeApiService.FILLED_ORDERS = filled_orders。该常量用于设置 TigerRequest.ApiMethodName。
请求
TigerRequest<OrderBatchResponse>ModelValue: QueryOrderModel.
参数
| 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 | — |
Id | Int64 | id | CLR 默认值;序列化时省略 | Required | — |
IsShowCharges | Boolean | show_charges | CLR 默认值;序列化时省略 | Optional | — |
SegType | SegmentType | seg_type | CLR 默认值;序列化时省略 | Optional | — |
SecType | SecType | sec_type | CLR 默认值;序列化时省略 | Optional | — |
Market | Market | market | CLR 默认值;序列化时省略 | Optional | Enum value |
Symbol | string | symbol | null | Required | — |
Right | string (nullable) | right | null | Optional | — |
Strike | string (nullable) | strike | null | Optional | — |
Expiry | string (nullable) | expiry | null | Optional | — |
StartDate | Int64 | start_date | CLR 默认值;序列化时省略 | Optional | 时间戳或日期格式;按 SortBy 选定的时间筛选,并保持时间顺序 |
EndDate | Int64 | end_date | CLR 默认值;序列化时省略 | Optional | 时间戳或日期格式;按 SortBy 选定的时间筛选,并保持时间顺序 |
Limit | Int32 | limit | 100 | Optional | Positive integer |
SortBy | OrderSortBy | sort_by | CLR 默认值;序列化时省略 | Optional | 仅支持综合账户。LATEST_CREATED:按订单创建/提交时间降序排序并按该时间筛选;LATEST_STATUS_UPDATED:按最近一次订单状态更新时间降序排序并按该时间筛选。NONE 或省略时不序列化该字段,服务端默认 LATEST_CREATED。 |
PageToken | string | page_token | null | Optional | — |
返回
OrderBatchResponse inherits TigerResponse; its data property is OrderBatchItem.
示例
TigerRequest<OrderBatchResponse> request = new()
{
ApiMethodName = TradeApiService.FILLED_ORDERS,
ModelValue = new QueryOrderModel { Account = tradeClient.GetDefaultAccount, Id = 1234567890L, SegType = SegmentType.SEC, SecType = SecType.STK, Market = Market.US }
};
OrderBatchResponse? response = await tradeClient.ExecuteAsync(request);响应类型
OrderBatchItem? data = response?.Data; // response 或 data 缺失时为 nullData 字段
| 字段 | API 字段 | C# 类型 | 说明 |
|---|---|---|---|
NextPageToken | nextPageToken | string | 下一页令牌 |
Items | items | List<TradeOrder> | 订单列表 |
TradeOrder 的完整字段见获取订单列表的 Data 字段。
返回示例
{
"code": 0,
"message": "success",
"timestamp": 1785528000000,
"data": {
"items": [
{
"id": 123456,
"orderId": 789012,
"symbol": "AAPL",
"action": "BUY",
"orderType": "LMT",
"totalQuantity": 100,
"filledQuantity": 100,
"limitPrice": 150.0,
"avgFillPrice": 149.95,
"status": "Filled"
}
]
}
}频率限制
基础额度:每分钟 120 次。
获取成交记录
操作名
TradeApiService.ORDER_TRANSACTIONS = order_transactions。该常量用于设置 TigerRequest.ApiMethodName。
请求
TigerRequest<OrderTransactionsResponse>ModelValue: OrderTransactionsModel.
参数
| 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 | — |
OrderId | Int64 | order_id | CLR 默认值;序列化时省略 | Optional | — |
SecType | SecType | sec_type | CLR 默认值;序列化时省略 | Optional | — |
Symbol | string | symbol | null | Required | — |
Right | string (nullable) | right | null | Optional | — |
Strike | string (nullable) | strike | null | Optional | — |
Expiry | string (nullable) | expiry | null | Optional | — |
StartDate | Int64 | start_date | CLR 默认值;序列化时省略 | Optional | Timestamp or date format; maintain chronological order |
EndDate | Int64 | end_date | CLR 默认值;序列化时省略 | Optional | Timestamp or date format; maintain chronological order |
Limit | Int32 | limit | 20 | Optional | Positive integer |
返回
OrderTransactionsResponse inherits TigerResponse; its data property is OrderTransactionsItem.
示例
TigerRequest<OrderTransactionsResponse> request = new()
{
ApiMethodName = TradeApiService.ORDER_TRANSACTIONS,
ModelValue = new OrderTransactionsModel { Account = tradeClient.GetDefaultAccount, OrderId = 1234567890L, SecType = SecType.STK, Symbol = "AAPL", Strike = "200" }
};
OrderTransactionsResponse? response = await tradeClient.ExecuteAsync(request);响应类型
OrderTransactionsItem? data = response?.Data; // response 或 data 缺失时为 nullData 字段(OrderTransactionsItem)
| 字段 | API 字段 | C# 类型 | 说明 |
|---|---|---|---|
Items | items | List<OrderTransactions> | 成交记录列表 |
Items 中每个 OrderTransactions:
| 字段 | API 字段 | C# 类型 | 说明 |
|---|---|---|---|
Id | id | Int64 | 成交记录标识 |
OrderId | orderId | Int64 | 订单标识 |
AccountId | accountId | string | 账户标识 |
SecType | secType | string | 证券类型 |
Market | market | string | 所属市场 |
Currency | currency | string | 计价币种 |
Symbol | symbol | string | 合约代码 |
Expiry | expiry | string | 到期日 |
Strike | strike | string | 行权价 |
Right | right | string | 期权方向 |
Action | action | string | 买卖方向 |
FilledQuantity | filledQuantity | Int64 | 成交数量 |
FilledPrice | filledPrice | Double | 成交价格 |
FilledAmount | filledAmount | Double | 成交金额 |
TransactedAt | transactedAt | string | 成交时间 |
TransactionTime | transactionTime | Int64 | 成交时间戳 |
返回示例
{
"code": 0,
"message": "success",
"timestamp": 1785528000000,
"data": [
{
"id": 123456,
"orderId": 789012,
"symbol": "AAPL",
"action": "BUY",
"filledQuantity": 100,
"filledPrice": 149.95,
"transactionTime": 1785441650000
}
]
}频率限制
基础额度:每分钟 60 次。
Updated about 1 month ago
