- Coinbase 公共数据 API 获取交易对基本信息 - 区块
- Coinbase 公共数据 API 获取交易对交易记录 - 区块
- Coinbase 公共数据 API 获取可用交易对列表 - 区块
- Coinbase 公共数据 API 获取交易对订单记录 - 区块
- Coinbase 公共数据 API 获取可用交易对列表 - 区块
- Coinbase 公共数据 API 获取交易对历史价格 - 区块
- 比特币生成创世区块-构造交易-挖矿-写入区块链代码演示
- Btron 交易所 API 公共端口获取交易信息 - 区块链数据
- Btron 交易所 API 公共端口获取最近交易 - 区块链数据
- Btron 交易所 API 公共端口获取交易对信息 - 区块链数
简介:Coinbase,相信大家都不陌生,世界顶级数字货币交易所。Coinbase 有非常完备的 API 服务,包括允许开发人员使用 OAuth2 协议允许 Coinbase 用户授予第三方应用程序对其帐户的完全或部分访问权限,而无需共享帐户的 API 密钥或登录凭据。本篇文章介绍开发者如何使用 Coinbase 公共数据 API 获取交易对基本信息。
Coinbase,相信大家都不陌生,世界顶级数字货币交易所。Coinbase 有非常完备的 API 服务,包括允许开发人员使用 OAuth2 协议允许 Coinbase 用户授予第三方应用程序对其帐户的完全或部分访问权限,而无需共享帐户的 API 密钥或登录凭据。
Coinbase, which I believe everyone knows, is the world's top digital currency exchange. Coinbase's API services are very comprehensive, it allows developers to use the OAuth2 protocol to allow a Coinbase user to grant a 3rd party application full or partial access to his/her account, without sharing the account’s API key or login credentials.
本篇文章,我们展示如何利用 Coinbase 的 Market Data API 获取交易对基本信息(包括最后交易价格,24小时交易量等)。
In this article, we show how to use Coinbase's Market Data API to get the snapshot information about the last trade (tick), best bid/ask and 24h volume.
Market Data API 是 Coinbase Pro API 中不需要身份验证的公共信息端口,用于检索市场数据。它提供市场数据的快照。
The Market Data API is an unauthenticated set of endpoints for retrieving market data. These endpoints provide snapshots of market data.
Market Data API 官方文档:https://docs.pro.coinbase.com/#market-data
Market Data API official documentation: https://docs.pro.coinbase.com/#market-data
获取交易对基本信息:
Get the snapshot information about the last trade (tick), best bid/ask and 24h volume:
https://api-public.sandbox.pro.coinbase.com/products/<product-id>/ticker
比如查询 ETH-BTC 交易对:
For example, query ETH-BTC:
https://api-public.sandbox.pro.coinbase.com/products/ETH-BTC/ticker
Node.js 代码示例:
Code example (Node.js):
const fetch = require('node-fetch');
fetch('https://api-public.sandbox.pro.coinbase.com/products/<product-id>/ticker', {
method: 'get',
}).then(response => response.json()
.then(data => console.log(data)));
返回的 JSON 示例:
Return JSON example:
{
"trade_id": 97517,
"price": ".98999",
"size": "1.00000000",
"time": "2019-03-11T13:20:29.151000Z",
"bid": "0.03999",
"ask": "0.98999",
"volume": "6.51999000"
}
Market Data API 思维导图:
Mind map of the Market Data API:

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

网友评论