Price difference between getOHLC() and chart on kite web

krtrader
krtrader edited October 2017 in Java client
Hi,

I can see difference in OHLC levels between kite web chart (PFA) and value returned by getOHLC() method in java client.
for example, today(31-10-2017) at 9.30 AM I called, getOHLC() method for BAJAJ-AUTO (NSE) and levelsI received are:
Open: 3270.05 High: 3285.95 Low: 3270.05 Close: 3282.2

Here Open price is 3270.05 as per getOHLC() API. But, in kite web hourly chart, Open price is 3273.95 for the first candle.

Please see attached image for Bajaj-Auto chart for today.

Why this difference is there between API and Chart data?

Regards
  • krtrader
    krtrader edited October 2017
    if you see daily chart then Open price shows as 3270.05


  • sujith
    Hi @krtrader,
    Kite web charts and historical data API are from the same source(database) and hence there won't be any difference between the data.
    A minute and hour charts are generated using the ticks that are received during the market hours at our end whereas day candles are generated using the bhav copy data provided by the exchange.
    Besides, if you look at a minute or hour candle, the open refers to first tick of that time interval whereas day candle is the open of the day.

    Check out the response for minute, hour and day candles for BAJAJ-AUTO here,
    minute:
    {
    "data": {
    "candles": [
    ["2017-10-31T09:15:00+0530", 3273.95, 3282.95, 3273.25, 3274.75, 923],
    ["2017-10-31T09:16:00+0530", 3274.75, 3279.95, 3274.75, 3278.05, 381],
    ["2017-10-31T09:17:00+0530", 3278.05, 3279.25, 3276.25, 3276.25, 620],
    ["2017-10-31T09:18:00+0530", 3276.25, 3278.05, 3276.05, 3278.05, 334],
    ["2017-10-31T09:19:00+0530", 3280, 3285, 3279.5, 3284.65, 521],
    ["2017-10-31T09:20:00+0530", 3283.5, 3283.7, 3275.75, 3278, 2191],
    ["2017-10-31T09:21:00+0530", 3278, 3278, 3273.7, 3275, 453],
    ["2017-10-31T09:22:00+0530", 3275, 3276.25, 3275, 3276.25, 1287],
    ["2017-10-31T09:23:00+0530", 3276.25, 3276.25, 3275.15, 3276, 213],
    ["2017-10-31T09:24:00+0530", 3276, 3276.25, 3273.4, 3273.4, 757],
    ["2017-10-31T09:25:00+0530", 3273.4, 3274.5, 3273.4, 3274, 366],
    ["2017-10-31T09:26:00+0530", 3274, 3274.2, 3271, 3274.2, 761],
    ["2017-10-31T09:27:00+0530", 3275, 3276.35, 3274.95, 3276.35, 286],
    ["2017-10-31T09:28:00+0530", 3276.35, 3281.5, 3276.35, 3277.7, 153],
    ["2017-10-31T09:29:00+0530", 3277.7, 3278.4, 3277.7, 3278.4, 194],
    ["2017-10-31T09:30:00+0530", 3278.4, 3281, 3278.4, 3281, 290]
    ]
    },
    "status": "success"
    }
    hour:
    {
    "data": {
    "candles": [
    ["2017-10-31T09:15:00+0530", 3273.95, 3295, 3271, 3291.3, 26879]
    ]
    },
    "status": "success"
    }
    day:
    {
    "data": {
    "candles": [
    ["2017-10-31T09:15:00+0530", 3270.05, 3296, 3250.45, 3257.1, 195420]
    ]
    },
    "status": "success"
    }
    All the above values will be same on Kite web also.
  • krtrader
    krtrader edited November 2017
    Hi @sujith Thanks for reply

    I understood that this difference is because of difference between bhav copy and actual tick data.
    Please confirm on below:

    1. getOHLC() method returns data using bhav copy, right?
    2. Is it possible to get OHLC based on tick interval using any API (other than subscribing to web socket)
  • sujith
    Hi @krtrader,
    1. getOHLC() method returns data using bhav copy, right?
    It will return tick data and OHLC data is of the day. bhav copy is generated at the end of the day. During the day it will return tick data.
    2. Is it possible to get OHLC based on tick interval using any API (other than subscribing to web socket)
    Websockets will give you OHLC of the day. Interval's OHLC is provided only on historical API.
  • krtrader
    It will return tick data and OHLC data is of the day. bhav copy is generated at the end of the day. During the day it will return tick data.
    No, for the Bajaj-Auto, I got below response at around 31-OCT-2017 9.30 AM
    Open: 3270.05 High: 3285.95 Low: 3270.05 Close: 3282.2

    My question was, Is (open, high, low and close) returned by getOHLC() API is based on bhav copy?
    I am not talking about lastPrice returned by the API (it must be based on tick during the day). But these OHLC values also based on tick during the day?
    If it is, then why API has returned open=3270.05 instead of 3273.95?

  • sujith
    Hi,
    The bhav copy is generated by end of the day post-market settlement which is around 17:30 or 16:30.
    If you request for OHLC before that then it will return OHLC of the tick data.
  • krtrader
    krtrader edited November 2017
    If you request for OHLC before that then it will return OHLC of the tick data.
    A simple question, if this the case then why getOHLC() API has returned open=3270.05 instead of 3273.95? I called API at 9.30 AM on 31-OCT-2017

    if you want I can give you more examples of such price differences
  • sujith
    Hi @krtrader,
    Let us say today is 31st October 2017 and you request for 31st October 2017 day's candle at 9:30 AM then you will get OHLC of day candle which is generated using tick data.
    If you request for the same candle post 18:30 then you will get day candle data which is generated using bhav copy provided by the exchange.
  • krtrader
    Sir, I am not talking about Day's candle.
    I am asking about return value of getOHLC API during the DAY.
    What will be the OHLC values returned by getOHLC API during day. Is it based on tick data or Bhav copy?

    My original question was why there is difference between values of getOHLC API (calling during day) and kite chart values?
    Yes, there is a difference. If you want I can share more examples of today also.
    I am not saying that something is wrong but I just want the clarification.
  • sujith
    Hi @krtrader,
    getOHLC will give you day's OHLC not that minute's OHLC.
    The chart will have that minute's OHLC.
  • krtrader
    How to get OHLC based on tick during market hours using API?
Sign In or Register to comment.