returns: Calculate returns

Description Usage Arguments Value

View source: R/returns.R

Description

Calculate returns

Usage

1
returns(x, type = "r", n = 1)

Arguments

x

numeric vector

type

'r' = x[t] / x[t-n] - 1 , 'l' = ln( x[t] / x[t-n] )

n

lookback

Value

Vector of same length as x with absent returns converted to 0 for relative and 1 for logarithmic.


QuantTools documentation built on Oct. 23, 2020, 7:54 p.m.