<p><div><div><div><div data-show-faces="false" data-height="21" data-width="100" data-layout="button_count" data-send="true" data-href="https://www.r-bloggers.com/getsymbols-and-alpha-vantage/"></div></div><div></div></div><div></div></div>
<div>
(This article was first published on <strong><a href="http://blog.fosstrading.com/2017/10/getsymbols-and-alpha-vantage.html"> FOSS Trading</a></strong>, and kindly contributed to <a rel="nofollow" href="https://www.r-bloggers.com/">R-bloggers)</a> </div>
<p>Thanks to <a rel="nofollow" href="http://quantdevel.com/public/" target="_blank">Paul Teetor</a>, <span>getSymbols()</span> can now import data from <a rel="nofollow" href="https://www.alphavantage.co/" target="_blank">Alpha Vantage</a>!  This feature is part of the <a rel="nofollow" href="http://www.quantmod.com/" target="_blank">quantmod</a> 0.4-11 release, and provides another <a rel="nofollow" href="http://blog.fosstrading.com/2017/06/yahoo-finance-alternatives.html" target="_blank">another data source</a> to avoid any <a rel="nofollow" href="http://blog.fosstrading.com/2017/06/quantmod-0-4-9-on-cran.html" target="_blank">Yahoo Finance API changes</a>*.</p>
<p>Alpha Vantage is a free web service that provides real-time and historical equity data.  They provide daily, weekly, and monthly history for both domestic and international markets, with up to 20 years of history. Dividend and split adjusted close prices are available for daily data. They also provide near real-time price bars at a resolution of 1 minute or more, for up to 10 recent days.
<div></div>
<div>All you need to get started is a <a rel="nofollow" href="https://www.alphavantage.co/support/#api-key" target="_blank">one-time registration for an API key</a>.  Alpha Vantage has <a rel="nofollow" href="https://www.alphavantage.co/documentation/" target="_blank">clean, documented, public API</a> that returns either JSON-encoded data or a CSV file.  The arguments to <span>getSymbols.av()</span> closely follow the native API, so be sure to use their documentation!</div>
<div></div>
<div>To get started, install the latest <a rel="nofollow" href="https://cran.r-project.org/package=quantmod" target="_blank">quantmod from CRAN</a>.  Then you call:</div>
<div></div>
<div>  <span>getSymbols(“MSFT”, src = “av”, api.key = “[your key]”)</span> </div>
<div></div>
<div>Where you replace “[your key”] with the API key you receive after registration.  You can use <span>setDefaults()</span> to set your API key one time, and use it for all <span>getSymbols.av()</span> calls.</div>
<div></div>
<div>  <span>setDefaults(“getSymbols.av”, api.key = “[your key]”)</span></div>
<div></div>
<div>*Speaking of API changes, this release also includes a fix for a Yahoo Finance change (<a rel="nofollow" href="https://github.com/joshuaulrich/quantmod/issues/174" target="_blank">#174</a>).</div>
	<p>
<div>
<div>To <strong>leave a comment</strong> for the author, please follow the link and comment on their blog: <strong><a href="http://blog.fosstrading.com/2017/10/getsymbols-and-alpha-vantage.html"> FOSS Trading</a></strong>.</div>
<hr>
<a rel="nofollow" href="https://www.r-bloggers.com/">R-bloggers.com</a> offers <strong><a rel="nofollow" href="https://feedburner.google.com/fb/a/mailverify?uri=RBloggers">daily e-mail updates</a></strong> about <a rel="nofollow" href="https://www.r-project.org/" title="The R Project for Statistical Computing">R</a> news and <a rel="nofollow" href="https://www.r-bloggers.com/search/tutorial" title="R tutorials">tutorials</a> on topics such as: <a rel="nofollow" href="https://www.r-bloggers.com/search/data%20science" title="Data science">Data science</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/Big%20Data" title="Big Data">Big Data, <a rel="nofollow" href="https://www.r-users.com/" title="R jobs">R jobs</a>, visualization (<a rel="nofollow" href="https://www.r-bloggers.com/search/ggplot2" title="ggplot and ggplot2 tutorials">ggplot2</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/boxplot" title="Boxplots using lattice and ggplot2 tutorials">Boxplots</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/map" title="Maps and gis">maps</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/animation" title="Animation in R">animation</a>), programming (<a rel="nofollow" href="https://www.r-bloggers.com/search/RStudio" title="RStudio IDE for R">RStudio</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/sweave" title="Sweave and literate programming">Sweave</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/LaTeX" title="LaTeX in R">LaTeX</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/SQL" title="SQL and databases">SQL</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/eclipse" title="Eclipse IDE for R">Eclipse</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/git" title="git and github, Version Control System">git</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/hadoop" title="Large data in R using Hadoop">hadoop</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/Web+Scraping" title="Web Scraping of google, facebook, yahoo, twitter and more using R">Web Scraping</a>) statistics (<a rel="nofollow" href="https://www.r-bloggers.com/search/regression" title="Regressions and ANOVA analysis tutorials">regression</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/PCA" title="principal component analysis tutorial">PCA</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/time+series" title="Time series">time series</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/trading" title="finance trading">trading</a>) and more...
<img width="1" alt="" src="http://feeds.feedburner.com/~r/RBloggers/~4/W3I7T7aIB4g" height="1"></a></div>