批量提交订单

流量控制: 3 每 秒

摘要


HTTP 方法

POST

访问路径

/api/v2/batchOrders

功能

批量提交订单,最多一次可以提交10个订单

API 描述


HTTP头

字段 类型 必须 说明 举例
X-API-KEY string ApiKey "HlkcGxbqBeaF76j4rvPaOasyfPwnkQ
6B6DQ6THZWbvrAGxzEdulXQvOKLrRW
ZLnN"

请求参数

字段 类型 必须 说明 举例
orders List[SubmitOrderRequest] 要提交的订单 /

请求示例

HTTP
CURL
POST https://api.loopring.io/api/v2/batchOrders HTTP/1.1
Host: api.loopring.io
Connection: keep-alive
Accept: */*
Accept-Encoding: gzip, deflate, br
Accept-Language: zh,en;q=0.9
X-API-KEY: sra1aavfa
Content-Type: application/json

{
    "orders" : [
        {
            "exchangeId" : 1,
            "orderId" : 1,
            "accountId" : 1,
            "tokenSId" : 0,
            "tokenBId" : 2,
            "amountS" : "1000000000000000000",
            "amountB" : "1000000000000000000",
            "allOrNone" : "false",
            "buy" : "true",
            "validSince" : 1567053142,
            "validUntil" : 1567053142,
            "maxFeeBips" : 20,
            "label" : 20,
            "signatureRx" : "13375450901292179417154974849571793069911517354720397125027633242680470075859",
            "signatureRy" : "13375450901292179417154974849571793069911517354720397125027633242680470075859",
            "signatureS" : "13375450901292179417154974849571793069911517354720397125027633242680470075859",
            "clientOrderId" : "1",
            "channelId" : "hebao::subchannel::0001",
            "orderType" : "LIMIT_ORDER"
        }
    ]
}
curl -X POST -H "X-API-KEY:sra1aavfa" -H "Content-Type:application/json" https://api.loopring.io/api/v2/batchOrders -d \
'{
    "orders" : [
        {
            "exchangeId" : 1,
            "orderId" : 1,
            "accountId" : 1,
            "tokenSId" : 0,
            "tokenBId" : 2,
            "amountS" : "1000000000000000000",
            "amountB" : "1000000000000000000",
            "allOrNone" : "false",
            "buy" : "true",
            "validSince" : 1567053142,
            "validUntil" : 1567053142,
            "maxFeeBips" : 20,
            "label" : 20,
            "signatureRx" : "13375450901292179417154974849571793069911517354720397125027633242680470075859",
            "signatureRy" : "13375450901292179417154974849571793069911517354720397125027633242680470075859",
            "signatureS" : "13375450901292179417154974849571793069911517354720397125027633242680470075859",
            "clientOrderId" : "1",
            "channelId" : "hebao::subchannel::0001",
            "orderType" : "LIMIT_ORDER"
        }
    ]
}'

响应字段

字段 类型 必须 说明 举例
resultInfo ResultInfo API返回信息 /
data List[SubmitOrderResult] 批量提交订单的详细结果 /

响应示例

{
    "resultInfo" : {
        "code" : 0,
        "message" : "SUCCESS"
    },
    "data" : [
        {
            "hash" : "0xfb5e711c2f044e94322ed262229cd8f0d0da00c22e1a00a0f5d881e45a38e1cf",
            "error" : {
                "code" : 0,
                "message" : "SUCCESS"
            }
        }
    ]
}

状态码

状态码 描述
100000 未知错误
100001 参数非法
104209 批量操作部分失败

模型


SubmitOrderRequest

提交订单参数

字段 类型 必须 说明 举例
exchangeId integer 交易所ID 1
orderId integer 订单ID 1
accountId integer 账户ID 1
tokenSId integer 需要卖出的Token ID 0
tokenBId integer 需要买入的Token ID 2
amountS string 需要卖出的Token数量 "1000000000000000000"
amountB string 需要买入的Token数量 "1000000000000000000"
allOrNone string 订单是否只能完全成交或者0成交, 目前只支持false "false"
buy string 买到为止或者卖出为止 "true"
validSince integer 订单生效时间, 精确到秒 1567053142
validUntil integer 订单失效时间, 精确到秒 1567053142
maxFeeBips integer 用户可以接受的最大订单费用, 取值范围(万分之)1~63 20
label integer 订单标签,用来标示订单属性或者来源等, 参与订单签名, 取值范围0~65535 20
signatureRx string 订单签名结果Rx部分 "13375450901292179417
15497484957179306991
15173547203971250276
33242680470075859"
signatureRy string 订单签名结果Ry部分 "13375450901292179417
15497484957179306991
15173547203971250276
33242680470075859"
signatureS string 订单签名结果S部分 "13375450901292179417
15497484957179306991
15173547203971250276
33242680470075859"
clientOrderId string 客户端标识的订单唯一ID "1"
channelId string 订单渠道号, 用来标示订单从哪个渠道提交 "hebao::subchannel::0
001"
orderType string 订单类型
取值范围 : ['LIMIT_ORDER', 'TAKER_ONLY', 'MAKER_ONLY']
"LIMIT_ORDER"

SubmitOrderResult

单个订单的提交结果

字段 类型 必须 说明 举例
hash string 提交的订单的HASH "0xfb5e711c2f044e9432
2ed262229cd8f0d0da00
c22e1a00a0f5d881e45a
38e1cf"
error ResultInfo 提交订单的失败错误信息 /

results matching ""

    No results matching ""