Note
Go to the end to download the full example code or to run this example in your browser via JupyterLite.
The Black-Scholes Greeks#
The Black-Scholes argument hedges an option with \(\Delta = \partial V/\partial S\) shares; the other partial derivatives measure how that hedge and the option’s value respond to everything else. The Greeks, named by traders after the 1973 paper, satisfy the pricing PDE itself,
\[\Theta + \tfrac12 \sigma^2 S^2 \Gamma + (r - q) S \Delta = r V,\]
so time decay is the price of positive gamma. Each analytic Greek is checked here against a finite difference of the price.
import matplotlib.pyplot as plt
import numpy as np
from financialkit.options import black_scholes_greeks, black_scholes_price, finite_difference_greeks
from financialkit.options.visualizers import plot_greeks
Hull’s Example 19.1, analytic and by finite differences#
args = (49.0, 50.0, 0.3846, 0.05, 0.20)
g = black_scholes_greeks(*args)
fd = finite_difference_greeks(black_scholes_price, *args)
for name in ("delta", "gamma", "vega", "theta", "rho", "epsilon", "vanna", "volga"):
print(f"{name:>7}: analytic {getattr(g, name):+10.5f} finite difference {getattr(fd, name):+10.5f}")
delta: analytic +0.52160 finite difference +0.52160
gamma: analytic +0.06555 finite difference +0.06555
vega: analytic +12.10524 finite difference +12.10524
theta: analytic -4.30539 finite difference -4.30539
rho: analytic +8.90657 finite difference +8.90657
epsilon: analytic -9.82979 finite difference -9.82979
vanna: analytic +0.13914 finite difference +0.13914
volga: analytic -0.22906 finite difference -0.22906
The PDE holds across spot#
max PDE residual: 2.7e-15
The Greeks of a call against spot#

Total running time of the script: (0 minutes 0.133 seconds)