Actively developed

QuantLib guide

QuantLib is not a trading framework but the pricing engine behind many of them.

Last reviewed · Also known as QuantLib-Python

Quick answer

QuantLib is the leading open-source library for quantitative finance, written in C++ with Python bindings (pip install QuantLib). It prices and risk-manages options (Black-Scholes, Heston, binomial, Monte Carlo), bonds, swaps and other derivatives, and bootstraps yield curves with full day-count and calendar handling.

QuantLib at a glance

Category
C#, Java & C++ frameworks
Language
C++, Python
License
BSD-3-Clause (modified)
Does
Performance analytics
Markets
Options, Bonds, Futures
Best for
Options and fixed-income strategies that need correct pricing and greeks.
In AlgoGP
Use the exported strategy object from your own code

Pick it if

Options and fixed-income strategies that need correct pricing and greeks.

Watch out for

Large, verbose API.

QuantLib strengths and limitations

Strengths

  • Industry-standard models and conventions.
  • Mature and widely used.
  • Python bindings via SWIG.

Limitations

  • Large, verbose API.
  • No backtesting or execution.

QuantLib example

pip install QuantLib
Install
import QuantLib as ql
today = ql.Date(20, 11, 2026); ql.Settings.instance().evaluationDate = today
option = ql.EuropeanOption(ql.PlainVanillaPayoff(ql.Option.Call, 100), ql.EuropeanExercise(ql.Date(20, 11, 2027)))
spot = ql.QuoteHandle(ql.SimpleQuote(100))
rate = ql.YieldTermStructureHandle(ql.FlatForward(today, 0.04, ql.Actual365Fixed()))
vol = ql.BlackVolTermStructureHandle(ql.BlackConstantVol(today, ql.TARGET(), 0.2, ql.Actual365Fixed()))
option.setPricingEngine(ql.AnalyticEuropeanEngine(ql.BlackScholesProcess(spot, rate, vol)))
print(option.NPV())
European option price.

Use QuantLib with AlgoGP

AlgoGP does not add QuantLib to projects automatically yet, but nothing stops you using them together. Every AlgoGP project exports plain Python with a framework-neutral strategy object, so you can call it from QuantLib yourself.

  1. 1

    Design and backtest in AlgoGP

    Describe the idea to the copilot and backtest it on AlgoGP’s normalized history.

  2. 2

    Add any bridge to get the adapter core

    Adding a bridged framework (for example Backtrader) writes frameworks/algogp_bridge.py, whose StrategyBridge.on_bar() returns the orders the strategy wants.

  3. 3

    Call it from QuantLib

    Feed QuantLib’s bars to StrategyBridge, place the returned orders with QuantLib, and report fills back with sync().

QuantLib: frequently asked questions

Can QuantLib backtest options strategies?

It prices them; combine it with historical data (e.g. ThetaData or ORATS) and a backtester.

QuantLib alternatives

Independent guide. AlgoGP is not affiliated with QuantLib. Features, licenses and maintenance change; check the official documentation. Nothing here is investment advice.

Build a strategy