-
Notifications
You must be signed in to change notification settings - Fork 3
REST API Reference
symbol 规则: 基础币种+计价币种。如BTC/USDT,symbol为btc_usdt;ETH/BTC, symbol为eth_btc。以此类推 (API调用限频规则: 1分钟200次,1天83200次)
在调用行情接口时,请添加get参数,key为apikey,value为网页上申请的apikey值。
例:
请求参数:
参数名称 |
是否必须 |
类型 |
描述 |
默认值 |
取值范围 |
symbol |
true |
string |
交易对 |
|
btc_usdt... |
period |
true |
string |
K线周期 |
|
1min|5min|15min|30min|1hour|2hour|4hour|6hour|12hour|1day|1week |
size |
false |
int |
|
|
[1,2000],默认150 |
响应数据:
参数名称 |
是否必须 |
数据类型 |
描述 |
取值范围 |
status |
true |
stirng |
请求处理结果 |
“ok”, “error” |
ts |
true |
number |
响应生成时间点,单位:毫秒 |
时间戳,毫秒 |
ticker |
true |
object |
kline数据 |
|
ticker说明:
" ticker": [
{
"id": K线ID
"amount": 成交量
"open": 开盘价, 为第一笔成交价
"close": 收盘价,当K线为最晚的一根时
"low": 最低价
"high": 最高价
}
]
请求响应示例:
/* GET /market/history/kline?symbol=btc_usdt&period=15min&size=1&apikey=value */
{
"status": "ok",
"ts": 1531556311956,
"tick": {
"id": 1531555200000
"amount": 223.360102
"open": 6201.102331
"close": 6315.04000
"low": 6164.050011
"high": 6325.082341
}
}
请求参数:
参数名称 |
是否必须 |
类型 |
描述 |
默认值 |
取值范围 |
symbol |
true |
string |
交易对 |
|
btc_usdt... |
type |
true |
string |
Depth类型 |
|
0, 1, 2, 3, 4, 5(六选一);0时,返回所有深度 |
响应数据:
参数名称 |
是否必须 |
数据类型 |
描述 |
取值范围 |
status |
true |
string |
请求处理结果 |
“ok”, “error” |
ts |
true |
number |
响应生成时间点,单位:毫秒 |
时间戳,毫秒 |
tick |
true |
object |
深度数据 |
|
tick说明:
"tick": {
"id": 消息id,
"ts": 消息生成时间,单位:毫秒,
"bids": [price(成交价), amount(成交量)],买盘,按price降序,
"asks": [price(成交价), amount(成交量)],卖盘,按price升序
}
请求响应示例:
/* GET /market/depth?symbol=eth_usdt&type=step1&apikey=value */
{
"status": "ok",
"ts": 1489472598812,
"tick": {
"id": 1489464585407,
"ts": 1489464585407,
"bids": [
[7964, 0.0678]// [price, amount]
],
"asks": [
[7979, 0.0736]
]
}
}
请求参数:
参数名称 |
是否必须 |
类型 |
描述 |
默认值 |
取值范围 |
symbol |
true |
string |
交易对 |
|
btc_usdt... |
响应参数:
参数名称 |
是否必须 |
数据类型 |
描述 |
取值范围 |
status |
true |
stirng |
请求处理结果 |
“ok”, “error” |
ts |
true |
number |
响应生成时间点,单位:毫秒 |
时间戳,毫秒 |
tick |
true |
object |
交易数据 |
|
tick说明:
"tick": {
"id": 消息id,
"data":
{
"id": 成交id,
"transPrice": 成交价钱,
"transNumber": 成交量,
"transDirection": 主动成交方向,
"finishTime": 最新成交时间
}
}
请求响应例子:
/* GET /market/trade/{symbol}?apikey=value*/
{
"status": "ok",
"ts": 1489473346905,
"tick": {
"id": 600848670,
"data": [
{
"id": 600848670,
"transPrice": 7962.62,
"transNumber": 0.0122,
"transDirection": "1", //1 买入 2卖出
"finishTime": 1489464451000
}
]
}
}
请求参数:(无,需签名认证)
响应数据:系统时间戳
请求响应例子
/* GET /v1/common/getTimestamp?apikey=value&signature=value*/
{
"status": "ok",
"data": 1494900087029
}
请求参数:(无,需签名认证)
响应数据:
参数名称 |
是否必须 |
数据类型 |
描述 |
取值范围 |
id |
true |
long |
account-id |
|
coinName |
true |
string |
币种名称 |
|
acccoutType |
true |
string |
账户类型 |
1 法币账户 2 币币账户 3 合约账户 |
balance |
true |
decimal |
账户余额 |
|
freeze |
true |
decimal |
冻结金额 |
|
useMoney |
true |
decimal |
可用金额 |
|
loanMoney |
true |
decimal |
借币金额 |
|
state |
true |
string |
账户状态 |
1:正常 0:锁定 |
请求响应例子:
/* GET /v1/account/accounts?apikey=value&signature=value */
{
"status": "ok",
"data": {
"id": 100009,
"coinName": "USDT",
"acccoutType": "1",
"balance": 20000,
"freeze": 0,
"useMoney": 20000,
"loanMoney": 0,
"status": "1",
}
}
请求参数:(需签名认证)
参数名称 |
是否必须 |
数据类型 |
描述 |
默认值 |
取值范围 |
amount |
true |
string |
限价单表示下单数量,市价买单时表示买多少钱,市价卖单时表示卖多少币 |
|
|
price |
false |
string |
下单价格,市价单不传该参数 |
|
精度支持6位小数 |
symbol |
true |
string |
交易对 |
|
btc_usdt... |
consignType |
true |
int |
订单类型 |
|
1限价委托 2 市价委托 |
consignDirection |
true |
int |
交易方向 |
|
1买入 2 卖出 |
响应数据:
参数名称 |
是否必须 |
数据类型 |
描述 |
取值范围 |
status |
true |
string |
返回状态 |
|
data |
true |
string |
订单ID |
|
请求响应例子:
/* POST /v1/orders/place {
"amount": "10.1",
"price": "100.1",
"symbol": "eth_usdt",
"consignType": "1",
"consignDirection": "1",
"apikey": value,
"signature": value
} */
{
"status": "ok",
"data": "59378"
}
请求参数:(需签名认证)
参数名称 |
是否必须 |
数据类型 |
描述 |
默认值 |
取值范围 |
order_id |
true |
string |
订单ID,填在path中 |
|
|
响应数据:
参数名称 |
是否必须 |
数据类型 |
描述 |
取值范围 |
status |
true |
string |
返回状态 |
|
data |
true |
string |
订单ID |
|
请求响应例子:
/* POST/v1/order/orders/{order_id}/submitcancel?apikey=value&signature=value*/
{
"status": "ok",//注意,返回OK表示撤单请求成功。订单是否撤销成功请调用订单查询接口查询该订单状态
"data": "59378"
}
请求参数:(需签名认证)
参数名称 |
是否必须 |
数据类型 |
描述 |
默认值 |
取值范围 |
order_id |
true |
string |
订单ID,填在path中 |
|
|
响应数据:
参数名称 |
是否必须 |
数据类型 |
描述 |
取值范围 |
accountId |
true |
long |
账户ID |
|
consignNumber |
true |
string |
订单数量 |
|
canceledAt |
false |
long |
订单撤销时间 |
|
createTime |
true |
long |
订单创建时间 |
|
transDoneNumber |
true |
string |
已成交数量 |
|
transTurnover |
true |
string |
已成交总金额 |
|
feeNumber |
true |
string |
已成交手续费(买入为币,卖出为钱) |
|
finishTime |
false |
long |
最后成交时间 |
|
id |
true |
long |
订单ID |
|
consignPrice |
true |
string |
订单价格 |
|
state |
true |
string |
订单状态 |
0 委托中 1 部分成交 2 已成交 3 已撤销 |
symbol |
true |
string |
交易对 |
btc_usdt... |
consignType |
true |
int |
订单类型 |
1限价委托 2 市价委托 |
transDirection |
true |
int |
交易方向 |
1买入 2 卖出 |
请求响应例子
/* GET /v1/order/orders/{order_id}?apikey=value&signature=value */
{
"status": "ok",
"data": {
"id": 59378,
"symbol": "btc_usdt",
"accountId": 100009,
"consignNumber": "10.1000000000",
"consignPrice": "100.1000000000",
"createTime": 1494901162595,
"consignType": "1",
"transDirection": "1",
"transDoneNumber": "10.1000000000",
"transturnover": "1011.0100000000",
"feeNumber": "0.0202000000",
"finishTime": 1494901400468,
"state": "1,
"canceledAt": 0,//订单撤销时间
}
}
请求参数:(需签名认证)
参数名称 |
是否必须 |
数据类型 |
描述 |
默认值 |
取值范围 |
symbol |
true |
string |
交易对 |
|
btc_usdt ... |
consignType |
true |
int |
订单类型 |
|
1限价委托 2 市价委托 |
transDirection |
true |
int |
交易方向 |
|
1买入 2卖出 |
start_date |
false |
string |
查询开始日期,日期格式yyyy-mm-dd |
|
|
end_date |
false |
string |
查询结束日期,日期格式yyyy-mm-dd |
|
|
states |
true |
string |
查询的订单状态组合,使用“逗号”分隔 |
|
0 委托中 1 部分成交 2 已成交 3 已撤销 |
from |
false |
string |
查询起始ID |
|
|
direct |
false |
string |
查询方向 |
|
prev向前,next 向后 |
size |
false |
string |
查询记录大小 |
|
|
响应数据:
参数名称 |
是否必须 |
数据类型 |
描述 |
取值范围 |
id |
true |
long |
订单ID |
|
symbol |
true |
string |
交易对 |
btc_usdt... |
accountId |
true |
long |
账户ID |
|
consignNumber |
true |
string |
订单数量 |
|
consignPrice |
true |
string |
订单价格 |
|
createTime |
true |
long |
订单创建时间 |
|
consignType |
true |
int |
订单类型 |
1限价委托 2 市价委托 |
transDirection |
true |
int |
交易方向 |
1买入 2 卖出 |
transDoneNumber |
true |
string |
已成交数量 |
|
transTurnover |
true |
string |
已成交总金额 |
|
feeNumber |
true |
string |
已成交手续费(买入为币,卖出为钱) |
|
finishTime |
false |
long |
最后成交时间 |
|
state |
true |
string |
订单状态 |
0 委托中 1 部分成交 2 已成交 3 已撤销 |
canceledAt |
false |
long |
订单撤销时间 |
|
请求响应例子:
/* GET /v1/order/orders?symbol=eth_usdt&consignType=1&transDirection=1&states=1&apikey=value&signature=value*/
{
"status": "ok",
"data":
{
"id": 59378,
"symbol": "eth_usdt",
"accountId": 100009,
"consignNumber": "10.1000000000",
"consignPrice": "100.1000000000",
"createTime": 1494901162595,
"consignType": "1",
"transDirection": "1",
"transDoneNumber": "10.1000000000",
"transturnover": "1011.0100000000",
"feeNumber": "0.0202000000",
"finishTime": 1494901400468,
"state": "1,
"canceledAt": 0,//订单撤销时间
}
}
请求参数:(需签名认证)
参数名称 |
是否必须 |
数据类型 |
描述 |
默认值 |
取值范围 |
symbol |
true |
string |
交易对 |
|
btc_usdt... |
consignType |
true |
int |
订单类型 |
|
1限价委托 2 市价委托 |
transDirection |
true |
int |
交易方向 |
|
1买入 2卖出 |
start_date |
false |
string |
查询开始日期,日期格式yyyy-mm-dd |
|
|
end_date |
false |
string |
查询结束日期,日期格式yyyy-mm-dd |
|
|
from |
false |
string |
查询起始ID |
|
|
direct |
false |
string |
查询方向 |
|
prev向前,next 向后 |
size |
false |
string |
查询记录大小 |
|
|
响应数据:
参数名称 |
是否必须 |
数据类型 |
描述 |
取值范围 |
id |
true |
long |
订单成交记录ID |
|
orderId |
true |
long |
订单ID |
|
matchId |
true |
long |
撮合ID |
|
symbol |
true |
string |
交易对 |
btc_usdt, bch_btc, rcn_eth ... |
consignType |
true |
int |
订单类型 |
1限价委托 2 市价委托 |
transDirection |
true |
int |
交易方向 |
1买入 2卖出 |
transPrice |
true |
string |
成交价格 |
|
transNumber |
true |
string |
成交数量 |
|
rivalFee |
true |
string |
成交手续费 |
|
finishTime |
true |
long |
成交时间 |
|
请求响应例子:
/* GET /v1/orders/matchresults?symbol=btc_usdt&consignType=1&transDirection=1&apikey=value&signature=value*/
{
"status": "ok",
"data":
{
"id": 29553,
"orderId": 59378,
"matchId": 0,
"symbol": btc_usdt,
"consignType": "1",
"transDirection": "1",
"transPrice": "100.1000000000",
"transNumber": "9.1155000000",
"rivalFee": "0.0182310000",
"finishTime": 1494901400435
}
}