Best Operating System For Quant Trading?

Best Operating System For Quant Trading?

One question that I am asked frequently is which operating system to use for quantitative trading research and implementation.

The short answer, as of the writing date of this article, is if you want to carry out any serious/mathematical quant trading research (machine learning/deep learning) you should make use of Ubuntu 16.04 LTS Linux, with a desktop version on a local research machine and the server version on a live trading VPS or equivalent. It is the most straightforward way to avoid problems with the bleeding-edge libraries that are required to carry out this form of research.

However, Ubuntu/Linux is likely to be unfamiliar to many of you since Windows is still the de facto choice of operating system both at home and in the modern office environment.

Given that your likely goal is to spend as much time as possible researching and developing quantitative trading strategies, rather than reading through stacks of programming books, is it worth your while to learn a brand new operating system and associated command line interface (CLI)?

Clearly this will depend upon your circumstances, preferred method of trading research, coding language of choice and complexity of your models. I would like to argue that for the majority of more complex Python-oriented scientific/quantitative research that learning Ubuntu/Linux and the CLI will pay immense dividends over your quant career.

Let's now take a look at the three major operating systems that are likely to be used within quant trading research.

Microsoft Windows

I am going to assume for the purposes of this article that nearly all, if not all, readers are completely familiar with Windows so I don't feel I need to explain what it is here, unlike the other two operating systems considered below!

Why Is It Advantageous For Quant Trading?

Windows is generally easily available (most new computers come with it as the default operating system) and much of the retail quant trading GUI-based software has been written solely for Windows. This alone makes it an extremely strong contender for much of quant trading.

While in the past Windows had a reputation for crashing intermittently (e.g. the famous Blue Screen Of Death) these days, with newer versions of Windows having been built on the old Windows NT kernel, it is often extremely reliable.

Further it is straightforward to transfer a GUI-based quant trading system from Windows Desktop to Windows Server, through a cloud-based service such as Microsoft Azure or Amazon Web Services.

All of the major relational databases are supported on Windows, including MySQL, PostgreSQL as well as Microsoft's own strong database contender, SQL Server. There are intuitive GUI interfaces to these databases provided by all of the vendors.

What Are Its Pitfalls?

Windows' main disadvantage, at least for "power" use lies in the fact that it relies almost exclusively on the GUI. This is an ideal situation for nearly all desktop usage but for quant trading at the advanced level it can be a distinct disadvantage. Higher-frequency quant models rely quite heavily on automation and task scheduling, where the CLI and tools like Unix cron are extremely effective. This makes Windows significantly less attractive as the frequency and level of desired automation of a strategy increases.

It also still has some difficulty in "playing nicely" with Python. While the Anaconda distribution largely solves this problem, there are still libraries where it is necessary to compile C/C++ code from scratch that often assumes the presence of a C++ compiler, such as GCC. This usually means installing a tool like Cygwin. However, once you get to this stage I feel it is worth just "starting over" and installing Ubuntu, rather than trying to replicate Linux within Windows.

A minor point these days is that Windows is also rather resource-hungry and so if absolute execution speed is required, Windows can be a little slower than an equivalent Linux system (particularly when it comes to server editions).

Apple Mac OS X

Mac OS X is the operating system found on Apple's line-up of Macs. It is actually a heavily modified version of a Unix distribution known as BSD. This means that it actually has a "best of both worlds" approach to both a GUI and CLI.

It provides an extremely intuitive gesture-based GUI but is also extremely popular with software developers as it has Linux-like capabilities built in.

I have personally used a MacBook Air for a number of years for Python development although I have since gravitated more towards Ubuntu Desktop for the majority of my Python 3 quant trading development.

Why Is It Advantageous For Quant Trading?

Its advantage lies primarily in the fact that it has both a comfortable GUI and powerful CLI, similar to Ubuntu. Hence it is easy to setup a Python quant research environment, using either a direct virtual environment approach or with a precompiled toolkit such as Anaconda.

The CLI brings in all the power of scripting and automation that is present in Linux systems, but the operating system allows easy compatibility with known ecosystems such as Microsoft Office. For certain users this can be a "dealbreaker" requirement.

Mac systems also have a reputation for being extremely reliable and stable. To provide a personal anecdote, I once went 251 days without a proper reboot of my MacBook Air. It is currently sitting at 91 days of uptime as I write this article!

What Are Its Pitfalls?

Perhaps the major disadvantage of Mac OS X is that due to Apple's consumer-facing business model there is no equivalent server environment that a quant trading model can be easily deployed to. Instead a model will need to be ported to a Linux server distribution (such as Ubuntu Server).

This is a non-trivial problem as differences in packages and deployment approaches can lead to catastrophic production errors that can take a strategy/portfolio offline. I have personally seen this happen in a rapidly-moving production environment.

Hence the common workaround is to utilise virtual machines (or a tool such as Docker) to develop on a nearly identical setup, locally. However this then motivates the question as to why a Mac is being used in the first place, rather than a local machine that uses Linux!

Indeed, for a particular absolute dollar amount a Mac laptop/desktop is usually less powerful than an equivalent machine by another manufacturer, e.g. Lenovo. Hence you are paying more for the Apple "brand" than raw computational power.

It is also likely that for the specific use case of DL-based work on GPUs, a Mac can be troublesome to try and configure. It is often much simpler to build a desktop machine from scratch and put Ubuntu on it for this purpose.

Ubuntu/Linux

Microsoft Windows has a philosophy of vertical integration of all components, rapid ease-of-use, graphical interface and abstracting away complexity for the user. For nearly all day-to-day use cases this is the perfect approach and is largely why Windows, and Microsoft, has seen so much historical success.

The Linux ecosystem is structured rather differently. Its philosophy is based around a hierarchical interaction of many different components, open and freely available code, a mixture of graphical and command line interfaces, as well as the ability to allow the user to perform powerful, complex operations with scripts.

In addition there are multiple distributions of Linux that all mix and match components differently. This can be extremely confusing for newcomers who are largely used to a "one size fits all" approach either with Windows or Mac OS X.

Thankfully, the "market" has consolidated somewhat around a popular distribution known as Ubuntu. Ubuntu was originally built on top of another powerful Linux distribution known as Debian, but has since taken a different direction.

In addition to this, over a number of years, Ubuntu has become easier to install and try out. It has evolved to provide an almost "out of the box" solution for basic word processing, spreadsheet and general "office" tasks. This makes it easier to transition from Windows or Mac for normal desktop use.

Why Is It Advantageous For Quant Trading?

The primary advantage of Ubuntu/Linux lies in its CLI capability. Having an extremely powerful CLI and scripting engine allows sophisticated automation of processes including data management, backtest engine development, broker interactivity and general research ability.

It is also the "only game in town" if you wish to operate at the bleeding edge of quantitative finance modelling with advanced ML/DL libraries. For DL in particular, nearly the entire research ecosystem is carried out in Python using TensorFlow and PyTorch, both of which have non-trivial installation requirements. In fact, anecdotally, these libraries are very difficult to get working with GPUs on Windows and so Ubuntu is the only realistic choice.

Using Linux makes it extremely straightforward to provide a sophisticated software development overlay to a quant trading model deployment process. All the power of version control and continuous integration is easily available within a Linux/CLI environment.

It's no accident that the majority of the top quant hedge funds almost exclusively use Linux and custom-developed environments for both research and development.

For those who wish to get into heavily quantitative or ML/DL based trading research I would highly recommend usage of Ubuntu Linux as your operating system.

What Are The Pitfalls?

The biggest problem in using Ubuntu/Linux is that most of the power comes through extensive use of both the command line interface and scripting. These are skills that can be learnt relatively quickly, but true mastery can take years. Linux very much has a "tinker under the hood" philosophy and this can be highly interesting, or extremely tiresome, depending upon your goals.

In addition to this Linux is not very forgiving when it comes to errors. The nature of ML/DL quant trading research relies on some bleeding edge libraries, such as TensorFlow/PyTorch that interact with GPUs. Hence installation of drivers, libraries and other tools can lead to problems.

Such problems are tricky to diagnose for a newcomer as the error messages can be relatively undecipherable. This can be extremely frustrating for those who are used to Windows and Mac "just working".

Linux has a much more explicit approach to user/admin permissions and this often stumps newcomers used to administrative privileges being largely abstracted away on Windows/Mac OS X. Another source of confusion lies in dependency management where certain packages (particularly Python libraries) can rely on necessary system packages being installed and correctly configured. Obscure error messages can arise that require a degree of experience to diagnose.

However, this could also be seen as the "price" for operating at the bleeding edge in order to make sophisticated models. Despite these issues there is an extremely welcoming community ready to help out new users and most errors have been seen (and diagnosed) before.

In Summary

Windows and Mac OS X are great for most "vanilla" GUI-based quant trading research. However, they are largely inappropriate for DL/ML research at the bleeding edge.

Ubuntu/Linux is the only realistic approach for the heavy quantitative DL/ML work, and is extremely powerful once expertise of the CLI has been obtained. However, it is not forgiving with regards errors due to permissions or dependency problems. In addition, the mixed-component philosophy can seem confusing to those used to one-size-fits-all operating systems.