PARTH P
ยทAlgo Trader

DataSocket reconnect sometimes subscribes an unwanted symbol "NIFTY10JUL25C25500"

I have a part of my code that rebalances the symbols depending on market movement. I use the optionchain python method for this.

fyers.optionchain(data=data)

Once the new symbols are generated, I trigger dataSocket unsubscribe and subscribe methods to get those new symbols in.

The list of newly generated symbols right before this happned is as follows,
['NSE:NIFTY2571025350CE', 'NSE:NIFTY50-INDEX', 'NSE:NIFTY2571025400CE', 'NSE:NIFTY2571025450PE', 'NSE:NIFTY2571025500CE', 'NSE:NIFTY2571025500PE', 'NSE:NIFTY2571725550CE', 'NSE:NIFTY2571725500PE', 'NSE:NIFTY2571025450CE', 'NSE:NIFTY2571725350PE', 'NSE:NIFTY2571025350PE', 'NSE:NIFTY2571025550CE', 'NSE:NIFTY2571025550PE', 'NSE:NIFTY2571725400CE', 'NSE:NIFTY2571725350CE', 'NSE:NIFTY2571025400PE', 'NSE:NIFTY2571725450CE', 'NSE:NIFTY2571725500CE', 'NSE:NIFTY2571725450PE', 'NSE:NIFTY2571725550PE', 'NSE:NIFTY2571725400PE']

Here, the generated symbols don't have any unwanted symbols.

Now, in some rare instances, after the act of resubscription, the dataSocket will include a symbol named "NIFTY10JUL25C25500", which doesn't follow the naming standard of any Fyers symbol, let alone a derivative.

The Tick object returned is as follows,
msg:{'ltp': 107.3, 'vol_traded_today': 7616550, 'last_traded_time': 1751860227, 'exch_feed_time': 1751860228, 'bid_size': 150, 'ask_size': 675, 'bid_price': 107.5, 'ask_price': 107.75, 'last_traded_qty': 75, 'tot_buy_qty': 754800, 'tot_sell_qty': 558300, 'avg_trade_price': 95.89, 'low_price': 85.0, 'high_price': 121.2, 'lower_ckt': 0, 'upper_ckt': 0, 'open_price': 121.2, 'prev_close_price': 121.55, 'symbol': 'NIFTY10JUL25C25500', 'ch': -14.25, 'chp': -11.7236}

My code breaks with the exception below since the msg didn't have "type" in it

exception:'type'

This issue is frustrating, and I can't trust the system anymore with headless execution in the cloud. Can we please get this sorted ASAP?

Details of setup:

Python: 3.12.10

Fyers Version: fyers_apiv3==3.1.7

OS: Windows(locally), Linux(cloud), Container "python:3.12-slim-bookworm"

NOTE: I find no way to reproduce this error since it's out of my control. Even though when I enter the symbol name "NIFTY10JUL25C25500" into the Fyers web, it returns the symbol below,

Best reply by PARTH P
View original
1
4 replies