updateStrategy: run standard and custom strategy wrapup functions such as...

Description Usage Arguments Details Author(s) See Also

View source: R/wrapup.R

Description

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.

Usage

1
2
3
4
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, ...)

Arguments

strategy

object of type strategy to initialize data/containers for

portfolio

string identifying a portfolio

account

string identifying an account. Same as portfolio by default

Symbols

character vector of names of symbols whose portfolios will be updated

parameters

named list of parameters to be applied during evaluation of the strategy, default NULL

Dates

optional xts-style ISO-8601 time range to run updatePortf over, default NULL (will use times from Prices)

Prices

optional xts object containing prices and timestamps to mark the book on, default NULL

update.Portf

TRUE/FALSE if TRUE (default) a call will be made to updatePortf

update.Acct

TRUE/FALSE if TRUE (default) a call will be made to updateAcct

update.EndEq

TRUE/FALSE if TRUE (default) a call will be made to updateEndEq

showEq

TRUE/FALSE if TRUE (default) ending equity will be printed to the screen

chart

TRUE/FALSE if TRUE (default) a call will be made to chart.Posn

...

any other passthrough parameters

Details

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:

update.Portf

if TRUE, will call updatePortf to mark the book in the portfolio.

update.Acct

if TRUE, will call updateAcct to mark the blotter account for this test.

update.EndEq

if TRUE, will call updateEndEq to update the account equity after all other accounting has been completed.

Author(s)

Garrett See, Brian Peterson

See Also

updatePortf, updateAcct, updateEndEq, chart.Posn


cloudcell/quantstrat documentation built on May 13, 2019, 8:03 p.m.