互联网科技区块链研习社区块链

CoinCap API 查询主流交易所加密货币交易数据 - 区块

2019-03-01  本文已影响22人  极客红石

简介:CoinCap API 是查询超过1,000种加密货币实时定价和市场活动的有用工具。通过收集来自数千个市场的交换数据,能够提供有关资产价格和可用性透明而准确的数据。本文整理 CoinCap RESTful API 查询主流交易所加密货币交易数据的基础操作和介绍。

CoinCap API 是查询超过1,000种加密货币实时定价和市场活动的有用工具。通过收集来自数千个市场的交换数据,能够提供有关资产价格和可用性透明而准确的数据。本文整理 CoinCap RESTful API 查询主流交易所加密货币交易数据的基础操作和介绍。

CoinCap 对于所有端口,默认情况下,单个页面提供100个响应,并且在请求时每页最多支持2,000个响应。

CoinCap API 服务包括 RESTful API 和 WebSocket API 两种。通过 CoinCap API 查询数据不需要申请密钥。

查询加密货币资产数据基础语句,之前有写过:https://www.jianshu.com/p/465de72871a4

主流交易所加密货币交易数据高级查询语句:

api.coincap.io/v2/assets//*这里放要查询的通证ID*//markets

注意ID不是通证符号,比如比特币的通证ID是“bitcoin”。

Node.js 代码示例:

CoinCap API 查询主流交易所加密货币交易数据

返回的JSON示例(以比特币为例):

CoinCap API 查询主流交易所加密货币交易数据返回 JSON

可以看到查询出来是主流交易所包含 BTC 的交易对的交易量数据,币安、Bibox、火币、ZB等交易所的数据均在列。

返回 JSON 在官方文档的释义:

exchangeId: unique identifier for exchange

baseId: unique identifier for this asset, base is asset purchased

quoteId: unique identifier for this asset, quote is asset used to purchase based

baseSymbol: most common symbol used to identify asset, base is asset purchased

quoteSymbol: most common symbol used to identify asset, quote is asset used to purchase base

volumeUsd24Hr: volume transacted on this market in last 24 hours

priceUsd: the amount of quote asset traded for one unit of base asset

volumePercent: percent of quote asset volume

CoinCap API 官方文档:https://docs.coincap.io/

CoinCap API 思维导图:

CoinCap API

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

上一篇下一篇

猜你喜欢

热点阅读