--- title: "Downloading Stock data using tidyquant" output: html_notebook --- Read the blog post [Charting with tidyquant](https://cran.r-project.org/web/packages/tidyquant/vignettes/TQ04-charting-with-tidyquant.html). ```{r} library(tidyverse) library(tidyquant) ``` This is a test dataset that is available in the *tidyquant* R package. ```{r} data("FANG") FANG ``` Download stock data. ```{r} AAPL <- tq_get("AAPL", get = "stock.prices", from = "2015-09-01", to = "2016-12-31") AMZN <- tq_get("AMZN", get = "stock.prices", from = "2000-01-01", to = "2016-12-31") ``` ```{r} AAPL %>% ggplot(aes(x = date, y = close)) + geom_line() + labs(title = "AAPL Line Chart", y = "Closing Price", x = "") + theme_tq() ``` ```{r} AAPL %>% ggplot(aes(x = date, y = close)) + geom_barchart(aes(open = open, high = high, low = low, close = close)) + labs(title = "AAPL Bar Chart", y = "Closing Price", x = "") + theme_tq() ```