Learn R Programming

PerformanceAnalytics (version 0.9.5)

download.SP500PriceReturns: download S & P Prices and calculate S & P returns

Description

This function downloads daily/monthly S & P 500 prices using get.hist.quote for "^gspc" and calculate S & P returns using CalculateReturns

Usage

download.SP500PriceReturns(start = "1998-01-01", end = NULL, compression=c("m","d"), method=c("compound","simple"))

Arguments

start
start date in YYYY-mm-dd format, default "1998-01-01"
end
end date in YYYY-mm-dd format
compression
"m" for monthly returns and "d" for daily returns, default monthly, as passthru to get.hist.quote
method
"simple" or "compound" as a passthru to CalculateReturns, default compound

Value

  • matrix of simple or compound returns on the S & P 500 at the daily/monthly scale specified

See Also

CalculateReturns download.RiskFree get.hist.quote

Examples

Run this code
sp500 = download.SP500PriceReturns(start = "1996-12-31", end = "2007-01-01")
class(sp500)
head(sp500)

Run the code above in your browser using DataLab