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 /trades/ 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/v2/ledger?from_date={YYYY-MM-DD}&to_date={YYYY-MM-DD}' \
--header 'Accept: application/json' \
--header 'access-token: {JWT}'


Query Parameters

Field Description
from_date
required
Date from which Ledger Report is required in format YYYY-MM-DD
to_date
required
Date upto which Ledger Report is required in format YYYY-MM-DD

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 header parameters along with page number as the response is paginated.

curl --request GET \
--url https://api.dhan.co/v2/trades/{from_date}/{to_date}/{page} \
--header 'Accept: application/json' \
--header 'access-token: {JWT}'


Path Parameters

Field Description
from_date
required
Date from which Trade History is required in format YYYY-MM-DD
to_date
required
Date upto which Trade History is required in format YYYY-MM-DD
page
required
Page number of which data is being fetched. Pass 0 as default.


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 of instrument to be subscribed as found in Annexure
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 Symbol in which order was placed - Refer here
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