数字货币
获取代码列表
对应的请求类:QuoteSymbolRequest
说明
获取所有数字货币的代码列表。
参数
| 参数 | 类型 | 是否必填 | 说明 |
|---|---|---|---|
| sec_type | string | 是 | 必为 CC |
返回
com.tigerbrokers.stock.openapi.client.https.response.quote.QuoteSymbolResponse
source
具体结构如下
public class QuoteSymbolResponse extends TigerResponse {
@JSONField(name = "data")
private List<String> symbols;
}返回数据可以通过QuoteSymbolResponse.getSymbols()方法调用,结果为包含返回数字货币代码数据的 List
示例
TigerHttpClient client = TigerHttpClient.getInstance().clientConfig(
ClientConfig.DEFAULT_CONFIG);
QuoteSymbolRequest request = QuoteSymbolRequest.newCcRequest();
QuoteSymbolResponse response = client.execute(request);
if (response.isSuccess()) {
System.out.println(Arrays.toString(response.getSymbols().toArray()));
} else {
System.out.println("response error:" + response.getMessage());
}返回示例
{
"code" : 0,
"message" : "success",
"timestamp" : 1770033519398,
"data" : [ "APT.USD", "IOTX.USD", "USDT.USD", "DYDX.USD", "DOGE.USD", "KAIA.USD", "ATOM.USD", "COMP.USD", "UNI.USD", "AAVE.USD", "LDO.USD", "LINK.USD", "SNX.USD", "OP.USD", "DOT.USD", "POL.USD", "BTC.USD", "SOL.USD", "ARB.USD", "TON.USD", "AVAX.USD", "MKR.USD", "IMX.USD", "ETH.USD", "LTC.USD" ],
"success" : true
}请求频率
基础限流为 10 次/分钟。
获取实时行情
对应的请求类:QuoteRealTimeQuoteRequest
说明
获取数字货币实时行情。
参数
| 参数 | 类型 | 是否必填 | 描述 |
|---|---|---|---|
| symbols | list | Yes | 数字货币代码列表(单次上限 50) |
| sec_type | string | Yes | 必为 CC |
返回
com.tigerbrokers.stock.openapi.client.https.response.quote.QuoteRealTimeQuoteResponsesource
返回数据可通过QuoteRealTimeQuoteResponse.getRealTimeQuoteItems()方法访问,返回RealTimeQuoteItem对象,其中com.tigerbrokers.stock.openapi.client.https.domain.quote.item.RealTimeQuoteItem 属性如下:
| 字段 | 类型 | 说明 |
|---|---|---|
| symbol | string | 数字货币代码 |
| open | Double | 开盘价 |
| high | Double | 最高价 |
| low | Double | 最低价 |
| close | Double | 收盘价 |
| preClose | Double | 前一交易日收盘价 |
| latestPrice | Double | 最新价 |
| latestTime | Long | 最新成交时间 |
| volumeDecimal | Double | 成交量,原始的成交量值,保留完整的小数精度 |
| change | Double | 涨跌额 |
| changeRate | Double | 涨跌率 |
示例
List<String> symbols = new ArrayList<>();
symbols.add("BTC.USD");
symbols.add("ETH.USD");
QuoteRealTimeQuoteRequest request = QuoteRealTimeQuoteRequest.newCcRequest(symbols);
QuoteRealTimeQuoteResponse response = client.execute(request);
if (response.isSuccess()) {
System.out.println(Arrays.toString(response.getRealTimeQuoteItems().toArray()));
} else {
System.out.println("response error:" + response.getMessage());
}返回示例
{
"code" : 0,
"message" : "success",
"timestamp" : 1770032332142,
"data" : [ {
"symbol" : "BTC.USD",
"open" : 77517.15,
"high" : 78366.03,
"low" : 74550.0,
"close" : 77517.15,
"preClose" : 77517.15,
"latestPrice" : 77839.45,
"latestTime" : 1770032330750,
"volumeDecimal" : 697.55996,
"change" : 322.3,
"changeRate" : 0.004157789598817811
}, {
"symbol" : "ETH.USD",
"open" : 2314.18,
"high" : 2374.87,
"low" : 2156.8,
"close" : 2313.05,
"preClose" : 2313.05,
"latestPrice" : 2286.79,
"latestTime" : 1770032330750,
"volumeDecimal" : 25668.0994,
"change" : -26.26,
"changeRate" : -0.011352975508527702
} ],
"success" : true
}请求频率
基础限流为 120 次/分钟。
获取 K 线数据
对应的请求类:QuoteKlineRequest
说明
获取数字货币 K 线数据。单次最多查询 10 个代码,每个代码最多返回 1200 条记录。数字货币查询不支持 withDate 指定日期方式;如需更长时间范围,请使用互不重叠的时间区间重复请求。
参数
| 参数 | 类型 | 描述 |
|---|---|---|
| symbols | list | 数字货币代码列表,上限:10 |
| period | KType | K 线周期:1min、3min、5min、15min、30min、60min、120min、240min、day、week、month、year;传 null 时默认为 day |
| begin_time | long | 区间开始时间,毫秒时间戳;使用不带时间的重载时传 -1 |
| end_time | long | 区间结束时间,毫秒时间戳;使用不带时间的重载时传 -1 |
| limit | int | 每个代码的返回条数,默认 300,最大 1200;非正数按 300 处理,超过 1200 按 1200 处理 |
返回
com.tigerbrokers.stock.openapi.client.https.response.quote.QuoteKlineResponsesource
返回数据可通过QuoteKlineResponse.getKlineItems()方法访问,返回KlineItem对象列表,其中com.tigerbrokers.stock.openapi.client.https.domain.quote.item.KlineItem 属性如下:
| 字段 | 类型 | 说明 |
|---|---|---|
| symbol | string | 数字货币代码 |
| period | string | K 线周期 |
| nextPageToken | string | SDK 响应字段;数字货币 K 线当前不提供分页 token,通常为 null |
| items | array | K 线对象 KlinePoint 的数组,字段参考下面说明 |
其中 K 线数据 KlinePoint 的属性如下:
| K 线字段 | 类型 | 说明 |
|---|---|---|
| close | Double | 收盘价 |
| high | Double | 最高价 |
| low | Double | 最低价 |
| open | Double | 开盘价 |
| time | Long | 毫秒时间戳 |
| volumeDecimal | Double | 成交量,保留小数精度 |
具体字段可通过对象的 get 方法,如getSymbol(),进行访问
示例
TigerHttpClient client = TigerHttpClient.getInstance().clientConfig(
ClientConfig.DEFAULT_CONFIG);
List<String> symbols = Arrays.asList("BTC.USD", "ETH.USD");
KType kType = KType.min1;
String startTime = "2026-01-29";
String endTime = "2026-01-30";
TimeZoneId timeZoneId = TimeZoneId.NewYork;
int limit = 200;
QuoteKlineRequest request = QuoteKlineRequest.newRequest(symbols, kType, startTime, endTime, timeZoneId)
.withLimit(limit)
.withSecType(SecType.CC);
QuoteKlineResponse response = client.execute(request);
if (response.isSuccess()) {
System.out.println(JSONObject.toJSONString(response));
} else {
System.out.println("response error:" + response.getMessage());
}返回示例
{
"code" : 0,
"message" : "success",
"timestamp" : 1770037196690,
"data" : [ {
"symbol" : "BTC.USD",
"period" : "1min",
"items" : [ {
"open" : 82808.12,
"close" : 82780.21,
"high" : 82808.12,
"low" : 82772.25,
"time" : 1769749140000,
"volumeDecimal" : 0.29135
}, {
"open" : 82810.81,
"close" : 82803.37,
"high" : 82810.81,
"low" : 82803.37,
"time" : 1769749080000,
"volumeDecimal" : 0.04455
}, {
"open" : 82823.91,
"close" : 82810.17,
"high" : 82823.91,
"low" : 82791.82,
"time" : 1769749020000,
"volumeDecimal" : 0.0493
} ]
}, {
"symbol" : "ETH.USD",
"period" : "1min",
"items" : [ {
"open" : 2751.48,
"close" : 2748.85,
"high" : 2751.75,
"low" : 2746.08,
"time" : 1769749140000,
"volumeDecimal" : 21.495
}, {
"open" : 2751.84,
"close" : 2751.83,
"high" : 2751.84,
"low" : 2751.83,
"time" : 1769749080000,
"volumeDecimal" : 0.022
}, {
"open" : 2753.08,
"close" : 2753.07,
"high" : 2753.08,
"low" : 2753.07,
"time" : 1769749020000,
"volumeDecimal" : 0.4104
} ]
} ],
"success" : true
}请求频率
基础限流为 60 次/分钟。
获取分时数据
对应的请求类:QuoteTimelineRequest
说明
获取数字货币分时数据。单次最多查询 10 个代码。SDK 使用 TimeLineType.day 和 TimeLineType.day5;其中 day5 请求值为 5day,响应周期会转换为 day5。
参数
| 参数 | 类型 | 是否必填 | 描述 |
|---|---|---|---|
| symbols | array | Yes | 数字货币代码列表,最多 10 只 |
| period | TimeLineType | No | day 或 day5,默认为 day;day5 的请求值为 5day |
| begin_time | long | No | 开始时间(毫秒时间戳),默认返回当天数据 |
返回
com.tigerbrokers.stock.openapi.client.https.response.quote.QuoteTimelineResponsesource
具体结构如下:
返回数据可通过QuoteTimelineResponse.getTimelineItems()方法访问,返回为包含TimelineItem对象的 List,其中com.tigerbrokers.stock.openapi.client.https.domain.quote.item.TimelineItem 属性如下:
| 字段 | 类型 | 说明 |
|---|---|---|
| symbol | string | 数字货币代码 |
| period | string | 周期,day 或 day5 |
| preClose | Double | 前收盘价 |
| intraday | TimelineRange | 分时范围 |
TimelineItem的具体字段可通过对象的 get 方法,如getSymbol(),进行访问
TimelineRange 字段:
| 字段 | 类型 | 说明 |
|---|---|---|
| beginTime | Long | 请求的开始时间,毫秒时间戳 |
| endTime | Long | 响应生成时的当前时间,毫秒时间戳 |
| items | List<TimelinePoint> | 分时点列表 |
TimelinePoint 字段:
| 分时字段 | 类型 | 说明 |
|---|---|---|
| price | Double | 最新价格 |
| avgPrice | Double | 平均成交价格;当前数字货币数据可能为 null |
| time | Long | 当前分时时间,毫秒时间戳 |
| volumeDecimal | Double | 成交量,原始的成交量值,保留完整的小数精度 |
示例
TigerHttpClient client = TigerHttpClient.getInstance().clientConfig(
ClientConfig.DEFAULT_CONFIG);
List<String> symbols = new ArrayList<>();
symbols.add("BTC.USD");
symbols.add("ETH.USD");
QuoteTimelineRequest request =
QuoteTimelineRequest.newCcRequest(symbols, System.currentTimeMillis() - 60 * 60 * 1000);
QuoteTimelineResponse response = client.execute(request);
if (response.isSuccess()) {
System.out.println(Arrays.toString(response.getTimelineItems().toArray()));
} else {
System.out.println("response error:" + response.getMessage());
}返回示例
{
"code" : 0,
"message" : "success",
"timestamp" : 1770040737146,
"data" : [ {
"symbol" : "BTC.USD",
"period" : "day",
"preClose" : 77517.15,
"intraday" : {
"items" : [ {
"price" : 77917.75,
"avgPrice" : null,
"time" : 1770040440000,
"volumeDecimal" : 0.01902
}, {
"price" : 77999.83,
"avgPrice" : null,
"time" : 1770040500000,
"volumeDecimal" : 0.06813
}, {
"price" : 78150.0,
"avgPrice" : null,
"time" : 1770040560000,
"volumeDecimal" : 0.06568
}, {
"price" : 78159.46,
"avgPrice" : null,
"time" : 1770040620000,
"volumeDecimal" : 0.07281
} ],
"beginTime" : 1770040435799,
"endTime" : 1770040737143
}
}, {
"symbol" : "ETH.USD",
"period" : "day",
"preClose" : 2313.05,
"intraday" : {
"items" : [ {
"price" : 2321.92,
"avgPrice" : null,
"time" : 1770040440000,
"volumeDecimal" : 8.9763
}, {
"price" : 2322.16,
"avgPrice" : null,
"time" : 1770040500000,
"volumeDecimal" : 1.1757
}, {
"price" : 2325.55,
"avgPrice" : null,
"time" : 1770040560000,
"volumeDecimal" : 25.7984
}, {
"price" : 2326.31,
"avgPrice" : null,
"time" : 1770040620000,
"volumeDecimal" : 13.1475
} ],
"beginTime" : 1770040435799,
"endTime" : 1770040737143
}
} ],
"success" : true
}请求频率
基础限流为 120 次/分钟。
Updated 4 days ago
