简介:CoinCap 是查询超过1,000种加密货币实时定价和市场活动的有用工具。通过收集来自数千个市场的交换数据,能够提供有关资产价格和可用性透明而准确的数据。本文整理 CoinCap API 查询数字货币市场基本数据的基础操作和介绍。
CoinCap 是查询超过1,000种加密货币实时定价和市场活动的有用工具。通过收集来自数千个市场的交换数据,能够提供有关资产价格和可用性透明而准确的数据。本文整理 CoinCap API 查询主流交易所交易基本数据的基础操作和介绍。
CoinCap 对于所有端口,默认情况下,单个页面提供100个响应,并且在请求时每页最多支持2,000个响应。
CoinCap API 服务包括 RESTful API 和 WebSocket API 两种。通过 CoinCap API 查询数据不需要申请密钥。
数字货币市场基本数据查询语句:
api.coincap.io/v2/markets
Node.js 代码示例:
const fetch = require('node-fetch');
fetch('https://api.coincap.io/v2/markets', {
method: 'get',
}).then(response => response.json()
.then(data => console.log(data.data)));
返回的JSON示例:
{
"data": [
{
"exchangeId": "acx",
"rank": "1",
"baseSymbol": "BTC",
"baseId": "bitcoin",
"quoteSymbol": "AUD",
"quoteId": "australian-dollar",
"priceQuote": "5449.1200000000000000",
"priceUsd": "3849.1836999949140395",
"volumeUsd24Hr": "801831.1549133405333972",
"percentExchangeVolume": "94.2170951004247824",
"tradesCount24Hr": "404",
"updated": 1552554174979
},
{
"exchangeId": "acx",
"rank": "2",
"baseSymbol": "ETH",
"baseId": "ethereum",
"quoteSymbol": "AUD",
"quoteId": "australian-dollar",
"priceQuote": "188.9700000000000000",
"priceUsd": "133.4858185886966897",
"volumeUsd24Hr": "22915.5905686127139472",
"percentExchangeVolume": "2.6926371751154067",
"tradesCount24Hr": "119",
"updated": 1552554175018
},
{
"exchangeId": "acx",
"rank": "3",
"baseSymbol": "BCH",
"baseId": "bitcoin-cash",
"quoteSymbol": "AUD",
"quoteId": "australian-dollar",
"priceQuote": "183.1400000000000000",
"priceUsd": "129.3675864758105083",
"volumeUsd24Hr": "18030.4779974796137891",
"percentExchangeVolume": "2.1186246627923210",
"tradesCount24Hr": "118",
"updated": 1552554175073
},
{
"exchangeId": "acx",
"rank": "4",
"baseSymbol": "LTC",
"baseId": "litecoin",
"quoteSymbol": "AUD",
"quoteId": "australian-dollar",
"priceQuote": "78.0100000000000000",
"priceUsd": "55.1051950473843931",
"volumeUsd24Hr": "4434.4032137750979292",
"percentExchangeVolume": "0.5210530755081871",
"tradesCount24Hr": "61",
"updated": 1552554175091
},
{
"exchangeId": "acx",
"rank": "5",
"baseSymbol": "HC",
"baseId": "hypercash",
"quoteSymbol": "AUD",
"quoteId": "australian-dollar",
"priceQuote": "1.8200000000000000",
"priceUsd": "1.2856230609696141",
"volumeUsd24Hr": "3834.5533378165317206",
"percentExchangeVolume": "0.4505692679598581",
"tradesCount24Hr": null,
"updated": 1552554175105
}
],
"timestamp": 1552554236026
}
返回 JSON 在官方文档的释义:
exchangeId: unique identifier for exchange
rank: rank is in ascending order - this number represents the amount of volume transacted by this market in relation to other markets on that exchange
baseSymbol: most common symbol used to identify asset, base is asset purchased
baseId: unique identifier for this asset, base is asset purchased
quoteSymbol: most common symbol used to identify asset, quote is asset used to purchase base
quoteId: unique identifier for this asset, quote is asset used to purchase base
priceQuote: the amount of quote asset traded for one unit of base asset
priceUsd: quote price translated to USD
volumeUsd24Hr: volume transacted on this market in last 24 hours
percentExchangeVolume: the amount of daily volume a single market transacts in relation to total daily volume of all markets on the exchange
tradesCount24Hr: number of trades on this market in the last 24 hours
updated: UNIX timestamp (milliseconds) since information was received from this particular market
翻译:
exchangeId: 交易所唯一标识符
rank: 权重,按升序排列,权重与总交易量直接相关,交易量最高的排在第1;
baseSymbol: 购买资产符号;
baseId: 购买资产ID;
quoteSymbol: 报价资产符号;
quoteId: 报价资产ID;
priceQuote: 单位购买资产的报价金额;
priceUsd: 单位购买资产报价金额转换为美元;
volumeUsd24Hr: 过去24小时内该市场的交易量;
percentExchangeVolume: 单个市场日交易量相对该交易所所有市场交易量的比例;
tradesCount24Hr: 过去24小时该市场的交易数量;
updated: 收到此特定市场信息的时间的 UNIX 时间戳。
CoinCap API 官方文档:https://docs.coincap.io/
CoinCap API 思维导图:

原创内容,欢迎转载,但转载请标明出处。
我们有一个区块链知识星球,做区块链前沿资料的归纳整理以方便大家检索查询使用,也是国内顶尖区块链技术社区,欢迎感兴趣的朋友加入。如果你对上面内容有疑问,也可以加入知识星球提问我:

网友评论