Rolling Sharpe Ratio with pyfolio: how risk free rate is estimated?

Hello everyone!

I’m struggling with the question: how pyfolio estimates risk free rate?

The plot_rolling_sharpe get as input the returns and create a plot of the rolling Sharpe Ratio. According to the Sharpe Ratio definition:

to calculate the Sharpe Ratio we need the risk free rate (e.g. from the benchmark). However, the plot_rolling_sharpe method don’t get any related input.

How Sharpe Rate is estimated? Is it used the average portfolio return as risk free rate?

Thank you very much!

Which file/folder are you looking at?

I’m looking at this file.

In particular to this piece of code:
plot_rolling_sharpe(returns=returns)

If my question is not clear I can try to rephrase.

Thanks!

You can go to the pyfolio-reloaded repository on github and find:

pyfolio/timeseries.py#L1072

It looks like pyfolio assumes a risk free rate of zero.
(Many Quantopian functions use approximations unfortunately)

1 Like

Thanks maartenb! I was suspecting it but I didn’t thought to go and look at pyfolio code documentation :man_facepalming:
My fault :sweat_smile:

However… this assumption really surprised me