简介:Newdex 是知名去中心化交易所,主要基于 EOS。Newdex 提供了 API 服务以便分析师投资人查询数字货币行情和交易信息。本篇文章整理如何使用 Newdex 公共数据 API 获取所有交易对行情。
Newdex 是知名去中心化交易所,主要基于 EOS。Newdex 提供了 API 服务以便分析师投资人查询数字货币行情和交易信息。
本篇文章整理如何使用 Newdex 公共数据 API 获取所有交易对行情。
Newdex API 官方英文文档:https://github.com/newdex/api-docs
Newdex API 官方中文文档:https://github.com/newdex/api-docs/blob/master/README_zh.md
行情 API 不需要使用密钥签名。
账号限制频率为10秒50次(单个APIKEY维度限制,如果不加签名,只允许访问行情接口,且频率会被限制为10秒10次)。
Newdex返回都是 JSON 格式,且一定会包含code字段。
如果请求错误,会返回 code 及 msg 字段,示例如下:
{
"code": 1003,
"msg": "Invalid signature"
}
如果请求成功,会返回 code 及 data 字段,示例如下:
{
"code": 200,
"data": "response data..."
}
Newdex 交易所 API 获取所有交易对行情:
语句:
Node.js 示例:
const fetch = require('node-fetch');
fetch('https://api.newdex.vip/v1/tickers', {
method: 'get',
}).then(response => response.json()
.then(data => console.log(data)));
返回的 JSON 示例:
{
"code": 200,
"data": [
{
"symbol": "thepeostoken-peos-eos",
"contract": "thepeostoken",
"currency": "PEOS",
"last": 0.012611,
"change": -0.1064,
"high": 0.015399,
"low": 0.012001,
"amount": 1721735.8911,
"volume": 22851.3549
},
{
"symbol": "newdexissuer-ndx-eos",
"contract": "newdexissuer",
"currency": "NDX",
"last": 0.000211,
"change": 0.0293,
"high": 0.000212,
"low": 0.000193,
"amount": 27877561.669299997,
"volume": 5582.1327999999985
},
{
"symbol": "pokereotoken-pke-eos",
"contract": "pokereotoken",
"currency": "PKE",
"last": 0.00504,
"change": 0.2569,
"high": 0.0055,
"low": 0.00351,
"amount": 850449.1873,
"volume": 4038.4409
}
]
}
Newdex API 服务思维导图:

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

网友评论