[R-SIG-Finance] How to get data from another source when the first one fails...

Joshua Ulrich josh.m.ulrich at gmail.com
Fri Oct 2 04:04:00 CEST 2015

On Wed, Sep 30, 2015 at 8:16 PM, George Kumar <grgkumar4 at gmail.com> wrote:
> Hi all,
> I use following command to make getSymbols (from quantmod package) get data
> from locally stored csv files.
> setDefaults(getSymbols,src='csv')
> My problem is that if the data is not found locally, I want it to get it
> from yahoo/google. How to go about doing this. If setDefaults allowed
> multiple sources, it would have been possible. Something like the following:
> setDefaults(getSymbols,src='csv yahoo')
> Please let me know how this can be done.
Write your own getSymbols function, e.g. getSymbols.csv2yahoo.  Then
wrap your call to getSymbols.csv in a try or tryCatch call.  If the
getSymbols.csv call fails, you can then call getSymbols.yahoo.

> Thanks.
> George
>         [[alternative HTML version deleted]]
> _______________________________________________
> 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.

Joshua Ulrich  |  about.me/joshuaulrich
FOSS Trading  |  www.fosstrading.com

More information about the R-SIG-Finance mailing list