Skip to Content

Exit Position

This API allows you to exit all or selected open positions in a single request.

USE CASE

Close all your open positions quickly when you want to get out of the market.

Details

  • This allows the user to either exit all open positions or any specific open position.
  • Send no id and every open position is closed. Send a position id, or a list of ids, to exit only those positions.
  • The exit is done with counter orders. Response code 201 means a counter order was placed but not filled, because of low liquidity or another reason.
  • The response confirms the exit request. Check Get Positions and Get Orders for the final state.
  • To cancel pending orders before exiting, send pending_orders_cancel as 1 in the DELETE body, and add id to limit it to one symbol.
  • Rate limits differ between the Standard and Prime plans. See Plans & rate limits.

Request Attributes

AttributeData TypeDescription
IdstringIn case id is not passed, then all the open positions will be closed

Response Attributes

AttributeData TypeDescription
sstringok / error
codeint
  • This is the code to identify specific responses .
  • If 201 comes in code it implies that counter order has been placed but not filled due to low liquidity or any other reason
messagestring
  • Message to clarify the request status.
  • Eg:All positions are closed

Sample Request :


{
"id": [positionId1,positionId2]
}

Details

  • This is an added functionality for exit position API. If a user has open positions in particular stocks and also working opposite order of the particular stock, the user can close the working orders and then exit the open positions.
  • The following should be passed in the body of the DELETE method of positions to cancel the pending orders:
  • Rate limits differ between the Standard and Prime plans. See Plans & rate limits.
{"pending_orders_cancel": 1} 
If only a single symbol's order and position needs to be cancelled, the position ID should also be sent in the body:
{"id": "NSE:SBIN-EQ-INTRADAY","pending_orders_cancel": 1}

Request Attributes

AttributeData TypeDescription
pending_orders_cancel*intMust be set to 1 in the request body to cancel the pending working order(s) associated with a position before exiting it. Eg: 1
idstringOptional. Position ID to target a single symbol's working order and position for cancellation/exit instead of all. Eg: NSE:SBIN-EQ-INTRADAY

Response Attributes

AttributeData TypeDescription
sstringStatus of the request. Eg: ok / error
codeintResponse code identifying the specific response. Eg: 200
messagestringMessage describing the result of the request. Eg: The position is closed.
Last updated on