Skip to Content
API ReferenceTradingPositionsSet Stop Loss & Target

Set Stop Loss & Target

This API allows you to add a Stop Loss and Take Profit to an open position.

USE CASE

Set your exit levels on a position after its entry order has traded.

Details

  • This allows the user to add Stop Loss and Take Profit to an existing open position.
  • positionId is mandatory, for example NSE:KWIL-EQ-INTRADAY. Send stopLoss, takeProfit or both.
  • legType is optional: 1 = offset, 2 = percentage.
  • qty is optional and its maximum is the position quantity.
  • The same PATCH /api/v3/positions endpoint is used to modify and to cancel these levels later.
  • This is the Positions API, for an open position. To add Take Profit and Stop Loss to an order that is still pending, see Creating TPSL in the Order Placement Guide.
  • Rate limits differ between the Standard and Prime plans. See Plans & rate limits.

Request Attributes

AttributeData TypeDescription
positionId*string
  • Mandatory. Position id
  • Eg: NSE:KWIL-EQ-INTRADAY
takeProfitfloatTake profit value
stopLossfloatStop loss value
qtyintOptional. Max qty should be position qty
legTypeintOptional. 1 = offset, 2 = percentage

Response Attributes

AttributeData TypeDescription
sstringRequest status, ok on success or error on failure
codeintResponse code (e.g. 1102 on success)
messagestringStatus message, e.g. "Successfully modified order"
id_fyersstringFyers-generated identifier for the position/order operation the stop-loss/target was attached to
Last updated on