Candle stick for 1 min

varuntoshniwal97
I am trying to prepare candle stick chart (1 min) with incoming tick data. I had a query regarding the open key. If data is received a bit later in the minute, should open value be the previous candle's close, and similarly should I consider previous candle's close value for high and low?
  • rakeshr
    @varuntoshniwal97
    If data is received a bit later in the minute, should open value be the previous candle's close
    For WebSocket streaming, we broadcast the same data as we receive in real-time from the respective exchange. So, there won't be any known delay.
  • varuntoshniwal97
    @rakeshr I'll explain my query in a better way. For example , we have a candle prepared for 11th minute , and on the 12th minute I don't have a tick yet , what should be the open value for the candle of the 12th minute until no new tick is received. Suppose for an instrument, i received the tick data at the 15th second of the minute, so should the open value for the current candle be the last candle's close ?
  • sujith
    @varuntoshniwal97,
    One can't display our live market data and historical data on a third-party website. You can contact any exchange registered data vendor.
  • varuntoshniwal97
    @sujith,
    It's not a third party website and for internal use only.
    I just wanted to understand the way how candle sticks bars are made, because the one's I'm preparing are totally off wrt to my own kite account charts.
    For more clarification, I've not subscribed to historical data APIs so it's just for realtime websockets tick data.
  • sujith
    You can know more about building candles here.
  • varuntoshniwal97
    @sujith ,
    I am trying to prepare candlestick chart for 1 minute using the incoming tick data, I check if the recent tick data's timestamp is of the same minute as the last data. If they belong to the same minute I change the value of ohlc accordingly, if not then i create a new object for a new minute. I just wanted to ask the logic behind creating this chart, when does the open value of a particular minute is same as the close of the previous minute? When are they similar and when do they change? I also wanted to ask how does zerodha manages 1 minute chart, do they manage it in the browser or call an api frequently?
  • sujith
    The first tick's ltp is the open and the last tick ltp is the close. High and low changes when there is a new lowest ltp or highest ltp.
    We use websocket data to plot live candles. We don't poll APIs.
  • varuntoshniwal97
    varuntoshniwal97 edited January 2021
    @sujith, understood. What if the last tick i received was suppose at 03:14:58 and the ltp was 50, and the next tick i receive is at 03:15:05 with an ltp of 52. So should the open value of the 03:15 minute should be 50 or 52? Is the close price of a candle is used as the open price for next candle? If yes, then always or just when the ohlc for the new candle is not known or not received?
  • sujith
    52 will be open for the 3:15 candle since it is the first tick's LTP received.
    No, the close price of the previous minute is not used for the next minute.
  • varuntoshniwal97
    @sujith , Thank you for your help. Got a better understanding
This discussion has been closed.