EVOLUTION-MANAGER
Edit File: getSymbols.MySQL.html
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><title>R: Retrieve Data from MySQL Database</title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <link rel="stylesheet" type="text/css" href="R.css" /> </head><body> <table width="100%" summary="page for getSymbols.MySQL {quantmod}"><tr><td>getSymbols.MySQL {quantmod}</td><td style="text-align: right;">R Documentation</td></tr></table> <h2> Retrieve Data from MySQL Database </h2> <h3>Description</h3> <p>Fetch data from MySQL database. As with other methods extending the <code>getSymbols</code> function, this should <em>NOT</em> be called directly. Its documentation is meant to highlight the formal arguments, as well as provide a reference for further user contributed data tools. </p> <h3>Usage</h3> <pre> getSymbols.MySQL(Symbols, env, return.class = 'xts', db.fields = c("date", "o", "h", "l", "c", "v", "a"), field.names = NULL, user = NULL, password = NULL, dbname = NULL, host = "localhost", port = 3306, ...) </pre> <h3>Arguments</h3> <table summary="R argblock"> <tr valign="top"><td><code>Symbols</code></td> <td> <p> a character vector specifying the names of each symbol to be loaded</p> </td></tr> <tr valign="top"><td><code>env</code></td> <td> <p> where to create objects. (.GlobalEnv)</p> </td></tr> <tr valign="top"><td><code>return.class</code></td> <td> <p> desired class of returned object. Can be xts, zoo, data.frame, or ts. (zoo)</p> </td></tr> <tr valign="top"><td><code>db.fields</code></td> <td> <p> character vector indicating names of fields to retrieve</p> </td></tr> <tr valign="top"><td><code>field.names</code></td> <td> <p> names to assign to returned columns </p> </td></tr> <tr valign="top"><td><code>user</code></td> <td> <p> username to access database </p> </td></tr> <tr valign="top"><td><code>password</code></td> <td> <p> password to access database </p> </td></tr> <tr valign="top"><td><code>dbname</code></td> <td> <p> database name </p> </td></tr> <tr valign="top"><td><code>host</code></td> <td> <p> database host </p> </td></tr> <tr valign="top"><td><code>port</code></td> <td> <p> database port </p> </td></tr> <tr valign="top"><td><code>...</code></td> <td> <p> currently not used </p> </td></tr> </table> <h3>Details</h3> <p>Meant to be called internally by <code>getSymbols</code> (see also) </p> <p>One of a few currently defined methods for loading data for use with <span class="pkg">quantmod</span>. Its use requires the packages <span class="pkg">DBI</span> and <span class="pkg">MySQL</span>, along with a running MySQL database with tables corresponding to the <code>Symbol</code> name. </p> <p>The purpose of this abstraction is to make transparent the ‘source’ of the data, allowing instead the user to concentrate on the data itself. </p> <h3>Value</h3> <p>A call to getSymbols.MySQL will load into the specified environment one object for each <code>Symbol</code> specified, with class defined by <code>return.class</code>. </p> <h3>Note</h3> <p>The default configuration needs a table named for the Symbol specified (e.g. MSFT), with column names date,o,h,l,c,v,a. For table layout changes it is best to use <code>setDefaults(getSymbols.MySQL,...)</code> with the new db.fields values specified. </p> <h3>Author(s)</h3> <p> Jeffrey A. Ryan </p> <h3>References</h3> <p><cite>MySQL AB <a href="https://www.mysql.com">https://www.mysql.com</a></cite> </p> <p><cite> Jeroen Ooms and David James and Saikat DebRoy and Hadley Wickham and Jeffrey Horner (2019). RMySQL: Database Interface and 'MySQL' Driver for R. <a href="https://CRAN.R-project.org/package=RMySQL">https://CRAN.R-project.org/package=RMySQL</a></cite> </p> <p><cite>R-SIG-DB. DBI: R Database Interface</cite> </p> <h3>See Also</h3> <p><code><a href="getSymbols.html">getSymbols</a></code>, <code><a href="setSymbolLookup.html">setSymbolLookup</a></code> </p> <h3>Examples</h3> <pre> ## Not run: # All 3 getSymbols calls return the same # MSFT to the global environment # The last example is what NOT to do! setDefaults(getSymbols.MySQL,user='jdoe',password='secret', dbname='tradedata') ## Method #1 getSymbols('MSFT',src='MySQL') ## Method #2 setDefaults(getSymbols,src='MySQL') # OR setSymbolLookup(MSFT='MySQL') getSymbols('MSFT') ######################################### ## NOT RECOMMENDED!!! ######################################### ## Method #3 getSymbols.MySQL('MSFT',env=globalenv()) ## End(Not run) </pre> <hr /><div style="text-align: center;">[Package <em>quantmod</em> version 0.4.20 <a href="00Index.html">Index</a>]</div> </body></html>