Submit multiple orders

Rate limit: 3 every second

API Overview


HTTP method

POST

Path

/api/v2/batchOrders

Summary

Submit up to 10 orders as a batch.

API description


HTTP Header

Field Type Required Description Example
X-API-KEY string Y ApiKey "HlkcGxbqBeaF76j4rvPaOasyfPwnkQ
6B6DQ6THZWbvrAGxzEdulXQvOKLrRW
ZLnN"

Request parameters

Field Type Required Description Example
orders List[SubmitOrderRequest] Y Orders to submit. /

Request example

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"
        }
    ]
}'

Response fields

Field Type Required Description Example
resultInfo ResultInfo Y Information returned by the API /
data List[SubmitOrderResult] Y Result of batch submit orders. /

Response example

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

Status code

Value Description
100000 Unknown error
100001 Invalid argument
104209 Partial batch operation failed

Model


SubmitOrderRequest

Submit order request description

Field Type Required Description Example
exchangeId integer Y Exchange ID 1
orderId integer Y Order ID 1
accountId integer Y Account ID 1
tokenSId integer Y The ID of the token to be sold 0
tokenBId integer Y The ID of the token to be bought 2
amountS string Y Number of tokens to be sold "1000000000000000000"
amountB string Y Number of tokens to be bought "1000000000000000000"
allOrNone string N Whether the order can only be filled completely or 0 deals, currently only supports false "false"
buy string Y Buy until buy or sell until buy "true"
validSince integer Y Order effective time, accuracy is in seconds 1567053142
validUntil integer Y Order expiration time, accuracy is in seconds 1567053142
maxFeeBips integer Y Maximum order fee that the user can accept, value range (in ten thousandths) 1 ~ 63 20
label integer Y Order label, used to indicate the order attribute or source, etc., to participate in order signature, value range 0 ~ 65535 20
signatureRx string Y Rx part of order signed result "13375450901292179417
15497484957179306991
15173547203971250276
33242680470075859"
signatureRy string Y Ry part of order signed result "13375450901292179417
15497484957179306991
15173547203971250276
33242680470075859"
signatureS string Y S part of order signed result "13375450901292179417
15497484957179306991
15173547203971250276
33242680470075859"
clientOrderId string N The unique order ID of the client "1"
channelId string N Order channel ID, used to indicate from which channel the order was submitted "hebao::subchannel::0
001"
orderType string N Order type
Allowable : ['LIMIT_ORDER', 'TAKER_ONLY', 'MAKER_ONLY']
"LIMIT_ORDER"

SubmitOrderResult

Single order submission results.

Field Type Required Description Example
hash string Y Hash of order submitted "0xfb5e711c2f044e9432
2ed262229cd8f0d0da00
c22e1a00a0f5d881e45a
38e1cf"
error ResultInfo N Error for order submission failure. /

results matching ""

    No results matching ""