Why Local Fintech Engineers Use C++

Written by Janey Zitomer
Published on Sep. 10, 2020
Why Local Fintech Engineers Use C++
Brand Studio Logo

For the following developers, simplicity is key. That said, writing code that other engineers can easily expand upon can be a tricky task. At local fintech companies Hudson River Trading and Wolverine Trading, tech professionals leverage C++ so that they can access high-level language capabilities without unnecessarily complicating existing software processes. Like any language, however, there are some tradeoffs, and the following developers said they’re very aware that if they aren’t careful, the same bells and whistles that make the programming language so attractive can result in a compounded headache. 

“C++ will let you do pretty much anything you want, including making a complete mess of things,” Peter Levenberg, a developer, said. 

In order to manage complexity and prevent “messes,” Levenberg’s team is judicious when using advanced C++ features like template metaprogramming — a route he only recommends taking when no simpler solution will do. 

At Wolverine Trading, engineers employ C++ to manage traffic routing between the company’s trade server and their flagship trading client. Software Engineer Chris White said that when used correctly, the programming language matches performance and scalability needs the system component demands.

Programming in C++ doesn’t mean eliminating usability-based tradeoffs. Instead, it allows engineers to navigate feature implementation with scale in mind.  

 

Hudson River Trading
Hudson River Trading

Before engineers at Hudson River Trading could develop their Single Dealer Platform, they needed to know that they could rely on a language with stable performance and access to low-level system details. Core Developer Peter Levenberg said that’s where C++ came into play. As a result, HRT clients are able to trade directly with the fintech company instead of using an exchange.

 

First, tell us a bit about how your team uses C++ in its work. 

Here at HRT, speed of execution is often very important. So we use C++ quite a bit for processes on the hot path. That can include anything from parsing market data and analyzing market conditions to preparing orders. 

C++ also gives our team a high degree of control over low-level system details without sacrificing access to high-level language capabilities. HRT believes in giving our developers the best tools they can for the job. So we keep current with the latest compilers and C++ features. For example, performance was critical when we developed our SDP, which allows other firms to trade directly with HRT instead of going through an exchange. After deploying the system largely implemented with C++, we solicited feedback from some of our trading partners. They said that it was one of the fastest SDPs they had interacted with.

 

What’s the most important best practice you follow when programming in C++?

One of HRT’s best practices is to strive to make our code as simple as possible. C++ will let you do pretty much anything you want, including making a complete mess of things. Therefore, it is important to be willing to spend time considering whether your first instinct is really the best one for the line of code. Complexity is not always necessary. But when it is, we use advanced C++ features like template metaprogramming judiciously. 

In addition, simpler code tends to be more reliable, which helps prevent mistakes — or worse, expensive downtime. Remember: when you write code, it’s not just to tell the computer what to do. It also serves to tell anyone who reads it in the future (including yourself) what it was supposed to do. If you’ve written sloppy or chaotic code, it’s much harder for anyone reading it to find bugs, extend it or simply understand what it does. Resist the urge to just bang out code and move on. It’s always a good idea to invest more time simplifying your code and making it easier for people to work with.

Resist the urge to just bang out code and move on.’’ 

What’s the biggest challenge you face when programming in C++ and how do you overcome that?

HRTers believe that one of the biggest challenges of using C++ is managing the complexity that arises as a system grows and evolves over time. We try to manage that problem through a variety of methods. At the lowest level, it is important to try and keep code contained in small, easy-to-test and understandable pieces. Anything that must be unusually complicated or esoteric, such as some hairy performance-critical code or code that interacts with a hard-to-use external API, is also well-contained. We try and maintain consistency by reusing components where it makes sense to do so. 

And at the highest level, we try and keep the system design itself as clean as it can be. Doing these things requires time and effort. And HRT understands that we need to allow developers the freedom to make things better. Finally, HRT is a collaborative environment. Discussing code reviews and system designs helps us all produce better code and become better developers.

 

Wolverine Trading
Wolverine Trading

At Wolverine Trading, engineers encapsulate lifetime management using the “Resource Acquisition Is Initialization (RAII)” idiom. By prioritizing resource acquisition over initialization, Software Engineer Chris White said the fintech company’s large code base is much less prone to hard-to-diagnose resource leaks. 

 

First, tell us a bit about how your team uses C++ in its work. 

Wolverine Execution Services (WEX), a subsidiary of Wolverine Trading, uses C++ for all back-end applications involved in the routing of customer trades and the delivery of real-time market data. Performance is paramount in those areas of our business and C++ provides the ability to fine-tune our software accordingly. 

Our trade server acts as a central hub where customers connect to us via our flagship trading client: the WEX Trading Platform (WTP). Various back-end C++ applications provide services to customers through that hub, such as those implementing messaging protocols to communicate with stock exchanges and other trading venues. 

The trade server’s primary responsibility is to manage time-sensitive traffic routing back and forth between those connected parties. Each traffic stream is validated in real time, recorded into persistent archives, and processed in parallel to the others. Given the performance and scalability needs of this system component, it’s a great example of an area where we employ C++ to its fullest.

We tightly scope object lifetimes and resource utilization.’’ 

What’s the most important best practice you follow when programming in C++?

We tightly scope object lifetimes and resource utilization. It’s often best to acquire resources as late as possible and release them as soon as possible. Furthermore, using the RAII idiom to encapsulate resource management can simultaneously make code safer. Following these practices translates to efficient and leak-free software. 

In our central trade server, tightly scoping the locking and unlocking of mutual exclusion object programs (mutexes) is critical for servicing customer traffic concurrently across many threads with minimal contention. By encapsulating lifetime management via RAII, our large code base is much less prone to hard-to-diagnose resource leaks stemming from early returns, exceptions and easily-overlooked mistakes. 

Many standard C++ objects, such as scoped locks and smart pointers, are predicated on these principles. So we often refer to those familiar paradigms when designing our own tools. Modern C++ features, such as lambdas and move semantics, complement these practices — making it easier than ever for us to tightly manage object lifetimes without sacrificing code readability.

 

With the release of C++20, what new features are you most excited about?

With the release of C++20, I’m most excited for the Range and Calendar libraries, and beyond C++20, the Networking/Executors framework. Range extensions go a long way toward making code more readable and easier to write without mistakes. Iteration logic that developers are writing day in and day out will be better encapsulated. The calendar library will fill a long standing gap in the standard tools, making date-time constructs more readily accessible. Calendar logic is used in many facets of our industry, such as in tracking trade history and managing contract expiration dates. 

Further in the future, the standardized Networking/Executors framework will replace many low-level constructs that we’ve either had to write ourselves or rely on from third-party libraries. The standard is great at elevating existing implementations to be both cleaner and more efficient, so we look forward to integrating these new features as they become available.

Responses have been edited for length and clarity. Images via listed companies.

Hiring Now
Braze
Marketing Tech • Mobile • Software