INNER CODE UNIT · Python
__init__
buzzsubash/algo_trading_strategies_india · broker-utilities/mtm_square_off_zerodha/zerodha_ltp_subscriber.py:33
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()
self.daily_instruments = set() # Keep tracking instruments all day
self.current_date = time.strftime('%Y-%m-%d')
# Performance optimization with faster batching
self.batch_size = 50
self.batch_data = []