[R-SIG-Finance] Help on getSymbols

Paul Teetor paulteetor at yahoo.com
Sat Apr 9 21:28:38 CEST 2016


I could be wrong, but I think Josh meant to say:

Either set Symbols=userInput and forgo the for loop, or keep the for
loop and set Symbols=userInput[i].

 
Paul Teetor, Elgin, IL  USA
http://quantdevel.com/public



________________________________
From: Joshua Ulrich <josh.m.ulrich at gmail.com>
To: Dan Mack <dmack10 at verizon.net> 
Cc: r-sig-finance <r-sig-finance at r-project.org>
Sent: Saturday, April 9, 2016 7:42 AM
Subject: Re: [R-SIG-Finance] Help on getSymbols


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


_______________________________________________
R-SIG-Finance at 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.



More information about the R-SIG-Finance mailing list