[R] Downloading currency data from from Yahoo

Tony Plate tplate at acm.org
Thu Sep 24 22:01:34 CEST 2009


you simply had the wrong symbol.  a search on yahoo.com suggests the symbol might be "GBP=x",

> getSymbols('GBP=x',src='yahoo')
> str(get("GBP=X"))
An ‘xts’ object from 2007-01-03 to 2009-09-23 containing:
  Data: num [1:707, 1:6] 0.51 0.51 0.52 0.52 0.52 0.52 0.51 0.51 0.51 0.51 ...
 - attr(*, "dimnames")=List of 2
  ..$ : NULL
  ..$ : chr [1:6] "GBP=X.Open" "GBP=X.High" "GBP=X.Low" "GBP=X.Close" ...
  Indexed by objects of class: [Date] TZ: GMT
  xts Attributes:  
List of 2
 $ src    : chr "yahoo"
 $ updated: POSIXct[1:1], format: "2009-09-24 19:58:01"
> 

-- Tony Plate

Bogaso wrote:
> Hi,
> 
> I wanted to download some currency data using "quantmod" package, however
> got following error :
> 
>> getSymbols('USD/GBP',src='yahoo')
> Error in download.file(paste(yahoo.URL, "s=", Symbols.name, "&a=", from.m, 
> : 
>   cannot open URL
> 'http://chart.yahoo.com/table.csv?s=USD/GBP&a=0&b=01&c=2007&d=8&e=24&f=2009&g=d&q=q&y=0&z=USD/GBP&x=.csv'
> In addition: Warning message:
> In download.file(paste(yahoo.URL, "s=", Symbols.name, "&a=", from.m,  :
>   cannot open: HTTP status was '404 Not Found'
> 
> Can anyone please tell me how to get rid of that? Your help will be highly
> appreciated.
> 
> Thanks
>




More information about the R-help mailing list