initAcct: Constructs the data container used to store calculated...

Description Usage Arguments Details Note

View source: R/initAcct.R

Description

Inputs portfolios: a list of portfolio object names to attach to the account initDate: date prior to the first close price given, used to contain initial account equity and initial position initEq: initial equity or starting capital, default is 100,000

Usage

1
2
initAcct(name = "default", portfolios, initDate = "1950-01-01",
  initEq = 0, currency = "USD", ...)

Arguments

name

Account name, as string

portfolios

character vector of strigs naming portfolios included in this account

initDate

A date prior to the first close price given, used to contain initial account equity and initial position

initEq

initial account equity in the currency of the portfolio, as a floating point number.

currency

ISO currency identifier used to locate the portfolio currency

...

any other passthrough parameters

Details

Outputs Constructs multi-column xts object used to store aggregated portfolio calculations

NOTES An Account object is a list of portfolios with portfolio summary information

The Account object is modeled on the CFTC Thirteen-column presentation table. Start with the CFTC six column presentation, which includes: Beg.Eq, Additions, Withdrawals, Net.Perf, End.Eq, Period.ROR No reason to persist Period.ROR, and Beg.Eq = Previous End.Eq, So we're left with four columns. Note that Period.ROR can be calc'd several different ways and is best left as a function.

To get to the CFTC thirteen columns add: Gross.Realized, Commission, Net.Realized, Interest, Ch.Unrealized, Advisory.Fees, Wealth.Index Again, no need to add Wealth.Index. Eventually, these additional columns will be useful. Gross.Realized will be calculated as (Net) Realized.PL + Txn.Fees

Note

TODO Add calcPeriodROR function

TODO Adddd functions addCapital, drawCapital, addFees

initDate and initEq can be used in addCapital to initalize the account? Track cash at this level??? Calc gross PL and subtract fees? Or calc net PL and add fees.


cloudcell/blotter documentation built on May 13, 2019, 8:01 p.m.