Import stock prices
stocks <- tq_get(c("NDA-FI.HE", "JPM", "DNB.OL", "MS"),
get = "stock.prices",
from = "2016-01-01")
stocks
## # A tibble: 8,737 × 8
## symbol date open high low close volume adjusted
## <chr> <date> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
## 1 NDA-FI.HE 2016-01-04 10.2 10.3 10.1 10.1 703596 5.51
## 2 NDA-FI.HE 2016-01-05 10.1 10.1 10.1 10.1 0 5.51
## 3 NDA-FI.HE 2016-01-07 9.95 9.95 9.79 9.88 906429 5.37
## 4 NDA-FI.HE 2016-01-08 9.88 9.88 9.88 9.88 0 5.37
## 5 NDA-FI.HE 2016-01-11 9.60 9.71 9.57 9.64 1030007 5.24
## 6 NDA-FI.HE 2016-01-12 9.62 9.81 9.57 9.72 1365547 5.28
## 7 NDA-FI.HE 2016-01-13 9.82 9.96 9.77 9.82 1997363 5.34
## 8 NDA-FI.HE 2016-01-14 9.78 9.78 9.53 9.64 2605240 5.24
## 9 NDA-FI.HE 2016-01-15 9.63 9.65 9.28 9.31 2522004 5.06
## 10 NDA-FI.HE 2016-01-18 9.34 9.41 9.21 9.23 1406527 5.02
## # ℹ 8,727 more rows
Plot stock prices
stocks %>%
ggplot(aes(x = date, y = adjusted, color = symbol)) +
geom_line()
