Discrepancies in Tick Data

mlearner

Sharing RELIANCE tick data below -


DEBUG:root:Ticks: [{'timestamp': datetime.datetime(2020, 7, 14, 9, 56), 'last_price': 1924.75, 'oi_day_low': 0, 'volume': 3856292, 'sell_quantity': 1518502, 'last_quantity': 19, 'change': -0.5297157622739018, 'oi': 0, 'average_price': 1925.42, 'ohlc': {'high': 1935.0, 'close': 1935.0, 'open': 1934.0, 'low': 1916.7}, 'tradable': True, 'depth': {'sell': [{'price': 1924.9, 'orders': 1, 'quantity': 8}, {'price': 1925.0, 'orders': 19, 'quantity': 1263}, {'price': 1925.05, 'orders': 1, 'quantity': 100}, {'price': 1925.1, 'orders': 3, 'quantity': 296}, {'price': 1925.15, 'orders': 5, 'quantity': 331}], 'buy': [{'price': 1924.75, 'orders': 2, 'quantity': 307}, {'price': 1924.7, 'orders': 1, 'quantity': 1}, {'price': 1924.5, 'orders': 3, 'quantity': 834}, {'price': 1924.35, 'orders': 2, 'quantity': 51}, {'price': 1924.3, 'orders': 1, 'quantity': 2}]}, 'mode': 'full', 'last_trade_time': datetime.datetime(2020, 7, 14, 9, 56), 'buy_quantity': 682297, 'oi_day_high': 0, 'instrument_token': 738561}]

DEBUG:root:Ticks: [{'timestamp': datetime.datetime(2020, 7, 14, 9, 56, 1), 'last_price': 1924.75, 'oi_day_low': 0, 'volume': 3856292, 'sell_quantity': 1518502, 'last_quantity': 19, 'change': -0.5297157622739018, 'oi': 0, 'average_price': 1925.42, 'ohlc': {'high': 1935.0, 'close': 1935.0, 'open': 1934.0, 'low': 1916.7}, 'tradable': True, 'depth': {'sell': [{'price': 1924.9, 'orders': 1, 'quantity': 8}, {'price': 1925.0, 'orders': 19, 'quantity': 1263}, {'price': 1925.05, 'orders': 1, 'quantity': 100}, {'price': 1925.1, 'orders': 3, 'quantity': 296}, {'price': 1925.15, 'orders': 5, 'quantity': 331}], 'buy': [{'price': 1924.75, 'orders': 2, 'quantity': 307}, {'price': 1924.7, 'orders': 1, 'quantity': 1}, {'price': 1924.5, 'orders': 3, 'quantity': 834}, {'price': 1924.35, 'orders': 2, 'quantity': 51}, {'price': 1924.3, 'orders': 1, 'quantity': 2}]}, 'mode': 'full', 'last_trade_time': datetime.datetime(2020, 7, 14, 9, 56), 'buy_quantity': 682297, 'oi_day_high': 0, 'instrument_token': 738561}]

DEBUG:root:Ticks: [{'timestamp': datetime.datetime(2020, 7, 14, 9, 56, 1), 'last_price': 1924.9, 'oi_day_low': 0, 'volume': 3856294, 'sell_quantity': 1518546, 'last_quantity': 2, 'change': -0.521963824289401, 'oi': 0, 'average_price': 1925.42, 'ohlc': {'high': 1935.0, 'close': 1935.0, 'open': 1934.0, 'low': 1916.7}, 'tradable': True, 'depth': {'sell': [{'price': 1924.9, 'orders': 1, 'quantity': 6}, {'price': 1925.0, 'orders': 22, 'quantity': 1299}, {'price': 1925.05, 'orders': 1, 'quantity': 100}, {'price': 1925.1, 'orders': 3, 'quantity': 296}, {'price': 1925.15, 'orders': 5, 'quantity': 331}], 'buy': [{'price': 1924.75, 'orders': 3, 'quantity': 360}, {'price': 1924.7, 'orders': 1, 'quantity': 1}, {'price': 1924.5, 'orders': 3, 'quantity': 834}, {'price': 1924.35, 'orders': 2, 'quantity': 51}, {'price': 1924.3, 'orders': 1, 'quantity': 2}]}, 'mode': 'full', 'last_trade_time': datetime.datetime(2020, 7, 14, 9, 56, 1), 'buy_quantity': 682323, 'oi_day_high': 0, 'instrument_token': 738561}]

DEBUG:root:Ticks: [{'timestamp': datetime.datetime(2020, 7, 14, 9, 56, 2), 'last_price': 1924.9, 'oi_day_low': 0, 'volume': 3856549, 'sell_quantity': 1518592, 'last_quantity': 8, 'change': -0.521963824289401, 'oi': 0, 'average_price': 1925.42, 'ohlc': {'high': 1935.0, 'close': 1935.0, 'open': 1934.0, 'low': 1916.7}, 'tradable': True, 'depth': {'sell': [{'price': 1924.9, 'orders': 3, 'quantity': 8}, {'price': 1925.0, 'orders': 23, 'quantity': 1304}, {'price': 1925.05, 'orders': 1, 'quantity': 100}, {'price': 1925.1, 'orders': 3, 'quantity': 296}, {'price': 1925.15, 'orders': 7, 'quantity': 458}], 'buy': [{'price': 1924.75, 'orders': 3, 'quantity': 126}, {'price': 1924.5, 'orders': 3, 'quantity': 838}, {'price': 1924.35, 'orders': 1, 'quantity': 50}, {'price': 1924.3, 'orders': 1, 'quantity': 2}, {'price': 1924.2, 'orders': 1, 'quantity': 1}]}, 'mode': 'full', 'last_trade_time': datetime.datetime(2020, 7, 14, 9, 56, 2), 'buy_quantity': 682080, 'oi_day_high': 0, 'instrument_token': 738561}]

DEBUG:root:Ticks: [{'timestamp': datetime.datetime(2020, 7, 14, 9, 56, 4), 'last_price': 1924.75, 'oi_day_low': 0, 'volume': 3856777, 'sell_quantity': 1517458, 'last_quantity': 5, 'change': -0.5297157622739018, 'oi': 0, 'average_price': 1925.42, 'ohlc': {'high': 1935.0, 'close': 1935.0, 'open': 1934.0, 'low': 1916.7}, 'tradable': True, 'depth': {'sell': [{'price': 1924.8, 'orders': 1, 'quantity': 1}, {'price': 1924.9, 'orders': 1, 'quantity': 69}, {'price': 1925.0, 'orders': 26, 'quantity': 1647}, {'price': 1925.05, 'orders': 1, 'quantity': 100}, {'price': 1925.1, 'orders': 3, 'quantity': 296}], 'buy': [{'price': 1924.75, 'orders': 3, 'quantity': 111}, {'price': 1924.7, 'orders': 1, 'quantity': 5}, {'price': 1924.5, 'orders': 6, 'quantity': 993}, {'price': 1924.35, 'orders': 1, 'quantity': 50}, {'price': 1924.3, 'orders': 2, 'quantity': 3}]}, 'mode': 'full', 'last_trade_time': datetime.datetime(2020, 7, 14, 9, 56, 3), 'buy_quantity': 683080, 'oi_day_high': 0, 'instrument_token': 738561}]

DEBUG:root:Ticks: [{'timestamp': datetime.datetime(2020, 7, 14, 9, 56, 5), 'last_price': 1924.8, 'oi_day_low': 0, 'volume': 3857156, 'sell_quantity': 1520051, 'last_quantity': 1, 'change': -0.5271317829457388, 'oi': 0, 'average_price': 1925.42, 'ohlc': {'high': 1935.0, 'close': 1935.0, 'open': 1934.0, 'low': 1916.7}, 'tradable': True, 'depth': {'sell': [{'price': 1924.8, 'orders': 1, 'quantity': 1}, {'price': 1924.9, 'orders': 2, 'quantity': 569}, {'price': 1924.95, 'orders': 1, 'quantity': 50}, {'price': 1925.0, 'orders': 27, 'quantity': 1747}, {'price': 1925.05, 'orders': 1, 'quantity': 100}], 'buy': [{'price': 1924.5, 'orders': 7, 'quantity': 967}, {'price': 1924.35, 'orders': 1, 'quantity': 50}, {'price': 1924.3, 'orders': 1, 'quantity': 2}, {'price': 1924.25, 'orders': 1, 'quantity': 19}, {'price': 1924.2, 'orders': 1, 'quantity': 1}]}, 'mode': 'full', 'last_trade_time': datetime.datetime(2020, 7, 14, 9, 56, 5), 'buy_quantity': 683401, 'oi_day_high': 0, 'instrument_token': 738561}]


2 queries -

1) Tick data for datetime.datetime(2020, 7, 14, 9, 56, 1) is duplicated. Can this duplication be avoided or else I will have to write logic to detect and then ignore duplicated data from websocket feed?

2) Tick data for datetime.datetime(2020, 7, 14, 9, 56, 3) is missing. Is this expected? If this discrepancy is from the exchange itself, can we assume universally no one got access to tick data for datetime.datetime(2020, 7, 14, 9, 56, 3) for RELIANCE?

Thanks.
Tagged:
  • sujith
    The way it works is if there is a change in the data the exchange has published then Kite Ticker will broadcast the same. So there is nothing wrong here.
    You can also go through this thread once.
  • mlearner
    mlearner edited July 2020
    The way it works is if there is a change in the data the exchange has published then Kite Ticker will broadcast the same.
    @sujith - Could not understand your reply clearly. I went through the thread link. Quite helpful. What I understand by reading it is, - KiteConnect is giving 1 sec snapshot data using couple of ticks per second when you do ws.subscribe([738561]).

    1) Now in this 1 sec snapshot result, there could be a duplication of timestamp as you might have captured multiple tick data points. And you are giving it all in API call and not discarding any data as the price of the instrument in these duplicated timestamps may differ? Is this understanding correct?

    2) I still could not understand how a timestamp like datetime.datetime(2020, 7, 14, 9, 56, 3) can be missing above. Is this a failover scenario where Kite Connect could not fetch 1 sec snapshot data from the exchange?
  • sujith
    @mlearner,
    It is the pub-sub mechanism wherein the publisher(exchange) publishes the data and we receive data and forward data to all the Kite Ticker subscribers.
    The timestamp is a data associated with the tick by the exchange and not appended by us. Like Nithin has mentioned in the above thread it is not possible for any platform to receive all the ticks over the internet.

    For an illiquid instrument, you may receive only one or two ticks a day or no tick at all.

    You will have to be co-located at the exchange to get all the ticks. You can write to kiteconnect(at)zerodha.com someone from our team will get back to you if you are interested in that.
    It costs around 18lakhs+/annum for the setup.
Sign In or Register to comment.