Re: Need to calculate daily risk free rate from Fed data
- To: mathgroup at smc.vnet.net
- Subject: [mg95248] Re: [mg95216] Need to calculate daily risk free rate from Fed data
- From: Bob Hanlon <hanlonr at cox.net>
- Date: Mon, 12 Jan 2009 06:25:14 -0500 (EST)
- Reply-to: hanlonr at cox.net
dailyRate[yearlyRate_?NumericQ, year_: Date[][[1]]] := Module[{dr, days}, days = DateDifference[{year, 1, 1}, {year + 1, 1, 1}]; dr /. FindRoot[1 + yearlyRate == (1 + dr)^days, {dr, yearlyRate/366}][[1]]] year defaults to current year dailyRate[0.008120] 0.000022157 For the same yearly rate, the daily rate during a leap year would be slightly lower since there is an additional day to arrive at the same yearly rate dailyRate[0.008120, 2008] 0.0000220964 Bob Hanlon ---- Andreas <aagas at ix.netcom.com> wrote: ============= The St. Louis Federal Reserve makes a great set of data available for financial analysis at their FRED (Federal Reserve Economic Data) site at http://research.stlouisfed.org/fred2/. I've downloaded treasury bill rates from 1984 to the present (they have lots of rates available at: http://research.stlouisfed.org/fred2/categories/116). The data set gives me the yearly interest rate on 3-Month T-Bills for each day i.e: 1984-12-31, 0.008120 1985-01-01, 0.008120 1985-01-02, 0.008100 1985-01-03, 0.008070 1985-01-04, 0.008080 1985-01-07, 0.008060 1985-01-08, 0.008060 1985-01-09, 0.007950 .. 2008-12-30, 0.000100 2008-12-31, 0.000110 2009-01-01, 0.000110 2009-01-02, 0.000080 2009-01-05, 0.000140 2009-01-06, 0.000140 I need to calculate the daily risk free rate for each interval in the data set based on the yearly rate give for each day. I've gotten as far as this: 1 + yearlyRate == (1 + dailyRate)^360 Does this make sense? If so, how do I implement this in Mathematica? If not, how would I do it? A couple of related questions: Can one use FinancialData[] to access Treasury or Libor rate information or access a risk free rate directly? Thx.