数字货币行情

数字货币 HTTP 行情支持 K 线和当日分时。请求代码使用 BTC.USD 等格式,并在请求模型中设置 SecType = SecType.CC。当前不支持数字货币历史分时。

获取数字货币 K 线

使用 TigerRequest<QuoteKlineResponse>QuoteApiService.KLINEQuoteKlineModel。数字货币请求将 QuoteKlineModel.SecType 设为 SecType.CC

分页时读取 KlineItem.NextPageToken,并在下一次请求中设置 QuoteKlineModel.PageToken;同时保留 SecType.CC

KlinePoint.VolumeDecimal 是可空的 double?,对应 JSON 字段 volumeDecimal。设置 SecType.CC 的数字货币 K 线使用该字段保留小数成交量;任何响应都可能缺失或为 null,此时使用整数 KlinePoint.Volume

返回

Data 形状项目字段嵌套字段
List<KlineItem>KlineItemItems: 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.TIMELINEQuoteTimelineModel。数字货币请求将 QuoteTimelineModel.SecType 设为 SecType.CC

TimelinePoint.VolumeDecimal 是可空的 double?,对应 JSON 字段 volumeDecimal。设置 SecType.CC 的数字货币当前分时使用该字段保留小数成交量;任何响应都可能缺失或为 null,此时使用整数 TimelinePoint.Volume。此支持仅适用于 timeline 当日分时请求,不适用于 history_timeline 历史分时请求。

返回

Data 形状项目字段嵌套字段
List<TimelineItem>TimelineItemIntradayPreMarketAfterHours: TimelineRange,其 ItemsList<[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

字段C# 类型
Codeint
Messagestring
Timestamplong
Signstring

响应的 Data

响应类型Data C# 类型
QuoteKlineResponseList<KlineItem>
QuoteTimelineResponseList<TimelineItem>

KlineItem

字段C# 类型
Symbolstring
Periodstring
NextPageTokenstring
ItemsList<KlinePoint>

KlinePoint

字段C# 类型说明
Timelong时间戳
OpenHighLowCloseAmountdouble
Volumelong整数成交量;VolumeDecimal 缺失或为 null 时使用
VolumeDecimaldouble?可选小数成交量;设置 SecType.CC 的数字货币 K 线使用该字段保留小数成交量。任何响应都可能缺失或为 null;缺失时读取 Volume

TimelineItem

字段C# 类型
Symbolstring
Periodstring
PreClosedouble
IntradayTimelineRange
PreMarketTimelineRange
AfterHoursTimelineRange

TimelineRange

字段C# 类型
BeginTimelong
EndTimelong
ItemsList<TimelinePoint>

TimelinePoint

字段C# 类型说明
Timelong时间戳
Pricedouble最新价
AvgPricedouble均价
Volumelong整数成交量;VolumeDecimal 缺失或为 null 时使用
VolumeDecimaldouble?可选小数成交量;SecType.CC 的数字货币当前分时使用该字段保留小数成交量。任何响应都可能缺失或为 null;缺失时读取 Volume

Did this page help you?