Super Order
Super orders are built for smart execution of your trades. They are a collection of orders clubbed into single order request, which includes entry leg, target leg and stop loss leg along with the option to add trailing stop loss.
This particular set of APIs can be used to create, modify and cancel super orders. You can place super orders across all exchanges and segments.
POST | /super/orders | Create a new super order |
PUT | /super/orders/{order-id} | Modify a pending super order |
DELETE | /super/orders/{order-id}/{order-leg} | Cancel a pending super order leg |
GET | /super/orders | Retrieve the list of all super orders |
Place Super Order
The super order request API lets you place new super orders. You can place a combination of orders using this API, wether that be entry leg, target leg and stop loss leg.
This order type is available across segments and exchanges. You can place intraday, carry forward or even MTF orders via this order type.
curl --request POST \
--url https://api.dhan.co/v2/super/orders \
--header 'Content-Type: application/json' \
--header 'access-token: JWT' \
--data '{Request JSON}'
Request Structure
{
"dhanClientId": "1000000003",
"correlationId": "123abc678",
"transactionType": "BUY",
"exchangeSegment": "NSE_EQ",
"productType": "CNC",
"orderType": "LIMIT",
"securityId": "11536",
"quantity": 5,
"price": 1500,
"targetPrice": 1600,
"stopLossPrice": 1400,
"trailingJump": 10
}
Parameters
Field | Type | Description |
dhanClientId required |
string | User specific identification generated by Dhan |
correlationId | string | The user/partner generated id for tracking back |
transactionType required |
enum string | The trading side of transaction BUY SELL |
exchangeSegment required |
enum string | Exchange Segment of instrument to be subscribed as found in Annexure |
productType required |
enum string | Product typeCNC INTRADAY MARGIN MTF |
orderType required |
enum string | Order TypeLIMIT
MARKET |
securityId required |
string | Exchange standard ID for each scrip. Refer here |
quantity required |
int | Number of shares for the order |
price required |
float | Price at which order is placed |
targetPrice required |
float | Target Price for the Super Order |
stopLossPrice required |
float | Stop Loss Price for the Super Order |
trailingJump required |
float | Price Jump by which Stop Loss should be trailed |
Response Structure
{
"orderId": "112111182198",
"orderStatus": "PENDING",
}
Parameters
Field | Type | Description |
orderId | string | Order specific identification generated by Dhan |
orderStatus | enum string | Last updated status of the order TRANSIT
PENDING
REJECTED
|
Modify Super Order
This API can be used to modify any leg of a Super Order till it is in PENDING
or PART_TRADED
state.
Note
Order Entry Leg ENTRY_LEG
can help modify the entire super order and can only be modified when the order status is PENDING
or PART_TRADED
. Once the entry order status is TRADED
, only TARGET_LEG
and STOP_LOSS_LEG
price and trail jump can be modified.
curl --request PUT \
--url https://api.dhan.co/v2/super/orders/{order-id} \
--header 'Content-Type: application/json' \
--header 'access-token: JWT' \
--data '{Request JSON}'
Request Structure
{
"dhanClientId":"1000000009",
"orderId":"112111182045",
"orderType":"LIMIT",
"legName":"ENTRY_LEG",
"quantity":"40",
"price":"1300",
"targetPrice": 1450,
"stopLossPrice": 1350,
"trailingJump": 20
}
{
"dhanClientId":"1000000009",
"orderId":"112111182045",
"legName":"TARGET_LEG",
"targetPrice": 1450
}
{
"dhanClientId":"1000000009",
"orderId":"112111182045",
"legName":"STOP_LOSS_LEG",
"stopLossPrice": 1350,
"trailingJump": 20
}
Parameters
Field | Type | description |
dhanClientId required |
string | User specific identification generated by Dhan |
orderId required |
string | Order specific identification generated by Dhan |
orderType conditionally required |
enum string | Order Type LIMIT
MARKET |
legName required |
enum string |
ENTRY_LEG - Entire Super Order can be modified, only when main order status is `PENDING` or `PART_TRADED` TARGET_LEG
STOP_LOSS_LEG |
quantity conditionally required |
int | Quantity to be modified - only for ENTRY_LEG |
price conditionally required |
float | Price to be modified - only for ENTRY_LEG |
targetPrice conditionally required |
float | Target Price to be modified - ENTRY_LEG or TARGET_LEG |
stopLossPrice conditionally required |
float | Stop Loss Price to be modified - ENTRY_LEG or STOP_LOSS_LEG |
trailingJump conditionally required |
float | Stop Loss Price jump to be modified - ENTRY_LEG or STOP_LOSS_LEG If trailing jump is not added or passed as 0 , it will be cancelled |
Response Structure
{
"orderId": "112111182045",
"orderStatus": "TRANSIT"
}
Parameters
Field | Type | Description |
orderId | string | Order specific identification generated by Dhan |
orderStatus | enum string | Last updated status of the order TRANSIT
PENDING
REJECTED
TRADED
|
Cancel Super Order
Users can cancel a pending/active super order using the order ID. There is no body for request and response for this call. On successful completion of request ‘202 Accepted’ response status code will appear.
curl --request DELETE \
--url https://api.dhan.co/v2/super/orders/{order-id}/{order-leg} \
--header 'Content-Type: application/json' \
--header 'access-token: JWT'
Path Parameters
Field | Description | Example |
order-id required |
Order ID of the Order being cancelled | 11211182198 |
order-leg required |
Order Leg to be cancelled | ENTRY_LEG
TARGET_LEG
STOP_LOSS_LEG |
Note: Cancelling main order ID cancels all legs. If particular target or stop loss leg is cancelled, then the same cannot be added again.
Response Structure
{
"orderId": "112111182045",
"orderStatus": "CANCELLED"
}
Parameters
Field | Type | Description |
orderId | string | Order specific identification generated by Dhan |
orderStatus | enum string | Last updated status of the order TRANSIT
PENDING
REJECTED
CANCELLED
|
Super Order List
This API lets you retrieve an array of all super orders placed in a day with their last updated status. This is a special order book which only consists of Super Orders, where the target and stop loss orders are nested under the main entry order leg. Individual legs of each super order can also be found in the main order book with their Order ID.
curl --request GET \
--url https://api.dhan.co/v2/super/orders \
--header 'Content-Type: application/json' \
--header 'access-token: JWT'
Request Structure
No Body
Response Structure
[
{
"dhanClientId": "1100003626",
"orderId": "5925022734212",
"correlationId": "string",
"orderStatus": "PENDING",
"transactionType": "BUY",
"exchangeSegment": "NSE_EQ",
"productType": "CNC",
"orderType": "LIMIT",
"validity": "DAY",
"tradingSymbol": "HDFCBANK",
"securityId": "1333",
"quantity": 10,
"remainingQuantity": 10,
"ltp": 1660.95,
"price": 1500,
"afterMarketOrder": false,
"legName": "ENTRY_LEG",
"exchangeOrderId": "11925022734212",
"createTime": "2025-02-27 19:09:42",
"updateTime": "2025-02-27 19:09:42",
"exchangeTime": "2025-02-27 19:09:42",
"omsErrorDescription": "",
"averageTradedPrice": 0,
"filledQty": 0,
"legDetails": [
{
"orderId": "5925022734212",
"legName": "STOP_LOSS_LEG",
"transactionType": "SELL",
"totalQuatity": 0,
"remainingQuantity": 0,
"triggeredQuantity": 0,
"price": 1400,
"orderStatus": "PENDING",
"trailingJump": 10
},
{
"orderId": "5925022734212",
"legName": "TARGET_LEG",
"transactionType": "SELL",
"remainingQuantity": 0,
"triggeredQuantity": 0,
"price": 1550,
"orderStatus": "PENDING",
"trailingJump": 0
}
]
}
]
Parameters
Field | Type | Description |
dhanClientId | string | User specific identification generated by Dhan |
orderId | string | Order specific identification generated by Dhan |
correlationId | string | The user/partner generated id for tracking back |
orderStatus | enum string | Last updated status of the order TRANSIT
PENDING
CLOSED
REJECTED
CANCELLED
PART_TRADED
TRADED |
transactionType | enum string | The trading side of transaction BUY
SELL |
exchangeSegment | enum string | Exchange Segment of instrument to be subscribed as found in Annexure |
productType | enum string | Product type of tradeCNC INTRADAY MARGIN MTF |
orderType | enum string | Order TypeLIMIT
MARKET |
validity | enum string | Validity of OrderDAY |
tradingSymbol | string | Refer Trading Symbol in Tables |
securityId | string | Exchange standard ID for each scrip. Refer here |
quantity | int | Number of shares for the order |
remainingQuantity | int | Quantity pending execution |
ltp | float | Last Traded Price of the instrument |
price | float | Price at which order is placed |
afterMarketOrder | boolean | If the order is placed after market |
legName | enum string | Leg identification in case of BO ENTRY_LEG
TARGET_LEG
STOP_LOSS_LEG |
trailingJump | float | Price Jump by which Stop Loss should be trailed |
exchangeOrderId | string | Exchange generated ID for the order |
createTime | string | Time at which the order is created |
updateTime | string | Last updated time of the order |
exchangeTime | string | Time at which order was sent to the exchange |
omsErrorDescription | string | Description of error in case the order is rejected or failed |
remainingQuantity | integer | Quantity pending at the exchange to be traded (quantity - filledQty) |
averageTradedPrice | integer | Average price at which order is traded |
filledQty | integer | Quantity of order traded on Exchange |
triggeredQuantity | integer | Quantity of Stop Loss or Target legs which has been placed on Exchange |
legDetails | []array | Array of Leg Details |
Note
There are two order status updates that needs to be considered. CLOSED
is used when the ENTRY_LEG and one of either TARGET_LEG or STOP_LOSS_LEG is also triggered for entire quantity. TRIGGERED
is present for TARGET_LEG and STOP_LOSS_LEG which indicates which of the two is actually triggered and then triggeredQuantity
can be referred to check the placed quantity.
Note: For description of enum values, refer Annexure