Cancel Order
Cancel an existing trade order.
Endpoint
POST /api/v3/tradeOrder/cancel
Description
Cancels an open trade order. Only orders with status OPEN or PENDING can be cancelled.
Authentication
Requires Bearer token authentication.
Authorization: Bearer {access_token}
Request Body
| Field | Type | Required | Description |
|---|---|---|---|
tradeOrderId | string | Yes | ID of the order to cancel |
Response
Returns the cancelled trade order object.
| Field | Type | Description |
|---|---|---|
tradeOrderId | string | Order identifier |
tradingAccountId | string | Trading account ID |
venue | string | Exchange venue |
instrumentId | string | Instrument identifier |
orderSide | string | Order side |
orderType | string | Order type |
status | string | Order status (CANCELLED) |
quantity | string | Original order quantity |
executedQuantity | string | Quantity filled before cancellation |
cancelledAt | integer | Cancellation timestamp (milliseconds) |
Usage
import requests
headers = {"Authorization": f"Bearer {access_token}"}
response = requests.post(
"https://cadenza-api-uat.algo724.com/api/v3/tradeOrder/cancel",
headers=headers,
json={
"tradeOrderId": "770e8400-e29b-41d4-a716-446655440002"
}
)
cancelled_order = response.json()["data"]
print(f"Order {cancelled_order['tradeOrderId']} status: {cancelled_order['status']}")
curl -X POST https://cadenza-api-uat.algo724.com/api/v3/tradeOrder/cancel \
-H "Authorization: Bearer eyJhbGciOiJIUzI1NiIs..." \
-H "Content-Type: application/json" \
-d '{"tradeOrderId": "770e8400-e29b-41d4-a716-446655440002"}'
Example Response
{
"data": {
"tradeOrderId": "770e8400-e29b-41d4-a716-446655440002",
"tradingAccountId": "550e8400-e29b-41d4-a716-446655440000",
"venue": "BINANCE",
"instrumentId": "BINANCE:BTC/USDT",
"baseAsset": "BTC",
"quoteAsset": "USDT",
"orderSide": "BUY",
"orderType": "LIMIT",
"timeInForce": "GTC",
"status": "CANCELLED",
"limitPrice": "50000.00",
"quantity": "0.001",
"executedQuantity": "0",
"executedCost": "0",
"createdAt": 1703052635110,
"updatedAt": 1703052700000,
"cancelledAt": 1703052700000
},
"success": true,
"errno": 0,
"error": null
}
Error Responses
| HTTP Code | Error | Description |
|---|---|---|
| 400 | Invalid request | Missing order ID |
| 401 | Unauthorized | Invalid or expired access token |
| 404 | Not found | Order not found |
| 400 | Cannot cancel | Order already filled or cancelled |
Example Error
{
"data": null,
"success": false,
"errno": -111001,
"error": "Order is already filled and cannot be cancelled"
}
Notes
- Only
OPENorPENDINGorders can be cancelled - Partially filled orders can be cancelled (unfilled portion is cancelled)
- The
executedQuantityshows how much was filled before cancellation - Cancellation is processed by the exchange and may take a moment
- Use the WebSocket API for real-time cancellation confirmation