[R-SIG-Finance] Help on getSymbols
Joshua Ulrich
josh.m.ulrich at gmail.com
Sat Apr 9 14:42:44 CEST 2016
On Sat, Apr 9, 2016 at 7:39 AM, Dan Mack <dmack10 at verizon.net> wrote:
> Josh, I have been using the get symbols to bull data from Yahoo via the following code and generally works well.
>
> FromDate = "2002-05-24"
> ToDate = "2016-03-17"
>
>
> userInput=c("SHW","ABC","LEN","PCLN","HAR","ETN","RRC","PNR","MO","MAT","SNDK","EW","SPLS","AGN","F","MMM",
> "SWK","EA","KSU","MLM","FCX","XRAY","BDX","DOW","LUK","PHM","TMO","DHI","COH","HOT","STZ","LOW","ADS”,
> "SWN","REGN","CSC","VFC","CI","HPQ","CA","TE","PWR","RF","BAX")
> for (i in userInput)
> {
> getSymbols(Symbols=userInput, src="yahoo", from = FromDate, to = ToDate, auto.assign=TRUE, return.class="data.frame")
> }
>
You're downloading all symbols in each iteration of your for loop.
Either set Symbols=userInput and forgo the for loop, or keep the for
loop and set Symbols=i.
> My issue is that many times it takes a really long time to complete, like upwards to 20-30 minutes. Sometimes the process terminate with an error message. I am trying to replicate it, but no luck right now it is just running. The error indicated something about a header being off.
>
> I have a hunch that something is not recognizing the download has completed and can’t terminate the call.
>
> I do notice that when I manually stop the get symbols call after a short time ( 1-2 minutes) all of my data I asked for will be in the global environment.
>
> This is preventing some automation I would like to do for my models.
>
> Do you have any suggestion on what could be causing this or any solutions?
>
> Thanks Dan
--
Joshua Ulrich | about.me/joshuaulrich
FOSS Trading | www.fosstrading.com
R/Finance 2016 | www.rinfinance.com
More information about the R-SIG-Finance
mailing list