I have a question regarding PerformanceAnalytics and Quantstrat packages. I want to test a monthly rebalancing portfolio strategy, but I want to incorporate the effect of annual fees and buy&sell fees for rebalancing.
Is there any practical way of doing this? In PerformanceAnalytics, I can easily test the monthly rebalancing strategy, but fees are problematic. In Quantstrat, I can easily incorporate fees, but is there a way to construct a monthly rebalance structure?
Thank you very much,
Kind regards.
In case an alternative package is also acceptable: here is how it could be done with the
PMwR
package.Start with example data: 30 industry series from Kenneth French's website.
Now we compute the dates at which transactions take place.
For the backtest, I'll use function
btest
in thePMwR
package. It takes as input a functionsignal
which evaluates to the target portfolio. Suppose we wanted an equal-weights portfolio; thensignal
could look as follows:btest
also accepts an argumentcashflow
that can be used to add/subtract arbitrary amounts to the cash balance. The following function deducts 10% of the total wealth at every end of year (it's just an example).This would take care of the annual fee. The easiest way to include trading fees proportional to the amount traded is via the separate argument
tc
. It remains to run the backtest:(Disclosure: I am the maintainer of packages
PMwR
,NMOF
anddatetimeutils
.)