Timestamps on 1-minute candles are wrong

rs20375
Timestamps on 1-minute candles are wrong, or maybe my assumption.

Assumption - candle for data between 11:25 and 11:26 will have timestamp of 11:25 (candle opening time, as I read at many places that Zerodha API generates candles named after opening time rather than closing time)

Reality - when I query at 11:26:05 I get the latest candle with timestamp 11:26.

Is my understanding wrong?
  • rs20375
    rs20375 edited January 21
    I figured this out myself.

    The last candle is the "live candle" still forming with changing market data, and so its timestamp is of the current minute. This also means we should be careful in using this candle, or exclude it entirely, while feeding into technical indicators, as its data is skewed compared to previous complete candles. Not to mention that the historical candles in a live market are anyway inaccurate to a good extent. However the alternative to form candles from ticks on your own is not a good one either, as you are not guaranteed to receive all the ticks of high volume scrips.
  • Matti
    xclude it entirely, while feeding into technical indicators
    Yep, this is best practice.
    form candles from ticks on your own is not a good one either, as you are not guaranteed to receive all the ticks of high volume scrips.
    This isn't any different from the historical candle you're querying. This isn't tick-by-tick data. The candle you query is also constructed using the same stream that you get on the websocket, so it is virtually the same.
  • ANL
    @rs20375 If you check older threads, you may have found many queries related to this issue. So the soul of this community says that calling an API for historical data during live trading is an extremely amateur way. Historical data is only for bactesting purpose. Candle generations from your own method will solve your query, but it required some additional tasks.

    Indeed, we should stay within the bounds of the retailer's adventure in everything we do. FYI, WebSocket data is just a snapshot of 100+ ticks in exchange per second. We don't know what the exact price of any instrument was in a millisecond before, so to conclude, when we are designing any trading strategy, make sure it won't be a latency based strategy; We are wasting our valuable time if it is. I similarly wasted a lot of time before coming to this difficult revelation.
Sign In or Register to comment.