tpSl action creates take-profit (TP) and stop-loss (SL) trigger orders for an existing position. Unlike regular orders, TP/SL orders do not consume margin when created — they sit dormant and automatically place a real closing order when the market reaches the trigger price.
You can set a TP only, an SL only, or both in a single request. For position-level TP/SL (isPositionTpsl: true), the closing direction is determined automatically from the position side — you don’t need to specify it. The position must already exist before you create position-level TP/SL orders.
Endpoint
Request
All requests must include an ECDSA signature and a millisecond-precision nonce.Action fields
string
required
Fixed value:
"tpSl".int32
required
The contract ID the TP/SL orders apply to.
int8
Identifies the position side:
0 = ONE_WAY, 1 = LONG, 2 = SHORT. Defaults to 0.boolean
When
true, creates position-level TP/SL orders that automatically close the position when triggered. When false, creates standalone trigger orders. Defaults to false.string
The side of the order placed when the trigger fires:
"B" = buy, "S" = sell. Used only for standalone trigger orders (isPositionTpsl = false); for position-level TP/SL the closing direction is inferred automatically.boolean
When
true, the triggered order is marked reduce-only and will only execute if it reduces an open position. Defaults to false.string
Trigger price for the take-profit leg. Set to
"0" to skip the TP leg. At least one of tpPrice or slPrice must be greater than "0".string
Trigger price for the stop-loss leg. Set to
"0" to skip the SL leg. At least one of tpPrice or slPrice must be greater than "0".string
Limit price used when the TP trigger fires.
"0" = execute as a market IOC order after triggering. Any positive value = execute as a GTC limit order at that price.string
Limit price used when the SL trigger fires.
"0" = execute as a market IOC order after triggering. Any positive value = execute as a GTC limit order at that price.string
The position size to close when the TP triggers.
"0" = close the entire position.string
The position size to close when the SL triggers.
"0" = close the entire position.int8
The price feed used to evaluate the TP trigger:
0 = mark price, 1 = index price, 2 = last traded price. Defaults to 0.int8
The price feed used to evaluate the SL trigger:
0 = mark price, 1 = index price, 2 = last traded price. Defaults to 0.Response
Success
Response fields
int64
The order ID assigned to the take-profit trigger order. Returns
0 if the TP leg was not set (i.e., tpPrice was "0").int64
The order ID assigned to the stop-loss trigger order. Returns
0 if the SL leg was not set (i.e., slPrice was "0").