Quantstrat to backtest portfolio strategy. User Defined Weights
On Wed, 2016-12-14 at 14:28 +0000, Vineet Gupta wrote:
I am trying to use Quantstrat to backtest a portfolio strategy with user defined weights at each re-balance date. The user defined weights, are given in a matrix (example shown below) ?????????Date?????ABC.UN???ABT.UN ACN.UN ADBE.UW 20 2015-05-15 0.50000000 0.000000????0.5???????0 21 2015-05-22 0.50000000 0.000000????0.5???????0 22 2015-05-29 0.50000000 0.000000????0.5???????0 23 2015-06-05 0.50000000 0.000000????0.5???????0 24 2015-06-12 0.08865296 0.411347????0.5???????0 25 2015-06-19 0.00000000 0.500000????0.5???????0 Simply put, how can I backtest such a strategy, using Quantstrat? I have looked at the rule, 'rulePctEquity', but this appears to only govern maximum trade sizes.? What information does Quantstrat need to re-balance my portfolio at each user-defined re-balance date? Thanks in advance. Very much appreciated
You haven't really given us enough information to answer your question, so I'm just guessing based on the information you did provide. If you are simply 'trading' a portfolio strategy where the portfolio is rebalanced form one set of weights to another on a specified rebalancing period, you probably don't want quantstrat at all. In that case, you likely want the function Return.portfolio in PerformanceAnalytics or you want to use PortfolioAnalytics to construct your target portfolio. Working in returns and weights is different than working in trades and cash. rulePctEquity simply governs how much of the total equity is available for each instrument in the strategy. ?It doesn't reduce the size of an existing position on the rebalance period, if there is one. ?It could certainly be extended to enter orders or transactions to rebalance, if you wanted it to. You'll have to provide a minimal reproducible example and more information about what you'd like to do for someone to be able to help you further. Regards, Brian