Problem using Quantmod and MySQL

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
8 messages Options
Reply | Threaded
Open this post in threaded view
|

Problem using Quantmod and MySQL

Ueli Hofstetter
I have some problems loading symbols from an mysql db using getSymbols.

Instead of repeating the issue, here is a link to the description on
stackoverflow

http://stackoverflow.com/questions/29333330/quantmod-error-loading-symbols-from-mysql-db

Any help is greatly appreciated

--
Ueli Hofstetter

        [[alternative HTML version deleted]]

_______________________________________________
[hidden email] 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.
Reply | Threaded
Open this post in threaded view
|

Re: Problem using Quantmod and MySQL

Mark Knecht
On Sun, Mar 29, 2015 at 11:50 AM, Ueli Hofstetter
<[hidden email]> wrote:

> I have some problems loading symbols from an mysql db using getSymbols.
>
> Instead of repeating the issue, here is a link to the description on
> stackoverflow
>
> http://stackoverflow.com/questions/29333330/quantmod-error-loading-symbols-from-mysql-db
>
> Any help is greatly appreciated
>
> --
> Ueli Hofstetter


I see the same error message here. I have moved pretty far away from
using R on a day-to-day basis so I have no idea how long this has been
going on.

Anyway, it's not only you so wait for someone closer to the system to
supply an answer.

HTH,
Mark

_______________________________________________
[hidden email] 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.
markknecht@gmail.com
Reply | Threaded
Open this post in threaded view
|

Re: Problem using Quantmod and MySQL

Joshua Ulrich
In reply to this post by Ueli Hofstetter
On Sun, Mar 29, 2015 at 1:50 PM, Ueli Hofstetter
<[hidden email]> wrote:
> I have some problems loading symbols from an mysql db using getSymbols.
>
> Instead of repeating the issue, here is a link to the description on
> stackoverflow
>
> http://stackoverflow.com/questions/29333330/quantmod-error-loading-symbols-from-mysql-db
>
> Any help is greatly appreciated
>
The "character" method for dbConnect was removed in the 0.10 release
of RMySQL. I'm not sure whether or not this was intentional. It was
not mentioned in the release notes.

> --
> Ueli Hofstetter
>


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

_______________________________________________
[hidden email] 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.
Reply | Threaded
Open this post in threaded view
|

Re: Problem using Quantmod and MySQL

Joshua Ulrich
On Sun, Mar 29, 2015 at 5:37 PM, Joshua Ulrich <[hidden email]> wrote:

> On Sun, Mar 29, 2015 at 1:50 PM, Ueli Hofstetter
> <[hidden email]> wrote:
>> I have some problems loading symbols from an mysql db using getSymbols.
>>
>> Instead of repeating the issue, here is a link to the description on
>> stackoverflow
>>
>> http://stackoverflow.com/questions/29333330/quantmod-error-loading-symbols-from-mysql-db
>>
>> Any help is greatly appreciated
>>
> The "character" method for dbConnect was removed in the 0.10 release
> of RMySQL. I'm not sure whether or not this was intentional. It was
> not mentioned in the release notes.
>
It was removed intentionally.  I do not have a MySQL database
available for testing, so I would really appreciate some help from
those who use this functionality.  Can someone please try this
suggested edit:
https://github.com/rstats-db/RMySQL/issues/62#issuecomment-87692704

And provide feedback at: https://github.com/joshuaulrich/quantmod/issues/45

Thanks!
Josh


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

_______________________________________________
[hidden email] 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.
Reply | Threaded
Open this post in threaded view
|

Re: Problem using Quantmod and MySQL

Mark Knecht
On Mon, Mar 30, 2015 at 9:25 AM, Joshua Ulrich <[hidden email]> wrote:

> On Sun, Mar 29, 2015 at 5:37 PM, Joshua Ulrich <[hidden email]> wrote:
>> On Sun, Mar 29, 2015 at 1:50 PM, Ueli Hofstetter
>> <[hidden email]> wrote:
>>> I have some problems loading symbols from an mysql db using getSymbols.
>>>
>>> Instead of repeating the issue, here is a link to the description on
>>> stackoverflow
>>>
>>> http://stackoverflow.com/questions/29333330/quantmod-error-loading-symbols-from-mysql-db
>>>
>>> Any help is greatly appreciated
>>>
>> The "character" method for dbConnect was removed in the 0.10 release
>> of RMySQL. I'm not sure whether or not this was intentional. It was
>> not mentioned in the release notes.
>>
> It was removed intentionally.  I do not have a MySQL database
> available for testing, so I would really appreciate some help from
> those who use this functionality.  Can someone please try this
> suggested edit:
> https://github.com/rstats-db/RMySQL/issues/62#issuecomment-87692704
>
> And provide feedback at: https://github.com/joshuaulrich/quantmod/issues/45
>
> Thanks!
> Josh
>
>
> --
> Joshua Ulrich  |  about.me/joshuaulrich
> FOSS Trading  |  www.fosstrading.com
>
> _______________________________________________
> [hidden email] 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.



I'm happy to try it out but a little confused as to all the locations
I need to edit. Help me clear this up and I'll try it out immediately.

The failure is coming when I'm trying to get the data using the following code:

> if (DownloadNewData){
+   if (!UseMySQL){
+     for (i in 1:length(TestSym)){
+       print(paste("From ",SymbolSrc," -- ",TestSym[i]))
+       getSymbolsCont(TestSym[i], from = DataStart, to = DataEnd,
adjust = MyAdjust, src=SymbolSrc)
+     }
+   } else {
+     for (i in 1:length(TestSym)){
+       print(paste("From MySQL -- ",TestSym[i]))
+ #      getSymbols(TestSym[i], src="MySQL")
+       getSymbols(TestSym[i], src="MySQL", user="mark",
password="MyTempPassword", dbname=dbName)
+       assign(TestSym[i], get(TestSym[i])[paste0(DataStart,"/",DataEnd)])
+     }
+     dbDisconnect(dbc)
+   }
+ }
[1] "From MySQL --  SPY"
 Show Traceback

 Rerun with Debug

Error in (function (classes, fdef, mtable)  :
  unable to find an inherited method for function ‘dbConnect’ for
signature ‘"character"’


Am I correct that the suggestion is to edit two lines?

First, I use

library(RMySQL)

Is the first edit to change this to

requireNamespace("RMySQL", quietly = TRUE)

or do I add this to my code somewhere and keep the library command?

Later in my code I have:

if (UseMySQL){
  if (MyAdjust) { dbName = paste0(dbName, "Adjust")}
  dbc = dbConnect(MySQL(), dbname=dbName)
#  setDefaults(getSymbols.MySQL, user="mark",
password="MyTempPassword", dbname=dbName)
}

This would be where the second edit goes?

dbConnect("MySQL", ...) to dbConnect(RMySQL::MySQL, ...)

Thanks,
Mark

_______________________________________________
[hidden email] 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.
markknecht@gmail.com
Reply | Threaded
Open this post in threaded view
|

Re: Problem using Quantmod and MySQL

Joshua Ulrich
On Mon, Mar 30, 2015 at 11:49 AM, Mark Knecht <[hidden email]> wrote:

> On Mon, Mar 30, 2015 at 9:25 AM, Joshua Ulrich <[hidden email]> wrote:
>> On Sun, Mar 29, 2015 at 5:37 PM, Joshua Ulrich <[hidden email]> wrote:
>>> On Sun, Mar 29, 2015 at 1:50 PM, Ueli Hofstetter
>>> <[hidden email]> wrote:
>>>> I have some problems loading symbols from an mysql db using getSymbols.
>>>>
>>>> Instead of repeating the issue, here is a link to the description on
>>>> stackoverflow
>>>>
>>>> http://stackoverflow.com/questions/29333330/quantmod-error-loading-symbols-from-mysql-db
>>>>
>>>> Any help is greatly appreciated
>>>>
>>> The "character" method for dbConnect was removed in the 0.10 release
>>> of RMySQL. I'm not sure whether or not this was intentional. It was
>>> not mentioned in the release notes.
>>>
>> It was removed intentionally.  I do not have a MySQL database
>> available for testing, so I would really appreciate some help from
>> those who use this functionality.  Can someone please try this
>> suggested edit:
>> https://github.com/rstats-db/RMySQL/issues/62#issuecomment-87692704
>>
>> And provide feedback at: https://github.com/joshuaulrich/quantmod/issues/45
>>
>> Thanks!
>> Josh
>>
>>
>> --
>> Joshua Ulrich  |  about.me/joshuaulrich
>> FOSS Trading  |  www.fosstrading.com
>>
>> _______________________________________________
>> [hidden email] 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.
>
>
>
> I'm happy to try it out but a little confused as to all the locations
> I need to edit. Help me clear this up and I'll try it out immediately.
>
> The failure is coming when I'm trying to get the data using the following code:
>
>> if (DownloadNewData){
> +   if (!UseMySQL){
> +     for (i in 1:length(TestSym)){
> +       print(paste("From ",SymbolSrc," -- ",TestSym[i]))
> +       getSymbolsCont(TestSym[i], from = DataStart, to = DataEnd,
> adjust = MyAdjust, src=SymbolSrc)
> +     }
> +   } else {
> +     for (i in 1:length(TestSym)){
> +       print(paste("From MySQL -- ",TestSym[i]))
> + #      getSymbols(TestSym[i], src="MySQL")
> +       getSymbols(TestSym[i], src="MySQL", user="mark",
> password="MyTempPassword", dbname=dbName)
> +       assign(TestSym[i], get(TestSym[i])[paste0(DataStart,"/",DataEnd)])
> +     }
> +     dbDisconnect(dbc)
> +   }
> + }
> [1] "From MySQL --  SPY"
>  Show Traceback
>
>  Rerun with Debug
>
> Error in (function (classes, fdef, mtable)  :
>   unable to find an inherited method for function ‘dbConnect’ for
> signature ‘"character"’
>
>
> Am I correct that the suggestion is to edit two lines?
>
> First, I use
>
> library(RMySQL)
>
> Is the first edit to change this to
>
> requireNamespace("RMySQL", quietly = TRUE)
>
> or do I add this to my code somewhere and keep the library command?
>
No, you shouldn't need to change anything in your code.

> Later in my code I have:
>
> if (UseMySQL){
>   if (MyAdjust) { dbName = paste0(dbName, "Adjust")}
>   dbc = dbConnect(MySQL(), dbname=dbName)
> #  setDefaults(getSymbols.MySQL, user="mark",
> password="MyTempPassword", dbname=dbName)
> }
>
> This would be where the second edit goes?
>
> dbConnect("MySQL", ...) to dbConnect(RMySQL::MySQL, ...)
>
No. Again, you shouldn't need to change your code.  The change
required is on L614 of getSymbols.R.

> Thanks,
> Mark



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

_______________________________________________
[hidden email] 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.
Reply | Threaded
Open this post in threaded view
|

Re: Problem using Quantmod and MySQL

Mark Knecht
On Mon, Mar 30, 2015 at 9:59 AM, Joshua Ulrich <[hidden email]> wrote:

> On Mon, Mar 30, 2015 at 11:49 AM, Mark Knecht <[hidden email]> wrote:
>> On Mon, Mar 30, 2015 at 9:25 AM, Joshua Ulrich <[hidden email]> wrote:
>>> On Sun, Mar 29, 2015 at 5:37 PM, Joshua Ulrich <[hidden email]> wrote:
>>>> On Sun, Mar 29, 2015 at 1:50 PM, Ueli Hofstetter
>>>> <[hidden email]> wrote:
>>>>> I have some problems loading symbols from an mysql db using getSymbols.
>>>>>
>>>>> Instead of repeating the issue, here is a link to the description on
>>>>> stackoverflow
>>>>>
>>>>> http://stackoverflow.com/questions/29333330/quantmod-error-loading-symbols-from-mysql-db
>>>>>
>>>>> Any help is greatly appreciated
>>>>>
>>>> The "character" method for dbConnect was removed in the 0.10 release
>>>> of RMySQL. I'm not sure whether or not this was intentional. It was
>>>> not mentioned in the release notes.
>>>>
>>> It was removed intentionally.  I do not have a MySQL database
>>> available for testing, so I would really appreciate some help from
>>> those who use this functionality.  Can someone please try this
>>> suggested edit:
>>> https://github.com/rstats-db/RMySQL/issues/62#issuecomment-87692704
>>>
>>> And provide feedback at: https://github.com/joshuaulrich/quantmod/issues/45
>>>
>>> Thanks!
>>> Josh
>>>
>>>
>>> --
>>> Joshua Ulrich  |  about.me/joshuaulrich
>>> FOSS Trading  |  www.fosstrading.com
>>>
>>> _______________________________________________
>>> [hidden email] 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.
>>
>>
>>
>> I'm happy to try it out but a little confused as to all the locations
>> I need to edit. Help me clear this up and I'll try it out immediately.
>>
>> The failure is coming when I'm trying to get the data using the following code:
>>
>>> if (DownloadNewData){
>> +   if (!UseMySQL){
>> +     for (i in 1:length(TestSym)){
>> +       print(paste("From ",SymbolSrc," -- ",TestSym[i]))
>> +       getSymbolsCont(TestSym[i], from = DataStart, to = DataEnd,
>> adjust = MyAdjust, src=SymbolSrc)
>> +     }
>> +   } else {
>> +     for (i in 1:length(TestSym)){
>> +       print(paste("From MySQL -- ",TestSym[i]))
>> + #      getSymbols(TestSym[i], src="MySQL")
>> +       getSymbols(TestSym[i], src="MySQL", user="mark",
>> password="MyTempPassword", dbname=dbName)
>> +       assign(TestSym[i], get(TestSym[i])[paste0(DataStart,"/",DataEnd)])
>> +     }
>> +     dbDisconnect(dbc)
>> +   }
>> + }
>> [1] "From MySQL --  SPY"
>>  Show Traceback
>>
>>  Rerun with Debug
>>
>> Error in (function (classes, fdef, mtable)  :
>>   unable to find an inherited method for function ‘dbConnect’ for
>> signature ‘"character"’
>>
>>
>> Am I correct that the suggestion is to edit two lines?
>>
>> First, I use
>>
>> library(RMySQL)
>>
>> Is the first edit to change this to
>>
>> requireNamespace("RMySQL", quietly = TRUE)
>>
>> or do I add this to my code somewhere and keep the library command?
>>
> No, you shouldn't need to change anything in your code.
>
>> Later in my code I have:
>>
>> if (UseMySQL){
>>   if (MyAdjust) { dbName = paste0(dbName, "Adjust")}
>>   dbc = dbConnect(MySQL(), dbname=dbName)
>> #  setDefaults(getSymbols.MySQL, user="mark",
>> password="MyTempPassword", dbname=dbName)
>> }
>>
>> This would be where the second edit goes?
>>
>> dbConnect("MySQL", ...) to dbConnect(RMySQL::MySQL, ...)
>>
> No. Again, you shouldn't need to change your code.  The change
> required is on L614 of getSymbols.R.
>
>> Thanks,
>> Mark
>
>
>
> --
> Joshua Ulrich  |  about.me/joshuaulrich
> FOSS Trading  |  www.fosstrading.com

In that case I'll leave it to someone else to test. I don't want to
mess with non-production libraries. My skill set in this code isn't
good.

Good luck,
Mark

_______________________________________________
[hidden email] 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.
markknecht@gmail.com
Reply | Threaded
Open this post in threaded view
|

Re: Problem using Quantmod and MySQL

Ueli Hofstetter
Has someone fixed/tested this in the meantime? Otherwise I will give it a
try.

Cheers

2015-03-30 19:02 GMT+02:00 Mark Knecht <[hidden email]>:

> On Mon, Mar 30, 2015 at 9:59 AM, Joshua Ulrich <[hidden email]>
> wrote:
> > On Mon, Mar 30, 2015 at 11:49 AM, Mark Knecht <[hidden email]>
> wrote:
> >> On Mon, Mar 30, 2015 at 9:25 AM, Joshua Ulrich <[hidden email]>
> wrote:
> >>> On Sun, Mar 29, 2015 at 5:37 PM, Joshua Ulrich <
> [hidden email]> wrote:
> >>>> On Sun, Mar 29, 2015 at 1:50 PM, Ueli Hofstetter
> >>>> <[hidden email]> wrote:
> >>>>> I have some problems loading symbols from an mysql db using
> getSymbols.
> >>>>>
> >>>>> Instead of repeating the issue, here is a link to the description on
> >>>>> stackoverflow
> >>>>>
> >>>>>
> http://stackoverflow.com/questions/29333330/quantmod-error-loading-symbols-from-mysql-db
> >>>>>
> >>>>> Any help is greatly appreciated
> >>>>>
> >>>> The "character" method for dbConnect was removed in the 0.10 release
> >>>> of RMySQL. I'm not sure whether or not this was intentional. It was
> >>>> not mentioned in the release notes.
> >>>>
> >>> It was removed intentionally.  I do not have a MySQL database
> >>> available for testing, so I would really appreciate some help from
> >>> those who use this functionality.  Can someone please try this
> >>> suggested edit:
> >>> https://github.com/rstats-db/RMySQL/issues/62#issuecomment-87692704
> >>>
> >>> And provide feedback at:
> https://github.com/joshuaulrich/quantmod/issues/45
> >>>
> >>> Thanks!
> >>> Josh
> >>>
> >>>
> >>> --
> >>> Joshua Ulrich  |  about.me/joshuaulrich
> >>> FOSS Trading  |  www.fosstrading.com
> >>>
> >>> _______________________________________________
> >>> [hidden email] 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.
> >>
> >>
> >>
> >> I'm happy to try it out but a little confused as to all the locations
> >> I need to edit. Help me clear this up and I'll try it out immediately.
> >>
> >> The failure is coming when I'm trying to get the data using the
> following code:
> >>
> >>> if (DownloadNewData){
> >> +   if (!UseMySQL){
> >> +     for (i in 1:length(TestSym)){
> >> +       print(paste("From ",SymbolSrc," -- ",TestSym[i]))
> >> +       getSymbolsCont(TestSym[i], from = DataStart, to = DataEnd,
> >> adjust = MyAdjust, src=SymbolSrc)
> >> +     }
> >> +   } else {
> >> +     for (i in 1:length(TestSym)){
> >> +       print(paste("From MySQL -- ",TestSym[i]))
> >> + #      getSymbols(TestSym[i], src="MySQL")
> >> +       getSymbols(TestSym[i], src="MySQL", user="mark",
> >> password="MyTempPassword", dbname=dbName)
> >> +       assign(TestSym[i],
> get(TestSym[i])[paste0(DataStart,"/",DataEnd)])
> >> +     }
> >> +     dbDisconnect(dbc)
> >> +   }
> >> + }
> >> [1] "From MySQL --  SPY"
> >>  Show Traceback
> >>
> >>  Rerun with Debug
> >>
> >> Error in (function (classes, fdef, mtable)  :
> >>   unable to find an inherited method for function ‘dbConnect’ for
> >> signature ‘"character"’
> >>
> >>
> >> Am I correct that the suggestion is to edit two lines?
> >>
> >> First, I use
> >>
> >> library(RMySQL)
> >>
> >> Is the first edit to change this to
> >>
> >> requireNamespace("RMySQL", quietly = TRUE)
> >>
> >> or do I add this to my code somewhere and keep the library command?
> >>
> > No, you shouldn't need to change anything in your code.
> >
> >> Later in my code I have:
> >>
> >> if (UseMySQL){
> >>   if (MyAdjust) { dbName = paste0(dbName, "Adjust")}
> >>   dbc = dbConnect(MySQL(), dbname=dbName)
> >> #  setDefaults(getSymbols.MySQL, user="mark",
> >> password="MyTempPassword", dbname=dbName)
> >> }
> >>
> >> This would be where the second edit goes?
> >>
> >> dbConnect("MySQL", ...) to dbConnect(RMySQL::MySQL, ...)
> >>
> > No. Again, you shouldn't need to change your code.  The change
> > required is on L614 of getSymbols.R.
> >
> >> Thanks,
> >> Mark
> >
> >
> >
> > --
> > Joshua Ulrich  |  about.me/joshuaulrich
> > FOSS Trading  |  www.fosstrading.com
>
> In that case I'll leave it to someone else to test. I don't want to
> mess with non-production libraries. My skill set in this code isn't
> good.
>
> Good luck,
> Mark
>



--
Ueli Hofstetter

        [[alternative HTML version deleted]]

_______________________________________________
[hidden email] 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.