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#

S = np.linspace(50, 150, 201)
K, T, r, q, sigma = 100.0, 0.5, 0.05, 0.0, 0.25
g = black_scholes_greeks(S, K, T, r, sigma, q)
residual = g.theta + 0.5 * sigma**2 * S**2 * g.gamma + r * S * g.delta - r * black_scholes_price(S, K, T, r, sigma)
print(f"max PDE residual: {np.max(np.abs(residual)):.1e}")
max PDE residual: 2.7e-15

The Greeks of a call against spot#

axes = plot_greeks(S, g)
for ax in axes:
    ax.axvline(K, color="k", lw=0.5)
plt.gcf().tight_layout()

plt.show()
delta, gamma, vega, theta, rho, vanna

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

Gallery generated by Sphinx-Gallery