def __init__(self, name='broker'):
        self.name = name
        self.log = logger.getLogger(self.name)        
        
        self.log.debug('Initializing broker. Pandas version={0}'.format(pandas.__version__))
        self.contracts = {} # a dict to keep track of subscribed contracts
        
        self.tws =  ibConnection() # tws interface
        self.nextValidOrderId = None
                
        self.dataModel = Subscriptions(self.tws) # data container
        
        self.tws.registerAll(self.defaultHandler) 
        #self.tws.register(self.debugHandler,message.TickPrice)
        self.tws.register(self.nextValidIdHandler,'NextValidId')
        self.log.debug('Connecting to tws')
        self.tws.connect()  
        
        self.tws.reqAccountUpdates(True,'')
initialize broker class
dataset/ETHPy150Open cmorgan/trading-with-python/lib/interactivebrokers.py/Broker.__init__