WebData {TTR}R Documentation

Fetch Internet Data

Description

Get investment data from the internet.

Usage

  getYahooData(symbol, start, end, freq="daily", type="price",
             adjust=TRUE, quiet=FALSE)
  stockSymbols(exchange=c("AMEX","NASDAQ","NYSE"),
              sort.by=c("Exchange","Symbol"), quiet=FALSE)

Arguments

symbol Yahoo! Finance instrument symbol.
start Numeric; first date of desired data, in YYYYMMDD format. Default is first date of series.
end Numeric; last date of desired data, in YYYYMMDD format. Default is last date of series.
freq Desired data frequency. One of "daily", "weekly", "monthly".
type Type of data to return. One of "price", or "split". type="split" will return both split and dividend data.
adjust Logical; if TRUE, the Open, High, Low, and Close prices will be adjusted for dividends and splits, and Volume will be adjusted for dividends.
quiet Logical; if TRUE, status messages will be printed to the console.
exchange Character vector of exchange names on which desired instrument symbols are traded.
sort.by Character vector of columns by which returned data will be sorted. Must be one or more of "Name", "Symbol", "Market.Cap", or "Exchange".

Details

getYahooData fetches individual stock data from the Yahoo! Finance website. It also adjusts price for splits and dividends, and volume for splits.

stockSymbols fetches instrument symbols from the nasdaq.com website, and adjusts the symbols to be compatible with the Yahoo! Finance website.

Value

getYahooData returns a numeric matrix containing the columns:

Date Trade date, in CCYYMMDD format.
Open Open price.
High High price.
Low Low price.
Close Close price.
Volume Volume.


stockSymbols returns a character vector containing all the listed symbols for the given exchanges.

Note

The symbols returned by stockSymbols may not be in the format necessary to retrieve data using getYahooData.

getYahooData has only been tested on daily data. It isn't known if the function correctly adjusts data for any other frequency.

Author(s)

Josh Ulrich

Examples

  ### Note: you must have a working internet
  ### connection for these examples to work!
  ibm <- getYahooData("IBM", 19990404, 20050607)

  nyse.symbols <- stockSymbols("NYSE")

[Package TTR version 0.14-0 Index]