A derivatives pricing library with AD sensitivities and calibration
Hedgehog
Hedgehog is a modular, SciML-inspired derivatives pricing library in Julia.
📐 Design Overview
All pricing and calibration workflows follow a SciML-inspired solve(problem, method) interface.
To compute a price, you define a PricingProblem using:
- A payoff (e.g. European call, American put)
- A set of market inputs (e.g. Black-Scholes inputs, Heston inputs)
- Then solve it with a pricing method (e.g. Monte Carlo, analytical formula, Fourier inversion)
payoff = VanillaOption(...)
market = BlackScholesInputs(...)
problem = PricingProblem(payoff, market)
sol = solve(problem, BlackScholesAnalytic()) price = sol.price
✅ Supported Payoffs
- European Call / Put
- American Call / Put
🧠 Supported Models (Price Dynamics)
- Black-Scholes (
LognormalDynamics) - Heston (
HestonDynamics)
⚙️ Pricing Methods
- Analytical formulas (Black-Scholes)
- Binomial Trees (Cox–Ross–Rubinstein)
- Monte Carlo:
- Fourier methods (Carr–Madan)
📊 Calibration
Hedgehog supports calibration via a unified interface:
- Solve for implied volatility using
CalibrationProblem - Invert volatility surfaces
- Build fully calibrated
RectVolSurfaceobjects from price matrices
🧮 Sensitivities
- Greeks supported via a
GreekProbleminterface:
BatchGreekProblem to compute a full gradient of sensitivities
🚀 Highlights
- Modular by construction: models, payoffs, and methods are swappable
- Unified
solve(problem, method)interface across pricing and calibration - Inspired by the SciML architecture and ecosystem
- Built on top of SciML components (StochasticDiffEq.jl, NonlinearSolve.jl, Integrals.jl)
- Open-source and focused on prototyping cutting-edge methods
📦 Dependencies
Hedgehog is built on several high-quality Julia packages:
- StochasticDiffEq.jl - For stochastic simulation - NonlinearSolve.jl - For calibration and implied volatility - Integrals.jl - For Fourier-based pricing methods - Optimization.jl - For advanced calibration - DataInterpolations.jl - For volatility surfaces and rate curves- ForwardDiff.jl - Automatic differentiation for Greeks calculation
- Accessors.jl - Functional lens-based access for Greeks and calibration
- Distributions.jl - For statistical distributions and sampling
📖 Documentation
Complete documentation is available at https://alecombi.github.io/Hedgehog.jl/
🔍 Examples
Example scripts demonstrating Hedgehog's functionality can be found in the examples/ directory:
examples/- Standalone Julia scripts for various pricing scenariosexamples/notebooks/- Pluto notebooks for interactive exploration (in progress)
🔍 Related Packages
Hedgehog.jl builds on the ideas and complements a number of Julia packages for derivatives pricing. Here's how it compares:
🧰 FinancialDerivatives.jl
Implements classic models like Black-Scholes and binomial trees for vanilla options, with support for asian options too, which are not available in Hedgehog yet. Hedgehog aims at extending these ideas with automatic differentiation, calibration tools, and a modular problem-method interface.
🧰 CharFuncPricing.jl
Focused on Fourier-based pricing under models like Heston. It implements COS method, which is not in Hedgehog at the moment. Hedgehog includes characteristic function methods too with Carr-Madan, including them within a broader framework for simulation, calibration, and AD/FD sensitivities.
🧰 AQFED.jl
A deep and ambitious package accompanying a book on equity derivatives. Covers topics like basket options and rough paths. It has a deep coverage of cutting-edge methods. Hedgehog aims for a more modular and general-purpose architecture, designed for reuse and extensibility.
🧰 Bruno.jl
A promising package combining simulation, pricing, and delta hedging. However, it hasn’t been updated in over two years. Hedgehog is under active development and structured for long-term flexibility.
🧰 QuantLib.jl
A pure Julia port of the C++ QuantLib library. It offers broad model coverage but hasn’t been active in the last 5 years. Hedgehog focuses on modern Julia design, composability, and integration with scientific computing tools.
🦤 What Makes Hedgehog.jl Different?
- Modular design with SciML-style
solve(problem, method)interface - Automatic and finite difference Greeks, with lens-based parameter access (
Accessors.jl) - Built on Julia’s scientific stack, including
DifferentialEquations.jl - Actively developed with extensibility and composability as core design goals
👥 Collaboration
Contributions are welcome! If you have ideas for new features, models, or improvements, feel free to open an issue or submit a pull request.
You can also reach out to Alessandro Combi via the Julia Zulip chat for questions or discussion.