Skip to content

Commit

Permalink
Merge pull request #194 from MridulS/information
Browse files Browse the repository at this point in the history
Add information ratio.
  • Loading branch information
justinlent committed Nov 3, 2015
2 parents d0ad12e + 74e75bc commit e42b0bf
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions pyfolio/timeseries.py
Original file line number Diff line number Diff line change
Expand Up @@ -772,6 +772,7 @@ def perf_stats(
all_stats['max_drawdown'] = max_drawdown(returns)
all_stats['omega_ratio'] = omega_ratio(returns)
all_stats['sortino_ratio'] = sortino_ratio(returns)
all_stats['information_ratio'] = information_ratio(returns)
all_stats['skewness'] = stats.skew(returns)
all_stats['kurtosis'] = stats.kurtosis(returns)

Expand Down Expand Up @@ -1329,3 +1330,31 @@ def min_max_vol_bounds(value, lower_bound=0.12, upper_bound=0.24):
return upper_bound

return annual_vol


def information_ratio(returns, benchmark_returns):
"""
Determines the Information ratio of a strategy.
Parameters
----------
returns : pd.Series or pd.DataFrame
Daily returns of the strategy, noncumulative.
- See full explanation in tears.create_full_tear_sheet.
benchmark_returns: float / series
Returns
-------
float
The information ratio.
Note
-----
See https://en.wikipedia.org/wiki/information_ratio for more details.
"""
active_return = returns - benchmark_returns
tracking_error = np.std(active_return, ddof=1)
if np.isnan(tracking_error):
return 0.0
return np.mean(active_return) / tracking_error

0 comments on commit e42b0bf

Please sign in to comment.