September 20, 2017 · Blog Posts
Pay Attention To What’s Under The Hood In Your Trading Application: Nothing Compares to C++ for Trading
Everyone knows that what you can’t see can hurt you and this is especially true for professional traders. In a world where competition is fierce and efficiency is constantly being pushed further and further, it’s critical to pay attention to each and every technical aspect of your trading. And just as it matters to know the specifications of your hardware and the details of your network connectivity, it’s also critically important to get down to the basic level of what language is used to develop the critical elements of your trading system. No other language can match C++ when it comes to efficient trading systems.
What is C++?
As programming languages go, C++ is no spring chicken but it has been continually updated. It was first developed beginning in 1979 as an extension of the C language by Bjarne Stroutsrup of Bell Labs with an eye to improving performance, efficiency and flexibility. C++ is ISO certified with the latest version, C++17, in the process of being implemented. C++ has found wide adoption in performance critical applications like telephone switches, space probes, and, in this case, trading applications. Stroutsrtup’s three central tenets remain the source of its success: performance, efficiency, and flexibility.
- Performance: C++ is a compiled language while others such as Java and Python are interpreted. Put another way, C++ is a direct language while others require intermediate steps. The impact on performance is obvious: an instruction or action that can be delivered directly is going to have higher performance than one that needs to be translated. Consider the analogy of delivering a note or letter to someone: is it better to give it to Steve who gives it to Bill who hands it to Jenny who delivers it to Joe or is it better to give it directly to Joe yourself? C++ is closest to the critical path of the calls for the operating system (OS) and, therefore, much more likely to produce higher performance.
- Efficiency: Because C++ has better performance, it also can be more efficient both in operation and to work with. In terms of operation, the fact that C++ is closer to the OS means that it can perform at a higher level in the face of large data volume or in carrying out more complicated instructions. The directness of C++ means that it can perform better in a high stress situation such as trading. And when it comes to working with C++, it can be more efficient because it can be used universally in every aspect of trading software that requires high performance standards. Additional benefit is gained when the critical elements of software, from the execution engine all the way up to the GUI (screen) are well integrated and full development of these elements in C++ brings that benefit.
- Flexibility: At first glance, C++ can appear to be less flexible than other languages such as Java or Python. The perception is that Java and Python are easier to use and are therefore likely to yield results more quickly. This view of flexibility is limited, however, and fails to account for the fact that C++ delivers more flexibility by letting you choose exactly the right kind of tools for a particular task. For example, when working with low level memory operations C++ lets you decide how to have memory allocated, and very nearly where in RAM you need it, using an operator called “new”. This level of flexibility is essential if you are writing a low-latency class where you need absolute control of every byte that needs to be allocated and the location of this new byte from a contiguousness standpoint. In the end, a view that Java or Python are more flexible is short-sighted when it comes to the high demands of professional trading: the short-term gain of ease of use will likely be offset in the long-term by the greater level of detail and control that is achievable with C++.
What It Means For You
There is a great deal of debate about the relative merits of different programming languages and, quite frankly, there are good reasons to use languages such as Python and Java in certain situations. In the case of Python, for example, use cases such as number crunching that requires more complex, multi-threaded calculations can be handled more efficiently than in other languages while Java has the benefit of being relatively simple and portable because of its platform independence. But neither of these can match the performance, efficiency, and flexibility of C++.
C++ is often disparaged because it can take more time and effort up front. However, the extra effort pays off in the long run as the directness and lack of compromise and work-arounds that come with C++ code lead to greater efficiency and flexibility in the long run.
Simply put, when it comes to trading applications, C++ is the right tool for the job.
The view from Rival
At Rival, the critical components that are directly involved with trading have been built in C++ by experienced and seasoned developers, and this makes us an ideal partner for you. As we said in our “Build vs. Buy” blog post, we offer a full suite of best in breed technology products and services that are explicitly developed with professional traders in mind. This not only includes features such as an auto-quoter and an electronic eye in Rival Trader but also a C++ API for those who require the ability to develop and deploy your own trading tools. Importantly, all of Rival’s trade facing applications have been written in C++ so they are integrated in an optimal way. It’s like a race car: every piece is developed using the highest standards and can therefore deliver at the highest level of performance. At the end of the day, traders who want the most efficient trading should choose Rival.