Skip to Content

Historical Data

This API allows you to get historical candle data for a symbol over a date range and resolution.

USE CASE

Fetch past candles to draw a chart, calculate indicators or backtest a strategy.

Details

The historical API provides archived data (up to date) for symbols across various exchanges within the given range. A historical record is presented in the form of a candle, and the data is available in different resolutions like 1 min, 10 min, 60 min ... 240 min, and daily.
To Handle Partial Candles

To receive completed candle data, send a timestamp prior to the current minute. Sending a timestamp for the current minute returns partial data because the minute is not yet finished. Always use a range_to timestamp of the previous minute to receive completed candle data.

Current Time (seconds can be 1-59): 12:10:20 PM

Input Parameters:

range_from: 12:08:00 PM

range_to: 12:09:20 PM (Current Time - 1 minute)

Output Summary: Returns 2 candles (12:08 PM & 12:09 PM). This example is for 1-minute candles; for other resolutions, subtract the resolution time from range_to to get completed candles only.

Good to know
  • Your app needs the Market Data permission (Historical data, Market Depth and Quotes).
  • Set date_format to 0 to pass range_from and range_to as epoch values, or to 1 to pass them as yyyy-mm-dd dates.
  • Set cont_flag to 1 for continuous data of futures and options, and oi_flag to 1 to include open interest in each candle.
  • Each candle is an array: epoch time, open, high, low, close and volume (open interest is added when oi_flag is 1).
Limits for History
  • Unlimited number of stocks history data can be downloaded in a day.
  • Up to 100 days of data per request for resolutions of 1, 2, 3, 5, 10, 15, 20, 30, 45, 60, 120, 180, and 240 minutes (Data available from July 3, 2017).
  • For 1D, 1W, and 1M resolutions, up to 366 days of data per request.
  • For Seconds Charts, history is available for 30-Trading Days only.

Plan limits

Standard plan

  • Daily candles: last 5 years (from 2021); the window moves forward every year
  • Intraday candles: last 1 year (from 2025)
  • Seconds data: not available

Prime plan

  • Daily candles: entire available history, 25+ years
  • Intraday candles: entire available history, 5+ years
  • Seconds data: available

For rate limits and all other plan details, see Plans & rate limits.

Request Attributes

AttributeData TypeDescription
symbol*string
  • Mandatory.
  • Eg: NSE:SBIN-EQ
resolution*string
  • The candle resolution. Possible values are: Day : “D” or “1D”
  • 5 seconds : “5S”
  • 10 seconds : “10S”
  • 15 seconds : “15S”
  • 30 seconds : “30S”
  • 45 seconds : “45S”
  • 1 minute : “1”
  • 2 minute : “2"
  • 3 minute : "3"
  • 5 minute : "5"
  • 10 minute : "10"
  • 15 minute : "15"
  • 20 minute : "20"
  • 30 minute : "30"
  • 60 minute : "60"
  • 120 minute : "120"
  • 240 minute : "240"
  • 1 Day : "1D"
  • 1 week : "1W"
  • 1 month : "1M"
date_format*intdate_format is a boolean flag. 0 to enter the epoch value. Eg:670073472. 1 to enter the date format as yyyy-mm-dd.
range_from*string
  • Indicating the start date of records. Accepts epoch value if date_format flag is set to 0. Eg: range_from: 670073472
  • Accepts yyyy-mm-dd format if date_format flag is set to 1. Eg: 2021-01-01
range_to*string
  • Indicating the end date of records. Accepts epoch value if date_format flag is set to 0. Eg: range_to: 1622028732
  • Accepts yyyy-mm-dd format if date_format flag is set to 1. Eg:2021-03-01
cont_flagintset cont flag 1 for continues data and future options.
oi_flagintset flag to "1" enable oi as a part of candle.

Response Attributes

AttributeData TypeDescription
sstringok / error
Candelsarray
  • Candles data containing array of following data for particular time stamp:
  • 1.Current epoch time
  • 2. Open Value
  • 3.Highest Value
  • 4.Lowest Value
  • 5.Close Value
  • 6.Total traded quantity (volume)
Last updated on