HTX will support a new endpoint to place orders in batch mode and allow user to cancel orders in batch mode based on client order IDs

Dear API user,

Since the effective day of this notification, HTX will support a new endpoint (POST /v1/order/batch-orders) in REST API which allows user to place orders in batch mode. And also, the existing endpoint (POST /v1/order/orders/batchcancel) for batch-cancelling orders will allow user to cancel orders in batch mode based on client order IDs.

 

POST /v1/order/batch-orders

Request Parameters

Field Name Data Type Mandatory Description
[{ price string false Order price (not required for market order)
amount string true Order size
type string true Order type, including: buy-market, sell-market, buy-limit, sell-limit, buy-ioc, sell-ioc, buy-limit-maker, sell-limit-maker, buy-stop-limit, sell-stop-limit
client-order-id string false Client order ID (maximum 64-character)
stop-price string false Trigger price (for stop limit order only)
operator string false Operation character (for stop limit order only. gte – greater than and equal (>=), lte – less than and equal (<=))
symbol string true Trading symbol
account-id }] string true Account ID

 

Example:

[

       {

    "account-id": "123456",

    "price": "7801",

    "amount": "0.001",

    "symbol": "btcusdt",

    "type": "sell-limit",

    "client-order-id": "c1"

       },

       {

    "account-id": "123456",

    "price": "7802",

    "amount": "0.001",

    "symbol": "btcusdt",

    "type": "sell-limit",

    "client-order-id": "d2"

       }

]

Response

Field Name Data Type Mandatory Description
status string true Status code
err-code string false Error code
err-msg string false Error message
data object true In same order of the request
[{ order-id long false Order ID (if rejected, this field is unavailable)
client-order-id string false Client order ID (if any)
err-code string false Error code for rejected order only
err-msg }] string false Error message for rejected order only

 

Example:

{

    "status": "ok",

    "data": [

        {

            "order-id": 61713400772,

            "client-order-id": "c1"

        },

        {

            "order-id": 61713400940,

            "client-order-id": "d2"

        }

    ]

}

POST /v1/order/orders/batchcancel

Request Parameters (Maximum number of orders to be cancelled in one batch request is 50)

Field Name Data Type Mandatory Description
order-ids string[] false Order ID list (Either order-ids or client-order-ids can be filled in one batch request. No more than 50 orders allowed.)
client-order-ids string[] false Client Order ID list (Either order-ids or client-order-ids can be filled in one batch request. No more than 50 orders allowed.)

 

Example:

{

  "client-order-ids": [

   "5983466", "5722939", "5721027","5719487"

  ]

}

Response

Field Name Data Type Mandatory Description
status string true Status code
err-code string false Error code

err-msg

string

false

Error message

data

object

true

 

{ success

string[]

false

Cancelled order list (Can be order ID list or client order list, upon the request.)

  failed }

string[]

false

Failed order list (Can be order ID list or client order list, upon the request.)

 

Failed order list:

Field Name Data Type Mandatory Description
[{ order-id long false Order ID (Return order ID if the request is based order-id.)
client-order-id string false Client order ID (Return client order ID if the request is based on client-order-id)
err-code string false Error code (Only applicable for rejected orders)
err-msg string false Error message (Only applicable for rejected orders)
order-state }] string false Current order state (if any)

 

Example:

 

{

    "status": "ok",

    "data": {

        "success": [

           "5983466"

        ],

        "failed": [

            {

                "err-msg": "Incorrect order state",

                "order-id":"",

                "client-order-id": "5722939",

                "err-code": "order-orderstate-error"

            },

            {

                "err-msg": "Incorrect order state",

                "order-id":"",

                "client-order-id": "5721027",

                "err-code": "order-orderstate-error"

            },

            {

                "err-msg": "Incorrect order state",

                "order-id":"",

                "client-order-id": "5719487",

                "err-code": "order-orderstate-error"

            }

        ]

    }

}

 

Effective Date: December 27, 2019 (GMT+8)

All the changes will be updated on https://huobiapi.github.io/docs/spot/v1/en/

HTX
December 29, 2019