knitr::opts_chunk$set(echo = TRUE)

avR Package

A simple client to access the Alpha Vantage Market Data Api. Only the TIME_SERIES_DAILY_ADJUSTED and TIME_SERIES_INTRADAY endpoints are exposed.

library(avR)
library(tidyquant)

Daily Market Data

aapl <- time_series_daily_adjusted("AAPL",from = "2019-01-01", to = "2019-06-01")
aapl

Intraday Market Data

aapl_id <- time_series_intraday("AAPL",nDays = 1)
aapl_id

Note that the data is returned as a tibble (dataframe)

ggplot2::ggplot(aapl ,aes(x = datetime)) +
  geom_candlestick(aes(open = aOpen, high=aHigh, low= aLow, close = aClose)) + ggplot2::ggtitle("APPLE DAILY",subtitle = "from ALPHA VANTAGE")
ggplot2::ggplot(aapl_id ,aes(x = minute,y=close,colour=date)) +
  geom_line() +
  ggplot2::ggtitle("APPLE Intraday",subtitle = "from ALPHA VANTAGE")


schardtbc/avR documentation built on March 12, 2020, 1:29 a.m.