Extending C++ Quant Libraries to AWS

Brian McCallion Amazon Web Services, Financial Markets, Lambda 1 Comment


In December 2015 we ported 955K lines of QuantLib C++ code to asm.js. This positions us to provide unique services around hedge fund and Financial markets applications and more. This technology unchains a wealth of quantitative Functions.
Customers demand compelling financial markets tools solutions for Amazon Web Services and we’re here to deliver.

Achievement Unlocked: Open Source C++ Quant Library 
Ported to Javascript

Serverless Computing

Examples run in your browser as javascript. And these examples also run as AWS Lambda functions, or on Node.js, or in Docker Containers on ECS Clusters (for CUDA optimized code)


Callable Bonds
Fitted Bond Curve
Convertible Bonds


Discrete Hedging

(~18 seconds)

Test FRA Construction, NPV Calculation, and FRA Purchase


Latent Models


Multi-Dimensional Integrals






Swap Valuation


Freeing Functions and Freeing Data

While closed-source providers offer solutions, an Open Source Quant distribution enables optimization to run on Amazon Web Services C4 and GPU 2 instance types, and fleets of docker containers.

Today large and midmarket financial firms recognize how the future of quantitative finance is in the Cloud and have taken a hard and sharp turn in this direction. These firms recognize they need to move quickly. Bronze Drum’s Carbon09 Quantitative Finance distributions optimized for AWS power this move to the cloud.

While the innovation of Open Source software development unleashed substantial innovation, data remains the lifeblood of financial firms. What is required to create a new ecosystem of microservices in the Cloud, each composed of single function services. While Fintech to-date largely focuses on the consumer side of services, financial firms seek answers to the question of how to leave incredibly valuable libraries of legacy code behind.

While in the Cloud Community substantial capital has been raised by firms that simply (well, we know it isn’t actually easy) make it simpler to use open source software like Cassandra, Hadoop, Apache Spark such solutions solve the distribution, packaging and build challenge but leave others as an implementation detail. Such solutions are extremely valuable as they save firms enormous amounts of time.

Cloud Computing is an unfortunate term which hides the real-story of a Devonian scale extinction of firms. Software as we’ve known it is no more. Serverless Computing reduces the friction to a greater degree. Simply to wrangle with an Open Source project and get it to build and install takes hours and days and requires continuous effort. Developers of risk solutions, when they can break away from the enormous amount of compliance and change control documentation that grows daily, have little time left to wrangle with builds.

As financial services reduces costs so as to free working capital for investment, product innovation becomes even more critical, even as the constraint–developers–become mired in the code of yesterday. Rapid development in languages like Python improves matters considerably. Yet code is code. And much of the code is repeated across organizations, across projects, and it all must be debugged–or not. In financial services, bugs are costly when found in production. Knight Trading certainly learned the hard way that the old ways of building applications a line of code at a time can destroy a business in minutes.

Developers in financial services leverage Open Source libraries such as QuantLib, yet even so, considerable experience with the library is necessary to become productive. And while the library certainly is designed to avoid certain types of mistakes, in many cases the library requires substantial augmentation. The develop must write significant new code in many cases. On the whole, while object oriented programming and C++ and scripting languages are a substantial improvement, they don’t actually do much to change the metaphor of developers moving grains of sand with chopticks as they build small castles. What’s needed is a building block that is self-contained, and small enough that multiple projects can begin to use microservices composed on the functional units of composition. We’ve taken some simple examples from QuantLib and transcompiled these examples to ASM.js using the remarkable Mozilla project, Emscripten. We began this initiative when AWS Lambda only supported Node.js / Javascript. We see substantial opportunity in this space to create building blocks that can be inspected and composed as widgets in a browser, yet also run seamlessly on the server side. We’re also looking at Java, and Python examples, having now used SWIG to build QuantLib for Python. In many ways it turns out that what seemed initially like QuantLib limitations: it’s single threaded optimization, and the fact of it being written in C++ lend themselves to transforming the library for other languages. We anticipate enterprise will begin to awaken to the fact that High Performance Computing in the Cloud is something they must do, no matter how many cores they run in the data center. We also believe that financial services must now rely no longer on its ability to pay massive bonuses, and to begin to leverage hyper scale web services in order to compete. It’s just as true today as it was in 2011 when Marc Andreessen wrote Why Sofware is Eating the World.

Public cloud significantly reduces the infrastructure and compute barrier to entry to financial markets. Further, the ability to write automated software to manage complex new compliance requirements remains a challenge for even the largest firms, some of which exited key markets such as derivatives and fixed income in 2015.

JP Morgan, Goldman Sachs, Morgan Stanley announced a multi-million dollar initiative to cut costs by aggregating, cleaning, and consuming their own Financial Markets Reference Data. Today these firms purchase such data from suppliers such as Bloomberg, Reuters, Six Financial, and others.

Ecosystem and Network Effects

In New York City finance the community of quants is small and close knit. Rather than write libraries from scratch, firms today choose to build on Quantlib. While commercial third-party solutions exist and offer a great deal, QuantLib, and Open Source software is a particularly good fit for financial markets.

  1. Financial firms require the highest degree of transparency and control over how they calculate portfolio risk, and process and price financial instruments. Open Source algorithms and libraries provide firms the ability to understand and define exactly the algorithms and assumptions they need, yet sidesteps the need to write and maintain all this code in house.
  2. Size Matters. The Cloud puts the focus back on the algorithms. Today new firms can compute on AWS anything that can be computed in the largest Wall Street firms.
  3. Time to Market Matters. With the data center receding as a competitive advantage, firms that can write the best software, and harness next generation web services stand to win.
  4. Unprecedented investment in Fintech. Incumbent firms are savvy enough not to wait for Uber, and pin their hopes on regulations to slow down upstarts. Incumbents seek a new kind of speed and agility to compete with the horde of Fintech disruptors. Both the disruptors  and the incumbents aggressively pursue new ways accelerate software development and to incorporate quantitative finance into web facing applications.