#NEWLINE# def testLong( self ) : #NEWLINE# #INDENT# strat = self . createStrategy ( ) #NEWLINE# strat . addPosEntry ( datetime . datetime ( 2000 , 11 , 10 ) , strat . enterLongStop , BaseTestCase . TestInstrument , 25 , 1 ) #NEWLINE# strat . addPosExitStop ( datetime . datetime ( 2000 , 11 , 16 ) , 26 ) #NEWLINE# strat . run ( ) #NEWLINE# self . assertEqual ( strat . enterOkCalls , 1 ) #NEWLINE# self . assertEqual ( strat . enterCanceledCalls , 0 ) #NEWLINE# self . assertEqual ( self . exitOkCalls , 1 ) #NEWLINE# self . assertTrue ( ( strat . exitCanceledCalls == 0 ) ) #NEWLINE# self . assertTrue ( ( round ( strat . getBroker ( ) . getCash ( ) , 2 ) == round ( ( 1000 + ( 26 - 25.12 ) ) , 2 ) ) )