def on_event(self, evt, is_final):
        """ this is invoked from in response to COM PumpWaitingMessages - different thread """
        response = self.response
        for msg in XmlHelper.message_iter(evt):
            bars = msg.GetElement('barData').GetElement('barTickData')
            for i in range(bars.NumValues):
                bar = bars.GetValue(i)
                ts = bar.GetElement(0).Value
                response['time'].append(datetime(ts.year, ts.month, ts.day, ts.hour, ts.minute))
                response['open'].append(bar.GetElement(1).Value)
                response['high'].append(bar.GetElement(2).Value)
                response['low'].append(bar.GetElement(3).Value)
                response['close'].append(bar.GetElement(4).Value)
                response['volume'].append(bar.GetElement(5).Value)
                response['events'].append(bar.GetElement(6).Value)

        if is_final:
            idx = response.pop('time')
            self.response = DataFrame(response, columns=['open', 'high', 'low', 'close', 'volume', 'events'], index=idx)
def on_event ( self , evt , is_final ) : response = self . response for msg in XmlHelper . message_iter ( evt ) : bars = msg . GetElement ( 'barData' ) . GetElement ( 'barTickData' ) for i in range ( bars . NumValues ) : bar = bars . GetValue ( i ) ts = bar . GetElement ( 0 ) . Value response [ 'time' ] . append ( datetime ( ts . year , ts . month , ts . day , ts . hour , ts . minute ) ) response [ 'open' ] . append ( bar . GetElement ( 1 ) . Value ) response [ 'high' ] . append ( bar . GetElement ( 2 ) . Value ) response [ 'low' ] . append ( bar . GetElement ( 3 ) . Value ) response [ 'close' ] . append ( bar . GetElement ( 4 ) . Value ) response [ 'volume' ] . append ( bar . GetElement ( 5 ) . Value ) response [ 'events' ] . append ( bar . GetElement ( 6 ) . Value ) if is_final : idx = response . pop ( 'time' ) self . response = DataFrame ( response , columns = [ 'open' , 'high' , 'low' , 'close' , 'volume' , 'events' ] , index = idx )
this is invoked from in response to COM PumpWaitingMessages - different thread