#NEWLINE# def calculate_signals( self , event ) : #NEWLINE# #INDENT# ticker = self . tickers [ 0 ] #NEWLINE# if ( ( event . type == 'TICK' ) and ( event . ticker == ticker ) ) : #NEWLINE# #INDENT# if ( ( self . ticks % 5 ) == 0 ) : #NEWLINE# #INDENT# if ( self . invested == False ) : #NEWLINE# #INDENT# signal = SignalEvent ( ticker , 'BOT' ) #NEWLINE# self . events_queue . put ( signal ) #NEWLINE# self . invested = True #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# signal = SignalEvent ( ticker , 'SLD' ) #NEWLINE# self . events_queue . put ( signal ) #NEWLINE# self . invested = False #NEWLINE# #UNINDENT# #UNINDENT# self . ticks += 1