Hello Alphien,
I have two questions on the framework :
1/ When you call the payout function, why do pass in returns and not prices ? Prices are unambiguous.
Looks like to pass in 1d log returns
2/ I am not comfortable with your trading calendar handling.
The prices seem to be padded rolling forward when the data is not a trading day for an asset.
Thus, if you sample these dates monthly for monthly rebalancing, you are not guaranteed that the sample date will be a trading day for all assets.
However the comments from your backtesting function hints that those days are discarded.
So we will end up randomly skipping some reabalancing dates. Not a big deal for daily rebalancings, but for monthly ones…
> Found 27 day(s) where weights are assigned but 1 or more markets are closed. These dates will be removed.
In short, the trading logic is not fully consistent with the input data logic.
Having NAs in the price time series or clean time series would allow everyone to handle the rebalancing logic.
Example: 2010-05-31 is not a trading day in the US (memorial day), but you report prices for TY and the HY ETF
TYa = getAlphathonBBs(“TYa”,asPrice = TRUE)
> tail(TYa[‘2010-05’])
> TYa
> 2010-05-24 105.9114
> 2010-05-25 106.4065
> 2010-05-26 105.9113
> 2010-05-27 105.1824
> 2010-05-28 105.5125
> 2010-05-31 105.5125
Thx