#NEWLINE# def testLongPositionGTC( self ) : #NEWLINE# #INDENT# strat = self . createStrategy ( ) #NEWLINE# strat . getBroker ( ) . setCash ( 48 ) #NEWLINE# strat . addPosEntry ( datetime . datetime ( 2000 , 1 , 27 ) , self . enterLong , BaseTestCase . TestInstrument , 1 , True ) #NEWLINE# strat . addPosExitMarket ( datetime . datetime ( 2000 , 2 , 3 ) ) #NEWLINE# strat . run ( ) #NEWLINE# self . assertEqual ( strat . positions [ 0 ] . isOpen ( ) , False ) #NEWLINE# self . assertEqual ( strat . enterOkCalls , 1 ) #NEWLINE# self . assertEqual ( strat . exitOkCalls , 1 ) #NEWLINE# self . assertTrue ( ( round ( strat . getBroker ( ) . getCash ( ) , 2 ) == round ( ( ( 48 + 57.63 ) - 47.94 ) , 2 ) ) ) #NEWLINE# self . assertTrue ( ( round ( strat . getNetProfit ( ) , 2 ) == round ( ( 57.63 - 47.94 ) , 2 ) ) ) #NEWLINE# self . assertEqual ( strat . positions [ 0 ] . getAge ( ) . days , 4 )