Skip to content

Statement

This set of APIs retreives all your trade and ledger details to help you summarise and analyse your trades.

GET /ledger Retrieve Trading Account debit and credit details
GET /tradeHistory/ Retrieve historical trade data

Ledger Report

Users can retrieve Trading Account Ledger Report with all Credit and Debit transaction details for a particular time interval. For this, you need to pass start date and end date as query parameters to define time interval of Ledger Report.

curl --request GET \
--url 'https://api.dhan.co/ledger?from_date={YYYY-MM-DD}&to_date={YYYY-MM-DD}' \
--header 'Content-Type: application/json' \
--header 'access-token: '


Request Structure

No Body


Response Structure

{
    "dhanClientId": "1000000001",
    "narration": "FUNDS WITHDRAWAL",
    "voucherdate": "Jun 22, 2022",
    "exchange": "NSE-CAPITAL",
    "voucherdesc": "PAYBNK",
    "vouchernumber": "202200036701",
    "debit": "20000.00",
    "credit": "0.00",
    "runbal": "957.29"
}


Parameters

Field Type Description
dhanClientId
string User specific identification generated by Dhan
narration string Description of the ledger transaction
voucherdate string Transaction Date
exchange string Exchange information for the transaction
voucherdesc string Nature of transaction
vouchernumber string System generated transaction number
debit string Debit amount (only when credit returns 0)
credit string Credit amount (only when debit returns 0)
runbal string Running Balance post transaction

Trade History

Users can retrieve their detailed trade history for all orders for a particular time frame. User needs to add query parameters for start date, end date and page number (default to be 0).

curl --request GET \
--url https://api.dhan.co/tradeHistory/{from_date}/{to_date}/{page} \
--header 'Content-Type: application/json' \
--header 'access-token: '


Request Structure

No Body


Response Structure

[
    {
    "dhanClientId": "1000000001",
    "orderId": "212212307731",
    "exchangeOrderId": "76036896",
    "exchangeTradeId": "407958",
    "transactionType": "BUY",
    "exchangeSegment": "NSE_EQ",
    "productType": "CNC",
    "orderType": "MARKET",
    "tradingSymbol": null,
    "customSymbol": "Tata Motors",
    "securityId": "3456",
    "tradedQuantity": 1,
    "tradedPrice": 390.9,
    "isin": "INE155A01022",
    "instrument": "EQUITY",
    "sebiTax": 0.0004,
    "stt": 0,
    "brokerageCharges": 0,
    "serviceTax": 0.0025,
    "exchangeTransactionCharges": 0.0135,
    "stampDuty": 0,
    "createTime": "NA",
    "updateTime": "NA",
    "exchangeTime": "2022-12-30 10:00:46",
    "drvExpiryDate": "NA",
    "drvOptionType": "NA",
    "drvStrikePrice": 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
customSymbol string Trading Symbol as per Dhan
securityId string Exchange standard id for each scrip. Refer here
tradedQuantity int Number of shares executed
tradedPrice float Price at which trade is executed
isin string Universal standard ID for each scrip
instrument string Type of Instrument
EQUITY DERIVATIVES
sebiTax string SEBI Turnover Charges
stt string Securities Transactions Tax
brokerageCharges string Brokerage charges by Dhan, refer pricing here
serviceTax string Applicable Service Tax
exchangeTransactionCharges string Exchange Transaction Charge
stampDuty string Stamp Duty Charges
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