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

Description Usage Arguments Value See Also Examples

View source: R/get_stocks.R

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
4
5
6
7
8
9
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 stock tickers.

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 succeeded;

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

The defaul is TRUE.

otherwise

Argument passed to safely.

quiet

Argument passed to 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 Nov. 29, 2021, 9:45 p.m.