read_stock_prices: Read stock and dividends from yahoo.finance

Description Usage Arguments Details Value Examples

Description

This is a convenience function for exercises in the Data Computing book. It reads stock prices and dividends over a specified time interval.

Usage

1
2
read_stock_prices(symbols = "F", what = c("prices", "daily", "weekly",
  "monthly", "dividends"), start_year = 1972, end_year = 2015)

Arguments

symbols

a single character string or a vector of character strings specifying a stock listed on yahoo.finance.

what

whether to read prices or dividends. For prices, use one of "daily", "weekly", "monthly". For dividends, use "dividends".

startYear

the lower end of the time interval for which to download data

endYear

the upper end of the time interval

Details

This function relies on the finance.yahoo.com API as it exists in early 2015.

Value

A data frame. One column in the data frame lists the stock symbol. This is useful when reading data for more than one stock.

Examples

1
## Not run: CarStocks <- readStockPrices("F", "monthly", 1995, 2012)

dtkaplan/dcfunctions documentation built on May 15, 2019, 4:59 p.m.