[R-SIG-Finance] RFC: quantmod::getSymbols.MySQL

Joshua Ulrich josh.m.ulrich at gmail.com
Wed Oct 29 15:02:11 CET 2014


On Wed, Oct 29, 2014 at 8:38 AM, Zachary Deane-Mayer
<zach.mayer at gmail.com> wrote:
> Hi Mark,
>
> It'd be a little cumbersome, but couldn't you also source() an R script at
> the start of your session that loads the parameters from .my.cnf and passes
> them to options()?
>
Better yet, put that in your .Rprofile.

> Alternatively, maybe getSymbols.MySQL could look for a cnf_file option, and
> then if that is not present look for a username and password?
>
As I replied to Mark, this would be new functionality and it would be
low priority for me.

> -Zach
>
> On Wed, Oct 29, 2014 at 9:00 AM, Mark Knecht <markknecht at gmail.com> wrote:
>>
>> On Wed, Oct 29, 2014 at 5: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
>> >
>>
>> Hi Josh,
>>    I'd lobby for adding 'host' and (I think) 'port' parameters also.
>> This allows you to get across the network to get the data.
>>
>>    As an individual user type this is OK. Not great, but OK. I'd
>> probably add the code above into a file I source in most of my
>> programs and it would get run. Over time I'll forget where this is
>> though and will need to find it when I create new databases or change
>> passwords.
>>
>>    In a more corporate setting (which isn't me these days) I'm not
>> sure it's very good. Standard usage (on Linux anyway, not sure about
>> Windows) is to have a .my.cnf file:
>>
>> mark at c2RAID6 ~ $ cat .my.cnf
>> [client]
>> user = josh
>> password = secret
>> host = localhost
>>
>> [beancounter]
>> user = josh
>> database = beancounter
>> password = secret
>> host = localhost
>>
>> mark at c2RAID6 ~ $
>>
>> If MySQL needs a password that's where it looks first. There are no
>> security issues with the R code this way. If I change my password in
>> MySQL then this is the one place I change it for all my programs (R or
>> otherwise) that use MySQL to work. This is how I was doing it prior to
>> the change with Defaults. I have no idea how much MySQL is used by
>> corporate R users but I suspect they'd prefer this if it's possible.
>>
>> Thanks,
>> Mark
>>
>> _______________________________________________
>> 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