Guides
Guides

Edit SL/TP

Modify previously set stop-loss or take-profit values on an open position.

Prices are USDT levels. The currency is inherited from the position.

stoploss_order_id and takeprofit_order_id are required for the legs being edited. Omitting them returns 400 risk order id missing. Fetch them from Open Positions (stoploss.order_id / takeprofit.order_id).

Request

curl -X PATCH "https://trade.mudrex.com/fapi/v1/futures/positions/{position_id}/riskorder" \
  -H "Content-Type: application/json" \
  -H "X-Authentication: your-secret-key" \
  -d '{
    "stoploss_price": "0.095",
    "takeprofit_price": "0.14",
    "stoploss_order_id": "019ecc5d-d102-7c2e-a1ee-84df95bcc2c2",
    "takeprofit_order_id": "019ecc5d-d102-7c31-97cb-33d44488c69b",
    "is_stoploss": true,
    "is_takeprofit": true,
    "trigger_type": "MARKET"
  }'

Parameters

ParameterTypeRequiredDescription
position_idstringYesThe unique identifier of the position (path parameter).
stoploss_pricenumberConditionalRequired if is_stoploss is true. New stop loss price (USDT).
takeprofit_pricenumberConditionalRequired if is_takeprofit is true. New take profit price (USDT).
stoploss_order_idstringConditionalRequired to edit the SL leg. ID of the existing stop loss order.
takeprofit_order_idstringConditionalRequired to edit the TP leg. ID of the existing take profit order.
trigger_typestringNoTrigger type: MARKET or LIMIT.
is_stoplossbooleanNoWhether to update the stop loss order (default: false).
is_takeprofitbooleanNoWhether to update the take profit order (default: false).

Response

Status: 200 OK

{
    "success": true,
    "data": {
        "message": "Risk order amended successfully"
    }
}

Response fields

FieldDescription
messageStatus message.

Errors

Common errors

Missing risk order idstoploss_order_id / takeprofit_order_id not supplied.

{
    "success": false,
    "errors": [
        { "code": 400, "text": "risk order id missing" }
    ]
}

Status: 400 Bad Request

Position not found

{
    "success": false,
    "errors": [
        { "code": 404, "text": "Position not found" }
    ]
}

Status: 404 Not Found

Position not in OPEN state

{
    "success": false,
    "errors": [
        { "code": 400, "text": "Position is not in OPEN state" }
    ]
}

Status: 400 Bad Request