cancelTpSl action cancels all TP/SL trigger orders associated with a specific position, identified by contract ID and position side. This is the fastest way to remove all trigger orders for a position without having to look up and cancel individual order IDs.
This action is idempotent: if there are no active TP/SL orders for the specified position, the request succeeds and returns cancelledCount: 0 rather than an error.
Endpoint
Request
All requests must include an ECDSA signature and a millisecond-precision nonce.Action fields
string
required
type (required) — Fixed value: "cancelTpSl".int32
required
a (required) — The contract ID whose TP/SL orders you want to cancel.int8
positionSide — Scopes the cancellation by position side: 0 = cancel all TP/SL orders for the entire contract, 1 = cancel LONG position TP/SL only, 2 = cancel SHORT position TP/SL only. Defaults to 0.Response
status: "ok"; response.data then carries a non-zero errorCode and an errorMessage.
Response fields
int
The number of TP/SL trigger orders that were cancelled. A value of
0 means no orders were found for the specified position — this is not an error condition.number
Present only when the request is rejected; a non-zero value means nothing was cancelled.
string
Present together with
errorCode. The rejection reason.