数字货币行情
数字货币 HTTP 行情支持 K 线和当日分时。请求代码使用 BTC.USD 等格式,并在请求模型中设置 SecType = SecType.CC。当前不支持数字货币历史分时。
获取数字货币 K 线
使用 TigerRequest<QuoteKlineResponse>、QuoteApiService.KLINE 和 QuoteKlineModel。数字货币请求将 QuoteKlineModel.SecType 设为 SecType.CC。
分页时读取 KlineItem.NextPageToken,并在下一次请求中设置 QuoteKlineModel.PageToken;同时保留 SecType.CC。
KlinePoint.VolumeDecimal 是可空的 double?,对应 JSON 字段 volumeDecimal。设置 SecType.CC 的数字货币 K 线使用该字段保留小数成交量;任何响应都可能缺失或为 null,此时使用整数 KlinePoint.Volume。
返回
Data 形状 | 项目字段 | 嵌套字段 |
|---|---|---|
List<KlineItem> | KlineItem | Items: List<[KlinePoint](#klinepoint)> |
示例
TigerRequest<QuoteKlineResponse> request = new()
{
ApiMethodName = QuoteApiService.KLINE,
ModelValue = new QuoteKlineModel
{
Symbols = new List<string> { "BTC.USD" },
Period = KLineType.day.Value,
Limit = 300,
SecType = SecType.CC
}
};
QuoteKlineResponse? response = await quoteClient.ExecuteAsync(request);
double? volume = response?.Data?[0].Items?[0].VolumeDecimal;获取数字货币当日分时
使用 TigerRequest<QuoteTimelineResponse>、QuoteApiService.TIMELINE 和 QuoteTimelineModel。数字货币请求将 QuoteTimelineModel.SecType 设为 SecType.CC。
TimelinePoint.VolumeDecimal 是可空的 double?,对应 JSON 字段 volumeDecimal。设置 SecType.CC 的数字货币当前分时使用该字段保留小数成交量;任何响应都可能缺失或为 null,此时使用整数 TimelinePoint.Volume。此支持仅适用于 timeline 当日分时请求,不适用于 history_timeline 历史分时请求。
返回
Data 形状 | 项目字段 | 嵌套字段 |
|---|---|---|
List<TimelineItem> | TimelineItem | Intraday、PreMarket、AfterHours: TimelineRange,其 Items 为 List<[TimelinePoint](#timelinepoint)> |
示例
TigerRequest<QuoteTimelineResponse> request = new()
{
ApiMethodName = QuoteApiService.TIMELINE,
ModelValue = new QuoteTimelineModel
{
Symbols = new List<string> { "BTC.USD" },
SecType = SecType.CC
}
};
QuoteTimelineResponse? response = await quoteClient.ExecuteAsync(request);
double? volume = response?.Data?[0].Intraday?.Items?[0].VolumeDecimal;返回模型字段表
所有响应的继承字段:TigerResponse
TigerResponse| 字段 | C# 类型 |
|---|---|
Code | int |
Message | string |
Timestamp | long |
Sign | string |
响应的 Data
Data| 响应类型 | Data C# 类型 |
|---|---|
QuoteKlineResponse | List<KlineItem> |
QuoteTimelineResponse | List<TimelineItem> |
KlineItem
KlineItem| 字段 | C# 类型 |
|---|---|
Symbol | string |
Period | string |
NextPageToken | string |
Items | List<KlinePoint> |
KlinePoint
KlinePoint| 字段 | C# 类型 | 说明 |
|---|---|---|
Time | long | 时间戳 |
Open、High、Low、Close、Amount | double | — |
Volume | long | 整数成交量;VolumeDecimal 缺失或为 null 时使用 |
VolumeDecimal | double? | 可选小数成交量;设置 SecType.CC 的数字货币 K 线使用该字段保留小数成交量。任何响应都可能缺失或为 null;缺失时读取 Volume |
TimelineItem
TimelineItem| 字段 | C# 类型 |
|---|---|
Symbol | string |
Period | string |
PreClose | double |
Intraday | TimelineRange |
PreMarket | TimelineRange |
AfterHours | TimelineRange |
TimelineRange
TimelineRange| 字段 | C# 类型 |
|---|---|
BeginTime | long |
EndTime | long |
Items | List<TimelinePoint> |
TimelinePoint
TimelinePoint| 字段 | C# 类型 | 说明 |
|---|---|---|
Time | long | 时间戳 |
Price | double | 最新价 |
AvgPrice | double | 均价 |
Volume | long | 整数成交量;VolumeDecimal 缺失或为 null 时使用 |
VolumeDecimal | double? | 可选小数成交量;SecType.CC 的数字货币当前分时使用该字段保留小数成交量。任何响应都可能缺失或为 null;缺失时读取 Volume |
Updated 1 day ago
