Skip to content

Historical Data

This API gives you historical candle data for the desired scrip across segments & exchange. This data is presented in the form of a candle and gives you timestamp, open, high, low, close & volume.

POST /charts/historical Get OHLC for daily timeframe
POST /charts/intraday Get OHLC for minute timeframe

Daily Historical Data

Retrieve OHLC & Volume of daily candle for desired instrument. The data for any scrip is available back upto the date of its inception.

curl --request POST \
--url https://api.dhan.co/v2/charts/historical \
--header 'Content-Type: application/json' \
--header 'access-token: JWT' \
--data '{}'


Request Structure

    {
        "securityId": "1333",
        "exchangeSegment":"NSE_EQ",
        "instrument": "EQUITY",
        "expiryCode": 0,
        "fromDate": "2022-01-08",
        "toDate": "2022-02-08"
    }


Parameters

Field Field Type Description
securityId
required
string Exchange standard ID for each scrip. Refer here
exchangeSegment
required
enum string Exchange & segment for which data is to be fetched - here
instrument
required
enum string Instrument type of the scrip . Refer here
expiryCode
conditionally required
enum integer Expiry of the instruments in case of derivatives. Refer here
fromDate
required
string Start date of the desired range
toDate
required
string End date of the desired range (non-inclusive)


Response Structure

{
    "open": [
                3978,3856,3925,3918,3877.85,3992.7,4033.95,4012,3910,3807,3840,3769.5,3731,3646,3749,
                3770,3827.9,3851,3815.3,3791
            ],
    "high": [
            3978,3925,3929,3923,3977,4043,4041.7,4012,3920,3851.55,3849.65,3809.4,3733.4,3729.8,
            3758,3808,3864,3882.5,3824.7,3831.8
            ],
    "low":  [
            3861,3856,3836.55,3857,3860.05,3962.3,3980,3910.5,3811,3771.1,3740.1,3722.2,3625.1,
            3646,3721.4,3736.4,3800.65,3816.05,3769,3756.15
            ],
    "close": [
            3879.85,3915.9,3859.9,3897.9,3968.15,4019.15,3990.6,3914.65,3826.55,3833.5,3771.35,
            3769.9,3649.25,3690.05,3736.25,3800.65,3856.2,3824.6,3814.9,3779
            ],
    "volume":[
            3937092,1906106,3203744,6684507,3348123,3442604,2389041,3102539,6176776,3112358,     
            3258414,3330501,5718297,3143862,2739393,2105169,1984212,1960538,2307366,1919149
            ],
    "timestamp": [
            1326220200,1326306600,1326393000,1326479400,1326565800,1326825000,1326911400,
            1326997800,1327084200,1327170600,1327429800,1327516200,1327689000,1327775400,
            1328034600,1328121000,1328207400,1328293800,1328380200,1328639400
            ]
}

Parameters

Field Field Type Description
open float Open price of the timeframe
high float High price in the timeframe
low float Low price in the timeframe
close float Close price of the timeframe
volume int Volume traded in the timeframe
timestamp int Epoch timestamp

Intraday Historical Data

Retrieve OHLC & Volume of 1, 5, 15, 25 and 60 min candle for desired instrument for last 5 trading days. This data available for all exchanges and segments.

    curl --request POST \
    --url https://api.dhan.co/v2/charts/intraday \
    --header 'Accept: application/json' \
    --header 'Content-Type: application/json' \
    --header 'access-token: ' \
    --data '{}'


Request Structure

    {
    "securityId": "1333",
    "exchangeSegment": "NSE_EQ",
    "instrument": "EQUITY",
    "interval": "1",
    "fromDate": "2024-09-11",
    "toDate": "2024-09-15"
    }


Parameters

Field Field Type Description
securityId
required
string Exchange standard ID for each scrip. Refer here
exchangeSegment
required
enum string Exchange & segment for which data is to be fetched - here
instrument
required
enum string Instrument type of the scrip . Refer here
interval
required
enum integer Minute intervals in timeframe
1, 5, 15, 25, 60
fromDate
required
string Start date of the desired range
toDate
required
string End date of the desired range


Response Structure

{
    "open":   [
                    3750,3757.85,3751.2,3763.6,3759.55,3759,3761,3763,3767.25,3773.65,3766.1,3765.65,3767.1,3774.15,3775.9,3774.95,3773.2,3774.7,3772.25,3774.85,3767.2,3768,3768.95,3768.85,3769.3,3773.55,3773.95,3770,3770.25,3769.1,3765.3,3760.2,3762.45,3765.4,
                    3767.8,3768.8,3764.75,3763.2,3764.9,3764.9,3765.45,3764,3765,3764.5,3764.3,3764.85,3765,3762,3764.2,3762.05,3757.55,3757,3754.25,3755.95,3760.75,3760.05,3757.45,3760.2,3757.1,3758.1,3757.6,3758.8,3760.35,3761.05,3761.15,3760.4,3760.25,3760.85,
                    3758.6,3760,3760.6,3759.05,3757.55,3758.2,3759.6,3760,3759,3759.3,3759.9,3758.8,3758.6,3759.5,3759.55,3757.4,3756.9,3757,3756.4,3757.6,3757.6,3757.05,3756.4,3757.95,3756.45,3757.4,3759.95
                ],
    "high":   [
                    3750,3757.9,3763.6,3765.2,3763.15,3768,3764.75,3766.9,3775,3773.8,3766.9,3768.5,3777.7,3777,3777.95,3775.4,3775.95,3775,3775,3774.95,3770.8,3770,3769,3769.85,3773.6,3776,3774.8,3772.15,3773.55,3772.1,3765.3,3763.85,3768.95,3769,3769.85,3769,3766.55,
                    3765.8,3765.4,3766,3766,3765.4,3767.35,3765,3765,3767.15,3765.5,3764.25,3764.2,3762.05,3760,3757.1,3757.3,3761.95,3762,3761,3759.95,3760.2,3758.15,3759.4,3759,3761.5,3762.6,3762.1,3762.75,3761.65,3761.55,3762,3760,3762,3763.7,3762.85,3762.8,3762,3761.85,3764.95,
                    3765,3763.55,3764,3765,3763.35,3761.6,3764,3763.4,3762.8,3763.5,3763.8,3763,3760,3762.55,3761,3761,3761.15,3760.9,3763.4,3761.4,3761.4,3762,3762,3762,3761.95,3762,3762,3758.5,3758.65,3761.45,3760.95,3759.85,3758.55,3757.85,3756.5,3755.9,3756.3,3755.75,3757.4,
                    3759.6,3758.8,3758.9,3758.25,3758.2,3758.6,3760,3761.55,3760.6,3759.05,3758.4,3759.6,3760.9,3760.25,3763.55,3761,3760.95,3760,3759.65,3759.55,3759.55,3758.7,3757.05,3757.35,3756.95,3758.25,3758,3758.8,3758.4,3759.85,3758.9,3759.35,3759.95
                ],
    "low":      [
                    3750,3746.1,3749.25,3757,3758.65,3758.6,3758,3761,3767.25,3764,3762.15,3765.15,3767.1,3772.25,3772.55,3772.35,3773.2,3772,3771.6,3767.3,3767,3767.4,3766.1,3767.55,3769.3,3773,3770,3768.85,
                    3769,3765,3760,3760,3762.45,3765.25,3765,3761.15,3763.2,3762.4,3764.3,3764,3764,3763.5,3764.25,3762.65,3763.55,3764.15,3762,3761.05,3761.5,3756.7,3756.65,3752.75,3753,3755.5,3758.15,3757.55,
                    3755.3,3756,3756.55,3757.05,3757.15,3757.6,3760,3760,3760,3760,3759.55,3759.5,3758.05,3759.5,3761.05,3760.3,3760.05,3760.1,3759,3761.1,3762.85,3761.2,3759.55,3761.05,3760.95,3760,3760,
                    3761.85,3761.55,3761.4,3761.95,3759.1,3758.05,3758.55,3759.9,3758.35,3760,3759.8,3759.5,3760,3759.75,3759.65,3760,3760.15,3760.1,3760,3756.5,3757.9,3758.45,3758.8,3759,3758,3757,3753.6,
                    3754,3755.1,3755.05,3755.05,3755.6,3756.4,3757.5,3756.25,3756,3756.05,3756.1,3756.7,3759.45,3758.3,3757.15,3756.85,3757.05,3759,3758.4,3759,3758,3758.65,3758,3758.5,3758.55,3758,3756.5,3756.15,3756,3755.35,3755.9,3756.05,3756,3756,3756.2,3756.45,3756.7,3756.9
                ],
    "close":    [
                    3750,3751.25,3763.6,3760.85,3759,3761.3,3762.95,3766.9,3772.95,3766.35,3765.55,3767.3,3774.1,3774.95,3775,3773,3775,3772.15,3774.95,3767.95,3768.5,3769,3768.55,3769.85,3773.15,3774,3770,
                    3771.35,3769.4,3765,3760.35,3762.5,3765.95,3768.35,3767.3,3764.05,3763.2,3764.95,3764.95,3765.45,3764,3764.9,3764.6,3764.3,3764.95,3765,3762,3764.2,3762.1,3758,3757.1,3753.85,3755.95,3760.65,
                    3760.35,3757.55,3759.95,3757.1,3757.5,3757.65,3758.8,3761.5,3761.05,3761.15,3761.1,3760.25,3759.55,3760,3759.5,3761.1,3761.55,3761,3761,3760.2,3761.6,3763.35,3762.85,3761.55,3762.6,3763.35,3761,
                    3761.05,3763.65,3762.8,3761.55,3763.5,3762.35,3759.95,3759,3760.5,3760.3,3761,3760.9,3759.9,3761.3,3761.3,3760,3760.7,3760.05,3760.9,3761.95,3762,3758.35,3758.45,3758.45,3760.9,3759.9,3758.55,3757,
                    3754.9,3755.7,3755.1,3755.55,3755.75,3756.6,3758.85,3758.7,3756.25,3757.4,3757.65,3758.6,3760,3760.6,3759.05,3757.55,3756.85,3759.2,3759.5,3759,3759.65,3759.9,3758.8,3759.65,3759.5,3759.55,3758.85,3756.9,3756.9,3756.4,3756.6,3756.2,3757.5,3756.4,3757.9,3756.3,3757.35,3758.75,3756.9
                ],
    "volume":   [
                    166,53629,34592,20802,11262,17549,13239,11514,20125,12948,11761,8039,21998,9373,13171,9564,7287,6217,13260,5135,9676,5218,7365,3541,5547,13108,3659,4587,6499,12101,12766,12216,7619,8063,9830,6717,5976,
                    3907,3907,7276,6048,3581,6525,3270,2139,6391,3418,3290,3636,9730,3460,8773,4929,7772,6410,5050,3300,5275,1871,1951,1901,2265,3353,2221,2822,2668,2840,3109,1995,3522,6635,2914,2056,2781,3331,3383,3125,2235,6889,
                    3398,1671,2054,2856,1668,1431,2576,1791,4715,1751,4474,1973,2292,2325,1845,2906,2240,2032,2984,2262,2980,2796,3117,7508,1971,2004,3972,2181,2511,2316,5713,2506,1717,1967,2072,2304,2248,1861,1503,2358,1845,2329,
                    2407,2589,1542,1571,1707,2355,2696,3459,4160,2037,2036,1972,1491,1664,1846,2049,2149,3937,2603,1765,2005,2867,2141,2103,2279,2490,2111
                ],
    "timestamp":[
                    1328845020,1328845500,1328845560,1328845620,1328845680,1328845740,1328845800,1328845860,1328845920,1328845980,1328846040,1328846100,1328846160,1328846220,1328846280,1328846340,1328846400,1328846460,1328846520,1328846580,1328846640,1328846700,1328846760,1328846820,1328846880,1328846940,1328847000,1328847060,1328847120,1328847180,1328847240,1328847300,1328847360,1328847420,1328847480,1328847540,
                    1328847600,1328847660,1328847720,1328847780,1328847840,1328847900,1328847960,1328848020,1328848080,1328848140,1328848200,1328848260,1328848320,1328848380,1328848440,1328848500,1328848560,1328848620,1328848680,1328848740,1328848800,1328848860,1328848920,1328848980,1328849040,1328849100,1328849160,1328849220,1328849280,1328849340,1328849400,1328849460,1328849520,1328849580,1328849640,1328849700,
                    1328849760,1328849820,1328849880,1328849940,1328850000,1328850060,1328850120,1328850180,1328850240,1328850300,1328850360,1328850420,1328850480,1328850540,1328850600,1328850660,1328850720,1328850780,1328850840,1328850900,1328850960,1328851020,1328851080,1328851140,1328851200,1328851260,1328851320,1328851380,1328851440,1328851500,1328851560,1328851620,1328851680,1328851740,1328851800,1328851860,
                    1328851920,1328851980,1328852040,1328852100,1328852160,1328852220,1328852280,1328852340,1328852400,1328852460,1328852520,1328852580,1328852640,1328852700,1328852760,1328852820,1328852880,1328852940,1328853000,1328853060,1328853120,1328853180,1328853240,1328853300,1328853360,1328853420,1328853480,1328853540,1328853600,1328853660,1328853720,1328853780,1328853840,1328853900,1328853960,1328854020,1328854080,1328854140,1328854200,1328854260
                    ] 
}

Parameters

Field Field Type Description
open float Open price of the timeframe
high float High price in the timeframe
low float Low price in the timeframe
close float Close price of the timeframe
volume int Volume traded in the timeframe
timestamp int Epoch timestamp


Note: For description of enum values, refer Annexure