Day historical data is different for same date, If the start & end date change.

KamalChhirang
KamalChhirang edited June 20 in General
If I make this call using Python:

hist_day_candles = kite.historical_data(6401, "2010-05-24 00:00:00", "2010-05-24 23:59:59", "day", continuous=False, oi=False)


I get this output:
{'date': datetime.datetime(2010, 5, 24, 0, 0, tzinfo=tzoffset(None, 19800)), 'open': 548, 'high': 607.9, 'low': 548, 'close': 548, 'volume': 6493632}
But If I make this call using Python:

hist_day_candles = kite.historical_data(6401, "2010-04-10 00:00:00", "2010-06-18 23:59:59", "day", continuous=False, oi=False)

I get this output for this date (2010-05-24):
{'date': datetime.datetime(2010, 5, 24, 0, 0, tzinfo=tzoffset(None, 19800)), 'open': 580, 'high': 607.9, 'low': 548, 'close': 593.7, 'volume': 6493632}
The open and close price is different.
Tagged:
  • rakeshr
    We tried both the above requests. We are getting the same OHLCV value for the mentioned day period.
    {'date': datetime.datetime(2010, 5, 24, 0, 0, tzinfo=tzoffset(None, 19800)),
    'open': 548, 'high': 607.9, 'low': 548, 'close': 548, 'volume': 6493632}

    Are you seeing this discrepancy on all requests or is it happening intermittently?
    Also, can you paste the complete debug log for both the above requests?
  • KamalChhirang
    KamalChhirang edited June 21
    Hmm, weird. This is the exact code, I used:
    hist_day_candles = kite.historical_data(6401, "2010-05-24 00:00:00", "2010-05-24 23:59:59", "day", continuous=False, oi=False)
    hist_day_candles

    hist_day_candles = kite.historical_data(6401, "2010-04-10 00:00:00", "2010-06-18 23:59:59", "day", continuous=False, oi=False)
    for candle in hist_day_candles:
    if str(candle["date"])=="2010-05-24 00:00:00+05:30":
    print(candle)
    and, this is the result, I got:
    DEBUG:urllib3.connectionpool:Starting new HTTPS connection (1): api.kite.trade:443
    DEBUG:urllib3.connectionpool:https://api.kite.trade:443 "GET /instruments/historical/6401/day?from=2010-05-24+00%3A00%3A00&to=2010-05-24+23%3A59%3A59&interval=day&continuous=0&oi=0 HTTP/1.1" 200 None

    [{'date': datetime.datetime(2010, 5, 24, 0, 0, tzinfo=tzoffset(None, 19800)),
    'open': 548,
    'high': 607.9,
    'low': 548,
    'close': 548,
    'volume': 6493632}]

    DEBUG:urllib3.connectionpool:Starting new HTTPS connection (1): api.kite.trade:443
    DEBUG:urllib3.connectionpool:https://api.kite.trade:443 "GET /instruments/historical/6401/day?from=2010-04-10+00%3A00%3A00&to=2010-06-18+23%3A59%3A59&interval=day&continuous=0&oi=0 HTTP/1.1" 200 None

    {'date': datetime.datetime(2010, 5, 24, 0, 0, tzinfo=tzoffset(None, 19800)), 'open': 580, 'high': 607.9, 'low': 548, 'close': 593.7, 'volume': 6493632}
  • rakeshr
    rakeshr edited June 21
    DEBUG:urllib3.connectionpool:https://api.kite.trade:443 "GET /instruments/historical/6401/day?from=2010-05-24+00%3A00%3A00&to=2010-05-24+23%3A59%3A59&interval=day&continuous=0&oi=0 HTTP/1.1" 200 None
    {'date': datetime.datetime(2010, 5, 24, 0, 0, tzinfo=tzoffset(None, 19800)), 'open': 548, 'high': 607.9, 'low': 548, 'close': 548, 'volume': 6493632}

    DEBUG:urllib3.connectionpool:https://api.kite.trade:443 "GET /instruments/historical/6401/day?from=2010-04-14+00%3A00%3A00&to=2010-06-18+23%3A59%3A59&interval=day&continuous=0&oi=0 HTTP/1.1" 200 None
    {'date': datetime.datetime(2010, 5, 24, 0, 0, tzinfo=tzoffset(None, 19800)), 'open': 548, 'high': 607.9, 'low': 548, 'close': 548, 'volume': 6493632}
    Showing same at our end.
    Are you seeing this discrepancy on all the requests or is it happening intermittently?
  • KamalChhirang
    It is happening on all requests.

    I noticed one thing, In your second request, the start date is "2010-04-14" and in my request, the start date is "2010-04-10".

    When I change the start date to "2010-04-14" results are same for me also. Can you please change the start date and try again? @rakeshr

    Thank you
  • KamalChhirang
    @rakeshr Sir, did you try with the new values, that I mentioned in the above reply.
  • rakeshr
    Yes, I was able to reproduce this. We are checking on this.
  • kkarthik100
    Any update on this? It is Sunday, July 4th, 2021 today and I am seeing the same problem. Data fetched is different each time. It occurs intermittently and not on all candles.
  • kkarthik100
    To provide more context, the discrepancy can be seen quite consistently on smaller time-frames. I tested fetching 5 minute candles on bank nifty. I issue a fetch (using code similar to that posted earlier in this thread). Then, I issue the same fetch a few seconds later. A few candles are different. And different candles are different each time I perform this experiment.

    An example of candles that differed from one fetch to another are shown below. See the corresponding candles closely to observe what values differ.

    1st fetch:
    ['2021-05-25T09:40:00+0530', 34888.1, 34888.1, 34798.45, 34815.4, 0]
    ['2021-05-25T09:45:00+0530', 34822.4, 34822.4, 34738.15, 34741.9, 0]

    2nd fetch (issued 5 seconds later):
    ['2021-05-25T09:40:00+0530', 34888.1, 34888.1, 34798.45, 34824.95, 0]
    ['2021-05-25T09:45:00+0530', 34824.4, 34824.4, 34738.15, 34741.9, 0]
  • KamalChhirang
    KamalChhirang edited August 9
    @rakeshr Sir any update on this issue?

    I did this today:
    hist_intra_candles = kite.historical_data(138444036,"2021-08-09 09:15:00","2021-08-09 15:30:00", "minute", continuous=False, oi=False)
    According to the data returned

    The closing price of 15:29 candle is "209" but on Kite.Zerodha.com chart, it is "209.95".

    The close price on 09:15 candle is "201.6" but on kite chart, it is "201.8".

    The volume is also wrong.

    I also fetched todays data before 2 hours today using a similar command, but in that data returned the values were correct, I do not have the exact dates that I gave as input previously.


  • KamalChhirang
    I am sorry, ignore my above post. I accidentally compared volume of NSE & BSE
This discussion has been closed.