In 1969 Instinet became the first electronic communication network (ECN) for trading financial products beyond the stock market floor. In the 1970s, computerized order flow dawned, while the 1980s saw the introduction of Michael Bloomberg’s eponymous terminal. By the late 1990s, programmer Joshua Levine created a small-order matching system called Island ECN. Island, written in FoxPro for MS-DOS version 2.6, had a nifty trick for enhancing speed.
In 2002, Instinet bought Island and a year later, it ported the code to Java. On his blog, Levine noted:
“While the Java version is some very nice code and ran several orders of magnitude faster—this code is particularly interesting precisely because it ran on such a slow platform and is so easy to read, highlighting the idea that it is usually the architecture and algorithms that matter more than raw platform speed.”
In the 2000s- Java was revolutionizing programming, thanks to its ease of use, security, portability, dynamic class loading, runtime thread creation, and more. The high-frequency trading (HFT) race was roaring, while Java-based tools such as thinkorswim were making algorithmic trading accessible to everyone. Goldman Sachs began building a Java collections framework called Caramel, which was open-sourced in 2012 and later renamed Eclipse Collections.
The language’s popularity created a virtuous cycle for financial companies. In fact, Peter Lawrey, a Java Champion and CEO of London-based Chronicle Software commented:
“Developers of Core Java are widely available in London and other financial centres, allowing HFT firms to pick the best staff for their needs.”
Written in Java in 2010, the Chicago Climate Exchange was designed for trading carbon dioxide offsets. During this time another revolution was brewing: the open-source software movement. Almost as soon as Java came on the trading scene, both the language and the runtime environment began changing to meet the finance industry’s unique demands. The first biggie was real-time performance. Simon Roberts, a former Java instructor commented:
“Real-time, strictly, refers to a guaranteed worst-case response. Most applications specify performance requirements in general statistical terms such as ‘90% of requests should be completed in under two seconds. A real-time requirement might not mandate ‘fast’ in the usual sense (though it often does). What matters is that absolutely no request takes longer to complete than some specified maximum.”
However, Java’s original garbage collector wasn’t optimized for real-time operations, and it was prone to halting all processing while it cleaned up unused memory. Indeed, the following two new Java 16 features released in March 2021 make Java even faster via memory management:
- JEP 376: ZGC with concurrent thread-stack processing moves ZGC thread-stack processing from savepoints to a concurrent phase, eliminating the last significant bottleneck for concurrent stack processing.
- JEP 387: Elastic metaspace frees up the HotSpot JVM’s memory faster and simplifies metaspace code for easier maintenance.
The Truffle language implementation framework is an open-source library for building tools and programming languages implementations as interpreters for self-modifying abstract syntax trees.
During the proof-of-concept, Goldman Sachs discovered that GraalVM was able to provide a base for Slang, and they could switch between Slang and C++: “If that is all running on GraalVM, then you do get an integrated environment where you can profile and debug across those boundaries. That’s just a huge efficiency that was very cool,” Haynes adds.
Thanks to simpler syntax and a plethora of data science libraries, languages such as Python and R have exploded in finance. Asked whether he’ll switch to other languages and libraries for blockchain or machine learning, Chronicle Software’s Lawrey remains true to Java. Java boasts a vast ecosystem of runtime options, profilers, debuggers, development environments, and dependency management tools. There’s also a large talent pool.
But what if you’re looking for a Java developer job in the finance industry?
Using Citadel Securities as an example, the company’s openings ask for expertise in Java SE and Jakarta EE; software patterns and enterprise architecture; and experience with Spring, Hibernate, the FIX protocol, Maven, Git, Jenkins, Nexus, relational databases, and big data. For any high-frequency trading application, you want to show that you can write memory-efficient code, advises Lawrey.
“Value-based classes improve memory footprint and thus the efficiency of CPU caches. While most modern computers have gigabytes or even terabytes of memory, they still have only 256 KB of level 2 cache local to each core, so if you want each core to run as fast as possible, you want to avoid going off your L2 cache—making memory still a precious resource.”
What’s next for Java in finance?
Considering the very recent history of modern popular finance, commission-free trading smartphone apps such as Robinhood aren’t that surprising. After all, the world’s stock markets may date back to the 1400s, but computerized finance is brand new. Seven-day trading; cryptocurrency expansion, as it becomes the new forex; green, energy-efficient ways to mine cryptocurrencies; blockchain for secure, frictionless transactions; and deep learning to anticipate the human desires that make stocks go up and down… Whatever comes next, Java will for sure stay deep in the world of finance.