Huobi Global 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, Huobi Global 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 NameData TypeMandatoryDescription
[{ pricestringfalseOrder price (not required for market order)
amountstringtrueOrder size
typestringtrueOrder 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-idstringfalseClient order ID (maximum 64-character)
stop-pricestringfalseTrigger price (for stop limit order only)
operatorstringfalseOperation character (for stop limit order only. gte – greater than and equal (>=), lte – less than and equal (<=))
symbolstringtrueTrading symbol
account-id }]stringtrueAccount 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 NameData TypeMandatoryDescription
statusstringtrueStatus code
err-codestringfalseError code
err-msgstringfalseError message
dataobjecttrueIn same order of the request
[{ order-idlongfalseOrder ID (if rejected, this field is unavailable)
client-order-idstringfalseClient order ID (if any)
err-codestringfalseError code for rejected order only
err-msg }]stringfalseError 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 NameData TypeMandatoryDescription
order-idsstring[]falseOrder ID list (Either order-ids or client-order-ids can be filled in one batch request. No more than 50 orders allowed.)
client-order-idsstring[]falseClient 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 NameData TypeMandatoryDescription
statusstringtrueStatus code
err-codestringfalseError 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 NameData TypeMandatoryDescription
[{ order-idlongfalseOrder ID (Return order ID if the request is based order-id.)
client-order-idstringfalseClient order ID (Return client order ID if the request is based on client-order-id)
err-codestringfalseError code (Only applicable for rejected orders)
err-msgstringfalseError message (Only applicable for rejected orders)
order-state }]stringfalseCurrent 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/

Huobi Global
December 29, 2019