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!