Description Usage Arguments Details Value Examples
step_cumret
creates a specification of a recipe
step that will calculate cumulative returns from a set of strategy
actions and historical prices.
1 2 3 4 5 6 7 |
recipe |
A recipe object. The step will be added to the sequence of operations for this recipe. |
... |
One or more selector functions to choose which variables are affected by the step. See selections (from recipes package) for more details. |
prices |
A quoted column name which will be used as historical price data. |
fee |
A |
mult |
A |
buy |
A |
sell |
A |
hold |
A |
prefix |
A |
actions |
A container for selected actions columns. Leave to |
role |
For model terms created by this step, what analysis
role should they be assigned? By default, the function assumes
that the created columns will be used
as |
trained |
A logical to indicate if the necessary informations for preprocessing have been estimated. |
skip |
A logical. Should the step be skipped when the
recipe is baked by bake()? While all operations are baked
when prep() is run, some operations may not
be able to be conducted on new data (e.g. processing
the outcome variable(s)). Care should be taken when using |
id |
A character string that is unique to this step to identify it. |
x |
A |
info |
Options for |
This step will return the calculated (log) cumulative returns, either just as a return, or as a cash multiplier for each selected columns.
An updated version of recipe
with the new step
added to the sequence of existing steps (if any).
1 2 3 4 5 6 7 8 9 10 11 | # import libs
library(quantrecipes)
# basic usage
rec <- recipe(. ~ ., data = actions) %>%
step_cumret(benchmark, portfolio, prices = "close") %>%
step_naomit(all_predictors()) %>%
prep()
# get preprocessed data
juice(rec)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.