def perf_stats(returns, factor_returns=None, positions=None,<EOL>transactions=None, turnover_denom='<STR_LIT>'):
stats = pd.Series()<EOL>for stat_func in SIMPLE_STAT_FUNCS:<EOL><INDENT>stats[STAT_FUNC_NAMES[stat_func.__name__]] = stat_func(returns)<EOL><DEDENT>if positions is not None:<EOL><INDENT>stats['<STR_LIT>'] = gross_lev(positions).mean()<EOL>if transactions is not None:<EOL><INDENT>stats['<STR_LIT>'] = get_turnover(positions,<EOL>transactions,<EOL>turnover_denom).mean()<EOL><DEDENT><DEDENT>if factor_returns is not None:<EOL><INDENT>for stat_func in FACTOR_STAT_FUNCS:<EOL><INDENT>res = stat_func(returns, factor_returns)<EOL>stats[STAT_FUNC_NAMES[stat_func.__name__]] = res<EOL><DEDENT><DEDENT>return stats<EOL>
Calculates various performance metrics of a strategy, for use in
plotting.show_perf_stats.

Parameters
----------
returns : pd.Series
    Daily returns of the strategy, noncumulative.
     - See full explanation in tears.create_full_tear_sheet.
factor_returns : pd.Series, optional
    Daily noncumulative returns of the benchmark factor to which betas are
    computed. Usually a benchmark such as market returns.
     - This is in the same style as returns.
     - If None, do not compute alpha, beta, and information ratio.
positions : pd.DataFrame
    Daily net position values.
     - See full explanation in tears.create_full_tear_sheet.
transactions : pd.DataFrame
    Prices and amounts of executed trades. One row per trade.
    - See full explanation in tears.create_full_tear_sheet.
turnover_denom : str
    Either AGB or portfolio_value, default AGB.
    - See full explanation in txn.get_turnover.

Returns
-------
pd.Series
    Performance metrics.