#NEWLINE# def testShortPosition( self ) : #NEWLINE# #INDENT# strat = self . createStrategy ( ) #NEWLINE# strat . addPosEntry ( datetime . datetime ( 2000 , 11 , 3 ) , strat . enterShort , BaseTestCase . TestInstrument , 1 , False ) #NEWLINE# strat . addPosExitMarket ( datetime . datetime ( 2000 , 11 , 7 ) ) #NEWLINE# strat . run ( ) #NEWLINE# self . assertEqual ( strat . enterOkCalls , 1 ) #NEWLINE# self . assertEqual ( strat . exitOkCalls , 1 ) #NEWLINE# self . assertTrue ( ( round ( strat . getBroker ( ) . getCash ( ) , 2 ) == round ( ( ( 1000 + 30.69 ) - 27.37 ) , 2 ) ) ) #NEWLINE# self . assertTrue ( ( round ( strat . getResult ( ) , 3 ) == round ( 0.10817856 , 3 ) ) ) #NEWLINE# self . assertTrue ( ( round ( strat . getNetProfit ( ) , 2 ) == round ( ( 30.69 - 27.37 ) , 2 ) ) )