Skip to main content

Get SL/TP Information

API Description

This interface allows querying the stop loss (SL) and take profit (TP) information for both filled and unfilled orders in futures trading.

Note: SL/TP information is only available via RESTful API.

Precautions

None

Authentication

This is a private interface and requires authentication. For details on using the RESTful API, refer to Introduction > Authentication & Code Snippet > Futures > RESTful Private Interface.

Request Method

GET

Endpoint

/v1/perpum/TPSL

Frequency Limit

The frequency limit for this interface is 10 requests/2s per user ID and IP. In addition to this per-interface limit, a global rate limit is also enforced.

For detailed information on Global rate limits and API Rate Limiting Policy, please refer to the "Frequency Limit" section at click here

Request Parameters

ParameterMandatoryTypeDescription
orderIdfalseLongOrder ID
openIdfalseLongPosition ID
planOrderIdfalseLongPlan order ID
stopFromtrueIntegerStop loss and take profit order type:
1: Requires an Order ID of the "plan" order.
2: Requires a Position ID from the "execute" market.
3: Requires a Plan Order ID from the "planTrigger" order.
Note: Depending upon the order type,corresponding ID is mandatory to be specified.
instrumentfalseStringThe base currency of the instrument. (e.g., BTC or btc). This parameter is case-insensitive.
Note: For instruments that start with numbers (e.g., 1000PEPE), both uppercase and lowercase formats are valid.

Response Parameters

ParameterTypeDescription
currentPieceBigDecimalNumber of current stop loss and take profit orders
closePieceBigDecimalNumber of contracts in batch stop loss and take profit orders
directionStringTrade direction: long, short
createdDateLongOrder creation timestamp
updatedDateLongTimestamp of latest update
idStringID
indexPriceBigDecimalIndex price at trigger
instrumentStringBase currency of the instrument e.g., BTC or ETH.
leverageIntegerPosition leverage
openIdLongPosition ID
priceTypeIntegerTrigger price type for stop loss and take profit :
1: index price
2: latest price
3: mark price
stopLossPriceBigDecimalStop loss price
stopLossRateBigDecimalStop loss rate
stopProfitPriceBigDecimalTake profit price
stopProfitRateBigDecimalTake profit rate
stopLossOrderPriceStringStop loss limit price
stopProfitOrderPriceStringTake profit limit price
stopProfitTypeStringPerpetual contract plan order type after triggering:
plan: Limit price
execute: Market price
stopLossTypeStringPerpetual contract plan order type after triggering:
plan: Limit price
execute: Market price
triggerStatusIntegerTake profit and stop loss trigger status:
0: Not triggered,
1: Triggered,
2: Canceled
userIdLongFutures account user ID
positionModelIntegerPosition margin mode:
0: Isolated margin
1: Cross margin
stopTypeIntegerStop loss and take profit order type:
1: Limit order
2: Market order3: Plan order
orderIdLongOrder ID

Request Example

The following Python code shows how to get the stop loss and take profit information for a filled order.

Note: For a complete code example, please refer to Introduction > Authentication & Code Snippet > Futures > RESTful Private Interface.

params = {
"openId" : "2435521222632076385", # position ID
"stopFrom" : "2", # 2: Position
}
api_url = "/v1/perpum/TPSL"
method = "GET"
response_code, response_data = FuturesRestfulPrivate(params, api_url, method, sec_key, api_key)
print(f"Response Code: {response_code}") # function FuturesRestfulPrivate() is defined in section (Introduction > Authentication & Code Snippet > Futures > RESTful Private Interface)

Note: For a complete Java code example, please refer to Introduction > Authentication & Code Snippet > Futures > RESTful Private Interface.

Response Example

The following is an example response returned by the above Python request:

{'code': 0,
'data': [{'closePiece': 2,
'createdDate': 1740771128000,
'currentPiece': 2,
'direction': 'long',
'id': 33308288734471132,
'indexPrice': 84530.2,
'instrument': 'BTC',
'leverage': 2,
'openId': 2435521222632076385,
'positionModel': 0,
'priceType': 2,
'stopLossPrice': 82000,
'stopLossRate': 0.05404302,
'stopLossType': 'execute',
'stopProfitPrice': 95000,
'stopProfitRate': 0.2544624,
'stopProfitType': 'execute',
'stopType': 2,
'triggerStatus': 0,
'updatedDate': 1740771128000,
'userId': 1162061}],
'msg': ''}