Subscribing to live feeds on multiple instruments



  • I am subscribing to feeds of multiple instrument but I am recieving feeds of the instrument last subscribed only. Can you please check ?


  • Global Moderator

    Hi @abbanerjee ,

    kindly send the request used by you for subscribing, obfuscate client specific details. It is easier for us to reply if you give us some details regarding your issue.

    Thanks,
    Alok Gaira



  • @AlokGaira said in Subscribing to live feeds on multiple instruments:

    e request used by you for subscribing, obfuscate client specific details. It is easier for us to reply if you give us some details regarding your issue.
    Thanks,
    Alok Gaira

    Can you please call me on my number ? Please check with Orpheus - he has my contact details.



  • Here is what it looks like

    for stockIdentifier in stockIdentifierlist:
        upstoxLiveAPI.unsubscribe( upstoxLiveAPI.get_instrument_ by_symbol(exchange_for_trade, stockIdentifier), LiveFeedType.LTP)
        upstoxLiveAPI.subscribe( upstoxLiveAPI.get_instrument_ by_symbol(exchange_for_trade, stockIdentifier), LiveFeedType.LTP)
    upstoxLiveAPI.set_on_quote_ update(on_new_price)
    upstoxLiveAPI.start_websocket( False)
    

    I suspect that the unsubscribe is causing the issue. Though I pass the correct instrument to ensure I unsubscribe before I subscribe - I think it unsubscribes all.

    Effectively you should have an endpoint to query current subscriptions per access code. That way we can verify before subscribing

    Also I noticed that the websocket sends same timestamp ltp multiple times. Is that by design ?



  • So what I suspected was indeed correct. The following code works without issues.

    for stockIdentifier in stockIdentifierlist:
        upstoxLiveAPI.unsubscribe(upstoxLiveAPI.get_instrument_by_symbol(exchange_for_trade, stockIdentifier), LiveFeedType.LTP)
    
    for stockIdentifier in stockIdentifierlist:
        upstoxLiveAPI.subscribe(upstoxLiveAPI.get_instrument_by_symbol(exchange_for_trade, stockIdentifier), LiveFeedType.LTP)
    

  • Global Moderator

    Hi @abbanerjee ,

    This is a bug with our API server, thanks for helping us finding it.
    We will resolve it ASAP.
    For the time being, you can only subscribe the feeds as you have figured it out.

    We regret any inconvenience caused by this.

    Thanks,
    Alok Gaira



  • Also the same timestamp and ltp is sent multiple times when subscribed. This causes missing ltps which I can see on the screen but the API does not get it. Can you also check that ?


  • Global Moderator

    Hi @abbanerjee ,

    We are working on the feature in which we will only send the feed packet if there is a change in it so you won't get same time stamp packet twice.
    We are sending the LTP at an interval of 500ms any LTP change between that will be missed. If you compare our feed with our web environment (pro.upstox.com) you will surely feel some missed LTP since pro platform updates feed at much faster rate than API.

    Thanks,
    Alok Gaira



  • May I ask why are you doing that and how is it benefitting the API's consumer?


  • Global Moderator

    @pranay the plan is to match with what we are doing with our web services. But it will happen only once we rule out the if's and but's happening with the API at the moment. It will just be a matter of time.

    Do let us know your experience on using the API. Your feedback is crucial.


Log in to reply
 

Looks like your connection to Upstox Forum was lost, please wait while we try to reconnect.