Skip to content

Cancel Order ​

This endpoint allows users to cancel a pending or partially filled order by providing either the system-generated order_no or a client-defined reference_id. If both are provided, the system will prioritize order_no. Two order cancellation methods are available:

  1. Single Crypto Cancel Order: Cancel order for a single crypto
  2. Batch Crypto Cancel Order: Cancel order for multiple cryptos (up to 5 simultaneous cryptocurrency orders)

Single Crypto Cancel Order ​

HTTP Request ​

bash
DELETE /trade/v1/orders

Request Parameters ​

NameTypeRequiredDescription
order_noSTRINGNoInternal order number generated by the system.
reference_idSTRINGNoCustom client-defined identifier for the order.

Example cURL Request ​

bash
curl --location --request DELETE '{$base_url}/trade/v1/orders' \
--header 'X-API-Key: YOUR_API_KEY' \
--header 'X-API-Signature: YOUR_GENERATED_SIGNATURE' \
--header 'X-API-Timestamp: 1746774142003' \
--header 'Content-Type: application/json' \
--data-raw '{
    "order_no": "22000000022"
    "reference_id": ""
}'

Successful Response Example ​

json
{
	"code": 0
}

Error Response Example ​

json
{
	"code": 030202,
	"message": "Invalid Parameter",
	"details": "order_no or reference_id is invalid"
}

See the Error Code Reference for details on possible error codes.


Batch Crypto Cancel Order ​

HTTP Request ​

bash
DELETE /trade/v1/orders/batch

Request Parameters ​

NameTypeRequiredDescription
order_noSTRINGNoInternal order number generated by the system.
reference_idSTRINGNoCustom client-defined identifier for the order.

Example cURL Request ​

bash
curl --location --request DELETE '{$base_url}/trade/v1/orders/batch' \
--header 'X-API-Key: YOUR_API_KEY' \
--header 'X-API-Signature: YOUR_GENERATED_SIGNATURE' \
--header 'X-API-Timestamp: 1746774142003' \
--header 'Content-Type: application/json' \
--data-raw '[{
    "order_no": "22000000022"
    "reference_id": ""
},{
    "order_no": "22000000023"
    "reference_id": ""
},{
    "order_no": "22000000024"
    "reference_id": ""
}]'

Successful Response Example ​

json
{
    "code": 0,
    "data": [
        {
            "order_no": "22000000022",
            "result": {
                "code": 0,
            }
        },
        {
            "order_no": "22000000023",
            "result": {
                "code": 0,
            }
        },
        {
            "order_no": "22000000024",
            "result": {
                "code": 11030204,
                "message": "Order Limit"
            }
        }
    ]
}

Error Response Example ​

json
{
	"code": 030202,
	"message": "Invalid Parameter",
	"details": "order_no or reference_id is invalid"
}

WebSocket Callback - Cancel Order Notification ​

To receive order status notifications, you should use a WebSocket connection. This allows your system to stay updated on changes such as order submission, partial fills, full fills, cancellations, or rejections.

WebSocket Endpoint for Order Status ​

To subscribe to order status updates, connect to the following WebSocket endpoint:

wss://{{base_url}}/ws/trade/v1

Once connected and authenticated, the server will push real-time updates regarding your active orders directly through this WebSocket channel.


WebSocket Message Fields ​

FieldTypeDescription
marketENUMMarket code (e.g., hkex, nasdaq)
order_typeENUMOrder type (e.g., limit, enhanced limit)
symbolSTRINGCode of the traded product
nameSTRINGName of the product
order_sideENUMOrder direction: buy or sell
account_codeSTRINGTrading account ID
order_noSTRINGSystem-generated order number
order_statusENUMOrder status after cancellation (can)
priceDECIMALOrder price
qtyDECIMALOriginal quantity
reference_idSTRINGClient-defined identifier
portfolio_idSTRINGPortfolio ID (which is a user-defined external id ) to distinguish between orders from different portfolios.
update_timeLONGLast updated timestamp (UNIX seconds)
create_timeLONGOrder creation timestamp
sub_accountSTRINGSub-user ID

WebSocket Callback Example ​

json
{
	"type": "order",
	"data": {
		"market": "hkex",
		"order_type": "enhanced_limit_order",
		"symbol": "00700",
		"name": "TENCENT",
		"order_side": "buy",
		"account_code": "80114138",
		"order_no": "22000000022",
		"order_status": "can",
		"price": 423.83,
		"qty": 1000,
		"outstand_qty": 0,
		"execute_qty": 0,
		"execute_amount": 0,
		"charge": 0,
		"charge_base_currency": "HKD",
		"base_currency": "HKD",
		"reference_id": "",
		"portfolio_id": "",
		"reject_reason": "",
		"update_time": 1746775317,
		"create_time": 1746775257,
		"sub_account": ""
	}
}