Tag Archives: programming language

Would most Quants agree that C++ is the best programming language to use to; price and structure financial derivatives?

Would most Quants agree that C++ is the best programming language to use to; price and structure financial derivatives? Modern Technology is so fascinating.

What is your definition of “best programming”?

Hi, basically I mean is C++ the best program that is used in the industry to price & structure financial derivatives like options & swaps.
Is it the most robust compared to other programs?


If you defined best as being robust, then Java and C#(.NET) are pretty much just as applicable as C++ for a production environment. C++ is very popular and in a lot of areas of quant finance it is dominant but not all. Check this thread for a massive discussion on the topic: http://www.linkedin.com/groupItem?view=&gid=90917&type=member&item=19160319

Hi, that’s great. So C++ is a very dominant program in finance. I starting to learn how to use it, so was very interested about it merits within the industry.
How would you define “best programming”?

You need a better definition of “best”.

If you mean least likely to introduce logical errors, leading to erroneous results, then a more strongly typed language like Java would help. However you really ought to be looking to your development process to underline your robustness (you do have a development process. And a regression test suite. Don’t you?)

If you mean fastest for code development at the expense of execution performance, then Excel or one of the scripting languages like Python or Ruby might be better. Not necessarily the most productive overall – easier to introduce errors unless you have a good process – see previous paragraph.

If you want to formally verify the correctness of your code, perhaps you should consider a functional language like ML. But forget about performance.

If you mean highest performance of compiled code, then don’t forget FORTRAN. It has some features that make it particularly amenable to code optimization, and modern derivatives offer good features for use with parallel hardware.

You’ll see C++ isn’t in any of these lists, but it is arguably a good compromise. Some type constraints to improve code quality, reasonably efficiently compiled, and with derivatives that provide support for parallel hardware. But don’t even think about trying to formally verify it!

• Hi, thanks for your input.

In regards to defining “best”, would you say then C++ is the Best Compromise with respect to other programs then, that’s why it’s widely used in the industry?

In regards to “regression test suite” I’m not familiar with this phrase.
As the only thing I’ve ever used  regressions for was testing the statistical significance of MacroEconomic Factors has on Global GDP in econometrics.

To be honest I’m fascinated by modern technology abrupt use within finance, that why I’m improving my programming skills, I’m experienced with VBA/Excel application in finance, now I want to master C++ skills in finance.

Thank you again.

I’m not really from this industry (I just have overlapping technology interests), so I’m not sure how prevalent C++ really is. Much of the general finance industry still runs COBOL, for the simple reason that once you have a body of code in a language it is hard to switch to another, even after 50 years.

If you want to use an object oriented language (which has its advantages for code quality), then C++ is a reasonable compromise. It has its weaknesses (weak typing, multiple inheritance, the template system), but it offers substantial performance benefits over newer alternatives such as Java.

Modern compiled programming languages can often be linked together, so the choice of language is less critical than it once was. Depending on the problem being solved I would also look seriously at FORTRAN, Java and C.

Rather than focussing on a specific programming language, you might be better off studying software engineering in general. In particular learning how design processes based on UML notation can improve the quality of your code, no matter what language you use.

A regression test suite is a set of tests you run regularly (typically overnight) on your program that test its behaviour against the original requirements. As you change the code, they should flag up if you have broken something that previously worked. Every time you fix a bug you should add tests to ensure that it is never re-introduced. Indeed all modern design flows start with writing the tests before the code.

As an example the GCC C compiler has a set of approximately 50,000 regression tests that any new version of the compiler must pass before being accepted.

7 days ago


I am from “the industry”. 25 yrs of writing trading, portfolio mgmt, pricing and such. C++ is great, Java is just as good. Don’t like scripting languages much, especially for larger systems.

Which to use will depend on what you’re doing. C++ for libraries, Java for large scale systems as all the housekeeping is done for you in various packages, and all you need concern yourself with is the problem at hand.

I’ve worked on structured pricing systems writtein in C++, pricing over 4 million CMOs multiple times a day. I’ve worked on system doing Corp and High Yield pricing writen in MSVC. I’ve worked on market data systems written in Java, and have written European ABS pricing systems in Java.

If you want something that will handle large numbers of users and scale up to the Enterprise, Java/JEE is the ticket. Core Java using Spring/Terracotta will also work, but you have to worry about threading, whereas with JEE (KA J2EE) you don’t. Containers will provide with the vertical scaling, clustering will provide the horizontal scaling, and VIPs will provide HA/DR. JTA/JPA comboined with Entity Manager will handle the database interactions (you need code very little with this, and transactionality and demarcation is built in).

Performance is pretty much equal, management of resources is much harder in C++. I’m talking about runtime resource management such as heap, DB connections, and the like.

My advice: learn Java and Spring. Start with JEE for container management, and go from there. Check java.sun.com (if that URL is still good, if not look under Oracle) for really good tutorials for all of the foregoing. Spring has tutorials as well, especially for IOC, that will get you well on your way.

Figure out IOC, AOP and SOA. They’ll save you much grief. Learn design patterns. Go from there.

IMHO if you want pure speed, C/C++ is a very good option.

More dynamic languages (e.g. Python) are very handy as glue but C/C++ provides very good performance (almost on par with Fortran) and allows to easily integrate optimised libraries like BLAS and multiple solvers etc. However the learning curve of (writing _good_) C/C++ is steep thus development times are longer compared to Python, Java etc. Also C/C++ is pretty raw. Python and Java come with many libraries that allow you to communicate over networks, make a GUI etc. C/C++ is not a good tool for such things.

Also be carefull of over-objectification and subtleties that might hurt performance. For instance few C++ developers know the difference between POD’s and non-POD types



NOTE I now post my TRADING ALERTS into my personal FACEBOOK ACCOUNT and TWITTER. Don't worry as I don't post stupid cat videos or what I eat!

Quant development: Which programming languages are the most widely used in trading systems for conventional algorithmic )?

Quant development: Which programming languages are the most widely used in trading systems for conventional algorithmic )?

Java, C++ and C# with extensive use of Python/Perl on Unix with Matlab

From what I know, functional languages such as Haskell, F#, SML etc are a nice fit in the financial sector in general, since you can mathematically prove program correctness which I assume is really helpful because a bug can cost you big time. That was a long sentence.

As an individual algo trader, i am using mql4 (similar to C) and mql5 (similar to C++) to develop automated trading program running on mt4 and mt5 platform. a

Definitely C++ on linux. I have heard of trading firms, that actually were trying to write everything on linux in C and use only pointer arithmetic to get away from even some latency found in the STL although I think you can have a i5 (sandy bridge) or better and do just fine with plenty of ram on C++ and linux. Also, python is great for simulations check out Longstaff Schwartz implemented in python. Very slick for backward analysis that forward analysis using monte carlo sims would just take forever. nd using Scilab (free language, similar to matlab) for data analysis….

• C# and NAG Fortran Libraries do everything I need

C# for client front end, C++ for backend.

VHDL/FPGA ?! For burning whole system in a FPGA chip?? But I though TI DSP has better solution for computing. More people use Verilog now for digital IC design. What matter most? Efficiency or crossing platform?

Really depends on what kind of results you want to achieve versus the best effort to develop. IMHO:

• C/C++ – Backend / Server Side Linux
• C# – GUI, Server Side Windows
• Java – Not a fan of event oriented language, but GUI and Some midware software (fast programming)
• Python, R, Matlab – Prototyping
• Flex – GUI / FrontEnd

If the application is not latency sensitive, I would recommend a large supported develop IDE like MS Visual Studio. You will find a large quantity of labor and easy debug.

On my personal softwares, I use C++ and QT.

have used R, C# and sql server 2008 at the backend for my trading models. I have build models based on machine learning algorithms. I have used the same for high frequency pair trading model. Which actually dynamically looks from more than 15000 pairs in a minute to find trading opportunities. It works well, but i must say that the architecture of the product has to be very robust to reduce the latency. But as of now it has been working fine for over 1.5 year now.

C++ seems to be popular going by the number of appearance in comments.

language #appearance
C++ 10
C# 6
C 4
R 3
MT5 1

From a Linked In group discussion

NOTE I now post my TRADING ALERTS into my personal FACEBOOK ACCOUNT and TWITTER. Don't worry as I don't post stupid cat videos or what I eat!

Get the latest details of IBM'S latest Java based programming language X10

Get the latest details of IBM’S latest Java based programming language X10

Executive Summary

X10 is a new programming language being developed at IBM Research in collaboration with academic partners. The X10 effort is part of the IBM PERCS project (Productive Easy-to-use Reliable Computer Systems) in the DARPA program on High Productivity Computer Systems. The PERCS project is focused on a hardware-software co-design methodology to integrate advances in chip technology, architecture, operating systems, compilers, programming language and programming tools to deliver new adaptable, scalable systems that will provide an order-of-magnitude improvement in development productivity for parallel applications by 2010.

X10 contributes to this productivity improvement by developing a new programming model, combined with a new set of tools integrated into Eclipse and new implementation techniques for delivering optimized scalable parallelism. X10 is a type-safe, modern, parallel, distributed object-oriented language intended to be very easily accessible to Java(TM) programmers. It is targeted to future low-end and high-end systems with nodes that are built out of multi-core SMP chips with non-uniform memory hierarchies, and interconnected in scalable cluster configurations. A member of the Partitioned Global Address Space (PGAS) family of languages, X10 highlights the explicit reification of locality in the form of places; lightweight activities embodied in async, future, foreach, and ateach constructs; constructs for termination detection ( finish) and phased computation ( clocks); the use of lock-free synchronization ( atomic blocks); and the manipulation of global arrays and data structures.

An Eclipse-based Integrated Development Environment (IDE) is being developed at IBM for X10 to help further increase programmer productivity by providing state-of-the-art functionality for viewing, editing, navigating, executing, and manipulating X10 programs. The goal of X10 Development Toolkit (X10DT) is to be a full-featured IDE for X10 offering the features Java programmers have come to love and depend upon in Eclipse: a source editor with various coding assists, lightweight information pop-ups, high-level and low-level navigation views, powerful search capabilities, application launch configuration management, refactoring, and debugging support. In addition, the X10DT will include tools, views and refactorings that specifically address the development of highly concurrent software in X10. The project is actively working on X10DT to meet these goals and welcomes assistance from the larger community.


NOTE I now post my TRADING ALERTS into my personal FACEBOOK ACCOUNT and TWITTER. Don't worry as I don't post stupid cat videos or what I eat!

For Quants, F# from Microsoft is proving to be much faster than statistical programming languages like R

For Quants, F# from Microsoft is proving to be much faster than statistical programming languages like R

I thought it I would post this very valid Linked In group discussion of the pro and cons of Matlab, R, and surprising F#. From what I gather below is that F# is much faster than R. Also, it seems to me that F# could be the next proven functional programming language as compared to the experimental languages. R seems to be proven in the Quant community but F# is created by Microsoft. It is also tightly integrated into the newly released Visual Studio 2010. That means you can get direct access .NET assemblies created by the likes of Visual Basic.NET or C#.
I am a big fan of MATLAB, but it has its drawbacks. Many of the problems I work with are huge data sets and MATLAB doesn’t handle these well at all. Recently I was working with a matrix of 10 million rows with 7 columns. It took hours just to create the matrix and working with it was almost impossible. In comparison I used a similar function in F# and got it to load the data and do the analysis in less than three minutes.

I have tried R and it seems to handle large data sets better than MATLAB, but the learning curve is steep and weak support for a UI is a drawback. I did try several of the outside R GUI tools, but the extra effort for integration and just getting them to work was too much for the time I had available. I am not saying R is bad, it actually looked very powerful. I just didn’t have the time to climb the learning curve.

F# has really impressed me lately. It doesn’t have the library support that MATLAB or R does, but it has great integration into Visual Studio 2010 and is extremely fast. I am seriously hoping it continues to gain traction in the finance arena so that the support libraries grow. Until then I will be porting some of my favourites.

I still use MATLAB, but it seems that is happening less and less.
Any compiled language is going to run circles around R, Matlab, or Mathematica. I am a fan of F#, though not doing much with it yet as my platform is UNIX based. F# is more concise and flexible than many other languages, so has potential as a research language.

It seems like an apples and oranges comparison though. As far as I know there is not the wealth of statistical tools available as libraries in F#. With the wealth of the R libraries, F# would be unquestionably the best environment for both research and “production”. At this point I think F# is the best env for production work and only reasonable for research purposes if your problem domain is well circumscribed and you have developed a large accessible model base.

I end up using R for research purposes and languages like F#, Java, etc. for “production”.

NOTE I now post my TRADING ALERTS into my personal FACEBOOK ACCOUNT and TWITTER. Don't worry as I don't post stupid cat videos or what I eat!