Let's say I have data stemming from date $t_1$ to date $t_2$, I have the annualized return each day during those two dates. Therefore I know the expected return and the standard deviation of the returns between those two dates. But what should I use as risk-free rate in the calculation of the Sharpe ratio: $$ \frac{E(r)-r_f}{\sigma}$$ It seems like to be consistent, it would be natural to use the average 1-year risk-free rate from the Treasury yield curve during dates $t_1$ and $t_2$.
1 Answer
The formula wants to compare the (expected) return of a risky asset with the (known) return of a risk-free alternative. You need therefore to think of $r_f$ as the return of a risk-free asset.
The easiest way to know you're doing it right is to reconstruct this asset on a spreadsheet. To consider a typical case: if you have per annum risk-free rates posted daily, the cumulative value of an initial investment of \$1 would be
$$s_0 = 1, \quad \quad s_{t+1}= s_t \times (1+i_{t+1})^{1/252}$$
where $i_t$ is the interest rate on day $t$. The return on the risk-free asset then would simply be $r_f = s_{t_2 - t_1} -1$.