Duration used in ohlc calculation in websocket ticks

bingo
Over what period are the ohlc in the websockets ticks response calculated?
  • fury1984
    @bingo Did you mean to ask the duration of each tick (like 1s or 2 s etc...)?
  • bingo
    @fury1984 : No, I understand that the duration difference in two consecutive ticks could be anything. My question is this -

    Let's say you historical data api in 1 minute interval, you will get the ohlc values calculated over every 1 min duration. Similarly, I want to know what that duration is while calculating the ohlc in the websocket tick response.
  • fury1984
    @bingo As @vivek answered in the below question, the ticks are directly streamed from exchange and they do no contain the timestamp. So I think it is not possible to exactly know the interval of each tick duration.

    https://kite.trade/forum/discussion/573/first-ticks-of-the-day#latest
  • bingo
    @fury1984 : I don't think my question got answered completely. Does it mean that the 'ohlc' in websocket tick response is calculated over the two latest ticks?
  • fury1984
    @bingo The following are the ticks I received for RELIANCE. Observe the ohlc data. It is constant over these ticks and was constant for more than half hour that I gathered ticks. The reason is the ohlc in each tick is the ohlc of the entire day not for that tick time period alone. If you want to know the OHLC over the last minute, you have to go through each tick and look at the last_traded_price and mark the corresponding open, high, low and close values. Hope this clarifies your doubt.

    [{'sell_quantity': 430136, 'ohlc': {'low': 1064.7, 'close': 1087.55, 'open': 1097.0, 'high': 1097.0}, 'tradeable': True, 'mode': 'quote', 'instrument_token': 738561, 'buy_quantity': 296303, 'average_price': 1077.56, 'change': -1.4803917061284455, 'last_price': 1071.45, 'last_quantity': 25, 'depth': {'sell': [{'orders': 458752, 'price': 1071.65, 'quantity': 948}, {'orders': 393216, 'price': 1071.7, 'quantity': 1635}, {'orders': 196608, 'price': 1071.75, 'quantity': 717}, {'orders': 262144, 'price': 1071.8, 'quantity': 1105}, {'orders': 458752, 'price': 1071.85, 'quantity': 1144}], 'buy': [{'orders': 131072, 'price': 1071.0, 'quantity': 161}, {'orders': 65536, 'price': 1070.95, 'quantity': 500}, {'orders': 65536, 'price': 1070.9, 'quantity': 266}, {'orders': 131072, 'price': 1070.8, 'quantity': 16}, {'orders': 196608, 'price': 1070.75, 'quantity': 301}]}, 'volume': 3883262}]
    [{'sell_quantity': 430538, 'ohlc': {'low': 1064.7, 'close': 1087.55, 'open': 1097.0, 'high': 1097.0}, 'tradeable': True, 'mode': 'quote', 'instrument_token': 738561, 'buy_quantity': 297962, 'average_price': 1077.56, 'change': -1.4849891958990267, 'last_price': 1071.4, 'last_quantity': 20, 'depth': {'sell': [{'orders': 65536, 'price': 1071.55, 'quantity': 8}, {'orders': 393216, 'price': 1071.65, 'quantity': 816}, {'orders': 196608, 'price': 1071.7, 'quantity': 1402}, {'orders': 196608, 'price': 1071.75, 'quantity': 717}, {'orders': 65536, 'price': 1071.8, 'quantity': 500}], 'buy': [{'orders': 65536, 'price': 1071.4, 'quantity': 323}, {'orders': 65536, 'price': 1071.05, 'quantity': 266}, {'orders': 262144, 'price': 1070.8, 'quantity': 217}, {'orders': 262144, 'price': 1070.75, 'quantity': 746}, {'orders': 131072, 'price': 1070.7, 'quantity': 336}]}, 'volume': 3883464}]
    [{'sell_quantity': 431038, 'ohlc': {'low': 1064.7, 'close': 1087.55, 'open': 1097.0, 'high': 1097.0}, 'tradeable': True, 'mode': 'quote', 'instrument_token': 738561, 'buy_quantity': 297962, 'average_price': 1077.56, 'change': -1.4849891958990267, 'last_price': 1071.4, 'last_quantity': 20, 'depth': {'sell': [{'orders': 65536, 'price': 1071.55, 'quantity': 8}, {'orders': 65536, 'price': 1071.6, 'quantity': 500}, {'orders': 393216, 'price': 1071.65, 'quantity': 816}, {'orders': 65536, 'price': 1071.7, 'quantity': 402}, {'orders': 327680, 'price': 1071.75, 'quantity': 1267}], 'buy': [{'orders': 65536, 'price': 1071.4, 'quantity': 323}, {'orders': 65536, 'price': 1071.05, 'quantity': 266}, {'orders': 262144, 'price': 1070.8, 'quantity': 217}, {'orders': 262144, 'price': 1070.75, 'quantity': 746}, {'orders': 65536, 'price': 1070.65, 'quantity': 94}]}, 'volume': 3883464}]
  • Vivek
    @bingo OHLC you get in every ticks is day's ohlc.
  • bingo
    OHLC you get in every ticks is day's ohlc.
    @vivek @fury1984 : In that case, if the market hasn't closed for the day, what does the close value represent?
  • bingo
    bingo edited October 2016
    @vivek @fury1984 : Adding to my previous post, if there has been no quantity traded since the start of the market day, what will be the value of `open` in websocket tick response?
  • Vivek
    @bingo Its previous day closing price if the market hasn't closed yet.
  • bingo
    @vivek Thanks.

    What about -
    @vivek @fury1984 : Adding to my previous post, if there has been no quantity traded since the start of the market day, what will be the value of `open` in websocket tick response?
  • Vivek
    @bingo You won't be getting ticks if the contract is not even traded.
  • bingo
    @vivek : Unless I am missing something here, In full mode, I will keep getting ticks if the bid/ask orders in the depth change.
Sign In or Register to comment.