Learn R Programming

PerformanceAnalytics (version 0.9.5)

CalculateReturns: calculate simple or compound returns from prices

Description

calculate simple or compound returns from prices

Usage

CalculateReturns(prices, method=c("compound","simple"))

Arguments

prices
data object containing ordered price observations
method
calculate "simple" or "compound" returns, default compound

Value

  • vector or matrix of simple or compound returns

See Also

Return.cumulative

Examples

Run this code
require(tseries)
prices = get.hist.quote("^gspc", start = "1999-01-01", end = "2007-01-01", quote = "Close", compression = "m")
returns = CalculateReturns(prices, method="simple")
colnames(returns)="SP500"

Run the code above in your browser using DataLab