Best Programming Language for Trading Systems?

Currently, I’m working on Learning Machine’s submission for Max Dama’s QuantCup. That involves optimising a “price-time priority limit order matching engine”. More simply, it means ‘making a system which matches buy and sell orders really fast’. *

As per the competition rules, I’m programming our entry in the C programming language. But when it comes to our own system, I’m probably going to write it in something different.

Why? I want a language which balances ease of programming with speedy end results. Though compiled C is very fast, it isn’t an object-oriented (‘OO’) language, which means it’s harder to represent the concepts I’m coding about in a way which seems natural to humans.

The four most widely used OO languages out there are C++, C#, Java and Python, and in them, I’m quite happily able to implement pretty much anything within the capacity of my intelligence (we’re screwed – ed). So which one did I pick?

Machine learning tecnologies

  • Python

Straight off the bat, I knew Python was unsuitable. While the language make it easy to pump out code at a ridiculous pace, it is terrifically slow (unless you write a library in C – but then that’s C, not Python). That particularly holds true for large scale projects.

Another consideration was the OO syntax in the language: I just don’t like it. It’s always felt tacked-on and feeble. Python is primarily a scripting language, I guess.

Having said that, Python is my language of choice for scraping data off the web and for simple model testing, so I may well come back to it later for a different purpose.

  • Java

Java was another candidate that was quickly crossed off our list. Why? Because as far as I know, Java doesn’t allow external functions to be called without piping a string into a program(if I’m wrong about this, let us know via the comments below!) [Turns out I was indeed wrong, see]. Another issue is the existence of C#. Pretty much the same language, but with a superset of Java’s features (i.e. does everything Java does, and more). And it has better handling of datetime type (important!).

  • C++

Of the four languages listed here, I’m least comfortable in C++. I thus figured that Learning Machine would be a great way to extend my knowledge of the language.

At first, C++ seemed perfect: solid OO implementation, a fast, compiled language, the ability to write Assembly language and C straight into a program, and great IDEs (I’m a fan of Visual Studio – university students can download it free through Microsoft’s DreamSpark program). C++ was so perfect, in fact that I started programming in it right away.

However, as soon as I got the basic class structure down pat, it hit me: the compiler. Spending thirty minutes debugging a simple error such as missing a type cast is not an efficient use of my time, particularly when trying to do university study alongside programming for Learning Machine.

  • C# (C Sharp)

Of the four languages considered, one was left: C#. An almost perfect language, it has all the advantages of C++ (bar its speed) and offers a huge standard library, with even more libraries available on the internet. It even lets you call external functions, and use pointers – features which place it in a class above Java. Not only that, but Microsoft seem to focus their documentation heavily on the language and their IDE, which smooths the ride somewhat.

Have I missed anything? Should I have included OCaml? Objective C? Erlang? Let us know in the comments! (I’m seriously considering writing some external functions in OCaml…)

* This matching task would normally be done within the exchange itself, but for speed reasons it’s also done within many high frequency trading firms so they can see the most up to date version of the order book and make orders accordingly.

Geef een reactie

Het e-mailadres wordt niet gepubliceerd. Vereiste velden zijn gemarkeerd met *