Import stock prices
stocks <- tq_get(c("NKE", "PUM.DE", "NFLX"),
get = "stock.prices",
from = "2020-01-01",
to = "2024-01-01")
stocks
## # A tibble: 3,033 × 8
## symbol date open high low close volume adjusted
## <chr> <date> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
## 1 NKE 2020-01-02 101. 102. 101. 102. 5644100 91.8
## 2 NKE 2020-01-03 101. 102 100. 102. 4541800 91.6
## 3 NKE 2020-01-06 101. 102. 101. 102. 4612400 91.5
## 4 NKE 2020-01-07 102. 103. 101. 102. 6719900 91.5
## 5 NKE 2020-01-08 101. 102. 101. 102. 4942200 91.3
## 6 NKE 2020-01-09 102. 102. 101. 101. 5007500 91.2
## 7 NKE 2020-01-10 102. 102. 101. 101. 5135300 90.7
## 8 NKE 2020-01-13 101 102. 101. 102. 6722400 91.8
## 9 NKE 2020-01-14 102. 104. 102. 103. 5088500 92.5
## 10 NKE 2020-01-15 103. 104. 102. 103. 4209200 92.4
## # ℹ 3,023 more rows
Plot stock prices
stocks %>%
ggplot(aes(x = date, y = adjusted, color = symbol)) +
geom_line()
