Import stock prices
stocks <- tq_get(c("PPTA", "IBM"),
get = "stock.prices",
from = "2022-01-01",
to = "2024-01-01")
stocks
## # A tibble: 1,002 × 8
## symbol date open high low close volume adjusted
## <chr> <date> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
## 1 PPTA 2022-01-03 4.64 4.80 4.61 4.77 80500 4.77
## 2 PPTA 2022-01-04 4.86 4.90 4.70 4.88 92500 4.88
## 3 PPTA 2022-01-05 4.85 4.89 4.5 4.55 92200 4.55
## 4 PPTA 2022-01-06 4.40 4.57 4.38 4.48 76400 4.48
## 5 PPTA 2022-01-07 4.56 4.59 4.36 4.54 53800 4.54
## 6 PPTA 2022-01-10 4.44 4.45 4.14 4.29 96700 4.29
## 7 PPTA 2022-01-11 4.24 4.37 4.12 4.35 72800 4.35
## 8 PPTA 2022-01-12 4.43 4.48 4.27 4.30 68700 4.30
## 9 PPTA 2022-01-13 4.35 4.35 4.20 4.22 54900 4.22
## 10 PPTA 2022-01-14 4.27 4.27 4 4.17 125200 4.17
## # ℹ 992 more rows
Plot stock prices
stocks %>%
ggplot(aes(x = date, y = adjusted, color = symbol)) +
geom_line()
