Probable inconsistency in the streaming data


  • @rajanprabu Yes it would be helpful if we receive timestamp in every tick, but I don't think so it is necessary. Because if there's no tickdata from the exchange, then you won't be able to confirm whether you should complete one candle formation or not. There are many scrips in which you won't get tickdata if there is no buyer/seller. It might happen that you won't get tickdata even after 10 minutes. In this case if you are using M5 timeframe, you won't be able to know when to close your candle and this will raise many issues. So I would suggest you not to use tickdata timestamps. Create your own timer function for it.


  • @dorje said in Probable inconsistency in the streaming data:

    hi bhavesh this is the issue i was speaking to you during conversation held with you, day before yesterday.

    Noted. I have asked my development team to work on the feedback shared on this post. We will keep you posted.


  • @dorje Will have to check that , you can run more than one program and divide the number of scrips among them

    i.e : Run 5 programs with 10 scrips each


  • @taleevaalam1 @bhaveshjain hi bhavesh this is the issue i was speaking to you during conversation held with you, day before yesterday.

    also @taleevaalam1 @rjbanna i need to ask you how many scripts data you can stream at a time cause i have subscribed for 50 scripts but i'm able to get data of only few scripts.


  • @rjbanna agreed with you we can use ltp of tvalue response to build the candle

    @admin @bhaveshjain Will it not be possible to just give us the following line as tick response continuously

    [{"to":"7128494980.08","lo":"1970.05","e":"nse_cm","sp":"1977.05","c":"1974.35","ltp":"1977.00","ltq":"47","tk":"2885","bs":"6","ltt":"16/12/2020 11:10:44","tsq":"955550","v":"3597688","bp":"1977.00","cng":"02.65","bq":"53","ap":"1981.41","nc":"00.13","name":"sf","tbq":"468907"}]
    

    and include the timeframe also in this response and get rid of the following data

    [{"tvalue":"16/12/2020 11:10:44","name":"tm"},{"e":"nse_cm","name":"sf","ltp":"1977.05","ltq":"40","tk":"2885","ltt":"NA"}]
    

    It would make us developers life easier

    If we want we can make do with the existing format as well but i don't want to work too hard on rearranging the data that i got from the API , the data should come in clean and consistent way


  • @rjbanna Thank for the explanations. Very much appreciated.

    Main motivation for me to switch to AB API was to get good quality ticks and not to miss ticks as it happened often with other big broker in India. If I am expected to use ticks with timestamp every 3-4 seconds, I need to switch back. I also dont understand why cant time be included in every tick that's it transmitted. Isn't that a basic requirement for a API ?


  • @rajanprabu If I were to make candle, I would use tvalue as it gets updated at every 1 or 2 seconds. You can create logic that compares the tvalue with your desired timeframe. ltt is last traded time, so it will only get updated if there's any price change. If there's no price update from the exchange for lets say 10 seconds, ltt won't update but tvalue will be updated to the recent time. So it might happen that values don't match.

    Now your second question. Yes sometimes you do get tvalue at the end of the response. That's why it is important not to hard code index places in your code. You should always check for the values, not the index, because tvalue will be the unique key in particular response. You can always loop through list and check for the tvalue key in the dict. By doing this way, you will always get the right value irrespective of the order.


  • @rjbanna Thanks for your answer. To parse it and make a candle out of it which timestamp do you use ? According to API documentation ltt is last updated time.. In some ticks value and ltt and tvalue are not matching ( whenever tvalue is available).. so wondering which one to use ?

    Another question is that

    {"tvalue":"16\/12\/2020 22:48:51","name":"tm"},{"to":"16900562031.89","lo":"64950.00","e":"mcx_fo","sp":"65847.00","c":"64826.00","ltp":"65840.00","ltq":"1","tk":"220582","bs":"1","ltt":"16\/12\/2020 22:48:50","tsq":"5761","v":"256441","bp":"65838.00","cng":"1014.00","bq":"4","ap":"65904.29","nc":"01.56","name":"sf","tbq":"8733"}]
    [{"to":"16900562031.89","lo":"64950.00","e":"mcx_fo","sp":"65847.00","c":"64826.00","ltp":"65840.00","ltq":"1","tk":"220582","bs":"1","ltt":"16\/12\/2020 22:48:50","tsq":"5761","v":"256441","bp":"65838.00","cng":"1014.00","bq":"4","ap":"65904.29","nc":"01.56","name":"sf","tbq":"8730"}]
    [{"to":"16900562031.89","lo":"64950.00","e":"mcx_fo","sp":"65847.00","c":"64826.00","ltp":"65840.00","ltq":"1","tk":"220582","bs":"1","ltt":"16\/12\/2020 22:48:50","tsq":"5761","v":"256441","bp":"65839.00","cng":"1014.00","bq":"4","ap":"65904.29","nc":"01.56","name":"sf","tbq":"8734"}]
    [{"to":"16900562031.89","lo":"64950.00","e":"mcx_fo","sp":"65847.00","c":"64826.00","ltp":"65840.00","ltq":"1","tk":"220582","bs":"1","ltt":"16\/12\/2020 22:48:50","tsq":"5762","v":"256441","bp":"65839.00","cng":"1014.00","bq":"4","ap":"65904.29","nc":"01.56","name":"sf","tbq":"8734"}]
    [{"tvalue":"16\/12\/2020 22:48:52","name":"tm"},{"to":"16900562031.89","lo":"64950.00","e":"mcx_fo","sp":"65847.00","c":"64826.00","ltp":"65840.00","ltq":"1","tk":"220582","bs":"1","ltt":"16\/12\/2020 22:48:50","tsq":"5761","v":"256441","bp":"65839.00","cng":"1014.00","bq":"4","ap":"65904.29","nc":"01.56","name":"sf","tbq":"8784"}]
    [{"to":"16900562031.89","lo":"64950.00","e":"mcx_fo","sp":"65847.00","c":"64826.00","ltp":"65840.00","ltq":"1","tk":"220582","bs":"1","ltt":"16\/12\/2020 22:48:50","tsq":"5761","v":"256441","bp":"65839.00","cng":"1014.00","bq":"8","ap":"65904.29","nc":"01.56","name":"sf","tbq":"8768"}]
    [{"to":"16900759744.76","lo":"64950.00","e":"mcx_fo","sp":"65847.00","c":"64826.00","ltp":"65840.00","ltq":"1","tk":"220582","bs":"1","ltt":"16\/12\/2020 22:48:52","tsq":"5760","v":"256444","bp":"65840.00","cng":"1014.00","bq":"2","ap":"65904.29","nc":"01.56","name":"sf","tbq":"8785"}]
    [{"tvalue":"16\/12\/2020 22:48:53","name":"tm"},{"to":"16900891553.34","lo":"64950.00","e":"mcx_fo","sp":"65847.00","c":"64826.00","ltp":"65840.00","ltq":"1","tk":"220582","bs":"1","ltt":"16\/12\/2020 22:48:52","tsq":"5765","v":"256446","bp":"65838.00","cng":"1014.00","bq":"6","ap":"65904.29","nc":"01.56","name":"sf","tbq":"8764"}]
    [{"to":"16900891553.34","lo":"64950.00","e":"mcx_fo","sp":"65847.00","c":"64826.00","ltp":"65840.00","ltq":"1","tk":"220582","bs":"1","ltt":"16\/12\/2020 22:48:52","tsq":"5855","v":"256446","bp":"65840.00","cng":"1014.00","bq":"1","ap":"65904.29","nc":"01.56","name":"sf","tbq":"8760"}]
    [{"to":"16900891553.34","lo":"64950.00","e":"mcx_fo","sp":"65847.00","c":"64826.00","ltp":"65840.00","ltq":"1","tk":"220582","bs":"1","ltt":"16\/12\/2020 22:48:52","tsq":"5855","v":"256446","bp":"65841.00","cng":"1014.00","bq":"5","ap":"65904.29","nc":"01.56","name":"sf","tbq":"8751"}]
    [{"to":"16900891553.34","lo":"64950.00","e":"mcx_fo","sp":"65847.00","c":"64826.00","ltp":"65840.00","ltq":"1","tk":"220582","bs":"1","ltt":"16\/12\/2020 22:48:52","tsq":"5855","v":"256446","bp":"65845.00","cng":"1014.00","bq":"1","ap":"65904.29","nc":"01.56","name":"sf","tbq":"8751"}]
    `[{"to":"16901482127.40","lo":"64950.00","e":"mcx_fo","sp":"65847.00","c":"64826.00","ltp":"65840.00","ltq":"1","tk":"220582","bs":"1","ltt":"16\/12\/2020 22:48:54","tsq":"5777","v":"256455","bp":"65841.00","cng":"1014.00","bq":"7","ap":"65904.28","nc":"01.56","name":"sf","tbq":"8777"},{"tvalue":"16\/12\/2020 22:48:54","name":"tm"}]
    [{"to":"16901482127.40","lo":"64950.00","e":"mcx_fo","sp":"65847.00","c":"64826.00","ltp":"65840.00","ltq":"1","tk":"220582","bs":"1","ltt":"16\/12\/2020 22:48:54","tsq":"5725","v":"256455","bp":"65845.00","cng":"1014.00","bq":"2","ap":"65904.28","nc":"01.56","name":"sf","tbq":"8793"}]
    [{"to":"16901482127.40","lo":"64950.00","e":"mcx_fo","sp":"65847.00","c":"64826.00","ltp":"65840.00","ltq":"1","tk":"220582","bs":"1","ltt":"16\/12\/2020 22:48:54","tsq":"5725","v":"256455","bp":"65845.00","cng":"1014.00","bq":"1","ap":"65904.28","nc":"01.56","name":"sf","tbq":"8792"}]
    [{"to":"16901548031.68","lo":"64950.00","e":"mcx_fo","sp":"65847.00","c":"64826.00","ltp":"65845.00","ltq":"1","tk":"220582","bs":"1","ltt":"16\/12\/2020 22:48:54","tsq":"5726","v":"256456","bp":"65842.00","cng":"1019.00","bq":"1","ap":"65904.28","nc":"01.57","name":"sf","tbq":"8781"}]
    

    In the above one can see that in the first tick tvalue was in the beginning and later it was at the end. If one need to constantly parse and make candled with it, it needs to be consistent. Or im making a mistake here.

    I hope my confusion is clear and thanks once again for your time.


  • @rajanprabu @taleevaalam1 I ran the API for 15 minutes, but I didn't see any inconsistencies in the response. I always get the tValue and to in the same list or only to. One thing that I notice is, I received tValue at every 3rd response. Below is the response that I got. Let me know if you have any questions for me.

    [{'name': 'tm', 'tvalue': '16/12/2020 21:55:44'}, {'ap': '65904.83', 'bp': '66071.00', 'bq': '13', 'bs': '1', 'c': '64826.00', 'cng': '1253.00', 'e': 'mcx_fo', 'lo': '64950.00', 'ltp': '66079.00', 'ltq': '1', 'ltt': '16/12/2020 21:55:43', 'name': 'sf', 'nc': '01.93', 'sp': '66079.00', 'tbq': '8994', 'tk': '220582', 'to': '16239543255.47', 'tsq': '5336', 'v': '246409'}]
    
    [{'ap': '65904.83', 'bp': '66071.00', 'bq': '13', 'bs': '1', 'c': '64826.00', 'cng': '1253.00', 'e': 'mcx_fo', 'lo': '64950.00', 'ltp': '66079.00', 'ltq': '1', 'ltt': '16/12/2020 21:55:43', 'name': 'sf', 'nc': '01.93', 'sp': '66079.00', 'tbq': '8994', 'tk': '220582', 'to': '16239543255.47', 'tsq': '5351', 'v': '246409'}]
    
    [{'ap': '65904.83', 'bp': '66071.00', 'bq': '13', 'bs': '1', 'c': '64826.00', 'cng': '1253.00', 'e': 'mcx_fo', 'lo': '64950.00', 'ltp': '66079.00', 'ltq': '1', 'ltt': '16/12/2020 21:55:44', 'name': 'sf', 'nc': '01.93', 'sp': '66079.00', 'tbq': '8994', 'tk': '220582', 'to': '16239609160.30', 'tsq': '5370', 'v': '246410'}]
    
    [{'name': 'tm', 'tvalue': '16/12/2020 21:55:45'}, {'ap': '65904.83', 'bp': '66071.00', 'bq': '13', 'bs': '1', 'c': '64826.00', 'cng': '1253.00', 'e': 'mcx_fo', 'lo': '64950.00', 'ltp': '66079.00', 'ltq': '1', 'ltt': '16/12/2020 21:55:44', 'name': 'sf', 'nc': '01.93', 'sp': '66079.00', 'tbq': '8994', 'tk': '220582', 'to': '16239609160.30', 'tsq': '5355', 'v': '246410'}]
    
    

  • @taleevaalam1 Yes I have the same issue as well. But I wonder how others are using it. @rjbanna any inputs regarding this ?