Quantitatively Intuitive Views on Markets

Backtesting – Tool Review

2017-02-20

Backtesting – the pillar of trading and investing. I know what all the naysayers say, but with all due respect, they got this one wrong. 🙂 In finance, and in time series in general, history repeats itself. Natural phenomena follow patterns, so does crowd behavior. Earth temperatures are not going to rise forever, so wouldn’t the current bull market. Enough rambling though.

My readers know that my main tool for backtesting has been Tradelib, a Java library which I have developed and used over the past couple of years. Working on some new (or rather old) project, I decided to take another look what’s around, and the results surprised me.
Being a lazy developer, and a comfortable open-source user, I did spend time reviewing other tools before I embarked on the Tradelib project. In fact, I documented some of this in an older post. Albeit the discussion there is from a slightly different angle (languages), I pretty much covered the frameworks I considered as alternatives. None of them cleared the bar, so Tradelib was born.

Two years later, I find myself in a similar situation. I am going back to portfolio re-balancing – something similar to the old Max-Sharpe posts. I could have just re-resurrected the code I used back then, but I decided it’s time for some due diligence. Naturally, I decided to take another look on what’s out there. My expectations were that I would end up extending Tradelig yet again. Boy, I was wrong.

Both Quantopian and QuantConnect have gone a long way. In other words, if I was in the same boat today, as I was two years ago I wouldn’t have started Tradelib. Period. I would have used either one.

Which one? I think it’s up to you, the user. Here are my quick notes:

QuantConnect is primarily C#, thus, it’s likely faster. You can use it directly on the web-site, or, you can download the standalone Lean engine. Load the project in Visual Studio and you are rolling. QuantConnect also supports not only stocks but also Forex, Futures and Options. Amazing.

Quantopian is Python. It’s slower, but to be fair, the performance differences are mostly visible when running the standalone library (Quantopian’s zipline library). Furthermore, Quantopian supports only stocks today. Looks like Futures and Options are coming soon, but nothing out yet.

To me it’s a toss between the two. The bottom line is that there is no need to develop event-driven back-testing frameworks from scratch – join one of these two and reap the benefits of open source collaboration.

To back my words, here is the Quantopian version of a very simple SPY/TLT/Cash re-balancing strategy which I used for this study. To see the source code select the Source Code tab. Neat, right?