Regarding Delay/Lag in Historical Data

Hi Team,

Wanted to know if there is any lag or delay in historical data api response.
For instance if I request for 5min data for a particular stock at 10:00:05 AM will I get 5 min data till 10:00 AM?
If yes is this feature available in the nodejs library(kiteconnectjs) ?

  • sujith
    Hi @raoulnair,
    Though the feature is available. We don't recommend using historical data API for live market strategies. The historical data API is provided for backtesting purpose only.
    For live strategies, we suggest generating candles at your end using the live market data provided via Websockets.
    You can know more here.
    The historical data API is an add-on subscription that will cost you Rs 2000 with the base Kite Connect subscription.
  • raoulnair
    Thanks @sujith
    What are the charges for websocket subscription only?
    My assumption was that its part of Kite API package which cost Rs 2000 thatincludes Websocket, historical data and other features.
  • sujith
    The base Kite Connect subscription includes placing an order, fetching orderbook, positions, holdings, funds, live market data and more which will cost you Rs 2000 per month.
    The historical data API is an add-on subscription which will cost you Rs 2000 per month.
  • narayanancv
    hi.. how can I get live market data for all nse shares
  • prakash.jj
    @sujith if you r saying historical data API to be used only for backtesting, how do we implement strategies which requires indicators to be calculated. Any indicators will need atleast last couple of days of minute data to get accurate can we use websocket data to get previous values.
  • sujith
    You can generate candles and store it at your end for later analysis.
  • prakash.jj
    @sujith I am not asking for later analyisis. Let's say I need to calculate 255 ema on 15 min timeframe, I would need atleast 10 days worth of data to even calculate one ema value. If we can't use historical API to get this data then I don't see an easy way to build my strategy without taking data from other vendors. Which defeats the purpose of having one API for the algo..
  • prakash.jj
    And generating candles on our end using websocket data is not reliable at we can miss the data because of various API errors, network errors etc
  • sujith
    You can generate candles and store it for how much ever period you want. You can fetch it from your database and do any operations you want. You can try out historical data API if it fits your use case you may use it. But we don't recommend using historical data for live strategies.
    The way our system works is we listen to all the ticks for an instrument and at the end of the minute, we generate a minute candle. The same candle is stored on the database. This happens for all the instruments that are being traded for the day. During this process, if one of the database write operations lags then it will affect the following writes also.
    Since the database write is not a time guaranteed operation. We can't guarantee that it will work the same way every time. There may be few seconds delay sometimes or it may not be there. Hence we don't recommend using historical data API for live strategies. It is provided only for backtesting purposes.
  • prakash.jj
    @sujith thank you for the clarification. So basically there is no better way to get historical or for that matter current intraday data minute wise without taking the risk of storing streaming data on our side using websocket. Which leaves us with the option of using kite API for only execution as you always say and use some other data vendor if we need reliable data for our strategies.
  • prakash.jj
    Do you have any such plans of providing such data in future. I am sure Thomson Reuters have got provision to provide minute wise data .
  • sujith
    You can get data from the exchange directly. It might cost tens of lakhs for each segment.
  • qwerty
    You can get the data from the google financial api, which has a lag of not more than 5 seconds
  • dhirs
    I do not really understand the point of this historical data API. you say it can be used for backtesting. But how? If it has corrupt data, the backtesting will give wrong results too.
    I am building a strategy that uses VWAP cross based on candle closing price. I run this at the end of the day. I get all garbage data for the closing price for most candles. How can this be used for backtesting?
  • sujith
    If the historical data Kite Connect offers don't serve your purpose then you can build candles at your end using the live market data provided via Websocket API. We usually recommend generating candles at your end for live market strategies.
    For older data dump for backtesting, you may contact any exchange registered data vendor. Since Kite Connect data doesn't seem to fit your use case.
  • vishwas
    @sujith as i have subscribed for historic data, i see many candle data from it are IN-CORRECT. Due to which even backtesting is failing. I receive close price X from API and on chart its X+4 or any other number. Can you please explain the reason? or any way to get accurate historic data?
This discussion has been closed.