updateStrategy
will run a series of common wrapup functions at the
beginning of an applyStrategy
call. This function allows the user to
add arbitrary wrapup functions to the sequence.
updateStrategy(strategy, portfolio = "default", account = portfolio,
Symbols = NULL, parameters = NULL, Dates = NULL, Prices = NULL,
update.Portf = TRUE, update.Acct = TRUE, update.EndEq = TRUE,
showEq = TRUE, chart = TRUE, ...)
object of type strategy
to initialize data/containers for
string identifying a portfolio
string identifying an account. Same as portfolio
by default
character vector of names of symbols whose portfolios will be updated
named list of parameters to be applied during evaluation of the strategy, default NULL
optional xts-style ISO-8601 time range to run updatePortf over, default NULL (will use times from Prices)
optional xts object containing prices and timestamps to mark the book on, default NULL
TRUE/FALSE if TRUE (default) a call will be made to updatePortf
TRUE/FALSE if TRUE (default) a call will be made to updateAcct
TRUE/FALSE if TRUE (default) a call will be made to updateEndEq
TRUE/FALSE if TRUE (default) ending equity will be printed to the screen
TRUE/FALSE if TRUE (default) a call will be made to chart.Posn
any other passthrough parameters
These arbitrary functions will be added to the update
slot of the strategy object
and when applyStrategy
is evaluated, the arbitrary wrapup functions will
be evaluated before the standardized functions.
For example, if you are working with high frequency data, it would be common
to mark the book on a lower frequency, perhaps minutes, hours, or even days,
rather than tick. A custom wrapup function could take your high frequency
data and transform it to lower frequency data before the call to updatePortf
.
The 'standard wrapup functions included are:
if TRUE, will call updatePortf
to mark the book in the portfolio.
if TRUE, will call updateAcct
to mark the blotter account for this test.
if TRUE, will call updateEndEq
to update the account equity after all other accounting has been completed.