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.
  • Dileep
    Thanks @ANL & @rakeshr . So i think from the exchange it self the tick data is not coming in asending time frame. Below is the sample API response.

    In the above if "timestamp"(in tick data the parameter name is "Exchange timestamp") parameter contains micoseconds as well that will be good.
    The question is
    1. who will include the microseconds to the "timestamp" parameter? whether the Exchange or the Zerodha(broker).
    2. By including microseconds, it is not guarantee that "timestamp" of the streaming ticks is in asending order(But actually it should stream in asending order).
    Please correct me if i am wrong.
  • ANL
    @Dileep Not Micorseconds , it is milliseconds

    Here are some issues that I observed:
    1. who will include the microseconds to the "timestamp" parameter? whether the Exchange or the Zerodha(broker).
    I don't know the format of tick data they are getting from the exchange. If the exchange provides milliseconds, they can just include. if not,

    Zerodha can't easily include milliseconds to the each tick data, as if they rely on whatever ticks are coming from the exchange. Exchange time is when exchange passing ticks to the broadcast channel. Mr. Rakeshr has to explain if it is possible.
    By including microseconds, it is not guarantee that "timestamp" of the streaming ticks is in asending order(But actually it should stream in asending order).
    Please correct me if i am wrong.
    As I said before, each tick has only one value for all params, not multiples. The logic is they can add whatever, but it matters only how they pass ticks and how we collect those ticks.

    For the Python client, the tick data is coming as a dictionary in a list of combined/series of ticks, so when we extract through, then there is a chance that it will be out of order or crop up other issues; otherwise, we have to do some other logic inside our code.

    @rakeshr Is it possible to remove the series of ticks in a list? Each tick should be a single tick in a list, and it will solve all issues customers are facing. So while streaming ticks, it will collect all ticks in a proper way.
    If you look around, all other data vendors provide it in this method.

    As a paying customer, I expect minimal overhead and increased satisfaction. Before passing the ticks to the customer, a company should be thoroughly checked for all possible logic and issues.
Sign In or Register to comment.