27
votes
$\begingroup$

What programming languages are the most common in quantitative finance, and why are these languages used?

Note: I do not mean, what languages are used to develop the accounting system at a hedge fund: this is specifically related to aspects of valuation and trading.

$\endgroup$
4
  • $\begingroup$ I created this general question so that we can just close any future "is language blah used in finance". $\endgroup$
    – Shane
    Commented Feb 8, 2011 at 21:10
  • $\begingroup$ Will request that this be made community wiki. $\endgroup$
    – Shane
    Commented Feb 8, 2011 at 21:13
  • $\begingroup$ What is community wiki? How do I get to the wiki start page? $\endgroup$
    – userJT
    Commented Feb 13, 2012 at 4:44
  • 2
    $\begingroup$ the best answer to this question is use what your employer pays you to use $\endgroup$
    – pyCthon
    Commented Feb 25, 2012 at 3:19

17 Answers 17

30
votes
$\begingroup$

Searching http://www.quantfinancejobs.com for

  • "C#": 62 jobs, 54 (2011)
  • "C++": 209 jobs, 236 (2011)
  • "Java": 72 jobs, 121 (2011)
  • "VBA": 35 jobs, 20 (2011)

Searching http://www.quantcode.com/modules/jobs/ for

  • "C#": 228 jobs, 277 (2011)
  • "C++": 696 jobs, 813 (2011)
  • "Java": 291 jobs, 328 (2011)
  • "VBA": 157 jobs, 190 (2011)
$\endgroup$
1
  • 5
    $\begingroup$ +1 Finally, an empirical answer to this. I always tell people that the best language is whatever their boss pays them to use. $\endgroup$ Commented Jul 25, 2011 at 13:26
29
votes
$\begingroup$

A choice of C, C++, or Java is practically required somewhere in the stack since most data vendors only supply bindings for one of those languages. Once the data arrives, though, the trading desk can use whatever it wants.

In addition to the above three, I've seen these used in production:

  • Visual Basic / Excel
  • q / kdb+
  • R
  • Python
  • MATLAB
  • OCaml

I've also seen Flex and AJAX used for some front-end components.

And finally, some firms build their own in-house proprietary languages. Goldman Sachs famously has Slang.


Related question:

What language should I use in quantitative finance?

Related answer:

  1. Whatever your boss pays you to use.
  2. At least one of the "Big Three" above to get the data feed.
  3. If you actually do get a choice, whatever you feel most comfortable using.

As per #3, that's why you'll notice most language choices are either mathematical in nature (like R and MATLAB) or very high-level in nature (like Python and OCaml).

$\endgroup$
5
  • $\begingroup$ Not so much these days, but APL and Fortran have been used quite extensively in the past. $\endgroup$
    – SCVirus
    Commented Feb 8, 2011 at 21:28
  • $\begingroup$ @SCVirus Yep, I once translated a legacy risk model from APL to q. $\endgroup$ Commented Feb 8, 2011 at 21:30
  • $\begingroup$ Little precision, AJAX isn't a language, but rather multiple technologies used to develop rich web user interfaces (front-end). It stands for Asynchronous Javascript and XML. $\endgroup$
    – Gui
    Commented Feb 10, 2011 at 23:10
  • 1
    $\begingroup$ @Gui Flex isn't a language either; it's an SDK based on top of ActionScript. $\endgroup$ Commented Feb 10, 2011 at 23:14
  • $\begingroup$ @ Chris, I'm using c# atm, do you recommend getting into python instead to get into quant related stuff? thanks $\endgroup$
    – Nikos
    Commented Dec 18, 2012 at 1:33
13
votes
$\begingroup$

I believe that C++ is the most common quantitative infrastructure language. I don't know of a single hedge fund or investment bank that doesn't use it extensively or completely (and I spoke to a lot of them at some point in the past). In some cases, as the former Lehman brothers-now-Barclays, C++ was the only language of choice, which is a bit extreme, given that C++ is not as easy to use as a scripting language. Most companies I know pair C++ with a scripting language of choice. Traditionally, this was MATLAB, which is still amazingly popular for prototyping. More recently, R and Python have become more popular. R especially is now used at several hedge funds I know, and has taken many MATLAB seats; and I know of Python users in JPM and UBS. Python has also nice bindings to BLAS, LAPACK, NAG and MOSEK. Goldman has diffentiated itself by developing a proprietary language, SLANG; the very definiton of non-popular. I don't think Java is used heavily or at all for numerical work. Just try to find maintained to BLAS and LAPACK.

Some crazy market maker will differentiate itself via language, as in the case of Jane St., lonely user of OCAML. I would not be surprised to find a LISP-only 10-person shop flying under the radar screen, and very wealthy. But I have never heard of a single Clojure/Scala/Groovy/Ruby/[add your trendy language] in a serious company. At least, I would never invest my money in a company using a web development, immature language to manage wealth.

Summing up, I would say C++, and then a number of prototyping languages, with MATLAB still dominating, but R having a strong positive momentum.

$\endgroup$
9
  • 1
    $\begingroup$ I've worked for two shops that never used C++. One did everything in q, and the other did everything in Java. $\endgroup$ Commented Feb 8, 2011 at 21:36
  • 3
    $\begingroup$ Java is becoming popular in algorithmic trading (which has its quant side as well). $\endgroup$
    – quant_dev
    Commented Feb 8, 2011 at 21:48
  • 2
    $\begingroup$ I use Java as well $\endgroup$
    – user40
    Commented Feb 8, 2011 at 22:03
  • $\begingroup$ LexiFi (lexifi.com) uses OCaml $\endgroup$ Commented Feb 8, 2011 at 23:09
  • 3
    $\begingroup$ Clojure, Scala and Groovy are not aimed at web development and can work well in Java-shops. A scripting language with a REPL and good Java-interop is great for building prototypes on existing Java code. $\endgroup$
    – Bob Jansen
    Commented Jul 23, 2011 at 19:11
13
votes
$\begingroup$

F# was used at credit suisse and I believe a number of other desks. From people I know at Microsoft the banks told MS to make it a supported language, otherwise it would have stayed a project at Microsoft Research.

I have also seen Haskell used for derivatives trading.

$\endgroup$
3
  • 3
    $\begingroup$ +1 for F#. Don Syme's (F#'s 'inventor') blog [ blogs.msdn.com/b/dsyme ] frequently features links about the usage of it inside investment banking. He also recently linked to a great StackOverflow answer about the areas in which F# has distinct advantages [ stackoverflow.com/questions/2785029/… ], the example given being energy portfolio optimization. $\endgroup$ Commented Feb 18, 2011 at 6:01
  • $\begingroup$ Great comment! Love the links! Working with functional programming is the best thing that happened to me. $\endgroup$
    – SRKX
    Commented Jun 12, 2011 at 13:04
  • $\begingroup$ The great thing about F# as opposed to most other programming languages is that it's got a scripting interface (F# Interactive, fsi.exe). What this means is you can edit your code and see the results instantly. For example, I've got an editor that re-runs the script on any change. That way, I see errors and failing tests immediately. $\endgroup$ Commented Mar 31, 2012 at 11:30
10
votes
$\begingroup$

I recently did a 'Poll' on 'LinkedIn' about this topic that got 160 votes and generated some great conversation on this subject.

http://linkd.in/gHNOgt (Poll Results: Java won out)

I realized after the fact that I should have structured the question more specifically"

Ultimately, depending on what component of a trading system you are tasked with building (back office, front office, messaging system, quant. analysis, etc.) different technologies do things better than others, and there is no 'One Size Fits All'

Interestingly, if you look at the 'age' demographic of the respondents, C/C++ was typically those whom were a bit older 30+, while the younger generation tended toward Java, F# (OCaml), Or Python.

Also, it's important that many programmers whom have mathematical backgrounds tend to find 'functional' languages more useful as opposed to 'imperative languages'.

Both have their pro's and con's, but remember: functional languages tend to compile into faster byte-code, but maybe harder to adapt to newer technologies for the web.

For my part, I'm writing a limit-order-book in F#, Scala (Functional Java), and Python, and am going to study the results.

http://www.opensourcetrader.com

$\endgroup$
6
  • $\begingroup$ Interesting project there! $\endgroup$ Commented Nov 12, 2011 at 16:15
  • $\begingroup$ @JeffBurdges thanks! If you'd like to participate - feel free to reach out! I've got a few different paths going so far... $\endgroup$ Commented Nov 12, 2011 at 22:45
  • $\begingroup$ "functional languages tend to compile into faster byte-code" can you give a reference for that? Isn't F# compiling to the same byte code as Visual Basic does? And latter is imperative ? $\endgroup$ Commented Feb 10, 2012 at 9:24
  • $\begingroup$ @user1194505 Sorry not byte code, more specifically compiling into more concise assembly level operations, nearinfinity.com/blogs/joe_ferner/is_f_faster_than_c.html, basically sums it up doing a few experiments and looking at the ASM instructions. But yes, your right, they all do compile to the same BYTE instructions: CLR (-8 $\endgroup$ Commented Feb 10, 2012 at 21:30
  • $\begingroup$ On your website where you accidentally link the Wiki to Dextor TV series downloads, I recommend using .mkv instead of .avi format as the file sizes can be so much smaller and at the same time, the resolution of x264 encoding so much better. $\endgroup$
    – Marcos
    Commented Mar 11, 2012 at 21:59
8
votes
$\begingroup$

Let me quote a few excerpts from Paul & Dominics Guide to Quant Careers (version 2.0):

Most quant jobs ask for C++, with much smaller demand for C# and Excel VBA and Java. Although Excel is the second most common skill, alas Excel VBA is regarded as “trivial” so few employers will be impressed by mastering it. This attitude is responsible for major efforts at the large banks to defuse the vast number of actively disruptive, yet critical spreadsheets that enjoy the reliability of a British train... Some quants get sucked into roles that we call “Excel Jockeys”. Although some Excel work is cutting edge trading floor work that makes money every time you get the sheet to work properly, the majority is looking after risk reports, data ingest and sheets that even users don't know why they have.

MatLab is common in both academia and finance, and it does not harm to have used it, but again like Excel VBA the view amongst managers is that if you are smart enough to do real quant work you can pick up whatever MatLab you need though we do see a few jobs for extreme high end MatLab gurus.

Fortran is still quite popular in academia, but has only a tiny market share in banks... Much “C++” code in banks is really much like C, and one does see “C++” code that is written using the C subset but trying to be like Fortran.

$\endgroup$
3
  • 3
    $\begingroup$ As much as Domonic's crazy rantings are amusing, he is a bit biased since he teaches the C++ course for the CQF programme. $\endgroup$ Commented Feb 8, 2011 at 21:49
  • 1
    $\begingroup$ C++ is dead - Java and C# anre what are being used for new systems $\endgroup$
    – Jack Kada
    Commented Feb 9, 2011 at 11:06
  • 2
    $\begingroup$ @Chloe Where did you get that from? I just wrote a brand new system in C++. My contention is that C++ is hardly the only language used by quants. However, it's still very popular and I usually advise anyone seeking a career as a quant developer to learn C++. $\endgroup$ Commented Feb 9, 2011 at 14:43
7
votes
$\begingroup$

C++, Java, Ocaml

Very good link for further information: http://www.selectorweb.com/algorithmic_trading.html

$\endgroup$
1
  • $\begingroup$ +1 for the selectorweb link, great quick intro with lots of useful links, though starting to get dated as it hasn't been updated since 2009. $\endgroup$ Commented Sep 16, 2011 at 10:00
6
votes
$\begingroup$

I use C# ( and more generally .Net Framework)

Regards

$\endgroup$
4
votes
$\begingroup$

It is true that C++ is oftenly required in jobs advertising but for me it is as a pledge of programming knowledge.

Now, in my opinion C# use tends to become the next standard over the next few years in the quant industry. I see two reasons for that,

  1. from a programming point of view, C# is very mature programming language AND does (natively) offer a plenty of very interesting possibilities such interaction with databases, excel, real time application, GPU programming .. and the transition for a C++ programmer is incredibly easy,
  2. the number of high end numerical libraries available in C#
$\endgroup$
5
  • 1
    $\begingroup$ I doubt it. Many places still develop models in C++. $\endgroup$
    – quant_dev
    Commented Jul 25, 2011 at 11:43
  • $\begingroup$ Beer4All - thanks for your comment! Regarding numerical libs in C#, do you mean external libs (free? commercial?) or those shipped by Microsoft? $\endgroup$
    – zoom
    Commented Nov 12, 2011 at 16:05
  • $\begingroup$ The C# numerical library of reference is NAG nag.com it's well expensive but you pay for a solution you can rely on. I have also experimented NMATHS which I found not fitted for Quants. Last but not least, the free MATHS.NET library, professionaly developped, suited to cope with large data, very promising but today incomplete and not mature for large deployments. $\endgroup$
    – Beer4All
    Commented Nov 15, 2011 at 18:24
  • $\begingroup$ I tested NAG also. But I couldn't get used to its clumsy API. Also, all .NET libs suffer from poor memory management, heavy GC use especially for large data. The only exception I know of ILnumerics, which claims to get around this. Havn't tested it yet though. $\endgroup$ Commented Feb 12, 2012 at 9:42
  • $\begingroup$ how does c# demand compare with c++ in quant as of Dec 2012? $\endgroup$
    – Nikos
    Commented Dec 18, 2012 at 1:41
4
votes
$\begingroup$

Java is the king!

i have done both C++ and Java. I have met two crowds:

  1. C++ gurus who turned Java Gurus: they all admitted that after knowing Java; they will never go back to C++ again. Although their code in Java was a bit clumpsy..:)

  2. C++ gurus who don't know Java; and don't want to know about it

I personaly will never ever ever do C++ again.

$\endgroup$
2
  • $\begingroup$ hi! what is your reasoning for your pref in Java? $\endgroup$
    – Nikos
    Commented Dec 18, 2012 at 1:42
  • $\begingroup$ The folks I know who feel this way cite C++ pointer arithmetic versus managed code's garbage collection. $\endgroup$
    – woodvi
    Commented Apr 26, 2013 at 16:43
3
votes
$\begingroup$

For a lot of complex Financial applications , the Array Programming Languages virtually have a monopoly . Check out the APLs from IBM , Dyalog , APLnext , and the variants J and Kdb ( Q ) . Python , R , and Matlab have implemented a number of ideas from the APL tradition . Morgan Stanley continues to use Arthur Whitney's ( the creator of Q , nee K ) A+ . SmartArrays has a library , interfaced to most standard languages and operating systems , implementing the essential array functions abstracted by a couple of the implementers of the most prominent traditional APLs

$\endgroup$
1
  • 1
    $\begingroup$ APL is quite powerful. I've spent a lot of time with Dyalog and its ability to go backwards in the debugger is very powerful. That said, as a language it's hard for me to recommend these days. Its disadvantages outweigh its advantages, IMO, as many alternatives have far better publicly available libraries (both numerical and otherwise), performance and community. q/kdb+ called from a high-level stats language like R (leveraging the former's in-memory database and the latter's robust numerical libraries) is hard to beat. I'm not familiar with SmartArrays - will check out, thanks. $\endgroup$ Commented Nov 7, 2011 at 0:14
3
votes
$\begingroup$

For empirical researching, we used MATLAB for the ease of implementation. We coupled with some C++ functions for the speed of backtesting in MATLAB. We tried Excel, VBA but its too slow for processing a huge amount of data.

For execution, it will depends if the strategy is sensitive to slippage. If high speed execution is required, C++. If not, Java is what we preferred.

$\endgroup$
3
votes
$\begingroup$

C++ is used everywhere.

There is some interest in function programming languages, like Haskell, which are a good fit for mathematical modelling but there are numerous issues with performance and memory consumption which limit usability. From experience, the talent pool is also not very deep when it comes to functional programmers, so building and sustaining a team of quant developers using a functional language is difficult.

$\endgroup$
3
votes
$\begingroup$

I've seen the following languages in use:

  • C++
  • C#
  • Excel (VBA)
  • F#
  • Q
  • MatLab
  • R
  • Python
$\endgroup$
1
  • 4
    $\begingroup$ Excel is not a language. $\endgroup$
    – murrekatt
    Commented Mar 10, 2011 at 12:25
2
votes
$\begingroup$

To add some languages I've seen used that I don't see in any responses yet:

  • SAS for statistical analysis
  • Perl, as a general purpose scripting language
  • Mathematica, as a possible alternative to MATLAB for mathematical scripting
  • C# or any other .NET language, used in similar capacities as Java would be
$\endgroup$
1
  • $\begingroup$ One of my professors is director of risk management at a hft shop and uses SAS exclusively. $\endgroup$
    – strimp099
    Commented Aug 6, 2011 at 12:10
1
vote
$\begingroup$

Has anyone else here ever used Stata? It's probably closest to R and Matlab. Like both R and Matlab, it is remarkably flexible and has many good built-in routines for the standard statistical techniques and a decent-sized community contributing code for some of the less popular techniques. Like Matlab but unlike R, it is very well documented with clear and simple examples and very easy to use and pick up, yet it is much cheaper than Matlab. For at least one hedge fund I know of, it has substituted well as a cheaper alternative to Matlab for strategy research and development.

$\endgroup$
0
votes
$\begingroup$

Besides all the procedural languages mentioned above I would also strongly vote for Complex Event Processing (CEP) and its programming language EPL (similar to SQL).

Time-based Market Data Analysis and Signal Generation are coded in EPL statements, whereas procedural actions like placing an order are coded in plain Java Code. The combination of the two provides a best-of-both-worlds approach and accommodates strategies that are predominantly time-based and therefore cannot be programed with traditional procedural programming languages.

Esper is an Open Source solution in the CEP area.

AlgoTrder is an Algorithmic Trading Framework based on CEP and Esper.

AlgoTrader is a Java based Algorithmic Trading Platform that enables development, simulation and execution of multiple strategies in parallel. The automated Trading Software can trade Forex, Options, Futures, Stocks & Commodities on any market.

There are two versions available of AlgoTrader:

  • An Open Source Version that you can download for free
  • A Commercial Version (with Support and Professional Services)
$\endgroup$
2
  • $\begingroup$ This paradigm seems interesting, but could you be so kind to edit in your affiliation with AlgoTrader? $\endgroup$
    – Bob Jansen
    Commented Jun 12, 2013 at 10:28
  • $\begingroup$ He clearly works for AlgoTrader since he just posted three "answers" in a row about it. $\endgroup$ Commented Jun 12, 2013 at 11:17

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