What programming languages are most commonly used in quantitative finance?

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

    I created this general question so that we can just close any future "is language `blah` used in finance".

    Will request that this be made community wiki.

    What is community wiki? How do I get to the wiki start page?

    the best answer to this question is use what your employer pays you to use

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

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

    Not so much these days, but APL and Fortran have been used quite extensively in the past.

    @SCVirus Yep, I once translated a legacy risk model from APL to q.

    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 Flex isn't a language either; it's an SDK based on top of ActionScript.

    @ Chris, I'm using c# atm, do you recommend getting into python instead to get into quant related stuff? thanks

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

    Java is becoming popular in algorithmic trading (which has its quant side as well).

    I use Java as well

    @Todd Just because a few smallish firms use OCaml hardly addresses the question. I agree completely with @gappy on the use of minor languages (and yes, immature languages for the most part).

    @Shane: I was responding to the mention of Jane St. as a "lonely user of OCAML". I wasn't trying to claim that the language was popular or commonly used.

    @Todd Apologies. Thanks for the reference in that case! :)

    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.

    why is R gaining over matlab? cause its open source?

  • 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 [ http://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 [ http://stackoverflow.com/questions/2785029/in-what-areas-might-the-use-of-f-be-more-appropriate-than-c/2787342#2787342 ], the example given being energy portfolio optimization.

    Great comment! Love the links! Working with functional programming is the best thing that happened to me.

    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.

  • 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!

    @JeffBurdges thanks! If you'd like to participate - feel free to reach out! I've got a few different paths going so far...

    "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 Sorry not byte code, more specifically compiling into more concise assembly level operations, http://www.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

    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.

    thanks @Marcos I've removed that before I get in trouble.

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

    C++ is dead - Java and C# anre what are being used for new systems

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

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

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

    Beer4All - thanks for your comment! Regarding numerical libs in C#, do you mean external libs (free? commercial?) or those shipped by Microsoft?

    The C# numerical library of reference is NAG http://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.

    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.

    how does c# demand compare with c++ in quant as of Dec 2012?

  • 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?

    The folks I know who feel this way cite C++ pointer arithmetic versus managed code's garbage collection.

License under CC-BY-SA with attribution

Content dated before 7/24/2021 11:53 AM