Last active
June 7, 2017 05:14
-
-
Save hpyhacking/b13fb1aa4ceb4d0a70371a963673482c to your computer and use it in GitHub Desktop.
[zh-CN] PEATIO EXCHANGE API NOTES
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"currency": "cny", // 账户的币种 例如 cny 或 btc | |
"balance":"100243840.0", // 账户余额, 不包括冻结资金 | |
"locked":"0.0" // 账户冻结资金 | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
curl -X GET 'https://yunbi.com/api/v2/markets?access_key=xxx&foo=bar&tonce=123456789&signature=e324059be4491ed8e528aa7b8735af1e96547fbec96db962d51feb7bf1b64dee' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"at":1398410899, // 以秒为单位的时间戳 | |
"ticker": { | |
"buy": "3000.0", // 当前买入价 | |
"sell":"3100.0", // 当前卖出价 | |
"low":"3000.0", // 过去24小时之内的最低价 | |
"high":"3000.0", // 过去24小时之内的最高价 | |
"last":"3000.0", // 最后成交价 | |
"vol":"0.11" // 过去24小时之内的总成交量 | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
payload = 'GET|/api/v2/markets|access_key=xxx&foo=bar&tonce=123456789' | |
hash = HMAC-SHA256(payload, 'yyy').to_hex | |
# e324059be4491ed8e528aa7b8735af1e96547fbec96db962d51feb7bf1b64dee |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"sn": "PEA5TFFOGQHTIO", // 用户的唯一编号 | |
"name":"foo", // 用户名字 | |
"email":"[email protected]", // 用户邮件地址 | |
"activated":true, // 用户是否已激活 | |
"accounts": [ // 用户的所有账户信息 [参见 Account] | |
{"currency":"cny", "balance":"100243840.0", "locked":"0.0"}, | |
{"currency":"btc", "balance":"99999708.26", "locked":"210.8"} | |
] | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"id": 7, // 唯一的 Order ID | |
"side": "sell", // Buy/Sell 代表买单/卖单 | |
"price": "3100.0", // 出价 | |
"avg_price": "3101.2", // 平均成交价 | |
"state": "wait", // 订单的当前状态 [wait,done,cancel] | |
// wait 表明订单正在市场上挂单 | |
// 是一个active order | |
// 此时订单可能部分成交或者尚未成交 | |
// done 代表订单已经完全成交 | |
// cancel 代表订单已经被撤销 | |
"market": "btccny", // 订单参与的交易市场 | |
"created_at": "2014-04-18T02:02:33Z", // 下单时间 ISO8601格式 | |
"volume": "100.0", // 购买/卖出数量 | |
"remaining_volume": "89.8", // 还未成交的数量 remaining_volume 总是小于等于 volume | |
// 在订单完全成交时变成 0 | |
"executed_volume": "10.2", // 已成交的数量 | |
// volume = remaining_volume + executed_volume | |
"trades_count": 1, // 订单的成交数 整数值 | |
// 未成交的订单为 0 有一笔成交的订单为 1 | |
// 通过该字段可以判断订单是否处于部分成交状态 | |
"trades": [ // 订单的详细成交记录 参见Trade | |
// 注意: 只有某些返回详细订单数据的 API 才会包含 Trade 数据 | |
{ | |
"id": 2, | |
"price": "3100.0", | |
"volume": "10.2", | |
"market": "btccny", | |
"created_at": "2014-04-18T02:04:49Z", | |
"side": "sell" | |
} | |
] | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"asks": [...], // 卖单列表 | |
"bids": [...] // 买单列表 | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# canonical_verb 请求方法,例如GET | |
# canonical_uri 请求地址,例如 /api/v2/markets | |
# canonical_query 请求参数,通过 & 连接而成的字符串参数包括 access_key 和 tonce | |
# 参数必须按照字母序排列,例如 access_key=xxx&foo=bar&tonce=123456789 | |
# | |
# 最后再把这三个字符串通过 '|' 字符连接起来,看起来就像这样: | |
# GET|/api/v2/markets|access_key=xxx&foo=bar&tonce=123456789 | |
def payload | |
"#{canonical_verb}|#{canonical_uri}|#{canonical_query}" | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"id":2, // 交易的唯一ID | |
"price":"3100.0", // 成交价 | |
"volume":"10.2", // 成交数量 | |
"market":"btccny", // 交易所属的市场 | |
"created_at":"2014-04-18T02:04:49Z", // 成交时间 | |
"order_id":101, // buy/sell 买或者卖 | |
"side":"sell" // 交易所属 Order ID | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment