Deep Hedging: Hedging Derivatives with Reinforcement Learning
Deep reinforcement learning framework for hedging derivatives under realistic market frictions including transaction costs, market impact, and risk limits.
Verdict
Framework from the paper (Quantitative Finance, 2019; arXiv 2018) for hedging a portfolio of derivatives under market frictions such as transaction costs, market impact, liquidity constraints or risk limits, using deep reinforcement learning. In the abstract, the authors report that, in a synthetic market driven by the Heston model with transaction costs, they outperform the standard "complete market" solution.
Practical Use
The paper presents a framework for hedging a portfolio of derivatives in the presence of market frictions such as transaction costs, market impact, liquidity constraints or risk limits. The abstract discusses how standard reinforcement learning methods can be applied to non-linear reward structures, in the authors' case convex risk measures. Per the abstract, its structure does not depend on specific market dynamics, and it generalizes across hedging instruments including the use of liquid derivatives. The hansbuehler/deephedging README calls the code a sample implementation whose purpose is to illustrate the concepts behind Deep Hedging, says it is not optimized for speed, and says any production use will require additional safeguards before use. It says running the code requires market data, which it calls a world; the sample code provides simplistic default implementations: a simple Black & Scholes world and a made up stochastic volatility world. PFHedge (github.com/pfnet-research/pfhedge) is a PyTorch-based framework for Deep Hedging and is MIT-licensed. The hansbuehler/deephedging repository (this page's code repo) is GPL-3.0-licensed. As of Oct 26, 2026, PFHedge's latest release is 0.23.0 (Aug 30, 2024).
Paper
https://arxiv.org/abs/1802.03042Hans Bühler, Lukas Gonon, Josef Teichmann, Ben Wood. Quantitative Finance, 2019
Code Repository
https://github.com/hansbuehler/deephedgingLicense
Custom. Code (hansbuehler/deephedging): GPL-3.0. Paper: arXiv non-exclusive distribution license (free to read; no reuse license).
Installation
pip install pfhedge