TTR (version 0.23-6)

stockSymbols: Fetch Internet Data

Description

Get investment data from the internet.

Usage

stockSymbols(exchange = c("AMEX", "NASDAQ", "NYSE"), sort.by = c("Exchange",
  "Symbol"), quiet = FALSE)

getYahooData(symbol, start, end, freq = "daily", type = "price", adjust = TRUE, quiet = FALSE)

Arguments

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".

quiet

Logical; if TRUE, status messages will be printed to the console.

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.

Value

getYahooData returns an xts object containing the columns:

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

Date

Trade date, in CCYYMMDD format.

Open

Open price.

High

High price.

Low

Low price.

Close

Close price.

Volume

Volume.

Warning

As of TTR 0.23-2, getYahooData has been patched to work with changes to Yahoo Finance, which also included the following changes to the raw data:

  • The adjusted close column appears to no longer include dividend adjustments

  • The open, high, and low columns are adjusted for splits, and

  • The raw data may contain missing values.

  • The raw data may contain errors.

Details

getYahooData fetches individual stock data from the Yahoo! Finance website. It also adjusts price for splits and dividends, and volume for splits. See the Warning section, and note that it is deprecated in favor of getSymbols in the quantmod package.

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

Examples

Run this code
# NOT RUN {
### Note: you must have a working internet
### connection for these examples to work!
if (interactive()) {
  ge <- getYahooData("GE", 19990404, 20050607, adjust = FALSE)

  nyse.symbols <- stockSymbols("NYSE")
}

# }

Run the code above in your browser using DataLab