Wrapper for Alpha Vantage API

Download data from the Alpha Vantage API (< https://www.alphavantage.co/>). Alpha Vantage is a RESTful API which provides various financial data, including stock prices and technical indicators. There is documentation for the underlying API available here: < https://www.alphavantage.co/documentation/>. To get access to this API, the user needs to first claim an API key: < https://www.alphavantage.co/support/>.


Build Status codecov.io Dependency Status

Introduction

Alpha Vantage is a free API which provides both real time and historical stock market data. It is easy to get an API key, intraday data is available, and many technical indicators are included in the service. This package is a simple wrapper client to get data from the API into easy-to-use R objects, namely xts.

Installation

To install the package, simply use the devtools::install_github("athompson1991/AlphaVantageClient") command. Obviously this means that the devtools package needs to be installed, but it should be straightforward. If the operating system is Ubuntu, then R may need to be run as sudo.

Usage

Step One: Set API Key

First, set your API key:

setAPIKey("ABCD")

Step Two: Download data.

Here is how to get daily time series loaded directly into an xts object:

amzn <- fetchSeries(function_nm = "time_series_daily", symbol = "amzn", outputsize = "full", datatype = "json")

The function returns a list with two elements - the xts object that is interpreted from the response, and the response from the httr package request. Now the data can be plotted, analyzed, manipulated into returns, etc.:

head(amzn$xts_object)
plot(amzn$xts_object[ ,1])
amzn_returns <- diff(log(amzn$xts_object[ ,1]))

Similarly, the other Alpha Vantage data offerings are available using the same function:

amzn_sma <- fetchSeries(function_nm = "sma", symbol = "amzn", interval = "daily", time_period = 60, series_type = "close")
amzn_bbands <- fetchSeries(function_nm = "bbands", symbol = "amzn", interval = "daily", time_period = 60, series_type = "close")

News

Reference manual

It appears you don't have a PDF plugin for this browser. You can click here to download the reference manual.

install.packages("AlphaVantageClient")

0.0.1 by Alex Thompson, 2 years ago


https://github.com/athompson1991/AlphaVantageClient


Browse source code at https://github.com/cran/AlphaVantageClient


Authors: Alex Thompson


Documentation:   PDF Manual  


MIT + file LICENSE license


Imports httr, xts

Suggests testthat, knitr, rmarkdown, mockery, httptest


See at CRAN