make_reinvested_return.data.table | R Documentation |
Compute reinvested return between start and end.
## S3 method for class 'data.table'
make_reinvested_return(price_data, start = 1,
end = nrow(price_data), ...)
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. |
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.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.