Order ws
快速入门¶
Restful API¶
公共接口¶
用户接口¶
订单接口¶
WebSocket API¶
WebSocket接入说明¶
公共接口¶
用户接口¶
订单接口¶
1. 下单¶
{
"id": "2d812f20c9e1030f5551eab0e039f613",
"method": "order.place_order",
"params": {
"side": 1,
"type": 1,
"volume": "100",
"price": "10000",
"symbol": "BTCUSDT",
"nonce": "17832",
"timestamp": "1724285700000",
"apiKey": "9a25209b66004da404d9ddcb48d1e11f",
"sign": "--signature here--"
}
}
请求参数
| 参数名 | 参数类型 | 必须 | 备注 |
|---|---|---|---|
| side | number | Y | 交易方向(1卖出2买入) |
| type | number | Y | 交易类型(1:限价交易 2:市价交易) |
| volume | string | Y | 委托量,限价时,基础币数量。市价时,计价币数量 |
| price | string | Y | 委托价 |
| symbol | string | Y | 币对 |
返回数据
{
"id": "2d812f20c9e1030f5551eab0e039f613",
"code": "0",
"msg": "success",
"data": {
"orderId": "123456",//订单号
"side": 1,//交易方向(1卖出2买入)
"type": 1,//交易类型(1:限价交易 2:市价交易)
"volume": "100",//委托量
"price": "10000",//委托价
"symbol": "BTCUSDT",//币对
"placeStatus": "1"//下单是否成功, 1成功
}
}
2. 批量下单¶
{
"id": "2d812f20c9e1030f5551eab0e039f613",
"method": "order.place_order.batch",
"params": {
"orderList": [
{
"side": 1,
"type": 1,
"volume": "100",
"price": "10000",
"symbol": "BTCUSDT"
},
{
"side": 2,
"type": 1,
"volume": "100",
"price": "10000",
"symbol": "BTCUSDT"
}
],
"nonce": "17832",
"timestamp": "1724285700000",
"apiKey": "9a25209b66004da404d9ddcb48d1e11f",
"sign": "--signature here--"
}
}
请求参数
| 参数名 | 参数类型 | 必须 | 备注 |
|---|---|---|---|
| orderList | object[] | Y | 下单集合 |
orderList
| 参数名 | 参数类型 | 必须 | 备注 |
|---|---|---|---|
| side | number | Y | 交易方向(1卖出2买入) |
| type | number | Y | 交易类型(1:限价交易 2:市价交易) |
| volume | string | Y | 委托量,限价时,基础币数量。市价时,计价币数量 |
| price | string | Y | 委托价 |
| symbol | string | Y | 币对 |
返回数据
{
"id": "2d812f20c9e1030f5551eab0e039f613",
"code": "0",
"msg": "success",
"data": [
{
"orderId": "123456",//订单号
"side": 1,//交易方向(1卖出2买入)
"type": 1,//交易类型(1:限价交易 2:市价交易)
"volume": "100",//委托量
"price": "10000",//委托价
"symbol": "BTCUSDT",//币对
"placeStatus": "1"//下单是否成功, 1成功
}
]
}
3. 撤单/批量撤单¶
{
"id": "2d812f20c9e1030f5551eab0e039f613",
"method": "order.cancel",
"params": {
"orderIdList": [
{
"orderId": "123456",
"symbol": "BTCUSDT"
}
],
"nonce": "17832",
"timestamp": "1724285700000",
"apiKey": "9a25209b66004da404d9ddcb48d1e11f",
"sign": "--signature here--"
}
}
请求参数
| 参数名 | 参数类型 | 必须 | 备注 |
|---|---|---|---|
| orderIdList | object[] | Y | 撤单集合 |
orderIdList
| 参数名 | 参数类型 | 必须 | 备注 |
|---|---|---|---|
| orderId | string | Y | 订单id |
| symbol | string | Y | 币对 |
返回数据
{
"id": "2d812f20c9e1030f5551eab0e039f613",
"code": "0",
"msg": "success",
"data": null
}
4. 查询撮合订单¶
{
"id": "2d812f20c9e1030f5551eab0e039f613",
"method": "order.deal.list",
"params": {
"orderId": "123456",
"symbol": "BTCUSDT",
"nonce": "17832",
"timestamp": "1724285700000",
"apiKey": "9a25209b66004da404d9ddcb48d1e11f",
"sign": "--signature here--"
}
}
请求参数
| 参数名 | 参数类型 | 必须 | 备注 |
|---|---|---|---|
| orderId | string | Y | 订单ID |
| symbol | string | Y | 币对 |
返回数据
{
"id": "2d812f20c9e1030f5551eab0e039f613",
"code": "0",
"msg": "success",
"data": {
"volume": "100",//成交数量
"price": "10000",//成交价格
"fee": "0.1",//手续费
"feeCoin": "BTC",//手续费币种
"role": "1",//角色(1-Maker 2-Taker)
"ctime": "2019-01-01T00:00:00Z",//成交时间(ISO8601)
"id": "123456"//撮合订单id
}
}
5. 查询历史委托订单¶
{
"id": "2d812f20c9e1030f5551eab0e039f613",
"method": "order.history.page",
"params": {
"page": 1,
"pageSize": 10,
"startTime": "2019-01-01T00:00:00Z",
"endTime": "2019-01-01T00:00:00Z",
"status": "2",
"side": "1",
"type": "1",
"symbol": "BTCUSDT",
"nonce": "17832",
"timestamp": "1724285700000",
"apiKey": "9a25209b66004da404d9ddcb48d1e11f",
"sign": "--signature here--"
}
}
请求参数
| 参数名 | 参数类型 | 必须 | 备注 |
|---|---|---|---|
| page | number | N | 第几页 |
| pageSize | number | N | 每页条数 |
| startTime | string | N | 订单创建起始时间(ISO8601) |
| endTime | string | N | 订单创建结束时间(ISO8601) |
| status | string | N | 订单状态(1未成交,2已成交,3部分成交,4已撤单,7部分成交/已撤单) |
| side | string | N | 交易方向(1卖出2买入) |
| type | string | N | 订单类型(1限价2市价) |
| symbol | string | Y | 币对 |
返回数据
{
"id": "2d812f20c9e1030f5551eab0e039f613",
"code": "0",
"msg": "success",
"data": {
"total": 100,
"pageNum": 1,
"pageSize": 10,
"data": [
{
"orderId": "123456",//订单ID
"userId": "123456",//用户ID
"orderType": "1",//订单类型,1.限价,2.市价
"amount": "100",//委托总价值 (计价币)
"dealAmount": "100",//成交数量
"volume": "100",//已成交价值 (计价币)
"leftAmount": "100",//剩余价值 (计价币)
"volume": "100",//委托数量 (基准币)
"dealVolume": "100",//已成交数量 (基准币)
"leftVolume": "100",//剩余数量 (基准币)
"status": "2",//订单状态(1未成交,2已成交,3部分成交,4已撤单,7部分成交/已撤单)
"type": "1",//1.限价,2.市价
"side": "1",//交易方向(1卖出2买入)
"price": "10000",//委托价格
"avgPrice": "10000",//平均成交价格
"progress": "100",//成交百分比 单位为1% 15.8为15.8%
"ctime": "2019-01-01T00:00:00Z",//订单创建时间
"utime": "2019-01-01T00:00:00Z",//订单修改时间
"base": "BTC",//基准币
"quote": "USDT",//计价币
"symbol": "BTCUSDT",//币对
"fee": "0.1",//手续费
"feeCoin": "BTC"//手续费币种
}
]
}
}
6. 查询当前委托订单¶
{
"id": "2d812f20c9e1030f5551eab0e039f613",
"method": "order.pending.list",
"params": {
"symbol": "BTCUSDT",
"nonce": "17832",
"timestamp": "1724285700000",
"apiKey": "9a25209b66004da404d9ddcb48d1e11f",
"sign": "--signature here--"
}
}
请求参数
| 参数名 | 参数类型 | 必须 | 备注 |
|---|---|---|---|
| symbol | string | Y | 币对 |
返回数据
{
"id": "2d812f20c9e1030f5551eab0e039f613",
"code": "0",
"msg": "success",
"data": [
{
"orderId": "123456",//订单ID
"userId": "123456",//用户ID
"orderType": "1",//订单类型,1.限价,2.市价
"amount": "100",//委托总价值 (计价币)
"dealAmount": "100",//成交数量
"volume": "100",//已成交价值 (计价币)
"leftAmount": "100",//剩余价值 (计价币)
"volume": "100",//委托数量 (基准币)
"dealVolume": "100",//已成交数量 (基准币)
"leftVolume": "100",//剩余数量 (基准币)
"status": "2",//订单状态(1未成交,2已成交,3部分成交,4已撤单,7部分成交/已撤单)
"type": "1",//1.限价,2.市价
"side": "1",//交易方向(1卖出2买入)
"price": "10000",//委托价格
"avgPrice": "10000",//平均成交价格
"progress": "100",//成交百分比 单位为1% 15.8为15.8%
"ctime": "2019-01-01T00:00:00Z",//订单创建时间
"utime": "2019-01-01T00:00:00Z",//订单修改时间
"base": "BTC",//基准币
"quote": "USDT",//计价币
"symbol": "BTCUSDT",//币对
"fee": "0.1",//手续费
"feeCoin": "BTC"//手续费币种
}
]
}