INNER CODE UNIT · Python
EnhancedZerodhaLTPSubscriber
buzzsubash/algo_trading_strategies_india · broker-utilities/mtm_square_off_zerodha/zerodha_ltp_subscriber.py:27
class EnhancedZerodhaLTPSubscriber:
"""
Enhanced LTP Subscriber that maintains WebSocket subscriptions
throughout the trading day to prevent stale LTP issues.
"""
def __init__(self, config_path: str = 'config.yaml'):
self.setup_logging()
self.load_config(config_path)
self.setup_kite_client()
self.setup_database()
self.setup_websocket()
# Thread safety
self.db_lock = Lock()
# Enhanced subscription management
self.subscribed_tokens = set()