Introduction
QuantLib is a free, open-source C++ library for quantitative finance. It provides a framework for modeling, trading, and risk management of financial instruments. Python, R, and other language bindings make it accessible beyond the C++ ecosystem.
What QuantLib Does
- Prices derivatives including options, swaps, bonds, and exotic instruments
- Builds and calibrates yield curves, volatility surfaces, and credit curves
- Performs Monte Carlo simulation for path-dependent instrument valuation
- Implements finite difference and lattice methods for option pricing
- Calculates risk sensitivities (Greeks) and value-at-risk metrics
Architecture Overview
QuantLib is organized around instrument, term structure, and pricing engine abstractions. Instruments define financial contracts, term structures model market curves, and pricing engines apply valuation methods. The library uses the observer pattern for lazy recalculation when market inputs change, and smart pointers for memory management.
Self-Hosting & Configuration
- Build from source with CMake on Linux, macOS, or Windows
- Install Python bindings via pip for scripting and rapid prototyping
- Link as a C++ library in quantitative applications and trading systems
- Configure evaluation dates and market conventions per pricing context
- Use Boost libraries (required dependency) for math and date utilities
Key Features
- Comprehensive coverage of fixed income, equity, FX, and credit derivatives
- Multiple pricing methods: analytic, tree, finite difference, and Monte Carlo
- Yield curve bootstrapping from deposits, futures, FRAs, and swaps
- Volatility surface construction from market quotes with interpolation
- Calendar and day count convention support for 30+ international markets
Comparison with Similar Tools
- NumPy/SciPy — General numeric libraries; QuantLib provides domain-specific financial models
- OpenGamma — Enterprise risk platform; QuantLib is a lower-level library for building custom solutions
- TA-Lib — Technical analysis indicators; QuantLib focuses on derivatives pricing and risk
- RiskMetrics — Proprietary methodology; QuantLib implements similar models as open source
FAQ
Q: Is QuantLib used in production? A: Yes, banks, hedge funds, and fintech companies use QuantLib for pricing and risk systems.
Q: Do I need C++ to use QuantLib? A: No, Python bindings (QuantLib-Python) provide full access to the library from Python.
Q: How does QuantLib handle performance? A: Core computations are in optimized C++, making it suitable for large-scale pricing grids.
Q: Is it free for commercial use? A: Yes, QuantLib is released under a modified BSD license that permits commercial use.