Historical candle data

The historical data API provides archived data (up to date as of the time of access) for instruments across various exchanges spanning back several years. A historical record is presented in the form of a candle (Timestamp, Open, High, Low, Close, Volume), and the data is available in several intervals—minute, 3 minutes, 5 minutes, hourly ... daily.

type endpoint  
GET /instruments/historical/:instrument_token/:interval Retrieve historical candle records for a given instrument.
# Fetch minute candles off NSE-ACC.
# This will return several days of minute data ending today.
# The time of request is assumed to be to be 01:30 PM, 1 Jan 2016,
# which is reflected in the latest (last) record.

# The data has been truncated with ... in the example responses.

curl "https://api.kite.trade/instruments/historical/5633/minute?from=2015-12-28+09:30:00&to=2016-01-01+10:30:00"
    -H "X-Kite-Version: 3" \
    -H "Authorization: token api_key:access_token" \
{
    "status": "success",
    "data": {
        "candles": [
            ["2015-12-28T09:15:00+0530", 1386.4, 1388, 1381.05, 1385.1, 788],
            ["2015-12-28T09:16:00+0530", 1385.1, 1389.1, 1383.85, 1385.5, 609],
            ["2015-12-28T09:17:00+0530", 1385.5, 1387, 1385.5, 1385.7, 212],
            ["2015-12-28T09:18:00+0530", 1387, 1387.95, 1385.3, 1387.95, 1208],
            ["2015-12-28T09:19:00+0530", 1387, 1387.55, 1385.6, 1386.25, 716],
            ["2015-12-28T09:20:00+0530", 1386.95, 1389.95, 1386.95, 1389, 727],
            ["2015-12-28T09:21:00+0530", 1389, 1392.95, 1389, 1392.95, 291],
            ["2015-12-28T09:22:00+0530", 1392.95, 1393, 1392, 1392.95, 180],
            ["2015-12-28T09:23:00+0530", 1392.95, 1393, 1392, 1392.15, 1869]
            ...
            ["2016-01-01T13:22:00+0530", 1386.4, 1388, 1381.05, 1385.1, 788],
            ["2016-01-01T13:23:00+0530", 1385.1, 1389.1, 1383.85, 1385.5, 613],
            ["2016-01-01T13:24:00+0530", 1385.5, 1387, 1385.5, 1385.7, 212],
            ["2016-01-01T13:25:00+0530", 1387, 1387.95, 1385.3, 1387.95, 1208],
            ["2016-01-01T13:26:00+0530", 1387, 1387.55, 1385.6, 1386.25, 716],
            ["2016-01-01T13:27:00+0530", 1386.95, 1389.95, 1386.95, 1389, 727],
            ["2016-01-01T13:28:00+0530", 1389, 1392.95, 1389, 1392.95, 291],
            ["2016-01-01T13:29:00+0530", 1392.95, 1393, 1392, 1392.95, 180],
            ["2016-01-01T13:30:00+0530", 1392.95, 1393, 1392, 1392.15, 1869]
        ]
    }
}

URI parameters

parameter  
:instrument_token Identifier for the instrument whose historical records you want to fetch. This is obtained with the instrument list API.
:interval The candle record interval. Possible values are:
· minute
· day
· 3minute
· 5minute
· 10minute
· 15minute
· 30minute
· 60minute

Request parameters

parameter  
from yyyy-mm-dd hh:mm:ss formatted date indicating the start date of records
to yyyy-mm-dd hh:mm:ss formatted date indicating the end date of records
continuous Accepts 0 or 1. Pass 1 to get continous data

Response structure

The response is an array of records, where each record in turn is an array of the following values — [timestamp, open, high, low, close, volume].

Note

It is possible to retrieve candles for small time intervals by making the from and to calls granular. For instance from = 2017-01-01 09:15:00 and to = 2017-01-01 09:30:00 to fetch candles for just 15 minutes between those timestamps.

Continuous data

It's important to note that the exchanges flush the instrument_token for futures and options contracts for every expiry. For instance, NIFTYJAN18FUT and NIFTYFEB18FUT will have different instrument tokens although their underlying contract is the same. The instrument master API only returns instrument_tokens for contracts that are live. It is not possible to retrieve instrument_tokens for expired contracts from the API, unless you regularly download and cache them.

This is where continuous API comes in which works for NFO and MCX futures contracts. Given a live contract's instrument_token, the API will return day candle records for the same instrument's expired contracts. For instance, assuming the current month is January and you pass NIFTYJAN18FUT's instrument_token along with continuous=1, you can fetch day candles for December, November ... contracts by simply changing the from and to dates.