No candles for 26Jan of NIFTY

dajinkya
Hi

why there is not candles for 26 Jan 2018 ????

https://api.kite.trade/instruments/historical/256265/5minute?from=2018-01-26&to=2018-01-26&api_key=xxx&access_token=yyy

Reponse
{"status": "success", "data": {"candles": []}}
  • rakeshr
    26th Jan 2018, was non trading day.
  • dajinkya
    sorry my bad

    What is the best way to get candle data of multiple instruments in one request?
    Is it possible?
  • rakeshr
    You can get historical data for only one scrip in one request.For multiple scrip, you will have to run loop with list of instrument token for required scrip.There is restriction of 3 request/sec for historical APIs, so make sure to introduce proper delay in the loop.
  • dajinkya
    Thanks for the information

    Any chances of improving this at some point?
  • sujith
    sujith edited January 2018
    @dajinkya,
    Our data team is working on revamp of historical API. We are planning to revise rate limit after it is completed. I don't think we will be providing bulk fetch for historical data API since data has to be fetched from the database for each instrument separately which will increase load at our end.
    Ideally, historical data is provided for backtesting purpose only. For live market strategies, I would suggest generating candles at your end using live market data.
  • dajinkya
    dajinkya edited January 2018
    @sujith any sample code how to form candles reading live data in python?

    I also noticed that 5min historical candles are available after 2-3 minutes they are formed
  • sujith
    @dajinkya,
    We don't have sample code but you can check out this thread to get started.

    A 5minute candle is built using five 1min candles when you request for 5min candle before completion of interval you may receive candle which is generated using two or three 1minute candles.
  • dajinkya
    @sujith , thanks for starter, but bit confused with your last line.

    What I was saying is. e.g
    day starts 5min candle at 09:15, 09:20, 09:25 ....etc
    When I request 5min candle at 09:26 min, i was expecting to get 09:25 candle, but until 09:27 I continue to get the candle before i.e 09:20
    at 09:28 i get 09:25 (which is quite late already 2-3 minutes)

    Are you suggesting to sync my call to historical api? Or the delay is expected ?
    And when revamp of api will happen will it have better performance?

    I understand you suggested to use live mkt data, but until i develop something, I will continue to use historical.
  • sujith
    Lets us say, you request for 5minute candle at 11:14 AM. You will see that last candle timestamp will be 11:10 AM
    That candle is generated using 11:10 AM to 11:14 AM 1minute candles. Once another 1minute candle is generated at 11:15 AM, it will give updated data after averaging last five 1minute candles.
    You need to sync with the historical data.
  • dajinkya
    @sujith wow, that is scary

    What do you advice, for 5minute candle, what time exactly request to be made to get complete 5 mins?

    And the entire 5min candle data, lets say has time stamps of 11:25 . then the data of candle is of 11:21-11:25 or 11:26-to-11:30?
  • sujith
    You need to experiment and check, it might take 10 to 20 seconds. But again it won't be consistent as there will be thousands of write requests pending in the queue. Since candle generation will be happening for all the instruments that are traded for the day.

    The 11:25 candle will contain data for 11:26 to 11:30.
Sign In or Register to comment.