Skip to content

Orders

The order management API lets you place a new order, cancel or modify the pending order, retrieve the order status, trade status, order book & tradebook.

POST /orders Place a new order
PUT /orders/{order-id} Modify a pending order
DELETE /orders/{order-id} Cancel a pending order
POST /orders/slicing Slice order into multiple legs over freeze limit
GET /orders Retrieve the list of all orders for the day
GET /orders/{order-id} Retrieve the status of an order
GET /orders/external/{correlation-id} Retrieve the status of an order by correlation id
GET /trades Retrieve the list of all trades for the day
GET /trades/{order-id} Retrieve the details of trade by an order id

place_order Place a new order
modify_order Modify a pending order
cancel_order Cancel a pending order
place_slice_order Slice order into multiple legs over freeze limit
get_order_list Retrieve the list of all orders for the day
get_order_by_id Retrieve the status of an order
get_order_by_corelationID Retrieve the status of an order by correlation id
get_trade_book Retrieve the list of all trades for the day
get_trade_book(order_id) Retrieve the details of trade by an order id

Order Placement

The order request API lets you place new orders.

curl --request POST \
--url https://api.dhan.co/orders \
--header 'Content-Type: application/json' \
--header 'access-token: JWT' \
--data '{Request JSON}'
dhan.place_order(data)


Request Structure

{
    "dhanClientId":"1000000003",
    "correlationId":"123abc678",
    "transactionType":"BUY",
    "exchangeSegment":"NSE_EQ",
    "productType":"INTRADAY",
    "orderType":"MARKET",
    "validity":"DAY",
    "tradingSymbol":"",
    "securityId":"11536",
    "quantity":"5",
    "disclosedQuantity":"",
    "price":"",
    "triggerPrice":"",
    "afterMarketOrder":false,
    "amoTime":"",
    "boProfitValue":"",
    "boStopLossValue": "",
    "drvExpiryDate":"string",
    "drvOptionType":"CALL"
    "drvStrikePrice": -3.402823669209385e+38
}
dhan.place_order(
    tag='',
    transaction_type=dhan.BUY,
    exchange_segment=dhan.NSE,
    product_type=dhan.INTRA,
    order_type=dhan.MARKET,
    validity='DAY',
    security_id='1333',
    quantity=10,
    disclosed_quantity=0,
    price=0,
    trigger_price=0,
    after_market_order=False,
    amo_time='OPEN',
    bo_profit_value=0,
    bo_stop_loss_Value=0,
    drv_expiry_date=None,
    drv_options_type=None,
    drv_strike_price=None    
)


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
NSE_EQ NSE_FNO NSE_CURRENCY BSE_EQ BSE_FNO BSE_CURRENCY MCX_COMM
productType
required
enum string Product type
CNC  INTRADAY MARGIN MTF  CO BO
orderType
required
enum string Order Type
LIMIT  MARKET  STOP_LOSS  STOP_LOSS_MARKET
validity
required
enum string Validity of Order
DAY IOC
tradingSymbol string Refer Trading Symbol in Tables
securityId
required
string Exchange standard id for each scrip. Refer here
quantity
required
int Number of shares for the order
disclosedQuantity int Number of shares visible (Keep more than 30% of quantity)
price
required
float Price at which order is placed
triggerPrice
conditionally required
float Price at which the order is triggered, in case of SL-M & SL-L
afterMarketOrder
conditionally required
boolean Flag for orders placed after market hours
amoTime
conditionally required
enum sting Timing to pump the after market order
OPEN OPEN_30 OPEN_60
boProfitValue
conditionally required
float Bracket Order Target Price change
boStopLossValue
conditionally required
float Bracket Order Stop Loss Price change
drvExpiryDate string Contract Expiry Date for F&O
drvOptionType enum string Type of Option
CALL PUT
drvStrikePrice float Strike Price for Options

Field Type Description
tag string The user/partner generated id for tracking back.
transaction_type
required
string The trading side of transaction
BUY  SELL
exchange_segment
required
string Exchange & Segment
NSE FNO  CUR BSE MCX
product_type
required
string Product type
CNC  INTRA MARGIN MTF CO BO
order_type
required
string Order Type
LIMIT MARKET SL SLM
validity
required
string Validity of Order
DAY IOC
security_id
required
string Exchange standard id for each scrip. Refer here
quantity
required
int Number of shares for the order
disclosed_quantity int Number of shares visible (Keep more than 30% of quantity)
price
required
float Price at which order is placed
trigger_price
conditionally required
float Price at which the order is triggered, in case of SL-M & SL-L
after_market_order
conditionally required
boolean Flag for orders placed after market hours
amo_Time
conditionally required
string Timing to pump the after market order
OPEN OPEN_30 OPEN_60
bo_profit_value
conditionally required
float Bracket Order Target Price change
bo_stop_loss_value
conditionally required
float Bracket Order Stop Loss Price change
drv_expiry_date string Contract Expiry Date for F&O
drv_options_type string Type of Option
CALL PUT
drv_strike_price float Strike Price for Options


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 CANCELLED TRADED EXPIRED

Order Modification

Using this API one can modify pending order in orderbook. The variables that can be modified are price, quantity, order type & validity. The user has to mention the desired value in fields.

curl --request PUT \
--url https://api.dhan.co/orders/{order-id} \
--header 'Content-Type: application/json' \
--header 'access-token: JWT' \
--data '{Request JSON}'
dhan.modify_order(data)


Request Structure

{
    "dhanClientId":"1000000009",
    "orderId":"112111182045",
    "orderType":"LIMIT",
    "legName":"",
    "quantity":"40",
    "price":"3345.8",
    "disclosedQuantity":"10",
    "triggerPrice":"",
    "validity":"DAY"
}
dhan.modify_order(
    order_id='112111182045',
    order_type=dhan.LIMIT,
    leg_name='',
    quantity=40,
    price=3345.8,
    disclosed_quantity=10,
    trigger_price=0,
    validity=dhan.DAY
)


Parameters

Field Type description
dhanClientId
required
string User specific identification generated by Dhan
orderId
required
string Order specific identification generated by Dhan
orderType
required
enum string Order Type
LIMIT MARKET STOP_LOSS STOP_LOSS_MARKET
legName
conditionally required
enum string In case of BO & CO, which leg is modified
ENTRY_LEG TARGET_LEG STOP_LOSS_LEG
quantity
required
int Number of shares for the order. In case of partially executed order, pass the remaining quantity only.
price
required
float Price at which order is placed
disclosedQuantity int Number of shares visible (if opting keep >30% of quantity)
triggerPrice
conditionally required
float Price at which the order is triggered, in case of SL-M & SL-L
validity
required
enum string Validity of Order
DAY IOC

Field Type description
order_id
required
string Order specific identification generated by Dhan
order_type
required
string Order Type
LIMIT MARKET SL SLM
leg_name
conditionally required
string In case of BO & CO, which leg is modified
ENTRY_LEG TARGET_LEG STOP_LOSS_LEG
quantity
required
int Number of shares for the order. In case of partially executed order, pass the remaining quantity only.
price
required
float Price at which order is placed
disclosed_quantity int Number of shares visible (Keep more than 30% of quantity)
trigger_price
conditionally required
float Price at which the order is triggered, in case of SL-M & SL-L
validity
required
string Validity of Order
DAY IOC


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 CANCELLED TRADED EXPIRED

Order Cancellation

Users can cancel a pending order in the orderbook using the order id of an order. 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/orders/{order-id} \
--header 'Content-Type: application/json' \
--header 'access-token: JWT'
dhan.cancel_order(order_id)


Request Structure

No Body


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 TRADED EXPIRED

Order Slicing

This API helps you slice your order request into multiple orders to allow you to place over freeze limit quantity for F&O instruments.

curl --request POST \
--url https://api.dhan.co/orders/slicing \
--header 'Content-Type: application/json' \
--header 'access-token: JWT'
--data '{Request JSON}'
dhan.place_slice_order(data)


Request Structure

{
    "dhanClientId":"1000000003",
    "correlationId":"123abc678",
    "transactionType":"BUY",
    "exchangeSegment":"NSE_EQ",
    "productType":"INTRADAY",
    "orderType":"MARKET",
    "validity":"DAY",
    "tradingSymbol":"",
    "securityId":"11536",
    "quantity":"5",
    "disclosedQuantity":"",
    "price":"",
    "triggerPrice":"",
    "afterMarketOrder":false,
    "amoTime":"",
    "boProfitValue":"",
    "boStopLossValue": "",
    "drvExpiryDate":"string",
    "drvOptionType":"CALL"
    "drvStrikePrice": -3.402823669209385e+38
}
dhan.place_slice_order(
    tag='',
    transaction_type=dhan.BUY,
    exchange_segment=dhan.NSE,
    product_type=dhan.INTRA,
    order_type=dhan.MARKET,
    validity='DAY',
    security_id='1333',
    quantity=10,
    disclosed_quantity=0,
    price=0,
    trigger_price=0,
    after_market_order=False,
    amo_time='OPEN',
    bo_profit_value=0,
    bo_stop_loss_Value=0,
    drv_expiry_date=None,
    drv_options_type=None,
    drv_strike_price=None    
)


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
NSE_EQ NSE_FNO NSE_CURRENCY BSE_EQ BSE_FNO BSE_CURRENCY MCX_COMM
productType
required
enum string Product type
CNC  INTRADAY MARGIN MTF  CO BO
orderType
required
enum string Order Type
LIMIT  MARKET  STOP_LOSS  STOP_LOSS_MARKET
validity
required
enum string Validity of Order
DAY IOC
tradingSymbol string Refer Trading Symbol in Tables
securityId
required
string Exchange standard id for each scrip. Refer here
quantity
required
int Number of shares for the order
disclosedQuantity int Number of shares visible (Keep more than 30% of quantity)
price
required
float Price at which order is placed
triggerPrice
conditionally required
float Price at which the order is triggered, in case of SL-M & SL-L
afterMarketOrder
conditionally required
boolean Flag for orders placed after market hours
amoTime
conditionally required
enum sting Timing to pump the after market order
OPEN OPEN_30 OPEN_60
boProfitValue
conditionally required
float Bracket Order Target Price change
boStopLossValue
conditionally required
float Bracket Order Stop Loss Price change
drvExpiryDate string Contract Expiry Date for F&O
drvOptionType enum string Type of Option
CALL PUT
drvStrikePrice float Strike Price for Options

Field Type Description
tag string The user/partner generated id for tracking back.
transaction_type
required
string The trading side of transaction
BUY  SELL
exchange_segment
required
string Exchange & Segment
NSE FNO  CUR BSE MCX
product_type
required
string Product type
CNC  INTRA MARGIN MTF CO BO
order_type
required
string Order Type
LIMIT MARKET SL SLM
validity
required
string Validity of Order
DAY IOC
security_id
required
string Exchange standard id for each scrip. Refer here
quantity
required
int Number of shares for the order
disclosed_quantity int Number of shares visible (Keep more than 30% of quantity)
price
required
float Price at which order is placed
trigger_price
conditionally required
float Price at which the order is triggered, in case of SL-M & SL-L
after_market_order
conditionally required
boolean Flag for orders placed after market hours
amo_Time
conditionally required
string Timing to pump the after market order
OPEN OPEN_30 OPEN_60
bo_profit_value
conditionally required
float Bracket Order Target Price change
bo_stop_loss_value
conditionally required
float Bracket Order Stop Loss Price change
drv_expiry_date string Contract Expiry Date for F&O
drv_options_type string Type of Option
CALL PUT
drv_strike_price float Strike Price for Options


Response Structure

[
    {
        "orderId": "552209237100",
        "orderStatus": "TRANSIT"
    },
    {
        "orderId": "552209237100",
        "orderStatus": "TRANSIT"
    }
]


Parameters

Field Type Description
orderId string Order specific identification generated by Dhan
orderStatus string Order Type
TRANSIT PENDING REJECTED CANCELLED TRADED EXPIRED CONFIRM

Note: The freeze limit is decided by the exchange for different instruments. The following are the freeze limits for NSE F&O Indices:

Index Symbol Freeze QTY in Lots
w.e.f. 1st Sep 2023
1 BANKNIFTY 60
2 NIFTY 36
3 FINNIFTY 45
4 MIDCPNIFTY 56

Order Book

This API lets you retrieve an array of all orders requested in a day with their last updated status.

curl --request GET \
--url https://api.dhan.co/orders \
--header 'Content-Type: application/json' \
--header 'access-token: JWT'
dhan.get_order_list()


Request Structure

No Body


Response Structure

[
    {
        "dhanClientId": "1000000003",
        "orderId": "112111182198",
        "correlationId":"123abc678",
        "orderStatus": "PENDING",
        "transactionType": "BUY",
        "exchangeSegment": "NSE_EQ",
        "productType": "INTRADAY",
        "orderType": "MARKET",
        "validity": "DAY",
        "tradingSymbol": "",
        "securityId": "11536",
        "quantity": 5,
        "disclosedQuantity": 0,
        "price": 0.0,
        "triggerPrice": 0.0,
        "afterMarketOrder": false,
        "boProfitValue": 0.0,
        "boStopLossValue": 0.0,
        "legName": ,
        "createTime": "2021-11-24 13:33:03",
        "updateTime": "2021-11-24 13:33:03",
        "exchangeTime": "2021-11-24 13:33:03",
        "drvExpiryDate": null,
        "drvOptionType": null,
        "drvStrikePrice": 0.0,
        "omsErrorCode": null,
        "omsErrorDescription": null,
        "filled_qty": 0,
        "algoId": "string"
    }
]


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 REJECTED CANCELLED TRADED EXPIRED
transactionType enum string The trading side of transaction
BUY SELL
exchangeSegment enum string Exchange & Segment
NSE_EQ NSE_FNO NSE_CURRENCY BSE_EQ BSE_FNO BSE_CURRENCY MCX_COMM
productType enum string Product type of trade
CNC  INTRADAY MARGIN MTF  CO BO
orderType enum string Order Type
LIMIT  MARKET  STOP_LOSS  STOP_LOSS_MARKET
validity enum string Validity of Order
DAY IOC
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
disclosedQuantity int Number of shares visible
price float Price at which order is placed
triggerPrice float Price at which order is triggered, for SL-M, SL-L, CO & BO
afterMarketOrder boolean The order placed is AMO ?
boProfitValue float Bracket Order Target Price change
boStopLossValue float Bracket Order Stop Loss Price change
legName enum string Leg identification in case of BO
ENTRY_LEG TARGET_LEG STOP_LOSS_LEG
createTime string Time at which the order is created
updateTime string Time at which the last activity happened
exchangeTime string Time at which order reached at exchange
drvExpiryDate int For F&O, expiry date of contract
drvOptionType enum string Type of Option
CALL PUT
drvStrikePrice float For Options, Strike Price
omserroeCode string Error code in case the order is rejected or failed
omsErrorDescription string Description of error in case the order is rejected or failed
filled_qty integer Quantity of order traded on Exchange
algoId string Exchange Algo ID for Dhan

Get Order by Order Id

Users can retrieve the details and status of an order from the orderbook placed during the day.

curl --request GET \
--url https://api.dhan.co/orders/{order-id} \
--header 'Content-Type: application/json' \
--header 'access-token: JWT'
dhan.get_order_by_id(order_id)


Request Structure

No Body


Response Structure

{
    "dhanClientId": "1000000003",
    "orderId": "112111182198",
    "correlationId":"123abc678",
    "orderStatus": "PENDING",
    "transactionType": "BUY",
    "exchangeSegment": "NSE_EQ",
    "productType": "INTRADAY",
    "orderType": "MARKET",
    "validity": "DAY",
    "tradingSymbol": "",
    "securityId": "11536",
    "quantity": 5,
    "disclosedQuantity": 0,
    "price": 0.0,
    "triggerPrice": 0.0,
    "afterMarketOrder": false,
    "boProfitValue": 0.0,
    "boStopLossValue": 0.0,
    "legName": ,
    "createTime": "2021-11-24 13:33:03",
    "updateTime": "2021-11-24 13:33:03",
    "exchangeTime": "2021-11-24 13:33:03",
    "drvExpiryDate": null,
    "drvOptionType": null,
    "drvStrikePrice": 0.0,
    "filled_qty": 0,
    "algoId": "string"
}


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 REJECTED CANCELLED TRADED EXPIRED
transactionType enum string The trading side of transaction
BUY SELL
exchangeSegment enum string Exchange & Segment
NSE_EQ NSE_FNO NSE_CURRENCY BSE_EQ BSE_FNO BSE_CURRENCY MCX_COMM
productType enum string Product type of trade
CNC  INTRADAY MARGIN MTF  CO BO
orderType enum string Order Type
LIMIT  MARKET  STOP_LOSS  STOP_LOSS_MARKET
validity enum string Validity of Order
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
disclosedQuantity int Number of shares visible
price float Price at which order is placed
triggerPrice float Price at which order is triggered, for SL-M, SL-L, CO & BO
afterMarketOrder boolean The order placed is AMO ?
boProfitValue float Bracket Order Target Price change
boStopLossValue float Bracket Order Stop Loss Price change
legName enum string Leg identification in case of BO
ENTRY_LEG TARGET_LEG STOP_LOSS_LEG
createTime string Time at which the order is created
updateTime string Time at which the last activity happened
exchangeTime string Time at which order reached at exchange
drvExpiryDate int For F&O, expiry date of contract
drvOptionType enum string Type of Option
CALL PUT
drvStrikePrice float For Options, Strike Price
filled_qty integer Quantity of order traded on Exchange
algoId string Exchange Algo ID for Dhan

Get Order by Correlation Id

In case the user has missed order id due to unforeseen reason, this API retrieves the order status using a tag called correlation id specified by users themselve.

curl --request GET \
--url https://api.dhan.co/orders/external/{correlation-id} \
--header 'Content-Type: application/json' \
--header 'access-token: JWT'
dhan.get_order_by_corelationID(corelationID)


Request Structure

No Body


Response Structure

{
    "dhanClientId": "1000000003",
    "orderId": "112111182198",
    "correlationId":"123abc678",
    "orderStatus": "PENDING",
    "transactionType": "BUY",
    "exchangeSegment": "NSE_EQ",
    "productType": "INTRADAY",
    "orderType": "MARKET",
    "validity": "DAY",
    "tradingSymbol": "",
    "securityId": "11536",
    "quantity": 5,
    "disclosedQuantity": 0,
    "price": 0.0,
    "triggerPrice": 0.0,
    "afterMarketOrder": false,
    "boProfitValue": 0.0,
    "boStopLossValue": 0.0,
    "legName": ,
    "createTime": "2021-11-24 13:33:03",
    "updateTime": "2021-11-24 13:33:03",
    "exchangeTime": "2021-11-24 13:33:03",
    "drvExpiryDate": null,
    "drvOptionType": null,
    "drvStrikePrice": 0.0,
    "omsErrorCode": null,
    "omsErrorDescription": null,
    "filled_qty": 0,
    "algoId": "string"
}


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 REJECTED CANCELLED TRADED EXPIRED
transactionType enum string The trading side of transaction
BUY SELL
exchangeSegment enum string Exchange & Segment
NSE_EQ NSE_FNO NSE_CURRENCY BSE_EQ BSE_FNO BSE_CURRENCY MCX_COMM
productType enum string Product type of trade
CNC  INTRADAY MARGIN MTF CO BO
orderType enum string Order Type
LIMIT  MARKET  STOP_LOSS  STOP_LOSS_MARKET
validity enum string Validity of Order
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
disclosedQuantity int Number of shares visible
price float Price at which order is placed
triggerPrice float Price at which order is triggered, for SL-M, SL-L, CO & BO
afterMarketOrder boolean The order placed is AMO ?
boProfitValue float Bracket Order Target Price change
boStopLossValue float Bracket Order Stop Loss Price change
legName enum string Leg identification in case of BO
ENTRY_LEG TARGET_LEG STOP_LOSS_LEG
createTime string Time at which the order is created
updateTime string Time at which the last activity happened
exchangeTime string Time at which order reached at exchange
drvExpiryDate int For F&O, expiry date of contract
drvOptionType enum string Type of Option
CALL PUT
drvStrikePrice float For Options, Strike Price
omserroeCode string Error code in case the order is rejected or failed
omsErrorDescription string Description of error in case the order is rejected or failed
filled_qty integer Quantity of order traded on Exchange
algoId string Exchange Algo ID for Dhan

Trade Book

This API lets you retrieve an array of all trades executed in a day.

curl --request GET \
--url https://api.dhan.co/trades \
--header 'Content-Type: application/json' \
--header 'access-token: JWT'
dhan.get_trade_book()


Request Structure

No Body


Response Structure

[
    {
        "dhanClientId": "1000000009",
        "orderId": "112111182045",
        "exchangeOrderId": "15112111182045",
        "exchangeTradeId": "15112111182045",
        "transactionType": "BUY",
        "exchangeSegment": "NSE_EQ",
        "productType": "INTRADAY",
        "orderType": "LIMIT",
        "tradingSymbol": "TCS",
        "securityId": "11536",
        "tradedQuantity": 40,
        "tradedPrice": 3345.8,
        "createTime": "2021-03-10 11:20:06",
        "updateTime": "2021-11-25 17:35:12"
        "exchangeTime": "2021-11-25 17:35:12",
        "drvExpiryDate": null,
        "drvOptionType": null,
        "drvStrikePrice": 0.0
    }
]


Parameters

Field Type Description
dhanClientId string User specific identification generated by Dhan
orderId string Order specific identification generated by Dhan
exchangeOrderId string Order specific identification generated by exchange
exchangeTradeId string Trade specific identification generated by exchange
transactionType enum string The trading side of transaction
BUY SELL
exchangeSegment enum string Exchange & Segment
NSE_EQ NSE_FNO NSE_CURRENCY BSE_EQ BSE_FNO BSE_CURRENCY MCX_COMM
productType enum string Product type of trade
CNC  INTRADAY MARGIN MTF  CO BO
orderType enum string Order Type
LIMIT  MARKET  STOP_LOSS  STOP_LOSS_MARKET
tradingSymbol string Refer Trading Symbol in Tables
securityId string Exchange standard id for each scrip.Refer here
tradedQuantity int Number of shares executed
tradedPrice float Price at which trade is executed
createTime string Time at which the order is created
updateTime string Time at which the last activity happened
exchangeTime string Time at which order reached at exchange
drvExpiryDate int For F&O, expiry date of contract
drvOptionType enum string Type of Option
CALL PUT
drvStrikePrice float For Options, Strike Price

Trades of an Order

Users can retrieve the trade details using an order id. Often during partial trades or Bracket/ Cover Orders, traders get confused in reading trade from tradebook.The response of this API will include all the trades generated for a particular order id.

curl --request GET \
--url https://api.dhan.co/trades/{order-id} \
--header 'Content-Type: application/json' \
--header 'access-token: JWT'
dhan.get_trade_book(order_id)


Request Structure

No Body


Response Structure

{
    "dhanClientId": "1000000009",
    "orderId": "112111182045",
    "exchangeOrderId": "15112111182045",
    "exchangeTradeId": "15112111182045",
    "transactionType": "BUY",
    "exchangeSegment": "NSE_EQ",
    "productType": "INTRADAY",
    "orderType": "LIMIT",
    "tradingSymbol": "TCS",
    "securityId": "11536",
    "tradedQuantity": 40,
    "tradedPrice": 3345.8,
    "createTime": "2021-03-10 11:20:06",
    "updateTime": "2021-11-25 17:35:12",
    "exchangeTime": "2021-11-25 17:35:12",
    "drvExpiryDate": null,
    "drvOptionType": null,
    "drvStrikePrice": 0.0
}


Parameters

Field Type Description
dhanClientId string User specific identification generated by Dhan
orderId string Order specific identification generated by Dhan
exchangeOrderId string Order specific identification generated by exchange
exchangeTradeId string Trade specific identification generated by exchange
transactionType enum string The trading side of transaction
BUY SELL
exchangeSegment enum string Exchange & Segment
NSE_EQ NSE_FNO NSE_CURRENCY BSE_EQ BSE_FNO BSE_CURRENCY MCX_COMM
productType enum string Product type of trade
CNC  INTRADAY MARGIN MTF  CO BO
orderType enum string Order Type
LIMIT  MARKET  STOP_LOSS  STOP_LOSS_MARKET
tradingSymbol string Refer Trading Symbol in Tables
securityId string Exchange standard id for each scrip. Refer here
tradedQuantity int Number of shares executed
tradedPrice float Price at which trade is executed
createTime string Time at which the order is created
updateTime string Time at which the last activity happened
exchangeTime string Time at which order reached at exchange
drvExpiryDate int For F&O, expiry date of contract
drvOptionType enum string Type of Option
CALL PUT
drvStrikePrice float For Options, Strike Price

Note: For description of enum values, refer Annexure