Hi Fyers Community,
I’ve been using the subscription feature to receive real-time market data for various symbols, and it has generally been working as expected. However, I encountered an issue during the trading day that I’m hoping to get some help with.
At one point, there was a disconnection in the feed. After reconnecting, I noticed that the prices I was receiving didn’t match the symbols they were supposed to be for. For example, I was getting the Last Traded Price (LTP) of the Nifty50-INDEX, but the symbol indicated was NIFTY2511623250PE. This led to a lot of confusion and inaccuracies in my application.
Here are the tick details I received at that time:
2025-01-13 12:28:48: [WinError 10054] An existing connection was forcibly closed by the remote host - goodbye
2025-01-13 12:28:53: Websocket connected
2025-01-13 12:28:53: The broker Ticks are: {'type': 'cn', 'code': 200, 'message': 'Authentication done', 's': 'ok'}
2025-01-13 12:28:53: The broker Ticks are: {'type': 'ful', 'code': 200, 'message': 'Full Mode On', 's': 'ok'}
2025-01-13 12:28:55: PushOverNotifier: Successfully loaded 38 messages from json file D:/ASK Non Directional System/ASKIntradayShortStraddle/deployDir\messages\pushOverMessages.json
2025-01-13 12:28:55: Successfully added the message to file
2025-01-13 12:28:55: FyersTicker:Register Symbols
2025-01-13 12:28:55: FyersTicker Subscribing tokens ['NSE:NIFTY50-INDEX', 'NSE:NIFTY2511623250CE', 'NSE:NIFTY2511623250PE']
2025-01-13 12:28:55: Ticker connection successful.
2025-01-13 12:28:55: The broker Ticks are: {'type': 'sub', 'code': 200, 'message': 'Subscribed', 's': 'ok'}
2025-01-13 12:28:56: The broker Ticks are: {'ltp': 147.8, 'vol_traded_today': 76142925, 'last_traded_time': 1736751533, 'exch_feed_time': 1736751534, 'bid_size': 2025, 'ask_size': 1650, 'bid_price': 147.35, 'ask_price': 147.75, 'last_traded_qty': 75, 'tot_buy_qty': 605700, 'tot_sell_qty': 548325, 'avg_trade_price': 149.04, 'low_price': 110.1, 'high_price': 199.7, 'lower_ckt': 0, 'upper_ckt': 0, 'open_price': 160.0, 'prev_close_price': 87.15, 'type': 'sf', 'symbol': 'NSE:NIFTY2511623250PE', 'ch': 60.65, 'chp': 69.5927}
2025-01-13 12:28:56: tickerLister: new tick received for NSE:NIFTY2511623250PE = 147.800000
2025-01-13 12:28:56: ShortStraddle: Going to check for StraddlePriceManager: ShouldPlaceTargetOrder NSE:NIFTY2511623250PE
2025-01-13 12:28:56: hasTimeCrossedTheGivenEpoch NextMinuteEpoch:2025-01-13 12:29:00 FeedTimeEpoch:2025-01-13 12:28:54
2025-01-13 12:28:56: ShortStraddle:isThisTradeOptionsTrade:Checking if the trade is options Trade
2025-01-13 12:28:56: ShortStraddle:isThisTradeOptionsTrade:TRUE
2025-01-13 12:28:56: StraddlePriceManager: ComputeStraddlePrice
2025-01-13 12:28:56: StraddlePriceManager: Straddle Price:280.600000, CE Price:132.800000, PE Price:147.800000
2025-01-13 12:28:56: StraddlePriceManager:ShouldPlaceTargetOrder Time has NOT crossed 1 Minute
2025-01-13 12:28:56: Price has not Crossed Above VWAP
2025-01-13 12:28:56: The broker Ticks are: {'ltp': 23220.5, 'vol_traded_today': 2343150, 'last_traded_time': 1736751535, 'exch_feed_time': 2334095, 'bid_size': 2317270, 'ask_size': 2319540, 'bid_price': 147.35, 'ask_price': 147.75, 'last_traded_qty': 75, 'tot_buy_qty': 605700, 'tot_sell_qty': 548325, 'avg_trade_price': 149.04, 'low_price': 110.1, 'high_price': 199.7, 'lower_ckt': 0, 'upper_ckt': 0, 'open_price': 160.0, 'prev_close_price': 87.15, 'type': 'sf', 'symbol': 'NSE:NIFTY2511623250PE', 'ch': 23133.35, 'chp': 26544.2915}
2025-01-13 12:28:56: tickerLister: new tick received for NSE:NIFTY2511623250PE = 23220.500000
2025-01-13 12:28:56: ShortStraddle: Going to check for StraddlePriceManager: ShouldPlaceTargetOrder NSE:NIFTY2511623250PE
2025-01-13 12:28:56: hasTimeCrossedTheGivenEpoch NextMinuteEpoch:2025-01-13 12:29:00 FeedTimeEpoch:1970-01-28 05:51:35
2025-01-13 12:28:56: ShortStraddle:isThisTradeOptionsTrade:Checking if the trade is options Trade
2025-01-13 12:28:56: ShortStraddle:isThisTradeOptionsTrade:TRUE
2025-01-13 12:28:56: StraddlePriceManager: ComputeStraddlePrice
2025-01-13 12:28:56: StraddlePriceManager: Straddle Price:23354.400000, CE Price:133.900000, PE Price:23220.500000
2025-01-13 12:28:56: StraddlePriceManager:ShouldPlaceTargetOrder Time has NOT crossed 1 Minute
2025-01-13 12:28:56: shouldPlaceTargetOrder: Price has crossed SL First Time is False
2025-01-13 12:28:56: shouldPlaceTargetOrder: Price has crossed SL First Time. So updated the parameters first time. So False
2025-01-13 12:28:56: The broker Ticks are: {'ltp': 23220.15, 'vol_traded_today': 2343150, 'last_traded_time': 1736751536, 'exch_feed_time': 2334095, 'bid_size': 2317270, 'ask_size': 2319540, 'bid_price': 147.35, 'ask_price': 147.75, 'last_traded_qty': 75, 'tot_buy_qty': 605700, 'tot_sell_qty': 548325, 'avg_trade_price': 149.04, 'low_price': 110.1, 'high_price': 199.7, 'lower_ckt': 0, 'upper_ckt': 0, 'open_price': 160.0, 'prev_close_price': 87.15, 'type': 'sf', 'symbol': 'NSE:NIFTY2511623250PE', 'ch': 23133.0, 'chp': 26543.8898}
2025-01-13 12:28:56: tickerLister: new tick received for NSE:NIFTY2511623250PE = 23220.150000
2025-01-13 12:28:56: ShortStraddle: Going to check for StraddlePriceManager: ShouldPlaceTargetOrder NSE:NIFTY2511623250PE
2025-01-13 12:28:56: hasTimeCrossedTheGivenEpoch NextMinuteEpoch:2025-01-13 12:29:00 FeedTimeEpoch:1970-01-28 05:51:35
2025-01-13 12:28:56: ShortStraddle:isThisTradeOptionsTrade:Checking if the trade is options Trade
2025-01-13 12:28:56: ShortStraddle:isThisTradeOptionsTrade:TRUE
2025-01-13 12:28:56: StraddlePriceManager: ComputeStraddlePrice
2025-01-13 12:28:56: StraddlePriceManager: Straddle Price:23354.050000, CE Price:133.900000, PE Price:23220.150000
2025-01-13 12:28:56: StraddlePriceManager:ShouldPlaceTargetOrder Time has NOT crossed 1 Minute
2025-01-13 12:28:56: shouldPlaceTargetOrder: Price has crossed SL First Time is True
2025-01-13 12:28:56: Tick Exchange Feed Time:2334095
2025-01-13 12:28:56: Next Time to check Crossing SL:2334097
2025-01-13 12:28:56: Has Price Crossed SL First Time:True
2025-01-13 12:28:56: Price has not Crossed Above VWAP
2025-01-13 12:28:57: The broker Ticks are: {'ltp': 146.6, 'vol_traded_today': 76148325, 'last_traded_time': 1736751536, 'exch_feed_time': 1736751536, 'bid_size': 1500, 'ask_size': 450, 'bid_price': 146.55, 'ask_price': 146.9, 'last_traded_qty': 75, 'tot_buy_qty': 607050, 'tot_sell_qty': 550125, 'avg_trade_price': 149.04, 'low_price': 110.1, 'high_price': 199.7, 'lower_ckt': 0, 'upper_ckt': 0, 'open_price': 160.0, 'prev_close_price': 87.15, 'type': 'sf', 'symbol': 'NSE:NIFTY2511623250PE', 'ch': 59.45, 'chp': 68.2157}
2025-01-13 12:28:57: tickerLister: new tick received for NSE:NIFTY2511623250PE = 146.600000
2025-01-13 12:28:57: ShortStraddle: Going to check for StraddlePriceManager: ShouldPlaceTargetOrder NSE:NIFTY2511623250PE
2025-01-13 12:28:57: hasTimeCrossedTheGivenEpoch NextMinuteEpoch:2025-01-13 12:29:00 FeedTimeEpoch:2025-01-13 12:28:56
2025-01-13 12:28:57: ShortStraddle:isThisTradeOptionsTrade:Checking if the trade is options Trade
2025-01-13 12:28:57: ShortStraddle:isThisTradeOptionsTrade:TRUE
2025-01-13 12:28:57: StraddlePriceManager: ComputeStraddlePrice
2025-01-13 12:28:57: StraddlePriceManager: Straddle Price:280.500000, CE Price:133.900000, PE Price:146.600000
2025-01-13 12:28:57: StraddlePriceManager:ShouldPlaceTargetOrder Time has NOT crossed 1 Minute
2025-01-13 12:28:57: Price has not Crossed Above VWAP
2025-01-13 12:28:57: The broker Ticks are: {'ltp': 133.7, 'vol_traded_today': 62740125, 'last_traded_time': 1736751536, 'exch_feed_time': 1736751536, 'bid_size': 525, 'ask_size': 1575, 'bid_price': 133.65, 'ask_price': 134.0, 'last_traded_qty': 150, 'tot_buy_qty': 683175, 'tot_sell_qty': 547800, 'avg_trade_price': 165.44, 'low_price': 121.35, 'high_price': 227.0, 'lower_ckt': 0, 'upper_ckt': 0, 'open_price': 168.0, 'prev_close_price': 283.8, 'type': 'sf', 'symbol': 'NSE:NIFTY2511623250CE', 'ch': -150.1, 'chp': -52.8894}
2025-01-13 12:28:57: tickerLister: new tick received for NSE:NIFTY2511623250CE = 133.700000
2025-01-13 12:28:57: ShortStraddle: Going to check for StraddlePriceManager: ShouldPlaceTargetOrder NSE:NIFTY2511623250CE
2025-01-13 12:28:57: hasTimeCrossedTheGivenEpoch NextMinuteEpoch:2025-01-13 12:29:00 FeedTimeEpoch:2025-01-13 12:28:56
2025-01-13 12:28:57: ShortStraddle:isThisTradeOptionsTrade:Checking if the trade is options Trade
2025-01-13 12:28:57: ShortStraddle:isThisTradeOptionsTrade:TRUE
2025-01-13 12:28:57: StraddlePriceManager: ComputeStraddlePrice
2025-01-13 12:28:57: StraddlePriceManager: Straddle Price:280.300000, CE Price:133.700000, PE Price:146.600000
2025-01-13 12:28:57: StraddlePriceManager:ShouldPlaceTargetOrder Time has NOT crossed 1 Minute
2025-01-13 12:28:57: Price has not Crossed Above VWAP
2025-01-13 12:28:57: The broker Ticks are: {'ltp': 23219.85, 'vol_traded_today': 2343150, 'last_traded_time': 1736751536, 'exch_feed_time': 2334095, 'bid_size': 2317270, 'ask_size': 2319540, 'bid_price': 146.55, 'ask_price': 146.9, 'last_traded_qty': 75, 'tot_buy_qty': 607050, 'tot_sell_qty': 550125, 'avg_trade_price': 149.04, 'low_price': 110.1, 'high_price': 199.7, 'lower_ckt': 0, 'upper_ckt': 0, 'open_price': 160.0, 'prev_close_price': 87.15, 'type': 'sf', 'symbol': 'NSE:NIFTY2511623250PE', 'ch': 23132.7, 'chp': 26543.5456}
2025-01-13 12:28:57: tickerLister: new tick received for NSE:NIFTY2511623250PE = 23219.850000[Enclose tick data here]
Has anyone else faced a similar issue? If so, how did you resolve it? Are there any recommended steps to handle disconnections and ensure the data integrity of symbol-to-price mappings upon reconnection?
I’d appreciate any insights or best practices the community can share.
Thanks in advance!