Quantmod: Error loading symbols from MySQL DB

廉价感情. 提交于 2019-12-11 11:29:14

问题


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!


回答1:


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.



来源:https://stackoverflow.com/questions/29333330/quantmod-error-loading-symbols-from-mysql-db

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!