#NEWLINE# def testStopOrderBuy( self ) : #NEWLINE# #INDENT# strat = self . createStrategy ( ) #NEWLINE# o = strat . stopOrder ( StrategyTestCase . TestInstrument , 100 , 1 , False ) #NEWLINE# strat . run ( ) #NEWLINE# self . assertTrue ( o . isFilled ( ) ) #NEWLINE# self . assertEquals ( o . getAction ( ) , broker . Order . Action . BUY ) #NEWLINE# self . assertEquals ( o . getAvgFillPrice ( ) , 124.62 ) #NEWLINE# self . assertEquals ( o . getQuantity ( ) , 1 ) #NEWLINE# self . assertEquals ( o . getFilled ( ) , 1 ) #NEWLINE# self . assertEquals ( o . getRemaining ( ) , 0 ) #NEWLINE# self . assertEqual ( strat . orderUpdatedCalls , 2 )