Backtesting in the clouds
Thomas Schmelzer
Portfolio construction and technology @ ADIA | Commodities and LS Equities | Visiting Scholar at Stanford.
Imagine a scenario where you want to facilitate backtesting for multiple strategies, written by various developers, some of whom may use different programming languages or environments. This presents a few challenges, primarily around maintaining consistency, version control, and the ease of use of the backtest process for everyone involved. Let's break down concerns and potential solutions:
We follow and API-first design and different languages will communicate with the backtest engine using a gRPC messaging protocol. The tool we are going to introduce is going to make it easy and fast to create such APIs. The central backend could be written in Python and clients (in Python, R, Java, etc.) communicate with it by sending input data and receiving results.
The management of versions has been simplified a great deal with dependabot and renovate but both ideas still require a level of discipline and computational hygiene that is often not met in practice. Needless to say that your backtesting engine may come with various other dependencies that are a potential source for conflict.
Our central backend operates on a server within a container. It’s completely isolated from the code of your strategy. If you still refuse containers let me remind you that it is 2025 :-)
The backtest service would come with an integrated logging and versioning system. Every time a backtest is initiated, one can log all relevant metadata (time, version, who). The data is stored in a centralized database, which can be queried or visualized. A simple interface (maybe a dashboard) could be created for users to track and analyze backtest histories, metrics, and changes. This could help to support backtest counting following an idea by Marcos Lopez de Prado .
To create a basic server for your own experiments I have created numpy-flight:
To support the rapid creation of such servers I have also created a [qcradle](https://pypi.org/project/qCradle/) template, e.g.
uvx qcradle https://github.com/tschm/server
There follow the instructions to create a server which comes complete with required dependencies, a Dockerfile, some tests and basic documentation. Once you have the server in a container it’s trivial to fire it up with any of the established cloud providers.
Conclusion
The idea of using centralized services is not new but it is of elevated relevance in situations where results need to be reproduced, metadata has to be logged and several languages have to be supported.
The approach sketched here addresses the core challenges of backtesting in a multi-language environment:
SpeedBot | Expert Quant | Algorithmic Trading | HFT | Risk Management
20 小时前Backtesting on the cloud is a game-changer! The scalability and speed of cloud-based infrastructure allow for running multiple strategies in parallel, reducing time-to-market for trading models. Plus, with GPU/TPU acceleration, complex simulations become more efficient. Curious to know—how do you handle data latency and API limits when scaling backtests?
CEO/Founder at QuantConnect | Democratizing quant trading | Disrupting algorithmic trading with OS innovation
2 天前This sounds a lot like the LEAN Engine container. And the cloud hosted variant is QuantConnect which has the data required.
MD, MSc(Financial Engineering), EMBA Managing Partner at Enthusia Consulting Ventures | CEO at Medanchor Limited
2 天前Interesting
Founding partner - Libra Investment Services
3 天前Replication issues could certainly be improved via such a process too.
We did this 20 years ago with AlphaEngine(R) (Mcube Investment Technologies - www.mcubeit.com) and Khaled Balama liked it (based on sage advice he received from the late Kirit Patel), but some of your colleagues were not happy and killed it after he left...LOL. Quite ironic that you bring this up 20 years later...