INNER CODE UNIT · Python
on_error
buzzsubash/algo_trading_strategies_india · broker-utilities/mtm_square_off_zerodha/zerodha_ltp_subscriber.py:221
def on_error(self, ws, code, reason):
"""WebSocket error callback"""
self.logger.error(f"❌ WebSocket error: {code} - {reason}")
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: