I am seeing issue with historical candles (3 minutes timeframe) being generated very late after actually the timeframe is completed. The delay I am seeing is almost 50 seconds which is too huge. I understand that historical data is not supposed to be used for live ticks and websocket is better suited for that. But the problem with websocket is that if you are in middle of the development, and need to restart server often the data recorded with websocket will not be reliable.
e.g. If I query 3m candles at 9:18 AM, the response should contain the 9:18 AM candle.
I read somewhere else that there may be delay on Zerodha side after timeframe is elapsed due to candles being persisted in DB so 10 seconds delay can be added. I think that is just the wrong reason. Why can you not query all candles but latest one from DB and return the latest candle that is generated in-memory instead of waiting for all DB writes to happen and then returning correct data after whopping 1 minute delay?
The issue may be with other timeframes as well; I have tested only with 3m.