Bad data from ohlc api today for many stocks - Mar 31

SpacemanSpiff
Hello,

I call ohlc api for a bunch of stocks about 15 seconds before market opens to get pre open data, including open price.

So far I have assumed its always accurate, there is enough time from pre open session close for Zerodha to fetch all data.
But today by chance i saw few trades that did not look right and so checked my logs. It seems that ohlc api gave stale open prices for many stocks ( but not all)

Ex - ADANIPORTS open price was sent as 593.35 whereas NSE open is actually 643.90. So it seems wednesday's open price was sent instead of today.
"NSE:ADANIPORTS": {"instrument_token":3861249, "last_price":636.65, "ohlc":{"open":593.35, "high":642.55, "low":590.1,"close":636.65}},

Right now api output is fine, so we got bad data only around open today.

1) What happened here ? Why did I get stale data ? Does it happen regularly for a call made so close to open ?
2) How to manage this ? I see quote api has timestamp/last_trade_time. So i could call quote instead of ohlc.
When open data is stale can we expect timestamp/last_trade_time to be accurate and have previous days date ?
If yes, then i could simply retry after some time for stale scrips.
Tagged:
  • sujith
    This happened because exchange sent the stale data. We have asked them about the RCA but haven't received any reply from the exchange.
  • SpacemanSpiff
    SpacemanSpiff edited March 2023
    Understood, so not much one can do other that make NSE look at it so that it does not happen again. Hopefully this is a one time issue.

    If you already know - by what time was this issue fixed and open prices corrected ?

    In this case i guess it wont matter but Just to be sure, is it ok to call ohlc api at 09:14:45 and expect it to have accurate open price, Or will it be better to call quote and also check ltt/timestamp to detect stale data ( and retry)? thanks
  • rakeshr
    will it be better to call quote and also check ltt/timestamp to detect stale data
    Yes, you can check for last_trade_time for today's DateTime.
This discussion has been closed.