Choosing Python and C++ for a Quantitative Pricing Library
Summary
The document discusses language choices for a pricing library that should support parallel pricing, control maintenance costs, and remain accessible to newer quantitative researchers. It argues that there is no single best language and suggests Python as a practical interface and development environment, backed by compiled numerical libraries such as those written in C or Fortran. Python’s large user and library communities are presented as advantages.
For GPU work, the answer points to CUDA’s support for multiple programming languages and says C++ is a reasonable choice for implementing GPU-based pricing components. It also urges library designers to consider their intended users and the existing ecosystem, noting that an established project such as QuantLib may already meet many needs. The discussion offers experience-based guidance rather than benchmarks, cost estimates, or a detailed architecture. Its recommendations therefore depend on the library’s performance targets, users, and integration requirements.
Key ideas
- The document presents Python and C++ as plausible choices rather than identifying one universally best language.
- Python can provide an approachable interface while compiled numerical libraries handle performance-intensive work.
- C++ is suggested for GPU pricing implementations using CUDA.
- Target users and the existing quantitative finance library ecosystem should inform language and architecture choices.
Tags
Full text
# Choosing programming language for the next generation of a pricing library # Choosing programming language for the next generation of a pricing library If I were to start development of a pricing library, which programming language would be most suitable to satisfy the following needs: - Implement highly parallelizable pricing models using GPU or any other hardware enabled techniques; - Reasonable maintains costs; - Be ready for the next generation of quants (today's students). The least is an important factor. Being detached from the academic environment do PhD students still know how program in C++? ## Answer by Theodore (score 1, accepted) https://quant.stackexchange.com/a/41059 There is no one definitive programming language to be used for this. As Attack68 stated, a library written mostly in Python while taking advantage of Python's fast libraries written in C would be a good choice for the following reasons: - Again, as the comment stated there is a large community of Python programmers, plus the community supporting the respective libraries mentioned (numpy, scipy, etc.) - Python is a very popular programming language, lots of people will use it. Again, there is no one definitive language that is the best choice for writing a library that takes advantage of GPU hardware or any other hardware. > Implement highly parallelizable pricing models using GPU or any other hardware enabled techniques; As far as GPUs go, I'd look into the Nvidia CUDA library, which has support for C, C++, Python, Fortran and MatLab. There are bindings for Java, R, and C# as well. Using Nvidia CUDA you can build a GPU based pricing library, and for that I personally would use C++ but CUDA has support for C and Python as well as stated above. However the other thing to note here (and something that was not included in the question) is one very important detail: Who is going to use the library, what would they use it for and how does the library set itself apart from the already extremely popular, well documented and community driven libraries for quantitative finance out there? The popular open source QuantLib has a Python version with a great deal of support, it is unlikely that anyone already used to and using QuantLib for Python would switch. > ...do PhD students still know how program in C++? Yes, of course they do. There are several ways you can find this out, including a simple internet search. For example, let's go to the site of the Caltech Department of Computing & Mathematical Sciences. A major part of getting a CS degree at the California Institute of Technology is the C/C++ education, you can view the course catalog for CS11, for example. You see that not only do they have C++ but advanced C++ as well. This was a bit unrelated however I thought it was necessary given your statement regarding whether or not C++ is still taught at prestigious technical universities. The two languages that I would chose from are C++ and Python, and in the case of the latter taking advantage of Python's quick Fortran libraries.
Shown in full with attribution under the source's licence. Licence: CC BY-SA 4.0 (Stack Exchange)
This summary was written by Stratmill's research agent from the original; it is not a copy of the source.