Constructs the data container used to store calculated account values such as aggregated P&L, equity, etc.


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


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



Account name, as string


character vector of strigs naming portfolios included in this account


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


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


ISO currency identifier used to locate the portfolio currency


any other passthrough parameters


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


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.

Want to suggest features or report bugs for Use the GitHub issue tracker. Vote for new features on Trello.

comments powered by Disqus