QuantRocket Blog

Is it better to run your quant trading in the cloud or locally? In this article, I outline the pros and cons of each approach and explain why running locally is often better for research while running in the cloud is better for live trading.

Don't assume the cloud is better

It's common to imagine that every serious workload should run in the cloud. We associate the cloud with modern, forward-looking companies and products. However, quants should analyze their use case and not make assumptions. Many commonly cited benefits of the cloud apply more to medium and large companies than to quant researchers working alone or in small teams. Articles touting the benefits of the cloud usually position the cloud as an alternative to an in-house data center. But for most quant researchers, the more applicable contrast is between the cloud and a local workstation.

The cloud is more expensive and less powerful than your local workstation

Companies often move to the cloud to save money, as they can rent compute resources for cheaper than they can pay in-house IT staff to manage an on-premise data center. But for a quant, the cloud is usually the more expensive option. Most quants already own a powerful workstation or laptop which is well-suited for quantitative research. The cloud introduces an additional expense.

Even if your workstation needs upgrading, buying a new workstation is usually a better deal than renting the equivalent machine in the cloud. A powerful workstation costs a few thousand dollars, while renting a comparably powerful cloud instance costs a few hundred dollars a month. This means that renting will become more expensive than buying within less than a year. And you can use the purchased workstation for multiple purposes, not just quant research.

If you run in the cloud, the high cost may lead you to skimp on resources and choose a less powerful machine than your local workstation, which will lessen the cost differential but slow down your research. Choosing a machine with ample CPU and memory is one of the most important things you can do to ensure a productive and enjoyable research experience.

One scenario where the cloud is cheaper than running locally is when you need specialized compute resources for a temporary workload, like training a machine learning model that requires more GPU than your local workstation offers. In this case, the temporary nature of the workload makes renting cheaper than buying.

The cloud provides an isolated environment, but so can Docker

Historically, an advantage of the cloud over a local workstation was that it provides an isolated environment that you can customize with the exact packages you need for your research. If you mess up the environment, you can destroy the cloud instance and start over with a fresh instance. In contrast, since you use your local workstation for multiple purposes, you can't as easily or safely wipe out your environment and start over.

This advantage of the cloud is less relevant today because of Docker. With Docker, you can create a custom environment for your research that runs on your local workstation yet is isolated from the rest of your operating system. You can destroy the environment and start over just as you would with a cloud instance. In fact, Docker is more flexible than the cloud alone because Docker allows you to deploy the same application to the cloud or to your local workstation without any changes to the application. This makes it easy to migrate back and forth between your workstation and the cloud or to deploy to both environments. Docker is the technology QuantRocket uses to support both local and cloud deployments.

The cloud is more reliable than your home office

Cloud providers have redundant power supplies and internet connections, as well as teams of engineers on call to fix problems. This is an area where the cloud handily beats a local workstation running in your home office. Unless you have a long-running generator and a backup internet connection, running locally makes you more vulnerable to outages than running in the cloud.

However, the superior uptime of the cloud is only relevant to live trading and other unattended processes. It doesn't help with research or anything interactive: a local outage that takes down your workstation will also take down your ability to access the cloud, disrupting your activity either way.

Can you use a local machine for live trading?

Using a local workstation for live trading is possible if your trading strategy trades infrequently enough that you can recover from temporary outages. For example, a strategy that trades once a day after the close can recover from a temporary outage because you can simply re-run the trades when power is restored. In contrast, outages are more disruptive for a strategy that trades every minute as they will cause you to miss time-sensitive opportunities.

Use a different machine for research and live trading

Whether you run locally or in the cloud, use a dedicated machine for live trading, not the same machine you use for research or other purposes. Your own research activities, if performed on the same computer as your live trading, are much more likely to crash your live trading than an occasional power outage or lost internet connection. Every time you load a large dataset into memory or run a CPU-intensive analysis, you will jeopardize the ability of your live trading to run smoothly.

Conclusion

Quants deciding where to run their infrastructure should weigh the cost and performance benefits of running locally against the reliability benefits of running in the cloud. A basic rule of thumb is to run your research locally and run your live trading in the cloud.

About QuantRocket

QuantRocket is a Python-based platform for researching, backtesting, and trading quantitative strategies. It provides a JupyterLab environment, offers a suite of data integrations, and supports multiple backtesters: Zipline, the open-source backtester that originally powered Quantopian; Alphalens, an alpha factor analysis library; Moonshot, a vectorized backtester based on pandas; and MoonshotML, a walk-forward machine learning backtester. Built on Docker, QuantRocket can be deployed locally or to the cloud and has an open architecture that is flexible and extensible.

Learn more or install QuantRocket now to get started.

QuantRocket LLC is not a financial advisor and nothing on this website or in any materials created by QuantRocket LLC should be construed as investment advice. All results are hypothetical unless otherwise noted. Past performance is not indicative of future results.

The material on this website and any other materials created by QuantRocket LLC is provided for informational purposes only and does not constitute an offer to sell, a solicitation to buy, or a recommendation or endorsement for any security or strategy, nor does it constitute an offer to provide investment advisory services by QuantRocket LLC.

In addition, the material offers no opinion with respect to the suitability of any security or specific investment. No information contained herein should be regarded as a suggestion to engage in or refrain from any investment-related course of action. Neither QuantRocket LLC nor any of its affiliates is undertaking to provide investment advice, act as an adviser to any plan or entity subject to the Employee Retirement Income Security Act of 1974, as amended, individual retirement account or individual retirement annuity, or give advice in a fiduciary capacity with respect to the materials presented herein. If you are an individual retirement or other investor, contact your financial advisor or other fiduciary unrelated to QuantRocket LLC about whether any given investment idea, strategy, product or service described herein may be appropriate for your circumstances. All investments involve risk, including loss of principal. QuantRocket LLC makes no guarantees as to the accuracy or completeness of the views expressed in the website. The views are subject to change, and may have become unreliable for various reasons, including changes in market conditions or economic circumstances. Past performance is not indicative of future results.