API Update on 2020/01/12-Announcement on Adding Automatic Order Cancellation API on HTX

Dear users,

HTX has added the automatic order cancellation API, called the Dead man’s switch, to protect the user’s assets when the connection to the exchange is lost due to network or system errors. HTX has added the “Dead man’s switch” API at 18:00 on January 11, 2021 (GMT+8), allowing users to cancel all of the user’s orders on the spot market during an accidental disconnection from the platform. Details are as follows:

Automatic Order Cancellation
Turn on/off the Dead man’s switch. If the Dead man’s switch is turned on and the API call isn’t sent twice within the set time, the platform will cancel all of your orders on the spot market(a maximum cancellation of 500 orders).

HTTP Request

POST/v2/algo-orders/cancel-all-after

Example Request

POST /v2/order/cancel-all-after{"timeout":"10"}(Parameters are placed in the HTTP Body)Request Parameter

Name Mandatory Type Description Default Value Range of Value
timeout true int time out duration (unit:second); see notes for details NA 0 or >=5 seconds

Notes:

  • The best practice is to set timeout as 60 seconds and send an API call every 15 seconds if you want to turn on the Dead man’s switch. This will keep your orders unchanged during temporary network congestion and guard your assets under extreme circumstances such as a power failure. Therefore, we suggest that you set timeout as >=5 seconds to avoid unnecessary cancellation of your orders due to frequency limitation or network congestion.  
  • Set timeout as 0 if you want to cancel the API operation and keep your orders open.

Response Data

Name Mandatory Type Description
code true int status code
message false string error description (if any)
data true object  
{ currentTime true long current time
triggerTime } true long trigger time

Example Response – Turn On Successful

Response:
{

"code": 200,

"data": [

    {

       "currentTime":"1587971400",

       "triggerTime":"1587971460"

  }

]

}

Example Response – Turn Off Successful

Response:
{

"code": 200,

"data": [

    {

       "currentTime":"1587971400",

       "triggerTime":"0"

  }

]

}

Example Response – Turn On/Off Failed

Response:
{

"code": 2003,

"message": "missing mandatory field"

}

How will the newly-added APIs affect me?

API users need to evaluate how the API improvements will help with their trades and update relevant Apps accordingly.

Effective Date: January 11, 2021 (GMT+8)

Please refer to HTX API Docs or the Spot API Change Log for details.

API users need to evaluate how the API improvements will help with their trades and update relevant Apps accordingly.