get_stocks()
allows you to quickly download stock indexes from the the Yahoo Finance without having to run for
loops.
get_stocks( tickers, from = "2010-01-01", to = Sys.Date(), periodicity = "daily", simplify = TRUE, otherwise = NULL, quiet = TRUE )
tickers | A |
---|---|
from | A date in the format |
to | A date in the format |
periodicity | One of: |
simplify | If TRUE, a
The defaul is TRUE. |
otherwise | Argument passed to |
quiet | Argument passed to |
A tidy tibble
if simplify = TRUE
and a list
of two components if simplify = FALSE
.
# Get stocks from the Merval Stock Index (Argentina) library(YahooTickers) ticks <- get_tickers(merval) get_stocks(ticks, periodicity = "monthly") #> Warning: PESA.BA download failed; trying again. #> Warning: TS.BA download failed; trying again. #> Warning: APBR.BA download failed; trying again. #> Warning: ERAR.BA download failed; trying again. #> Warning: incomplete final line found by readTableHeader on 'https://query1.finance.yahoo.com/v7/finance/download/FRAN.BA?period1=1262304000&period2=1637884800&interval=1mo&events=history&crumb=W.g8FFjXibA' #> # A tibble: 1,153 × 8 #> date tickers open high low close volume adjusted #> <date> <fct> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> #> 1 2010-01-01 GGAL.BA 2.15 2.27 1.95 2.04 28709313 1.95 #> 2 2010-02-01 GGAL.BA 2.04 2.05 1.81 1.9 18485991 1.81 #> 3 2010-03-01 GGAL.BA 1.87 2.47 1.87 2.37 28977189 2.26 #> 4 2010-04-01 GGAL.BA 2.37 2.54 2.33 2.39 23021214 2.28 #> 5 2010-05-01 GGAL.BA 2.39 2.39 2 2.18 41753189 2.08 #> 6 2010-06-01 GGAL.BA 2.17 2.51 2.16 2.29 30309571 2.18 #> 7 2010-07-01 GGAL.BA 2.3 2.54 2.23 2.5 24744265 2.38 #> 8 2010-08-01 GGAL.BA 2.52 3.49 2.5 3.22 85268253 3.07 #> 9 2010-09-01 GGAL.BA 3.29 4.02 3.29 3.96 53190804 3.78 #> 10 2010-10-01 GGAL.BA 3.98 5.15 3.88 5.15 52487664 4.91 #> # … with 1,143 more rows