Feature: Splicing Data Source

Historical quotes are at the center of any backtest. Unfortunately, the range of available quotes is often not sufficient to thoroughly test a strategy. Many instruments can be simulated before inception, by using proxy data. Our latest TuringTrader feature allows splicing data sources to extend the available data and simulation range.

The Problem

Let’s assume we are developing a strategy targeting Vanguard’s S&P 500 ETF (VOO). This ETF launched in September 2010, so our backtest will not even span a full economic cycle, including the 2008 recession. We probably want to address that, and run simulations reaching further back.

Luckily, we can find multiple suitable proxies for VOO, including the following:

There are multiple possibilities of how we can use these proxies. The most straightforward approach is to substitute VOO with one of these proxies. While this is a simple solution, we have now replaced our target ETF with one that has a different absolute price, and possibly shows subtle differences in behavior. Most importantly, these subtle differences are not limited to the past but also affect the current behavior of our strategy.

To overcome this issue, we need to splice our data for VOO with those from the proxy. Unfortunately, this is easier said than done. We need to scale the proxy and make sure that the transition between the target and its proxy is smooth. However, this scaling factor is not static: whenever the S&P 500 pays a dividend, the quotes need to be back-adjusted, requiring an adjustment to the scaling factor. Therefore, a practical solution must be automated and run whenever we load new data.

spilled glue on bottle *)

The Solution

TuringTrader’s new Splicing Data Source addresses this problem elegantly. Our original code might have instantiated the data source for VOO like this:


All we need to do to splice VOO together with a proxy is this:


TuringTrader will now use VOO, for as long as it can. Before 2010, it will switch to SPY. Further, before 1993, it will use $SPXTR, the S&P 500 Total Return Index. No need for any code changes to the strategy!

Instead of specifying the splicing operation in the nickname, we can achieve the same using the Data Source Descriptor. All we have to do is to create a new descriptor file, let’s call it VOO++.inf, and add the following content:


We can then use this data source in our strategy like this:


This feature was born from an urgent need that we had for our strategy development. We hope it makes TuringTrader also more useful for you and allows you to test your strategies more thoroughly, and over longer periods.

Happy coding!

*) Photo by Scott Sanker on Unsplash