Skip to content

Commit

Permalink
Added information ratio to reports
Browse files Browse the repository at this point in the history
  • Loading branch information
ranaroussi committed Apr 28, 2022
1 parent beb1b14 commit ab154fc
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 2 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
Change Log
===========

0.0.53
------
- Added information ratio to reports

0.0.52
------
- Added Treynor ratio
Expand Down
8 changes: 8 additions & 0 deletions quantstats/reports.py
Original file line number Diff line number Diff line change
Expand Up @@ -451,6 +451,8 @@ def metrics(returns, benchmark=None, rf=0., display=True,
metrics['Volatility (ann.) %'] = [ret_vol, bench_vol]
metrics['R^2'] = _stats.r_squared(
df['returns'], df['benchmark'], prepare_returns=False)
metrics['Information Ratio'] = _stats.information_ratio(
df['returns'], df['benchmark'], prepare_returns=False)
else:
metrics['Volatility (ann.) %'] = [ret_vol]

Expand Down Expand Up @@ -616,6 +618,12 @@ def metrics(returns, benchmark=None, rf=0., display=True,

if not sep:
metrics = metrics[metrics.index != '']

# remove spaces from column names
metrics = metrics.T
metrics.columns = [c.replace(' %', '').replace(' *int', '').strip() for c in metrics.columns]
metrics = metrics.T

return metrics


Expand Down
2 changes: 1 addition & 1 deletion quantstats/stats.py
Original file line number Diff line number Diff line change
Expand Up @@ -906,7 +906,7 @@ def rolling_greeks(returns, benchmark, periods=252, prepare_returns=True):
return _pd.DataFrame(index=returns.index, data={
"beta": beta,
"alpha": alpha
}).fillna(0)
})


def compare(returns, benchmark, aggregate=None, compounded=True,
Expand Down
2 changes: 1 addition & 1 deletion quantstats/version.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
version = "0.0.52"
version = "0.0.53"

0 comments on commit ab154fc

Please sign in to comment.