volume_traded discrepancy

ANL
ANL edited November 20 in Python client
Hello @sujith
Total volume traded value will always increase, not decrease.
What I have observed is that the volume traded is reduced. How is it possible? Is it a glitch, or what I observed is wrong?
Also, sometimes the same value is duplicating multiple times. What is the reason for all this?

TIme: 19-Nov-2024 15.20.00
NIFTY24N2123500PE

Vol 1: 182324200
Vol 2: 182337150
Vol 3: 182324200 (decreased & repeating)
Vol4: 182342725
  • ANL
    Note: Multiple values are not a problem. Please ignore it.
  • vaibhavsharma13
    Is it happening in data from Websocket?
  • ANL
    Yes, it is happening for almost all tokens from webscoket.
  • vaibhavsharma13
    I have seen duplicate volume but never seen decreasing volume with Websocket data.
  • ANL
    Duplicates can happen in L2, but decreasing volume is strange.
  • rakeshr
    TIme: 19-Nov-2024 15.20.00
    NIFTY24N2123500PE

    Vol 1: 182324200
    Vol 2: 182337150
    Vol 3: 182324200 (decreased & repeating)
    Vol4: 182342725
    I just checked ticks log for the mentioned instrument and timestamp. The volume are in the correct order as per the exchange timestamp.
    eg: Volume1: 182324200 is at "2024-11-19T15:20:01"
    Volume3: 182324200 is at "2024-11-19T15:20:02"
    Volume2: 182337150 is at "2024-11-19T15:20:02"
    Volume4: 182342725 is at "2024-11-19T15:20:03"
    As, you can see vol 3, and vol 2, came at the same seconds, but in the correct order. You should store it accordingly in your db/store.
  • ANL
    I am using score as an exchange timestamp from Redis, so how could the order be incorrect?
  • ANL
    @rakeshr I have checked with TrueData ticks. I am using both Kite and Truedata, the same code I am using with Truedata, and I have been checking for 1 hour, and I am sure I am not getting volume-decreasing issues with Truedata.

    I am converting to Unix timestamp before storing any ticks, so Unix is so accurate and giving it as a score, so no way it shows out of order.
  • ANL
    I just checked ticks log for the mentioned instrument and timestamp.
    The log time and streaming tick time are the same in your system? or after streaming the ticks, then it stores and sorts the time in the logs?
  • ANL
    @sujith @rakeshr It would be helpful if you could reply to the query.
  • sujith
    We have asked the team to take a look at this.
  • Dileep
    Hi @ANL i am also facing same issue. I am using API quotes.
  • vaibhavsharma13
    it happens in API quotes, but i never saw it websocket'
  • rakeshr
    @ANL
    The log time and streaming tick time are the same in your system? or after streaming the ticks, then it stores and sorts the time in the logs?
    Yes, they are the same. We use the same data source for our charts as well. Please note that while there can be multiple ticks within the same second, but they will always be in the correct order. You might want to consider implementing a unique sorting identifier at your end to differentiate the sequence of ticks within the same second.
  • ANL
    @rakeshr @sujith Please consider including milleseconds in the exchange timestamp so it will avoid these out-of-order issues. All other data providers (paid or free) have this feature, or they will pass the ticks only if they have sorted the ticks's order.
  • ANL
    @Dileep
    am also facing same issue. I am using API quotes.
    Quote API is just a snap of WS, so whatever ticks you are getting is solely based on the WS stream service.
  • rakeshr
    Please consider including milleseconds in the exchange timestamp so it will avoid these out-of-order issues
    We will check on this. For now, as mentioned above, you can attach a received timestamp or version to order in such a condition.
  • Dileep
    Hi @rakeshr The best way is sorting the volumes in asending order .So the same issue in API call also will fix.
  • ANL
    @Dileep Each tick has volume, so the issue arises when the two ticks with the same timestamp will create an out-of-order issue, so only the possible way from their end is to simply include milliseconds so each tick will be unique as milliseconds are different.Or they can do different unique sorting methods without including milliseconds.

    Second time is enough when the tick frequency is lower, but now we get 3 to 4 ticks per second in a volatile situation. A millisecond is necessary to get clarity.
    The best way is sorting the volumes in asending order
    Not possible to do that. Volume cannot be sorted in ascending order because one tick has only one volume value, so it is not possible. Once stored in a DB, we can do the sorting or whatever we need.
Sign In or Register to comment.