get_stocks: A wrapper over 'getSymbols' that maps over index components.

Description Usage Arguments Value See Also Examples

Description

get_stocks() allows you to quickly download stock indexes from the the Yahoo Finance without having to run for loops.

Usage

1
2
3
get_stocks(tickers, from = "2010-01-01", to = Sys.Date(),
  periodicity = "daily", simplify = TRUE, otherwise = NULL,
  quiet = TRUE)

Arguments

tickers

A character vector with the yahoo symbols.

from

A date in the format YYYY-MM-DD.

to

A date in the format YYYY-MM-DD.

periodicity

One of: daily, weely or monthly.

simplify

If TRUE, a tibble is returned. If FALSE a list with two elements is returned:

  • result: with the downloads that sucedded;

  • error: with the stocks not covered by the Yahoo Finance.

The defaul is TRUE.

otherwise

Argument passed to purrr::safely.

quiet

Argument passed to purrr::safely. A notification is showed whenever an error occurs. Default is TRUE.

Value

A tidy tibble if simplify = TRUE and a list of two components if simplify = FALSE.

See Also

safely()

Examples

1
2
3
4
# Get stocks from the Merval Stock Index (Argentina)
library(YahooTickers)
ticks <- get_tickers(merval)
get_stocks(ticks, periodicity = "monthly")

Reckziegel/YahooTickers documentation built on May 28, 2019, noon