7

I am interested in ultra high frequency trading and Java is the language I know best.

I was always under the impression I would have to perfect my C++ skills in order to work within the ultra high frequency domain (no pun intended) because a lot of job specs seemed to ask for this.

Elsewhere on the internet i have seen people comment that Java is actually preferred because you can find Java developers much easier. However, I thought this a bad argument because in terms of ultra high frequency, you need to grab an order as soon as possible and designing your system based upon the ease of finding programmers isn't going to achieve what you need in terms of latency.

So, would you say I would be best off concentrating on Java, or is it unavoidable to specialise in C++ in order to get into this career?

user997112
  • 1,479
  • 3
  • 19
  • 24

6 Answers6

13

There are low-latency systems built in Java (for example the Disruptor), but C++ is still a commonly used language in this space. I'd personally learn both and how to communicate between the two (e.g. JNI or similar).

Looking at existing job ads in this area is probably a good idea as well.

12

To preface my answer I will say I have worked in the finance industry so I will start with a little history lesson before going into why you should learn C++.

Before Java's release C++ was the language used primarily for banking applications, especially when dealing with low latency situations such as HFT. When Java became stable enough with delivering the "write one, run anywhere" slogan that the banks started to adopt it as the new default language for smaller application and, when it's performance improved, they began using it for larger ones.

With this in mind you should also know that banks are in habit of both writing all there own stuff by default (with some exceptions) and not re-writing it if it just works in making them money; you do see a lot of legacy applications that require ancient versions of the JVM or a certain amount of magic to get working but are adding business value. Older versions of the JVM had sucky performance compared to C++ at the time and indeed current generation VMs so writing a low latency, real time system was probably not seen as being particularly viable from a performance point of view.

In other words the odds are you will likely be maintaining an existing platform that was probably written when C++ was the language of choice. At the end of the day it will either be Java or C++, you might stumble across some C or even assembly (unlikely). Additionally even if the application is Java it could call out over JNI to C++ to do the heavy lifting so I would learn C++ to the point I can do something useful in it.

In terms of mastering C++ over Java or vice versa: learn both to the point you can pass an interview, there are going to be platforms out there that have Java, mastery will come with use.

ahjmorton
  • 671
6

You make it sound as if there are no jobs outside of the high-frequency trading industry in C++. That's just not true- C++ is an excellent language to learn and master for plenty of other reasons.

DeadMG
  • 36,914
6

Hardware is getting faster, but the demand for computing power by big finance institution is growing even faster. I know someone (not that well) who writes low-latency trading systems in C++. Those are not general-purpose systems. They buy the best hardware there is, max out RAM and study the details of the particular architecture each time. If it had to work any faster, they would have to do it as a specialized FPGA. So, ultra low latency trading will force you to learn new hardware all the time, which is transient knowledge IMO. Look for Java positions perhaps? You'll still need to know C++.

Job
  • 6,459
3

Short answer: No, you have opportunities in the HFT world with your Java skills.

Caveat: Learning any new language will force you to think/code/communicate in new ways, this is usually a good thing.

Personal experience: When I worked in bulge-bracket IB I interviewed for a Java role in an HFT group. I knew no C++ but this didn't deter my interviewers, their team wrote Java for most pricing and trading, C/C++ to optimize network and disk IO. My Java experience would "confine" me to the pricing/trading space, which is a very, very large space in which to be confined.

How the story ends/advice to OP: I didn't take the job, opting instead to try out the small company scene. Was the best choice for me at the time, but had I wanted to stay in IB, HFT would have been challenging and enlightening. Take your Java skills and apply to HFT/low-latency positions. There's plenty for you to do, and you'll work alongside some awesome C++ developers too.

Matt Stephenson
  • 279
  • 1
  • 3
2

Java is a certainly well used in high frequency trading. There are libraries like Javolution for example for very low latency coding (achieved for example by special data structures that avoid heap allocation), or the Disruptor which underpins the LMAX trading platform.

C/C++ still gives you more direct control over the machine, which can give you the edge in some extremely latency sensitive situations. And for these reasons it's still probably the "traditional" choice for ultra high frequency applications.

But overall, most of the code in trading platforms isn't so latency sensitive that you really need C/C++. Think about all the analytics tools for example - latency simply isn't an issue and the productivity you get from being on the JVM will clearly outweigh any minor performance advantages of C/C++. In addition, I'd say that Java (along with other JVM languages like Scala and Clojure) is much better suited to handle the highly concurrent, distributed, big data problems that are likely to be a major driver for future developments.

I would give you the following advice:

  • Apply for jobs anyway, don't wait to master C/C++ first. If you're a good enough Java coder you should be able to get jobs in the right kind of companies and transition to C/C++ later if there is a need.
  • Start learning C/C++ anyway. It will make you a better coder overall to have a low level systems language under your belt (even if Java is bringing in the money most of the time). Some basic C/C++ knowledge might help you in interviews as well - you can position yourself as a Java expert but with an interest/aptitude for C++.
mikera
  • 20,777