批量下单
描述
此接口用于批量下单,最多可以下10个订单。
HTTP请求
POST /v3/trade/orders
请求参数
参数 | 是否必填 | 类型 | 描述 |
---|---|---|---|
symbol | 是 | String | 交易对。常用形式为“基础货币”+“报价货币” |
side | 是 | String | 枚举:BUY and SELL |
mgnMode | 是 | String | 保证金模式, CROSS :全仓;ISOLATED :逐仓。开平模式下必填,买卖模式下与posSide联动,要么都填要么都为空。 |
posSide | 是 | String | 双向持仓模式下必填,且仅可选择 LONG 或 SHORT 。开平模式下必填,买卖模式下与mgnMode联动,要么都填要么都为空。 |
type | 是 | String | 订单类型;枚举 MARKET , LIMIT , LIMIT_MAKER |
clOrdId | 否 | String | 用户自定义订单ID |
px | 否 | String | 价格,仅当限价单的时候有效,市价无需输入。 |
sz | 是 | String | 委托张数 |
reduceOnly | 否 | Boolean | 只减仓 |
timeInForce | 否 | String | 枚举 FOK ,IOC ,GTC ;非必填,默认是 GTC |
stpMode | 否 | String | Enumerate - EXPIRE_TAKER - EXPIRE_MAKER - EXPIRE_BOTH 默认为NONE |
备注:
posSide持仓方向
- 单向持仓模式下此参数非必填
- 如果填写仅可以选择
BOTH
;在双向持仓模式下必填,且仅可选择LONG
或SHORT
- 双向持仓模式下,side和posSide需要进行组合
- 买入开多(side 填写
BUY
; posSide 填写LONG
) - 卖出开空(side 填写
SELL
; posSide 填写SHORT
) - 卖出平多(side 填写
SELL
;posSide 填写LONG
) - 买入平空(side 填写
BUY
; posSide 填写SHORT
)
- 买入开多(side 填写
- 单向持仓模式下,返回
BOTH
响应参数
参数 | 类型 | 描述 |
---|---|---|
ordId | String | 订单编号 |
clOrdId | String | 用户自定义订单ID |
请求示例
[
{
"symbol": "BTC_USDT_PERP",
"side": "buy",
"mgnMode": "CROSS",
"posSide": "BOTH",
"type": "limit",
"px": "60000",
"sz": "1",
"timeInForce": "GTC",
"stpMode": "",
"reduceOnly": false,
"clOrdId": "310d7fc9-8bb4-472f-b477-d974724f077d"
},
{
"symbol": "BTC_USDT_PERP",
"side": "buy",
"mgnMode": "CROSS",
"posSide": "BOTH",
"type": "limit",
"px": "60000",
"sz": "2",
"timeInForce": "GTC",
"stpMode": "EXPIRE_TAKER",
"reduceOnly": false,
"clOrdId": "2486353f-64d3-4f7d-aa0a-7e34f45b6a6e"
},
{
"symbol": "BTC_USDT_PERP",
"side": "buy",
"mgnMode": "CROSS",
"posSide": "BOTH",
"type": "limit",
"px": "60000",
"sz": "2",
"timeInForce": "GTC",
"stpMode": "EXPIRE_TAKER",
"reduceOnly": false,
"clOrdId": "57faf779-d45b-46ee-87e6-9cb11d5804f4"
},
{
"symbol": "BTC_USDT_PERP",
"side": "sell",
"mgnMode": "CROSS",
"posSide": "BOTH",
"type": "limit_maker",
"px": "60000",
"sz": "1",
"timeInForce": "GTC",
"stpMode": "",
"reduceOnly": false,
"clOrdId": "843afc62-06ec-4439-bace-b93dd4d96fbd"
},
{
"symbol": "BTC_USDT_PERP",
"side": "sell",
"mgnMode": "CROSS",
"posSide": "BOTH",
"type": "limit",
"px": "60000",
"sz": "2",
"timeInForce": "GTC",
"stpMode": "EXPIRE_TAKER",
"reduceOnly": false,
"clOrdId": "fa8011fe-8312-4b23-a671-b0ed34df3f30"
},
{
"symbol": "BTC_USDT_PERP",
"side": "sell",
"mgnMode": "CROSS",
"posSide": "BOTH",
"type": "limit",
"px": "60000",
"sz": "2",
"timeInForce": "GTC",
"stpMode": "EXPIRE_TAKER",
"reduceOnly": false,
"clOrdId": "c9a20e43-1dda-45f4-9f69-3c0656b53161"
}
]
响应示例
{
"code":200,
"data":[
{
"clOrdId":"310d7fc9-8bb4-472f-b477-d974724f077d",
"code":10014,
"msg":"Price limit, high 0.6897,low 0.5643",
"ordId":""
},
{
"clOrdId":"2486353f-64d3-4f7d-aa0a-7e34f45b6a6e",
"code":200,
"msg":"Success",
"ordId":"331377100571541504"
},
{
"clOrdId":"57faf779-d45b-46ee-87e6-9cb11d5804f4",
"code":200,
"msg":"Success",
"ordId":"331377100605095936"
},
{
"clOrdId":"843afc62-06ec-4439-bace-b93dd4d96fbd",
"code":10014,
"msg":"Price limit, high 0.6897,low 0.5643",
"ordId":""
},
{
"clOrdId":"fa8011fe-8312-4b23-a671-b0ed34df3f30",
"code":200,
"msg":"Success",
"ordId":"331377100613484545"
},
{
"clOrdId":"c9a20e43-1dda-45f4-9f69-3c0656b53161",
"code":200,
"msg":"Success",
"ordId":"331377100621873152"
}
],
"msg":"Success"
}