Submit an order

Rate limit: 5 every second

API Overview


HTTP method

POST

Path

/api/v3/order

Summary

Submit an order

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
exchange string Y The adderss of the exchange which has to process this order "1"
accountId integer Y Loopring's account ID 1
storageId integer Y The unique identifier of the L2 Merkle tree storage slot where the burn made in order to exit the pool will or has been stored. 1
sellToken TokenVolumeV3 Y Wrapper object used to describe a token associated with a certain quantity. "TokenVolume{tokenId: 0, volume: 1234}"
buyToken TokenVolumeV3 Y Wrapper object used to describe a token associated with a certain quantity. "TokenVolume{tokenId: 0, volume: 1234}"
allOrNone string Y Whether the order supports partial fills or not.Currently only supports false as a valid value "false"
fillAmountBOrS string Y Fill size by buy token or by sell token "true"
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
eddsaSignature string Y The orders EdDSA signature. The signature is a hexadecimal string obtained by signing the order itself and concatenating the resulting signature parts (Rx, Ry, and S). Used to authenticate and authorize the operation. "13375450901292179417
15497484957179306991
15173547203971250276
33242680470075859"
clientOrderId string N An arbitrary, client-set unique order identifier, max length is 120 bytes "1"
orderType string N Order types, can be AMM, LIMIT_ORDER, MAKER_ONLY, TAKER_ONLY
Allowable : ['LIMIT_ORDER', 'TAKER_ONLY', 'MAKER_ONLY', 'AMM']
"LIMIT_ORDER"
tradeChannel string N field.SubmitOrderRequestV3.tradeChannel
Allowable : ['ORDER_BOOK', 'AMM_POOL', 'MIXED']
"ORDER_BOOK"
taker string N Used by the P2P order which user specify the taker, so far its 0x0000000000000000000000000000000000000000 "0x506d67A6f22927a2DA
a20a9510EA73D5E66Baf
18"
poolAddress string N The AMM pool address if order type is AMM "0x506d67A6f22927a2DA
a20a9510EA73D5E66Baf
18"
affiliate string N An accountID who will recieve a share of the fee of this order "10068"

Request example

HTTP
CURL
POST https://api3.loopring.io/api/v3/order HTTP/1.1
Host: api3.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

{
    "exchange" : "1",
    "accountId" : 1,
    "storageId" : 1,
    "sellToken" : {
        "tokenId" : 0,
        "volume" : "1000000000000"
    },
    "buyToken" : {
        "tokenId" : 0,
        "volume" : "1000000000000"
    },
    "allOrNone" : "false",
    "fillAmountBOrS" : "true",
    "validUntil" : 1567053142,
    "maxFeeBips" : 20,
    "eddsaSignature" : "13375450901292179417154974849571793069911517354720397125027633242680470075859",
    "clientOrderId" : "1",
    "orderType" : "LIMIT_ORDER",
    "tradeChannel" : "ORDER_BOOK",
    "taker" : "0x506d67A6f22927a2DAa20a9510EA73D5E66Baf18",
    "poolAddress" : "0x506d67A6f22927a2DAa20a9510EA73D5E66Baf18",
    "affiliate" : "10068"
}
curl -X POST -H "X-API-KEY:sra1aavfa" -H "Content-Type:application/json" https://api3.loopring.io/api/v3/order -d \
'{
    "exchange" : "1",
    "accountId" : 1,
    "storageId" : 1,
    "sellToken" : {
        "tokenId" : 0,
        "volume" : "1000000000000"
    },
    "buyToken" : {
        "tokenId" : 0,
        "volume" : "1000000000000"
    },
    "allOrNone" : "false",
    "fillAmountBOrS" : "true",
    "validUntil" : 1567053142,
    "maxFeeBips" : 20,
    "eddsaSignature" : "13375450901292179417154974849571793069911517354720397125027633242680470075859",
    "clientOrderId" : "1",
    "orderType" : "LIMIT_ORDER",
    "tradeChannel" : "ORDER_BOOK",
    "taker" : "0x506d67A6f22927a2DAa20a9510EA73D5E66Baf18",
    "poolAddress" : "0x506d67A6f22927a2DAa20a9510EA73D5E66Baf18",
    "affiliate" : "10068"
}'

Response fields

Field Type Required Description Example
hash string Y Order hash of submit order response "13375450901292179417
15497484957179306991
15173547203971250276
33242680470075859"
clientOrderId string Y The clientOrderId of the submitted order "client_order_id"
status string Y Order status of submit order response
Allowable : ['processing', 'processed', 'cancelling', 'cancelled', 'expired', 'failed']
"cancelled"
isIdempotent boolean Y Idempotent of submit order response, submit same order again when order was UNKNOWN or WAIT_FREEZE_BALANCE in relayer, idempotent will be true
Allowable : [True, False]
"false"

Response example

{
    "hash" : "13375450901292179417154974849571793069911517354720397125027633242680470075859",
    "clientOrderId" : "client_order_id",
    "status" : "cancelled",
    "isIdempotent" : false
}

Status code

Value Description
100000 Unknown error
100001 Invalid argument
102001 Exchange ID is incorrect
102002 Unsupported TokenId in the order
102003 Invalid account ID
102004 Invalid order ID
102005 Market does not support
102006 Illegal rate field
102007 Order already exists
102008 Order has expired
102010 Order is missing signature information
102011 Insufficient user balance
102012 The order amount is too small
102014 Failed to freeze the amount, please try again later
102020 Exceeded the maximum order amount
102021 Nonce is invalid
102027 Submit order failed
102120 Order is not valid
104001 Empty ApiKey
104002 Invalid ApiKey
104003 Invalid Account ID
104004 No signature information provided
104005 Wrong signature information

Model


TokenVolumeV3

Wrapper object used to describe a token associated with a certain quantity.

Field Type Required Description Example
tokenId integer Y The Loopring's token identifier. 0
volume string Y The volume of the token "1000000000000"

results matching ""

    No results matching ""