跳到主要内容

批量下单

描述

此接口用于批量下单,最多可以下10个订单。

HTTP请求

POST /v3/trade/orders

请求参数

参数是否必填类型描述
symbolString交易对。常用形式为“基础货币”+“报价货币”
sideString枚举:BUY and SELL
mgnModeString保证金模式, CROSS:全仓;ISOLATED:逐仓。开平模式下必填,买卖模式下与posSide联动,要么都填要么都为空。
posSideString双向持仓模式下必填,且仅可选择 LONGSHORT。开平模式下必填,买卖模式下与mgnMode联动,要么都填要么都为空。
typeString订单类型;枚举 MARKET, LIMIT, LIMIT_MAKER
clOrdIdString用户自定义订单ID
pxString价格,仅当限价单的时候有效,市价无需输入。
szString委托张数
reduceOnlyBoolean只减仓
timeInForceString枚举 FOKIOCGTC;非必填,默认是 GTC
stpModeStringEnumerate
- EXPIRE_TAKER
- EXPIRE_MAKER
- EXPIRE_BOTH
默认为NONE

备注:

posSide持仓方向

  • 单向持仓模式下此参数非必填
  • 如果填写仅可以选择 BOTH ;在双向持仓模式下必填,且仅可选择 LONGSHORT
  • 双向持仓模式下,side和posSide需要进行组合
    • 买入开多(side 填写 BUY; posSide 填写 LONG
    • 卖出开空(side 填写 SELL; posSide 填写 SHORT
    • 卖出平多(side 填写 SELL;posSide 填写 LONG
    • 买入平空(side 填写 BUY; posSide 填写 SHORT
  • 单向持仓模式下,返回 BOTH

响应参数

参数类型描述
ordIdString订单编号
clOrdIdString用户自定义订单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"
}