#NEWLINE# def testUnrealized2( self ) : #NEWLINE# #INDENT# instrument = 'orcl' #NEWLINE# barFeed = load_daily_barfeed ( instrument ) #NEWLINE# strat = TestStrategy ( barFeed , instrument , 1000 ) #NEWLINE# strat . addPosEntry ( datetime . date ( 2000 , 12 , 13 ) , strat . enterLong , instrument , 1 , False ) #NEWLINE# strat . run ( ) #NEWLINE# self . assertEqual ( strat . positions [ 0 ] . isOpen ( ) , True ) #NEWLINE# self . assertEqual ( strat . getActivePosition ( ) . getPnL ( ) , ( 29.06 - 29.25 ) ) #NEWLINE# self . assertEqual ( strat . getActivePosition ( ) . getReturn ( ) , ( ( 29.06 - 29.25 ) / 29.25 ) )