quantlab.analysis.factor_report.long_short_statistics#

quantlab.analysis.factor_report.long_short_statistics(rate)[source]#

Return annualized statistics of a per-bar long-short return series.

The number of periods per year is measured from the data: the periods between the first and last timestamp over the years they span, so daily stock bars give about 252 and daily crypto bars about 365.

Parameters:
ratepandas.Series

Per-bar long-short return, indexed by timestamp; missing periods count as 0.

Returns:
dict

periods_per_year, long_short_annual_return (compounded), long_short_annual_volatility, long_short_sharpe (annualized mean over annualized volatility, no risk-free rate) and long_short_max_drawdown (the worst fall from a running peak of the compounded value, a negative fraction or 0). A value that reaches 0 stays there: annual return and drawdown are then -1.

Examples

>>> stats_ = long_short_statistics(rate)
>>> sorted(stats_)
['long_short_annual_return', 'long_short_annual_volatility', 'long_short_max_drawdown', 'long_short_sharpe', 'periods_per_year']