INNER CODE UNIT · Python
on_reconnect
buzzsubash/algo_trading_strategies_india · broker-utilities/mtm_square_off_zerodha/zerodha_ltp_subscriber.py:225
def on_reconnect(self, ws, attempts_count):
"""WebSocket reconnect callback"""
self.logger.info(f"🔄 WebSocket reconnecting (attempt {attempts_count})")
def on_noreconnect(self, ws):
"""WebSocket no reconnect callback"""
self.logger.error("🚫 WebSocket failed to reconnect")
def on_ticks(self, ws, ticks):
"""
Enhanced tick data handler with faster processing.
Optimized for high-frequency data processing.
"""
try:
current_time = time.time()
tick_count = len(ticks)
for tick in ticks: