Historic data for Nifty Options sending wrong values for Low and Close


For Nifty Options historic data during live market hours ( between 9:15 am and 3:30 pm ), when I request 15 min candle data using the Python client, it seems like the data for "Low" and "Close" prices for the second last candle ( most recently closed candle ) is completely inconsistent with the data for "Low" and "Close" prices for the exact same Nifty Option in Kite.Web, even if the historical_data() function is called several minutes after previous candle had closed. Below is a snippet for a nifty option that can be tested during live market hours:

from_date = now - dt.timedelta(days=3),
to_date = now - dt.timedelta(minutes=15),
interval = "15minute"

This happens during live market for most / all second last candles ( ones before the open and active 15 min candles ) until current 15 min candle is closed.

Please fix this issue asap.

Thank you
    SRIJAN edited January 2022
    No, that's not correct way to fetch intraday data. Actually, KiteConnect has a weird way of sending data. What happens is that if your 'from' and 'to' are not exactly the timestamps of the start and end of the candle,then it doesn't send the data as you see in kite web or app. It sends the candles exactly 'from' 'to'. I mean let's say when you called this function ,the time was 12:48 pm. Then your 'to' will be 12:33 pm. You call this function expecting to return you the full 12:30 15m candle(12:30:00-12:44:59). But what it sends is (12:30:00-12:33:59). Kite stores data in 1m candles. And makes higher timeframes from that data. So,the open is correct,but not high,low and close. But today,most of the times,market was falling,so the high stayed the same mostly,giving you an illusion that only low and close are incorrect. After 12:45 candle closes at 1:00 pm,if you call this function,your 'to' will be after 12:45 pm. So ,it would return complete 12:30 candle(12:30:00-12:44:59). To fetch the correct last candle data,use 'to' as dt.now(). And ignore the last row from the response.
  • ag_0925
    Got an idea now. Will resolve this issue at my end.
    Thank you so much for the clarification @SRIJAN !
This discussion has been closed.