Issue with Receiving Ticks via Fyers WebSockets API

Hello Fyers Community,

I am facing an issue with the WebSockets API when subscribing to the Fyers ticker feed.

Sometimes, I can successfully receive the ticks, but other times, I do not receive any ticks at all. If I run the exact same code 2-3 times, I eventually manage to get the ticks.

Today, I was trying to subscribe to the following symbols:
["NSE:NIFTY2511623500CE", "NSE:NIFTY2511623500PE"]

However, I could not receive any ticks for these symbols. A few seconds before subscribing to these, I had subscribed to ["NSE:NIFTY50-INDEX"] and received the ticks for that symbol successfully.

I would like to know:

  • Is there a limit to the number of symbols I can subscribe to at a time?
  • Could there be any specific reason why this inconsistency occurs?

I have attached my code below for reference. I’d appreciate any insights or guidance on how to resolve this issue.

Thank you in advance for your help!

def registerSymbols(self, symbols):
    logging.info("FyersTicker:Register Symbols")
    tokens = []
    
    
    symbol=symbols
    #symbol=['NSE:SBIN-EQ', 'NSE:ADANIENT-EQ']
    #symbol = ["NSE:NIFTY50-INDEX" , "NSE:NIFTYBANK-INDEX"]
    print("Going to register Symbol:",symbol)
    data_type="SymbolUpdate"
    for symbolData in symbol:
          if symbolData not in self.registeredSymbols:
            self.registeredSymbols.append(symbolData)      
    #   isd = Instruments.getInstrumentDataBySymbol(symbol)
    #   token = isd['instrument_token']
    #   logging.info('FyersTicker registerSymbol: %s token = %s', symbol, token)
    #   tokens.append(token)

    

    logging.info('FyersTicker Subscribing tokens %s', symbol)
    threading.Thread(target=self.ticker.subscribe, args=(symbol,data_type,)).start()
  

Hey @ramksree-q9d ,

Can we know if there is any error faced when you run the socket for these symbols . Can we know the response received when you are not getting the ticks

Hi Abhishek.

Thank you for your reply. I didnt get any reply or response when I subscribed to these symbols.But I was getting the ticks for NSE:NIFTY50-ĪNDEX which I subscribed few seconds back.I usually start getting the ticks once I subscribe to the symbol.Even for this code,it works and gets me the ticks after I subscribe.

Is there any kind of response we get if we send a subscription request? I was not able to find anything on your docs..But I log all the responses from the server..So if you can provide me a sample of what kind of response I should receive,I can check and update you

Thanks in advance

Hi Abhishek,

Any updates on this query?

Hi Abhishek,

Did you mean to ask any response from the API like

“The broker Ticks are: {‘type’: ‘sub’, ‘code’: 200, ‘message’: ‘Subscribed’, ‘s’: ‘ok’}” .

I got this message when I subscribed to “NSE:NIFTY50-INDEX” and also for the options symbol. If you wish, I can share the full log file

Hi @WWhYB2qrsx

Any updates on this query and how I can fix this issue?