OHLC wrong first 1 minute candle from historical api and websocket

abhijeetv
Hi, Today I noticed for MGL when I query the historical data @9:17 for the 1-minute time frame
MGL : OHLC Open: 832.3 High:834.75 Close :833.3 Low :831.3

After some time when I query for the same at @9:30, the open price was changed
Open: 834.45 High:834.75 Close :833.3 Low :831.3

Even I validated my WebSocket data open price started at 832.3.

Any Idea on why the open price was changed?
  • sujith
    Are you comparing websocket open price and minute data open price?
  • SRIJAN
    The opening price is not decided by the first tick at 9:15 . Its decided at 9:08 AM. Initially, what happened is just like you captured the 1st tick at 832.3, historical data api did the same and showed opening at 832.3 . After a while,the opening of 1st min was replaced by the actual opening price of 834.45.
  • abhijeetv
    @SRIJAN @sujith thanks for the prompt reply, what is the correct way to get an open price when the market opens.
  • SRIJAN
    You can fetch ohlc quote after 9:08 AM for equity and 9:15 AM for derivatives. For equity,you can even fetch just ltp after 9:08 but before 9:15.
    https://kite.trade/docs/connect/v3/market-quotes/#retrieving-ohlc-quotes
  • rohitmalekar2117
    @SRIJAN @sujith Hi sir, actually I don't want opening price of 9.08 to be included in the first candle. It's causing lot of issues to my strategy. What I want is place ohlc data from 9.15AM be if for 5 min or 15 min first candle.. how to do it sir
  • SRIJAN
    I don't get your question.
    Do you mean you want to "plot" ohlc data??
  • rohitmalekar2117
    @SRIJAN I mean currently in first candle of any day ohlc includes data from 9.08 also.. so ohlc data which we are getting from kite api is different from what is shown on chart.. I will give one real example below--
    On 28th April 2022 for powergrid open and high on chart is 231.55 but kite api historical data gives open and high for first candle as 233.4 which is formed at 9.08(pre-market data) which is causing lot of problems. So I wanted to know whether there is any option where I can get ohlc data starting from 9.15 only.
    I my strategies basically formed on first candle high- low range I want data from just 9.15-9.30 not from 9.08-9.30 which is currently happening for all stocks.
    Like on tradingview we have regular trading hours and extended trading hours as seperate data option, likewise is there any option in kite api
  • SRIJAN
    SRIJAN edited May 2022
    Kite is showing the real opening and high. The data you get from historical data api is the same data used to make chart on Kite web/app. You can verify that the opening and high on kite charts is also 233.4.

    If you want to exclude the first tick at 9:08, try the same thing as Abhijeet was doing initially.
    Fetch the first minute candle just some time after market opening at 9:15.Get the open value ,which would be the first tick at 9:15 at this time,as Kite will take some time to adjust the opening, and save that value in a variable. Later,when you fetch data,replace the open you get(now,the real opening of 9:08) with the opening you saved(the 1st tick of 9:15).
    Because,this workaround is based on a glitch ,it might stop working anyday when they fix it.
    Also,I have never tried it, just telling you what Abhijeet said,so,try this workaround and check if it works.

    If it doesn't work or they fix it some day,you have to get the first tick at 9:15 from the websocket
    https://kite.trade/docs/connect/v3/websocket/
Sign In or Register to comment.