Hi,

I avoid this yahoo bug/policy with the following function:

# Continuously try to get all prices for tickers, when yahoo is having
problems again
getSymbolsCont <-
function(tickers, from=NULL, to=Sys.Date(), src="yahoo") {
    ok = FALSE
    n = length(tickers)
    i = 1
    while(i <= n | !ok) {

        print(tickers[i])

        sym = NULL
        try ( sym <- getSymbols(tickers[i], from=from, to=to, src=src,
auto.assign=FALSE))

        if(!is.null(sym)) {
            assign(tickers[i], sym, envir = .GlobalEnv)
            i = i+1
            ok=TRUE
        } else {ok=FALSE}

        Sys.sleep(1)
    }
}

Works for me.

-Mark-


2012/4/4 benn fine <bennfine@gmail.com>

> I've googled and found a similar question at
>
> http://stackoverflow.com/questions/8502512/quantmod-overriding-the-warning-messagebut
> no answer.........
>
> When I loop over several stocks using getSymbols, yahoo will occasionally
> barf as if I have asked it for too many quotes.
> Is there a workaround for this? Using Sys.sleep doesn't seem to help:
>
> sdvals=1:100
> for(i in 1:100)  {
> Sys.sleep(2)
> cat("Getting Data for Stock ",nas100[i,1],"\n")
> foo=getSymbols(nas100[i,2],auto.assign=FALSE)
> rfoo=monthlyReturn(foo)
> sdvals[i]=sqrt(var(rfoo))
> }
>
> Getting Data for Stock  Activision
> Getting Data for Stock  Adobe
> Getting Data for Stock  Akamai
> Getting Data for Stock  Alexion
> Getting Data for Stock  Altera
> Error in download.file(paste(yahoo.URL, "s=", Symbols.name, "&a=", from.m,
> :
>  cannot open URL '
>
> http://chart.yahoo.com/table.csv?s=ALTR&a=0&b=01&c=2007&d=3&e=04&f=2012&g=d&q=q&y=0&z=ALTR&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'
>
> Thanks!
>
>        [[alternative HTML version deleted]]
>
> _______________________________________________
> R-SIG-Finance@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-sig-finance
> -- Subscriber-posting only. If you want to post, subscribe first.
> -- Also note that this is not the r-help list where general R questions
> should go.
>

	[[alternative HTML version deleted]]

