I am trying to fetch symbols from a MySQL db using getSymbols, however the following code
library(blotter)
library(DBI)
library(RMySQL)
setDefaults(getSymbols.MySQL,user="****", password="****", dbname="quantmoddb")
currency("USD")
stock("myspy",currency="USD",multiplier=1)
getSymbols("myspy",src="MySQL")
throws
Error in (function (classes, fdef, mtable) :
unable to find an inherited method for function ‘dbConnect’ for signature ‘"character"’
I am pretty sure the db is set up correctly as the following code runs fine and returns the dataset as expected.
con <- dbConnect(RMySQL::MySQL(),user="****",password="****", dbname="quantmoddb",
host="localhost", port=3306)
db.Symbols <- DBI::dbListTables(con)
query <- paste("SELECT * from myspy ORDER BY date")
rs <- DBI::dbSendQuery(con, query)
fr <- DBI::fetch(rs, n=-1)
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.