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()