Volume data aggregation issue using websockets

kashish9696
Hi,
I'm using the KiteTicker client from the kiteconnect python module to subscribe to streaming live data. I have tried a lot of optimisations(including making sure that nothing blocks the on_ticks callback). However, on aggregating ticks into bars for instruments I see that my OHLC is close to the bar shown on charts in the Kite webapp but the volumes are way off. My guess is that zerodha samples ticks at their end before sending it through to the websocket client but can someone confirm this?
  • kashish9696
    @sujith can you please help here?
  • rakeshr
    My guess is that zerodha samples ticks at their end before sending it through to the websocket client but can someone confirm this?
    No, we don't sample/filter the websocket tick data. It's streamed as received from the respective exchange.
    Which field are you using to calculate interval volume? You can subtract last total volume/volume traded with first volume traded value for the mentioned interval.
  • kashish9696
    I'm using the 'last_traded_quantity' field to calculate the interval volume. In each interval, I sum this field for every tick received for a particular symbol. I had already thought about your approach too and that does return the correct volume as shown in the candle chart on zerodha but my question still remains unanswered that why should both these approaches give different outputs if zerodha is pushing all ticks as it is.
  • sujith
    You need to use volume traded for the day field. It is a cumulative value, you need to subtract last tick's volume and first tick's volume.
  • kashish9696
    @sujith I understand that and that approach does give me the correct result. But my point is if Zerodha is not filtering any ticks and all ticks are being sent as it is, the sum of 'last traded quantity' of all ticks in an interval should be equal to the diff between last tick's volume and first tick's volume in that interval else Zerodha is filtering ticks. I'm available to discuss this on call in detail if you like.
  • sujith
    sujith edited December 2024
    Kite Connect offers you a snapshot(level-2) data as streamed by exchange, there can be hundreds of ticks per second at the exchange, but exchange streams only one or two ticks a second over the internet.
    You need to be located at the exchange to get tick by tick data.

    You may refer to this thread.
  • kashish9696
    Understood. Thanks. This is what I wanted to confirm.
Sign In or Register to comment.