def summary_stats(curve, periods):
 total_return = curve['networth'][(-1)]
 returns = curve['returns']
 pnl = curve['networth']
 sharpe = sharpe_ratio(returns, periods)
 (max_dd, dd_duration) = max_drawdown(pnl)
 stats = [('Total Return', ('%0.2f%%' % ((total_return - 1.0) * 100.0))), ('Sharpe Ratio', ('%0.2f' % sharpe)), ('Max Drawdown', ('%0.2f%%' % (max_dd * 100.0))), ('Drawdown Duration', ('%d' % dd_duration))]
 return stats

def summary_stats ( curve , periods ) : total_return = curve [ 'networth' ] [ ( - 1 ) ] returns = curve [ 'returns' ] pnl = curve [ 'networth' ] sharpe = sharpe_ratio ( returns , periods ) ( max_dd , dd_duration ) = max_drawdown ( pnl ) stats = [ ( 'Total Return' , ( '%0.2f%%' % ( ( total_return - 1.0 ) * 100.0 ) ) ) , ( 'Sharpe Ratio' , ( '%0.2f' % sharpe ) ) , ( 'Max Drawdown' , ( '%0.2f%%' % ( max_dd * 100.0 ) ) ) , ( 'Drawdown Duration' , ( '%d' % dd_duration ) ) ] return stats
periods - daily .