QuantLib is the most widely used open-source pricing library in quantitative finance. It covers fixed income, derivatives, credit, and FX with battle-tested implementations. But its design (deep inheritance hierarchies, virtual function dispatch, fine-grained object allocation) makes it slow for production workloads that require repricing thousands of trades against hundreds of scenarios.
The Integration: Less Than 1% Code Changes
AADC integrates with QuantLib through operator overloading. The process requires less than 1% code changes to the QuantLib codebase:
- Replace
doublewithidouble(AADC’s active type) at the market data entry points - Run the existing QuantLib pricing path once to record the computation graph
- Compile the recorded graph to a native kernel
- Evaluate the kernel with new market data inputs
The pricing logic, curve construction, and instrument definitions remain untouched. AADC records whatever QuantLib does internally (interpolation, bootstrapping, cashflow projection) without needing to understand it.
Performance: 6-100× Faster
The speedup depends on the complexity of the instrument and the size of the portfolio. Simple instruments (FX forwards, IRS) see 6-20× improvement. Complex instruments (swaptions, exotic structures) see 50-100× improvement. The gain increases with portfolio size because the compiled kernel amortizes its overhead across more evaluations.
Full adjoint Greeks are included at near-zero marginal cost. Instead of bumping each curve point and repricing (O(n) evaluations for n risk factors), one adjoint pass through the compiled kernel produces all sensitivities simultaneously.
The QuantBench repository on GitHub provides reproducible benchmarks and integration examples.
View the QuantBench repository on GitHub
Published by MatLogica. Implemented using AADC, a commercial adjoint AD compiler (matlogica.com).