Closed bscully27 closed 5 years ago
Realized the risk free should be converted from an annual value to daily. (1+.01)**(1/252.) -1 = .000039
This yields better results sharpe_ratio( ret, .000039 ) array([2.55241228])
Docs should be updated with more specific input expectations.
Thanks for bringing this up - just added a quick doc string change to clarify this.
from empyrical.stats import sharpe_ratio
ret = [SPX returns from 2017 without dividends]
sharpe_ratio( ret, 0.01 ) array([-34.99321358])
sharpe_ratio( ret, 0.00 ) Out[39]: array([2.69941353])
sharpe_ratio( ret, .01, annualization=252 ) Out[51]: array([-34.99321358])
ret is in DECIMAL form. Ie .01 means 1 percent. 2017-01-03 0.0085 2017-01-04 0.0057 2017-01-05 -0.0008 2017-01-06 0.0035 2017-01-09 -0.0035
The sharpe ratio should not swing from 2.699 to -34.993 for a constant risk free rate change from zero to .01.