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
idand 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_cancelas 1 in the DELETE body, and addidto limit it to one symbol. - Rate limits differ between the Standard and Prime plans. See Plans & rate limits.
Request Attributes
| Attribute | Data Type | Description |
|---|---|---|
Id | string | In case id is not passed, then all the open positions will be closed |
Response Attributes
| Attribute | Data Type | Description |
|---|---|---|
s | string | ok / error |
code | int |
|
message | string |
|
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
| Attribute | Data Type | Description |
|---|---|---|
pending_orders_cancel* | int | Must be set to 1 in the request body to cancel the pending working order(s) associated with a position before exiting it. Eg: 1 |
id | string | Optional. 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
| Attribute | Data Type | Description |
|---|---|---|
s | string | Status of the request. Eg: ok / error |
code | int | Response code identifying the specific response. Eg: 200 |
message | string | Message describing the result of the request. Eg: The position is closed. |
Last updated on