[R-SIG-Finance] How to lag Return.portfolio a day?

Ilya Kipnis ||y@@k|pn|@ @end|ng |rom gm@||@com
Tue Dec 3 20:55:35 CET 2019


So, quick question in case this is already implemented in Return.portfolio,
but this is something that's been bugging me for a while now.

Say you're backtesting a momentum strategy, with your rebalance dates being
monthly endpoints. While in a perfect world, you'd get your closing data at
the close and have time to rebalance the strategy right then and there, in
the real world, you might not have closing data until the next morning--or
you're a large fund that takes a day to move capital into position, or
whatever other real-world constraint.

For instance, here's an obligatory minimum reproducible example:

posRets <- rep(.003, 63)
posRets <- cbind(posRets, 0)
posRets <- xts(posRets, order.by=as.Date(c(1:63)))
wts <- rbind(c(0,1), c(1,0), c(0,1), c(1,0))
tmp <- endpoints(posRets)
tmp[1] <- 1
wts <- xts(wts, order.by=index(posRets)[tmp])
out <- Return.portfolio(R = posRets, weights = wts)

Now, given that the weights are allocated at the end of every month, if we
have a 1-day lag to account for execution, I'd expect the first day of each
new month to be identical to the day before it. That is, if the previous
month had a zero return because it was invested in the second asset, then
the first day of the new month should also have a zero return, and vice
versa.

This is not the case.

[image: image.png]

Is there a lag setting in Return.portfolio to account for this, or should I
write the function myself?

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://stat.ethz.ch/pipermail/r-sig-finance/attachments/20191203/8093c9e7/attachment.html>

-------------- next part --------------
A non-text attachment was scrubbed...
Name: image.png
Type: image/png
Size: 11622 bytes
Desc: not available
URL: <https://stat.ethz.ch/pipermail/r-sig-finance/attachments/20191203/8093c9e7/attachment.png>


More information about the R-SIG-Finance mailing list