Quantitative Finance Stack Exchange is a question and answer site for finance professionals and academics. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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.


locked by chrisaycock Jun 12 '13 at 11:18

This question exists because it has historical significance, but it is not considered a good, on-topic question for this site, so please do not use it as evidence that you can ask similar questions here. This question and its answers are frozen and cannot be changed. More info: help center.

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

17 Answers 17

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
  • 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).

Not so much these days, but APL and Fortran have been used quite extensively in the past. – SCVirus Feb 8 '11 at 21:28
@SCVirus Yep, I once translated a legacy risk model from APL to q. – chrisaycock Feb 8 '11 at 21:30
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. – Gui Feb 10 '11 at 23:10
@Gui Flex isn't a language either; it's an SDK based on top of ActionScript. – chrisaycock Feb 10 '11 at 23:14
@ Chris, I'm using c# atm, do you recommend getting into python instead to get into quant related stuff? thanks – Nikos Dec 18 '12 at 1:33

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)
+1 Finally, an empirical answer to this. I always tell people that the best language is whatever their boss pays them to use. – chrisaycock Jul 25 '11 at 13:26

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.

I've worked for two shops that never used C++. One did everything in q, and the other did everything in Java. – chrisaycock Feb 8 '11 at 21:36
Java is becoming popular in algorithmic trading (which has its quant side as well). – quant_dev Feb 8 '11 at 21:48
I use Java as well – user40 Feb 8 '11 at 22:03
LexiFi (lexifi.com) uses OCaml – Todd Schiller Feb 8 '11 at 23:09
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. – Bob Jansen Jul 23 '11 at 19:11

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.

+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. – James Webster Feb 18 '11 at 6:01
Great comment! Love the links! Working with functional programming is the best thing that happened to me. – SRKX Jun 12 '11 at 13:04
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. – Dmitri Nesteruk Mar 31 '12 at 11:30

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.


Interesting project there! – Jeff Burdges Nov 12 '11 at 16:15
@JeffBurdges thanks! If you'd like to participate - feel free to reach out! I've got a few different paths going so far... – jordan.baucke Nov 12 '11 at 22:45
"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 ? – user1194505 Feb 10 '12 at 9:24
@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 – jordan.baucke Feb 10 '12 at 21:30
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. – Marcos Mar 11 '12 at 21:59

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.

As much as Domonic's crazy rantings are amusing, he is a bit biased since he teaches the C++ course for the CQF programme. – chrisaycock Feb 8 '11 at 21:49
C++ is dead - Java and C# anre what are being used for new systems – Jack Kada Feb 9 '11 at 11:06
@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++. – chrisaycock Feb 9 '11 at 14:43

C++, Java, Ocaml

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

+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. – Tal Fishman Sep 16 '11 at 10:00

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



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#
I doubt it. Many places still develop models in C++. – quant_dev Jul 25 '11 at 11:43
Beer4All - thanks for your comment! Regarding numerical libs in C#, do you mean external libs (free? commercial?) or those shipped by Microsoft? – zoom Nov 12 '11 at 16:05
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. – Beer4All Nov 15 '11 at 18:24
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. – user1194505 Feb 12 '12 at 9:42
how does c# demand compare with c++ in quant as of Dec 2012? – Nikos Dec 18 '12 at 1:41

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.

hi! what is your reasoning for your pref in Java? – Nikos Dec 18 '12 at 1:42
The folks I know who feel this way cite C++ pointer arithmetic versus managed code's garbage collection. – Hello World 123 Apr 26 '13 at 16:43

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

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. – ZAxisMapping Nov 7 '11 at 0:14

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.


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.


I've seen the following languages in use:

  • C++
  • C#
  • Excel (VBA)
  • F#
  • Q
  • MatLab
  • R
  • Python
Excel is not a language. – murrekatt Mar 10 '11 at 12:25

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
One of my professors is director of risk management at a hft shop and uses SAS exclusively. – strimp099 Aug 6 '11 at 12:10

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.


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)
This paradigm seems interesting, but could you be so kind to edit in your affiliation with AlgoTrader? – Bob Jansen Jun 12 '13 at 10:28
He clearly works for AlgoTrader since he just posted three "answers" in a row about it. – chrisaycock Jun 12 '13 at 11:17

protected by Tal Fishman Apr 2 '12 at 15:18

Thank you for your interest in this question. Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).

Would you like to answer one of these unanswered questions instead?

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