Trades Endpoints

New Order

  • Path: /api/v1/trade/order

  • Method: POST

  • Description: Send new order

  • Body:

β”œβ”€ symbol: String (Mandatory)
β”œβ”€ side: String (Mandatory) (SELL, BUY)
β”œβ”€ positionSide: String (Mandatory) (Default NET for One-way Mode ; LONG or SHORT for Hedge Mode. It must be sent in Hedge Mode.)
β”œβ”€ type: String (Mandatory) (Order type: LIMIT, MARKET, STOP, TAKE_PROFIT,STOP_MARKET, TAKE_PROFIT_MARKET, TRAILING_STOP_MARKET, POST_ONLY)
β”œβ”€ reduceOnly: String (Mandatory) ("true" or "false". default "false". Cannot be sent in Hedge Mode; cannot be sent with closePosition=true.not supported)
β”œβ”€ quantity: Number (Mandatory) (Cannot be sent with closePosition=true(Close-All))
β”œβ”€ price: Number (Mandatory)
β”œβ”€ clientOrderId: String (Mandatory) (A unique id among open orders. Automatically generated if not sent. Can only be string following the rule: ^[\.A-Z\:/a-z0-9_-]{1,36}$)
β”œβ”€ stopPrice: Number (Used with STOP/STOP_MARKET or TAKE_PROFIT/TAKE_PROFIT_MARKET orders)
β”œβ”€ closePosition: String (true, false;Close-All,used with STOP_MARKET or TAKE_PROFIT_MARKET.not supported)
β”œβ”€ activationPrice: Number (Used with TRAILING_STOP_MARKET orders, default as the latest price(supporting different workingType))
β”œβ”€ callbackRate: Number (Used with TRAILING_STOP_MARKET orders, min 0.1, max 5 where 1 for 1%)
β”œβ”€ timeInForce: String (Mandatory) (GTC, IOC, FOK, GTX)
β”œβ”€ workingType: String (stopPrice triggered by: "MARK_PRICE", "CONTRACT_PRICE". Default "CONTRACT_PRICE")
└─ priceProtect: String ("TRUE" or "FALSE", default "FALSE". Used with STOP/STOP_MARKET or TAKE_PROFIT/TAKE_PROFIT_MARKET orders.not supported)

Condition orders will be triggered when:

-STOP, STOP_MARKET: BUY: latest price ("MARK_PRICE" or "CONTRACT_PRICE") >= stopPrice SELL: latest price ("MARK_PRICE" or "CONTRACT_PRICE") <= stopPrice

-TAKE_PROFIT, TAKE_PROFIT_MARKET: BUY: latest price ("MARK_PRICE" or "CONTRACT_PRICE") <= stopPrice SELL: latest price ("MARK_PRICE" or "CONTRACT_PRICE") >= stopPrice

  • Response:

β”œβ”€ code: Number
β”œβ”€ msg: String
└─ data: Object
   β”œβ”€ clientOrderId: String  (User defined order number)
   └─ orderId: String  (System order number)
  • Example:

Request:

{
  "symbol": "ETH-USDC",
  "side": "BUY",
  "type": "LIMIT",
  "quantity": 1,
  "price": 2500,
  "clientOrderId": "00000001",
  "timeInForce": "GTC",
}

Response:

{
  "code": 0,
  "msg": "",
  "data": {
    "clientOrderId": "",
    "orderId": ""
  }
}

Cancel Order

  • Path: /api/v1/trade/cancelOrder

  • Method: POST

  • Description: Cancel order by orderId and clientOrderId

  • Body:

β”œβ”€ symbol: String (Mandatory)
β”œβ”€ orderId: String  (System order number)
└─ clientOrderId: String  (User defined order number)
  • Response:

β”œβ”€ code: Number
└─ msg: String
  • Example:

Request:

{
  "symbol": "ETH-USDC",
  "orderId": "37266642",
  "clientOrderId": "000000001"
}

Response:

{
  "code": 0,
  "msg": ""
}

Query Current Open Order

  • Path: /api/v1/trade/openOrders

  • Method: GET

  • Description: Query current open order

  • Parameters:

└─ symbol: String
  • Response:

β”œβ”€ code: Number
β”œβ”€ msg: String
└─ data: Array
   β”œβ”€ symbol: String
   β”œβ”€ side: String
   β”œβ”€ positionSide: String
   β”œβ”€ status: String
   β”œβ”€ price: String
   β”œβ”€ origQty: String  (Original quantity)
   β”œβ”€ origType: String  (Original order type)
   β”œβ”€ type: String  (order type)
   β”œβ”€ timeInForce: String
   β”œβ”€ orderId: String  (System order number)
   β”œβ”€ clientOrderId: String  (User defined order number)
   β”œβ”€ reduceOnly: Boolean  (if reduce position only)
   β”œβ”€ workingType: String  (Conditional price trigger type)
   β”œβ”€ stopPrice: String  (please ignore when order type is TRAILING_STOP_MARKET)
   β”œβ”€ closePosition: Boolean  (if Close-All)
   β”œβ”€ activatePrice: String  (activation price, only return with TRAILING_STOP_MARKET order)
   β”œβ”€ priceRate: String  (callback rate, only return with TRAILING_STOP_MARKET order)
   β”œβ”€ priceProtect: Boolean  (if conditional order trigger is protected)
   β”œβ”€ orderTime: Number
   β”œβ”€ cumQuote: String  (trades amount)
   β”œβ”€ executedQty: String  (trades quantity)
   β”œβ”€ avgPrice: String  (trades price)
   β”œβ”€ updateTime: Number
   └─ frozenMargin: String
  • Example:

Request:

https://api.aboard.exchange/arbitrum/api/v1/trade/openOrders?symbol=ETH-USDC

Response:

{
  "code": 0,
  "msg": "",
  "data": [
    {
      "symbol": "ETH-USDC",
      "side": "BUY",
      "positionSide": "SHORT",
      "status": "NEW",
      "price": "0",
      "origQty": "0.40",
      "origType": "TRAILING_STOP_MARKET",
      "type": "TRAILING_STOP_MARKET",
      "timeInForce": "GTC",
      "orderId": "1573346959",
      "clientOrderId": "abc",
      "reduceOnly": false,
      "workingType": "LAST_PRICE",
      "stopPrice": "9300",
      "closePosition": false,
      "activatePrice": "9020",
      "priceRate": "0.3",
      "priceProtect": false,
      "orderTime": 1579276756075,
      "cumQuote": "0",
      "executedQty": "0",
      "avgPrice": "0.00000",
      "updateTime": 1579276756075,
      "frozenMargin": "12.34"
    }
  ]
}

Query Order

  • Path: /api/v1/trade/order

  • Method: GET

  • Description: Query order

  • Parameters:

β”œβ”€ symbol: String (Mandatory)
β”œβ”€ orderId: String  (System order number)
└─ clientOrderId: String  (User defined order number)
  • Response:

β”œβ”€ code: Number
β”œβ”€ msg: String
└─ data: Object
   β”œβ”€ symbol: String
   β”œβ”€ side: String
   β”œβ”€ positionSide: String
   β”œβ”€ status: String  (Order status)
   β”œβ”€ price: String
   β”œβ”€ origQty: String  (Original quantity)
   β”œβ”€ origType: String  (Original order type)
   β”œβ”€ type: String  (Order type)
   β”œβ”€ timeInForce: String
   β”œβ”€ orderId: String  (System order number)
   β”œβ”€ clientOrderId: String  (User defined order number)
   β”œβ”€ reduceOnly: Boolean  (if reduce position only)
   β”œβ”€ workingType: String  (Conditional price trigger type)
   β”œβ”€ stopPrice: String  (please ignore when order type is TRAILING_STOP_MARKET)
   β”œβ”€ closePosition: Boolean  (if Close-All)
   β”œβ”€ activatePrice: String  (activation price, only return with TRAILING_STOP_MARKET order)
   β”œβ”€ priceRate: String  (callback rate, only return with TRAILING_STOP_MARKET order)
   β”œβ”€ priceProtect: Boolean  (if conditional order trigger is protected)
   β”œβ”€ orderTime: Number
   β”œβ”€ cumQuote: String  (trades amount)
   β”œβ”€ executedQty: String  (trades quantity)
   β”œβ”€ avgPrice: String  (trades price)
   └─ updateTime: Number
  • Example:

Request:

https://api.aboard.exchange/arbitrum/api/v1/trade/order?symbol=ETH-USDC&orderId=&clientOrderId=

Response:

{
  "code": 0,
  "msg": "",
  "data": {
    "symbol": "ETH-USDC",
    "side": "BUY",
    "positionSide": "SHORT",
    "status": "NEW",
    "price": "0",
    "origQty": "0.40",
    "origType": "TRAILING_STOP_MARKET",
    "type": "TRAILING_STOP_MARKET",
    "timeInForce": "GTC",
    "orderId": "1573346959",
    "clientOrderId": "abc",
    "reduceOnly": false,
    "workingType": "LAST_PRICE",
    "stopPrice": "9300",
    "closePosition": false,
    "activatePrice": "9020",
    "priceRate": "0.3",
    "priceProtect": false,
    "orderTime": 1579276756075,
    "cumQuote": "0",
    "executedQty": "0",
    "avgPrice": "0.00000",
    "updateTime": 1579276756075
  }
}

Query History Orders

  • Path: /api/v1/trade/historyOrders

  • Method: GET

  • Description: Query history orders

  • Parameters:

β”œβ”€ symbol: String (Mandatory)
β”œβ”€ orderId: String  (If orderId is set, it will get orders >= that orderId. Otherwise most recent orders are returned)
β”œβ”€ startTime: Number
β”œβ”€ endTime: Number
└─ limit: Number  (Number of result sets returned, default:100 maximum:500)
  • Response:

β”œβ”€ code: Number
β”œβ”€ msg: String
└─ data: Array
   β”œβ”€ symbol: String
   β”œβ”€ side: String
   β”œβ”€ positionSide: String
   β”œβ”€ status: String  (Order status)
   β”œβ”€ price: String
   β”œβ”€ origQty: String  (Original quantity)
   β”œβ”€ origType: String  (Original order type)
   β”œβ”€ type: String  (Order type)
   β”œβ”€ timeInForce: String
   β”œβ”€ orderId: String  (System order number)
   β”œβ”€ clientOrderId: String  (User defined order number)
   β”œβ”€ reduceOnly: Boolean  (if reduce position only)
   β”œβ”€ workingType: String  (Conditional price trigger type)
   β”œβ”€ stopPrice: String  (please ignore when order type is TRAILING_STOP_MARKET)
   β”œβ”€ closePosition: Boolean  (if Close-All)
   β”œβ”€ activatePrice: String  (activation price, only return with TRAILING_STOP_MARKET order)
   β”œβ”€ priceRate: String  (callback rate, only return with TRAILING_STOP_MARKET order)
   β”œβ”€ priceProtect: Boolean  (if conditional order trigger is protected)
   β”œβ”€ orderTime: Number
   β”œβ”€ cumQuote: String  (trades amount)
   β”œβ”€ executedQty: String  (trades quantity)
   β”œβ”€ avgPrice: String  (trades price)
   └─ updateTime: Number
  • Example:

Request:

https://api.aboard.exchange/arbitrum/api/v1/trade/historyOrders?symbol=ETH-USDC&orderId=&startTime=1628575642000&endTime=1628585642000&limit=100

Response:

{
  "code": 0,
  "msg": "",
  "data": [
    {
      "symbol": "ETH-USDC",
      "side": "BUY",
      "positionSide": "SHORT",
      "status": "NEW",
      "price": "0",
      "origQty": "0.40",
      "origType": "TRAILING_STOP_MARKET",
      "type": "TRAILING_STOP_MARKET",
      "timeInForce": "GTC",
      "orderId": "1573346959",
      "clientOrderId": "abc",
      "reduceOnly": false,
      "workingType": "LAST_PRICE",
      "stopPrice": "9300",
      "closePosition": false,
      "activatePrice": "9020",
      "priceRate": "0.3",
      "priceProtect": false,
      "orderTime": 1579276756075,
      "cumQuote": "0",
      "executedQty": "0",
      "avgPrice": "0.00000",
      "updateTime": 1579276756075
    }
  ]
}

Query History Trades

  • Path: /api/v1/trade/historyTrades

  • Method: GET

  • Description: Query history trades

  • Parameters:

β”œβ”€ symbol: String (Mandatory)
β”œβ”€ fromId: String  (TradeId to fetch from. Default gets most recent trades)
β”œβ”€ startTime: Number
β”œβ”€ endTime: Number
└─ limit: Number  (Number of result sets returned, default:100 maximum:500)
  • Response:

β”œβ”€ code: Number
β”œβ”€ msg: String
└─ data: Array
   β”œβ”€ symbol: String
   β”œβ”€ side: String
   β”œβ”€ positionSide: String
   β”œβ”€ orderId: Number
   β”œβ”€ id: String  (Trades id)
   β”œβ”€ price: String
   β”œβ”€ qty: String  (trades quantity)
   β”œβ”€ quoteQty: String  (trades amount)
   β”œβ”€ realizedPnl: String  (Profit and loss)
   β”œβ”€ commission: String
   β”œβ”€ commissionAsset: String
   β”œβ”€ maker: Boolean  (if maker)
   β”œβ”€ doneTime: Number
   └─ tradeType: String  (Standard; Liquidation; Auto Deleveraging)
  • Example:

Request:

https://api.aboard.exchange/arbitrum/api/v1/trade/historyTrades?symbol=ETH-USDC&fromId=&startTime=1628575642000&endTime=1628585642000&limit=100

Response:

{
  "code": 0,
  "msg": "",
  "data": [
    {
      "symbol": "ETH-USDC",
      "side": "SELL",
      "positionSide": "SHORT",
      "orderId": 25851813,
      "id": "698759",
      "price": "7819.01",
      "qty": "0.002",
      "quoteQty": "15.63802",
      "realizedPnl": "-0.91539999",
      "commission": "-0.07819010",
      "commissionAsset": "USDT",
      "maker": false,
      "doneTime": 1569514978020,
      "tradeType": "Standard"
    }
  ]
}

Set Leverage

  • Path: /api/v1/trade/setLeverage

  • Method: POST

  • Description: Set leverage for contract

  • Parameters:

    β”œβ”€ symbol: String (Mandatory)
    └─ leverage: Number (Leverage value)
  • Response:

    β”œβ”€ code: Number
    └─ msg: String
  • Example:

Request:

{ 
"symbol": "ETH-USDC", 
"leverage": 10 
}

Response:

{
  "code": 0,
  "msg": ""
}

Query Leverage

  • Path: /api/v1/trade/symbolLeverage

  • Method: GET

  • Description: Query leverage

  • Parameters:

    └─ symbol: String (Mandatory)
  • Response:

    β”œβ”€ code: Number
    β”œβ”€ msg: String
    └─ data: Object
      β”œβ”€ symbol: String
      └─ leverage: Number (Leverage value)
  • Example:

Request:

https://api.aboard.exchange/arbitrum/api/v1/trade/symbolLeverage?symbol=ETH-USDC

Response:

{
  "code": 0,
  "msg": "",
  "data": [
    {
      "symbol": "ETH-USDC",
      "leverage": 10
    }
  ]
}

Last updated