getReturns(ticker, freq = c("month", "week", "day"), get = c("overlapOnly", "all"), start = "1970-01-01", end = NULL)
"month"
for 12 observations per year and other options are "week"
and "day"
."overlapOnly"
, will return the stock returns for which all stocks had data and drop any dates with NA
; if it is monthly data, minor corrections are made when appropriate. The "all"
option yields all stock returns regardless of whether data for all stocks is available; stock data obtained under the "all"
option may not work in the other functions in this package if NA
values are present."YYYY-MM-DD"
."YYYY-MM-DD"
. If using freq="month"
(the default) or freq="week"
, the DD
should be specified as the last day of the month or week, respectively.getReturns
outputs an object of class "stockReturns"
, which is a list of the following:
stockModel
, optimalPort
, testPort
, portReturn
#===> Citi and Bank of America, 2004-2008 <===#
# cBac <- getReturns(c('C','BAC'), start='2004-01-01', end='2008-12-31')
# print(cBac)
# summary(cBac)
# plot(cBac)
# lines(cBac, lwd=2)
# pairs(cBac)
Run the code above in your browser using DataLab