quantstrat is slow

The complaint I hear most frequently about quantstrat is that it’s slow, especially for large data. Some of this slow performance is due to quantstrat treating all strategies as path-dependent by default. Path dependence requires rules to be re-evaluated for each timestamp with a signal. More signals equates to longer run-times. If your strategy is not path-dependent, you can get a fairly substantial performance improvement by turning path-dependence off. If your strategy truly is path-dependent, keep reading…

Tactical asset allocation using quantstrat

As promised in the introduction to quantstrat, here is an example strategy. I thought I’d start with the obligatory tactical asset allocation (TAA) strategy. This post will replicate the strategy in the post, tactical asset allocation using blotter. The “faber” demo in the quanstrat package contains a TAA strategy but it uses a slightly different approach than the code we’re trying to replicate. There are two major differences: The blotter TAA code initiates a position at the first observation where the close is above the SMA.

Introduction to quantstrat

quantstrat provides a generic infrastructure to model and backtest signal-based quantitative strategies. It is a high-level abstraction layer (built on xts, FinancialInstrument, blotter, etc.) that allows you to build and test strategies in very few lines of code. quantstrat is still under heavy development but is being used every day on real portfolios. We encourage you to send contributions and test cases to the project forums. This post is a joint effort between me and Brian Peterson.