Rfactory Labs: Market data

Members · 06

Market data

The last of the setup pieces, and the one we kept putting off, because market data is the awkward part of this business. Where it comes from, the three places it can live, the four checks that decide whether a dataset can be trusted, and what it actually costs.

Why data is the awkward part

A backtest is only as good as the history it runs on, and history is easy to get wrong in ways that flatter you. The most common trap: a dataset that only contains the stocks that still exist today. Test any strategy on that and it looks brilliant, because every company that went bust has been quietly removed. Getting data that avoids this, and keeps it correct as companies split, pay dividends and change names, is expensive and fiddly. That is the real reason we rent it from QuantConnect rather than build it.

The three places data comes from

QUANTCONNECT CLOUD DATA US stocks and futures, decades deep DOWNLOADED FROM QUANTCONNECT the same data, copied to your machine EXCHANGE-DIRECT DOWNLOADS crypto and FX, from the venues' own feeds CLOUD BACKTEST NODE runs next to the data LOCAL BACKTEST Docker, on your machine included in the service yearly licence plus credits per file free or cheap every dataset, wherever it lives, must pass four checks: survivorship-safe · adjusted for splits and dividends · point-in-time · the right resolution
Three sources, two places to run. Cloud data stays in the cloud and feeds the cloud node; anything on your own machine feeds local backtests, whether it was bought from QuantConnect or pulled straight from an exchange.

The first source is QuantConnect's own cloud data: US stocks and futures going back decades, with the dead companies still in it and the corporate actions handled. You never see the files; the cloud backtest node reads them directly, and that is part of what the seat and the node pay for. The second source is the same data downloaded to your own computer, which QuantConnect sells by the file, paid for in their credits, on top of a yearly licence for the reference data behind it. The third is data you fetch yourself from the exchanges and data services that publish it, which is how we get crypto and FX history, since those venues make it available for free or nearly so. Where the data lives decides where the backtest runs.

The four checks

Whatever the source, we ask four questions before a dataset is allowed near a backtest. Is it survivorship-safe, meaning the companies and contracts that disappeared are still in it? Is it adjusted for splits and dividends, so a stock that split two for one does not look like it halved overnight? Is it point-in-time, meaning the data shows what was known on each day rather than what was corrected later? And is it the right resolution, daily bars for a monthly rotation, minute bars for an intraday breakout, and never the other way round? A dataset that fails any of these will produce a beautiful backtest and a painful live account.

What it costs, and the rule we follow

Cloud backtests cost nothing extra for data; it is included. Downloading to your own machine is a different story, and it has two layers that caught us out. The first is an up-front licence. To backtest US stocks or US futures on your own machine you need the reference data behind the prices, the record of splits, dividends, delistings and contract rolls, and QuantConnect licenses that per asset class at around $600 a year each. The second layer is the data itself, sold by the file in their credits. Daily data is one file per symbol and cheap. Minute data is one file per symbol per trading day, so a few years of a few symbols runs into thousands of files and the bill balloons.

That arithmetic changed our plan. We had expected to run most backtests locally and use the cloud for the heavy lifting. Once we saw that the same reference data and the same minute history are included free on a cloud backtest node, we did the opposite: we skipped the licences entirely, moved every US stock and futures backtest to the cloud, and kept local backtesting for the data we fetch ourselves. Crypto turned out to be cloud-only in QuantConnect's catalogue, not available for download at any price, which settled it: for crypto and FX we go straight to the exchanges, where the history is free, and keep those files locally.

The rule that survives all of this: nothing downloads without a human seeing the price first. Our runner works out what a download will cost in credits and stops to ask before spending anything. That is cheap insurance against an AI that is being helpful at your expense.

That completes the setup pieces. Next in the main series: the Market Compass, how a computer reads market weather.