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?

6
  • @Job You should add that as an answer. You're the only person to mention that C++ isn't always fast enough, and that's an important point! Jan 3, 2012 at 14:23
  • 9
    I'm feeling sick. This is a game where people throw money on a table, betting they can grab the pile faster than the other players can, and they say they're creating wealth. Hey, have fun. Jan 3, 2012 at 20:28
  • 1
    @MikeDunlavey: Anyone who trades like that won't trade very long Jan 3, 2012 at 22:27
  • 4
    @Mike Dunlavey, like it or not, someone out there will do it if there is a perceived reward, then they will. What seems fast today will not be 10 years from now. Yes, small shops cannot afford to compete, but neither can they run a railroad or optical fiber network. My only problem with big banks is that we subsidize and encourage their risk-taking behavior with our taxes. Unethical $-making opportunities using software are all around us - in social media sale of privacy, in big pharma cover-ups, "charities" ... At least finance people are honest about pursuing their simple self-interests.
    – Job
    Jan 3, 2012 at 22:44
  • 3
    @Job: You're right, and I don't like it. Once I heard someone argue, about a similar occupation, "Look, if you don't do it, someone else will." I know trading is ethics-neutral, but what occurred to me was "you could say the same about burglary" :-) Jan 3, 2012 at 23:02

6 Answers 6

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.

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.

2
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++.

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.

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++.
3
  • 1
    There is no language called "C/C++". As the OP talked specifically about C++, I don't know why you insist on adding C.
    – Sjoerd
    Jan 3, 2012 at 14:34
  • 3
    @Sjoerd - obviously C and C++ are different languages. But in this context (ability to write low level, low-latency code close to the hardware) they are effectively equivalent. Both enable you to manage memory manually, which is the main reason to use them in preference to Java (where the automatic GC cycles can cause occasional pauses that are difficult to avoid)
    – mikera
    Jan 3, 2012 at 15:57
  • +1 for "Apply for jobs anyway, don't wait to master C/C++ first". Companies do like it when the applicant wants to do exactly what they do; they might offer a lower rate though.
    – Job
    Jan 3, 2012 at 18:36

Not the answer you're looking for? Browse other questions tagged or ask your own question.