Cancel Position Take Profit and Stop Loss
Cancel Position Take Profit and Stop Loss
Cancel existing position take profit and stop loss orders, supporting both spot and contract trading.
Request frequency limit: 1/s
Rate limit rule: UserID
Request URL
POST /deepcoin/trade/cancel-position-sltp
Request Parameters
| Field Name | Required | Type | Description |
|---|---|---|---|
| instType | true | string | Product type Spot: SPOTContract: SWAP |
| instId | true | string | Product ID e.g., BTC-USDT for spot, BTC-USDT-SWAP for contract |
| ordId | true | string | SLTP Order ID Obtained from set-position-sltp API response or trigger order query |
Notes:
- The
ordIdis returned when setting position TP/SL via theset-position-sltpAPI - You can also query pending trigger orders to get the
ordId
Request Example
Cancel spot position TP/SL:
{
"instType": "SPOT",
"instId": "BTC-USDT",
"ordId": "1000762096073860"
}
Cancel contract position TP/SL:
{
"instType": "SWAP",
"instId": "BTC-USDT-SWAP",
"ordId": "1000596068909100"
}
Response Parameters
| Field Name | Type | Description |
|---|---|---|
| ordId | string | Order ID |
| sCode | string | Event execution result status code0: Success |
| sMsg | string | Rejection message if the request is unsuccessful |
Response Example
Successful response:
{
"code": "0",
"msg": "",
"data": {
"ordId": "1000762096073860",
"sCode": "0",
"sMsg": ""
}
}
Failed response (order not found):
{
"code": "51400",
"msg": "Order does not exist",
"data": {
"ordId": "1000762096073860",
"sCode": "51400",
"sMsg": "Order does not exist"
}
}
Failed response (order already executed):
{
"code": "51401",
"msg": "Order already executed",
"data": {
"ordId": "1000762096073860",
"sCode": "51401",
"sMsg": "Order already executed or canceled"
}
}
Description
Functionality
- Cancel existing position take profit and stop loss orders
- Supports both spot (SPOT) and contract (SWAP) trading
- Can only cancel pending TP/SL orders (not yet triggered)
Use Cases
- Strategy Adjustment: Cancel existing TP/SL to set new levels
- Market Change Response: Remove TP/SL when market conditions change
- Manual Control: Take manual control of position closing instead of automatic TP/SL
- Error Correction: Cancel incorrectly set TP/SL orders
Important Notes
- Order ID Required: You must have the
ordIdfrom the set-position-sltp response - Order Status: Can only cancel pending orders; already triggered or executed orders cannot be canceled
- Query Orders: Use the trigger-orders-pending API to query existing TP/SL orders and get their IDs
- Timing: Once a TP/SL order is triggered, it cannot be canceled
- Verification: Ensure the order belongs to your account before attempting to cancel
Related APIs
- Set Position TP/SL:
/deepcoin/trade/set-position-sltp- Set new TP/SL orders - Modify Position TP/SL:
/deepcoin/trade/modify-position-sltp- Modify existing TP/SL orders - Query Pending Trigger Orders:
/deepcoin/trade/trigger-orders-pending- Query existing TP/SL orders - Query Trigger Order History:
/deepcoin/trade/trigger-orders-history- Query historical TP/SL orders