[R-SIG-Finance] Downloading Real Time Data from FRED (fImport/fredSeries)

Brian G. Peterson brian at braverock.com
Fri Jan 8 13:42:19 CET 2010


Research wrote:
> Hi,
>
> I was looking at the API for ALFRED:
>
>    http://api.stlouisfed.org/docs/fred/realtime_period.html
>    http://api.stlouisfed.org/docs/fred/series_release.html
>
> ALFRED is like FRED but provides us with real-time data, i.e., data 
> for macroeconomic variables as they were originaly announced 
> (released) and not the revised (finalised) data which FRED contains. 
> These are useful for real-time econometric applications.
>
> I was wondering, how can one use the existing routines/packages that 
> access FRED, to access ALFRED.
>
> From what I have checked so far,  the mnemonics appear to be the same 
> on FRED and ALFRED for the same series (say PAYMES for non-farm 
> payrolls).

I haven't used the fImport function, but quantmod has a similar 
function, so I'll use that in my examople on modifying, the details 
should be quite similar.

look at function:

getSymbols.FRED

copy this to function getSymbols.ALFRED

modify it to include a parameter for the api key, or better yet register 
one for the project. 

then modify the line starting with download.file to reflect the new 
required URL. While the Symbol may be the same, the url is clearly different

test and share with the community

Regards,
 
  - Brian

-- 
Brian G. Peterson
http://braverock.com/brian/
Ph: 773-459-4973
IM: bgpbraverock



More information about the R-SIG-Finance mailing list