Information ratio in

20 views
Skip to first unread message

lsyi...@gmail.com

unread,
Nov 8, 2015, 11:58:22 AM11/8/15
to Zipline Python Opensource Backtester
Hi there

I just found the definition/formula of information ratio in zipline seems not consistent.

As in investopia and wikipeida, it should be defined as the ratio between (portfolio returns - benchmark returns) and standard deviation of (portfolio returns - benchmark returns)

Information Ratio (IR)



Rp = Return of the portfolio
Ri = Return of the index or benchmark
Sp-i = Tracking error (standard deviation of the difference between returns of the portfolio and the returns of the index)


In zipline/finance/risk/risk.py, the information_ratio function is formulated accordingly. 

def information_ratio(algorithm_returns, benchmark_returns):
    """

    Args:
        algorithm_returns (np.array-like):
            All returns during algorithm lifetime.
        benchmark_returns (np.array-like):
            All benchmark returns during algo lifetime.

    Returns:
        float. Information ratio.
    """
    relative_returns = algorithm_returns - benchmark_returns

    relative_deviation = relative_returns.std(ddof=1)

    if zp_math.tolerant_equals(relative_deviation, 0) or \
       np.isnan(relative_deviation):
        return 0.0

    return np.mean(relative_returns) / relative_deviation

But this function is not imported elsewhere

However, in both risk/cumulative.py, and risk/period.py, a information_ratio function is defined and it uses the algorithm volatility instead as the denominator. 

def information_ratio(algo_volatility, algorithm_return, benchmark_return):
    """

    Args:
        algorithm_returns (np.array-like):
            All returns during algorithm lifetime.
        benchmark_returns (np.array-like):
            All benchmark returns during algo lifetime.

    Returns:
        float. Information ratio.
    """
    if zp_math.tolerant_equals(algo_volatility, 0):
        return np.nan

    # The square of the annualization factor is in the volatility,
    # because the volatility is also annualized,
    # i.e. the sqrt(annual factor) is in the volatility's numerator.
    # So to have the the correct annualization factor for the
    # Sharpe value's numerator, which should be the sqrt(annual factor).
    # The square of the sqrt of the annual factor, i.e. the annual factor
    # itself, is needed in the numerator to factor out the division by
    # its square root.
    return (algorithm_return - benchmark_return) / algo_volatility



Any reasoning behind this ?

Joe Jevnik

unread,
Nov 10, 2015, 9:00:20 PM11/10/15
to Zipline Python Opensource Backtester
Hey, I don't have an answer yet but I just wanted to let you know that we are looking into this.
Reply all
Reply to author
Forward
0 new messages