Skip to content

Place Order

Jason Zong edited this page Jun 2, 2018 · 11 revisions

Place a new order.

Request POST /v1/placeorder

HTTP Request Header

  • Authorization: Bearer <token> Token obtained when signing in

Params

  • traderAddr Trader address
  • pairId String of trading pair, e.g. "ETH_LOOM"
  • amount Amount of token to buy or sell
  • price Order price in ethereum
  • action "Buy" or "Sell"
  • nonce Order nonce. The recommended value is the current timestamp in millisecond
  • expireTimeSec Order expire time (timestamp in second)
  • sig signature of Keccak256(SHA3) of signing message using private key of the trader address.

Signing Message

Field Length Note
Prefix 40 "\x19Ethereum Signed Message:\n70DEx2 Order: "
Market Address 20 DEx address: 0x7600977eb9effa627d6bd0da2e5be35e11566341
Nonce 8
ExpireTimeSec 8
AmountE8 8 Amount * 1e8
PriceE8 8 Price * 1e8
IoC(Immediate or Cancel) 1 Only 0 is supported for now
Action 1 Buy=0, Sell=1
PairId 4 int32(tokenCode(A)) << 16 | int32(tokenCode(B))

Sample Request

 {
   "amount": "66.51501244",
   "price": "0.00150342",
   "action": "Buy",
   "nonce": 1522290645732,
   "expireTimeSec": 1522377045,
   "sig": "0x3d42c49bebfc912d5b6698556db273e9e38b72928b052eccd967a4bb4d31cb007b363a1a30d45ee5055b64a8a7d8bac7fc1d4d2f3009d910b856467699a58b4f00",
   "pairId": "ETH_ADX"
 }

Sample Response

 {
   "order": {
     "orderId": "10000004",
     "pairId": "ETH_ADX",
     "action": "Buy",
     "price": "0.01000000",
     "amountTotal": "10.00000000",
     "amountFilled": "0.00000000",
     "filledAveragePrice": "0.00000000",
     "status": "Unfilled", // "Filled" or "Unfilled" or "PartiallyFilled" or "Cancelled" or "Expired"
     "createTimeMs": "1522554774421",
     "updateTimeMs": "1522554774421",
     "expireTimeSec": "1522641169",
     "nonce": "1522554769144"
   }
 }

Clone this wiki locally