RFC: quantmod::getSymbols.MySQL
Hi Josh,
As you probably noticed, I updated getSymbols.FI() to use options a
couple weeks ago, but instead of using a single option that is a list,
I made a separate option for each function argument. This allows two
things: 1) you can have different default values set for the "from"
argument (for example) of different getSymbols.*() methods. 2) It
doesn't change the old defaults. i.e. getOption("someOption",
"2014-01-01") will return the value of the option if it is set, or
"2014-01-01" if not.
With your list structure, the default value has to be determined
inside the function, I suppose.
Here's the formal argument list for getSymbols.FI
args(getSymbols.FI)
function (Symbols, from = getOption("getSymbols.FI.from", "2010-01-01"),
to = getOption("getSymbols.FI.to", Sys.Date()), ..., dir =
getOption("getSymbols.FI.dir",
""), return.class = getOption("getSymbols.FI.return.class",
"xts"), extension = getOption("getSymbols.FI.extension",
"rda"), split_method = getOption("getSymbols.FI.split_method",
c("days", "common")), use_identifier =
getOption("getSymbols.FI.use_identifier",
NA), date_format = getOption("getSymbols.FI.date_format"),
verbose = getOption("getSymbols.FI.verbose", TRUE), days_to_omit =
getOption("getSymbols.FI.days_to_omit",
c("Saturday", "Sunday")), indexTZ = getOption("getSymbols.FI.indexTZ",
NA))
Garrett
On Wed, Oct 29, 2014 at 7:25 AM, Joshua Ulrich <josh.m.ulrich at gmail.com> wrote:
As many of you know, the Defaults package was removed from CRAN on
2014-10-03 at Jeff's request. This broke a fair bit of functionality
in quantmod, most of which I have addressed in recent commits on
R-Forge.
One issue I have not resolved is how to adapt getSymbols.MySQL to the
new no-Defaults paradigm. I will be taking over as maintainer of
quantmod, so I am soliciting input from getSymbols.MySQL users.
My proposed solution to getSymbols.MySQL is to look for specific
option()s if certain arguments are missing. I think this is the
cleanest and most obvious solution, but am open to alternatives. I
would use the option structure below, with only the three arguments
listed.
options(quantmod.defaults = list(
getSymbols.MySQL = list(
user="josh",
password="secret",
dbname="stocks")
)
)
Should I consider another option structure? Should additional
arguments be supported? Anything else I'm missing?
Thanks,
--
Joshua Ulrich | about.me/joshuaulrich
FOSS Trading | www.fosstrading.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.