yahooImport daily stock market data from Yahoo's Web site,
yahooSeries easy to use download from Yahoo,
keystatsImport key statistics from Yahoo's Web site.}yahooImport(query, file = "tempfile",
source = "http://chart.yahoo.com/table.csv?", save = FALSE,
sep = ";", swap = 20, try = TRUE)
yahooSeries(symbols = c("^DJI", "IBM"), from = NULL, to = NULL,
nDaysBack = 365, quote = c("Open", "High", "Low", "Close", "Volume"),
aggregation = c("d", "w", "m"), returnClass = c("timeSeries", "ts",
"matrix", "data.frame"), getReturns = FALSE, ...)
keystatsImport(query, file = "tempfile",
source = "http://finance.yahoo.com/q/ks?s=", save = FALSE,
try = TRUE)d for daily, w for
weekly and m for monthly data records.returnSeries?from and to are not specified.file. By default FALSE."timeSeries" object, alternatives are: "ts",
"matrix", or "data.frame".yahooImport returns an S4 object of class
fWEBDATA with the following slots:yahooSeries returns an S4 object of
class timeSeries or alternatively an object specified by
the function argument returnClass.
The function keystatsImport returns a data frame with
key statistics downloaded from yahoo's web site.s=SYMBOL&a=DD&b=MM&c=CCYY&g=d&q=q&z=SYMBOL&x=.csv
where SYMBOL has to replaced by the symbol name of the
instrument, and DD, MM, and CCYY by the
day, month-1 and century/year when the time series should start.Here are some examples of symbols:
[query] Description:
^DJI Dow Jones 30 Industrial Averages
^NYA New York Stock Exchange Composite
^NDX Nasdaq 100 Index
^IXIC Nasdaq Composite Index
^TYX US 30Y Treasury Bond Index
IBM BM DJIA Stock
KO Coca-Cola DJIA Stock }
The meaning of the tokens in the query string are the following:
s Selected Ticker-Symbol
a First Quote starts with Month (mm)
b First Quote starts with Day (dd)
c First Quote starts with Year (ccyy)
d Last Quote ends with Month (mm)
e Last Quote ends with Day (dd)
f Last Quote ends with Year (ccyy)
z Selected Ticker-Symbol }
## yahooImport -
# [test 19/20 century change 01-12-1999 -- 31-01-2000]
query = "s=IBM&a=11&b=1&c=1999&d=0&q=31&f=2000&z=IBM&x=.csv"
IBM = yahooImport(query)
if (!is.null(IBM)) print(IBM@data[1:20, ])Run the code above in your browser using DataLab