#NEWLINE# def summarizePerformance( self , test_data_set ) : #NEWLINE# #INDENT# '\n        This function is called at every PERIOD_BTW_SUMMARY_PERFS.\n        Arguments:\n            test_data_set\n        ' #NEWLINE# print ( 'Summary Perf' ) #NEWLINE# observations = test_data_set . observations ( ) #NEWLINE# prices = observations [ 0 ] #NEWLINE# invest = observations [ 1 ] #NEWLINE# steps = np . arange ( len ( prices ) ) #NEWLINE# steps_long = ( np . arange ( ( len ( prices ) * 10 ) ) / 10.0 ) #NEWLINE# host = host_subplot ( 111 , axes_class = AA . Axes ) #NEWLINE# plt . subplots_adjust ( right = 0.9 , left = 0.1 ) #NEWLINE# par1 = host . twinx ( ) #NEWLINE# host . set_xlabel ( 'Time' ) #NEWLINE# host . set_ylabel ( 'Price' ) #NEWLINE# par1 . set_ylabel ( 'Investment' ) #NEWLINE# ( p1 , ) = host . plot ( steps_long , np . repeat ( prices , 10 ) , lw = 3 , c = 'b' , alpha = 0.8 , ls = '-' , label = 'Price' ) #NEWLINE# ( p2 , ) = par1 . plot ( steps , invest , marker = 'o' , lw = 3 , c = 'g' , alpha = 0.5 , ls = '-' , label = 'Investment' ) #NEWLINE# par1 . set_ylim ( ( - 0.09 ) , 1.09 ) #NEWLINE# host . axis [ 'left' ] . label . set_color ( p1 . get_color ( ) ) #NEWLINE# par1 . axis [ 'right' ] . label . set_color ( p2 . get_color ( ) ) #NEWLINE# plt . savefig ( 'plot.png' )