ranaroussi / quantstats

Portfolio analytics for quants, written in Python
Apache License 2.0
4.73k stars 827 forks source link

How is the sharpe ratio calculated? #258

Open LHanLi opened 1 year ago

LHanLi commented 1 year ago

the sharpe ratio is defined as (r-r_f)/sigma, however i can' get this value from the annual return and annual volatility. In my case, the annual return is 4.21%, free risk rate is 3%, volatility is 9.94%, the sharpe ratio should be (0.0421-0.03)/0.094 = 0.1217, but quantitates give a sharpe is 0.18.

liuweihan826 commented 1 year ago

image Quantstats calculates the Sharpe ratio by dividing the mean of the return series by the volatility of the return series and then annualizing it.