make_reinvested_return.data.table: Compute reinvested return between start and end.

View source: R/adjustment.R

make_reinvested_return.data.tableR Documentation

Compute reinvested return between start and end.

Description

Compute reinvested return between start and end.

Usage

## S3 method for class 'data.table'
make_reinvested_return(price_data, start = 1,
  end = nrow(price_data), ...)

Arguments

price_data

A data.frame of prices as produced by make_raw_data. In particular, requires columns index, close, rawshares, and rawdividend.

start

An index vector (numeric or logical) of starting points.

end

An index vector (numeric or logical) of ending poitns.

...

Additional arguments.

Value

A data.frame of reinvested returns with columns index and reinvested_return. If the (start,end] ranges do not overlap, the returns are a running calculation from each start indexed from start+1 to end. If there the (start,end] ranges do not partition the index of the input, the missing indexes are omitted (especially useful when looking at trade returns in which you are not always in the market). If there is overlap in the (start,end] ranges, there is just one return calculated for each end indexed by the index at end.


e-mu-pi/adjustr documentation built on Sept. 26, 2024, 9:34 p.m.