Hi. I generaly use the tick: KiteTick to get the OHLCV values for the instrument. The issue is that compared to chart, the values are not always correct. This happens randomly and for some symbols it mathces, and for some it does not match. for example, for TCS today,2025-09-18, at 9:18 after the first 3 min candle formed, my code logger the values for OHLC as following: 09:18:01 - NSE.TCS - INFO - is_new_candle - New Candle for 3minute for TCS at 2025-09-18 09:18:00 09:18:01 - NSE.TCS - INFO - myfunc - TCS Volume 125605 09:18:01 - NSE.TCS - INFO - myfunc - TCS Tick Based OHLC High 3193.8 09:18:01 - NSE.TCS - INFO - myfunc - TCS Tick Based OHLC Low 3185.0 09:18:01 - NSE.TCS - INFO - myfunc - TCS Tick Based OHLC Open 3185.0 09:18:01 - NSE.TCS - INFO - myfunc - TCS Tick Based OHLC Close 3172.8 09:18:01 - NSE.TCS - INFO - myfunc - TCS Days First Candle Volume 30000
here the Close value is wrong 3172.8. Infact TCS never touched 3172 in first 30 mins today after gap open around 3185. On chart this value is 3185. I have other examples too. Please check this. This happens randomly with high value as well. But for close value, the issue is pretty consistent.
Why I use this? I need the day level OHLC values and I dont want to use historical API as i work with 100s of symbols.
code: in my ticker handle/processor: def __init__(self, tick_data: Dict[str, Any]): self.instrument_token = tick_data.get("instrument_token") self.last_price = tick_data.get("last_price") self.volume = tick_data.get("volume_traded", 0) # Default to 0 for volume self.ohlc = tick_data.get("ohlc", {})
def on_tick(self, tick: KiteTick) -> None: tick_day_high = tick.ohlc.get('high', None) if tick.ohlc else None #use only for basic.its not very accurate tick_day_low = tick.ohlc.get('low', None) if tick.ohlc else None #use only for basic.its not very accurate tick_day_open = tick.ohlc.get('open', None) if tick.ohlc else None #use only for basic.its not very accurate tick_day_close = tick.ohlc.get('close', None) if tick.ohlc else None #use only for basic.its not very accurate logger.info(f"Tick Based OHLC High {tick_day_high}") logger.info(f" Tick Based OHLC Low {tick_day_low}") logger.info(f"Tick Based OHLC Open {tick_day_open}") logger.info(f"Tick Based OHLC Close {tick_day_close}")
In the WebSocket, OHLC represents the values for the day. Before the market opens, this data reflects the previous trading day's values. However, once the market opens, the closing price will still represent the previous trading day, while the opening, high, and low values will update to reflect the current day's data.
So, the price(3172.8) represents the previous trading day's close price in the websocket. For more details, you may refer to the documentation.
Hi @Nivas I am referring to values after market open. So yesterday close is out of picture. see the timestamp in my logs..its 9:18 am. So why would i get close of yesterday if other values OHL are for today?
09:18:01 - NSE.TCS - INFO - is_new_candle - New Candle for 3minute for TCS at 2025-09-18 09:18:00 09:18:01 - NSE.TCS - INFO - myfunc - TCS Volume 125605 09:18:01 - NSE.TCS - INFO - myfunc - TCS Tick Based OHLC High 3193.8 09:18:01 - NSE.TCS - INFO - myfunc - TCS Tick Based OHLC Low 3185.0 09:18:01 - NSE.TCS - INFO - myfunc - TCS Tick Based OHLC Open 3185.0 09:18:01 - NSE.TCS - INFO - myfunc - TCS Tick Based OHLC Close 3172.8 09:18:01 - NSE.TCS - INFO - myfunc - TCS Days First Candle Volume 30000
@gs3141 In the WebSocket, OHLC reflects the values for the day's time frame (not for minute or hourly intervals). Once the market opens, the closing price will still represent the previous trading day, as the day's closing price is available only after the market closes. Meanwhile, the opening, high, and low values will update to show the current day's data. You may refer to the similar discussion here.
So, the price(3172.8) represents the previous trading day's close price in the websocket. For more details, you may refer to the documentation.
09:18:01 - NSE.TCS - INFO - is_new_candle - New Candle for 3minute for TCS at 2025-09-18 09:18:00
09:18:01 - NSE.TCS - INFO - myfunc - TCS Volume 125605
09:18:01 - NSE.TCS - INFO - myfunc - TCS Tick Based OHLC High 3193.8
09:18:01 - NSE.TCS - INFO - myfunc - TCS Tick Based OHLC Low 3185.0
09:18:01 - NSE.TCS - INFO - myfunc - TCS Tick Based OHLC Open 3185.0
09:18:01 - NSE.TCS - INFO - myfunc - TCS Tick Based OHLC Close 3172.8
09:18:01 - NSE.TCS - INFO - myfunc - TCS Days First Candle Volume 30000