Historical API candles differs from live market candles on Kite Web

kranthi edited June 2023 in Python client
During live market, the "historical API" provides different candle data compared to the data available on the Kite Web platform charts.

Tried on Index Tokens, and Index Option tokens
Tried on different intervals (1min, 2min, 5min - considered the same block as in Kite )
Tried at different invervals of a minute (after 5sec, 10sec, 15sec, ...)
Tried with different timestamps
(from_date 2023-06-20 and to_date 2023-06-22
from_date 2023-06-20 10:00:00 and to_date 2023-06-22 10:04:59 |
from_date 2023-06-20 10:00:00 and to_date 2023-06-22 10:05:00 |
from_date 2023-06-20 and to_date 2023-06-22 )

Only one or two of the OHLC fields are euqivalent to that of Kite Web candles OHLC

Even if takes 1 to15 seconds to process the tick data, the actual candle data should have been available in HistoricalAPI.

I would like to get the "same candle data" that is being displayed on Kite Web charts during the live markets.
Please let me know, how to get that...
  • rakeshr
    Pooling is not recommended on the historical data API requests. Go through the historical data FAQs.
  • kranthi
    kranthi edited June 2023
    I understand pooling is not recommended.
    But, as long as two or three requests made per minute/5 minutes, I think it should be okay.
    [Rate Limit: Historical API - 3r/s -- MAX 180/minute]

    But the question is how "to get the same data" that is being displayed on Kite web through historical api.

    I did check all the historical data FAQs.

    Ironically, though we have historical api, there it was suggested to make candles from tick data.

    When a candle is already completed, that data should be avalable with few seconds delay.
    The question is why "historical api" can't provide the same data that is being displayed on kite charts "during live markets" with few seconds delay.
  • sujith
    The historical data API is provided only for backtesting purposes only. It is not meant for live market strategies.
    Since the candle is generated for all 93k+ instruments at our end. We can't guarantee any time line when candle will be generated, since it involves DB operations. It may be generated at 10th second after end of the minute or 100 seconds after end of the minute. We suggest generating candles at your end for the instruments that you are tracking.
  • kranthi
    It's interesting.

    Historical api 's shortest duration candle is for a minute.
    Historical api, does provide data for the candles that are being generated (i.e., for the ongoing candle), and that data changes in seconds.
    [tried checking requests for the same instruments, with few seconds delay]

    So, I really wonder, how many number of DB Operations are being made here for the "ongoing candle".

    All I'm interested is how can I get the same data, that is being displayed on Kite Web.
  • kranthi
    Btw the candle is already being generated for all those 93k+ instruments at your end for live charting.
    Means, the data is already available.

    All you need to do is, copying/synch the data to the Historical API's DB with last candle.

    And I don't think it would take more time to perform a read operation of all those 93k+ instruments candle data, and write the data into the DB.

    I wonder, why your team is not looking into this.
  • himanshurajgupta
    @kranthi These are some very valid questions which you have raised. If the data is correctly available on live charting then what is stopping you to have the same data in historical API DB when you are already updating the historical API db values almost every second. This is something Zerodha's dev team should definitely prioritize. I understand that fixing it can have some impact/bug in initial days but with proper testing it can be done easily. This has been a long due on Zerodha's Dev team end and everytime they escape this by saying we have multiple DB operations.

    I would request @sujith to look forward on this matter and it would be really helpful if there is a chance of prioritizing it in future.
Sign In or Register to comment.