Import stock prices
stocks <- tq_get(c("LULU", "CLX", "MMC"),
get = "stock.prices",
from = "2019-06-01",
to = "2020-06-01")
stocks
## # A tibble: 753 × 8
## symbol date open high low close volume adjusted
## <chr> <date> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
## 1 LULU 2019-06-03 166. 168. 162. 164. 1634900 164.
## 2 LULU 2019-06-04 165. 169. 165. 169 1273600 169
## 3 LULU 2019-06-05 170. 174. 169. 174. 1814500 174.
## 4 LULU 2019-06-06 174. 174. 170. 170. 1685700 170.
## 5 LULU 2019-06-07 172. 173. 170. 172. 1846600 172.
## 6 LULU 2019-06-10 174. 176. 171. 171. 1930900 171.
## 7 LULU 2019-06-11 172. 174. 170. 172. 2016200 172.
## 8 LULU 2019-06-12 172. 173. 169. 171. 5417600 171.
## 9 LULU 2019-06-13 182. 183. 172. 175. 11076700 175.
## 10 LULU 2019-06-14 173. 178. 172. 177. 3635700 177.
## # … with 743 more rows
Plot stock prices
stocks %>%
ggplot(aes(x = date, y = adjusted, color = symbol)) +
geom_line()
