Skip to content

How to Calculate European Option Greeks by Hand and in Python

Original question

How do I calculate the Greeks for European call and put options using both analytical formulas and Python?
Differentiate the Black–Scholes price with respect to spot, volatility, calendar time, and the rate. Evaluate the resulting formulas at the same inputs used for the price. State the units for each Greek. A mathematical vega of 37.5237.52 corresponds to about 0.37520.3752 in option value for a one-percentage-point volatility increase.

Differentiate the price and check the units

Let τ=T−t\tau=T-t, let NN be the standard normal CDF and ϕ\phi its density, and assume zero dividends. Use
d1=log⁡(S/K)+(r+σ2/2)τστ,d2=d1−στ.d_1=\frac{\log(S/K)+(r+\sigma^2/2)\tau}{\sigma\sqrt{\tau}},\qquad d_2=d_1-\sigma\sqrt{\tau}.
From C=SN(d1)−Ke−rτN(d2)C=SN(d_1)-Ke^{-r\tau}N(d_2), the identity Sϕ(d1)=Ke−rτϕ(d2)S\phi(d_1)=Ke^{-r\tau}\phi(d_2) cancels the chain-rule terms in the spot derivative. Hence ΔC=N(d1)\Delta_C=N(d_1). Put–call parity C−P=S−Ke−rτC-P=S-Ke^{-r\tau} gives ΔP=N(d1)−1\Delta_P=N(d_1)-1, and differentiating either delta yields Γ=ϕ(d1)/(Sστ)\Gamma=\phi(d_1)/(S\sigma\sqrt{\tau}) for both. Differentiating with respect to volatility gives ν=Sϕ(d1)τ\nu=S\phi(d_1)\sqrt{\tau} for both.
Define a=−Sϕ(d1)σ/(2τ)a=-S\phi(d_1)\sigma/(2\sqrt{\tau}). Calendar theta is ΘC=a−rKe−rτN(d2)\Theta_C=a-rKe^{-r\tau}N(d_2) for the call and ΘP=a+rKe−rτN(−d2)\Theta_P=a+rKe^{-r\tau}N(-d_2) for the put. Finally, ρC=Kτe−rτN(d2)\rho_C=K\tau e^{-r\tau}N(d_2) and ρP=−Kτe−rτN(−d2)\rho_P=-K\tau e^{-r\tau}N(-d_2). These expressions assume positive spot, strike, time to maturity, and volatility.
To see why call delta simplifies, differentiate each term in C=SN(d1)−Ke−rτN(d2)C=SN(d_1)-Ke^{-r\tau}N(d_2). The derivative of the leading SS produces N(d1)N(d_1). The two CDF derivatives are proportional to the same ∂d1/∂S=∂d2/∂S\partial d_1/\partial S=\partial d_2/\partial S. Their coefficients cancel by the density identity above. Gamma then comes from differentiating the remaining N(d1)N(d_1). For the put you can use C−P=S−Ke−rτC-P=S-Ke^{-r\tau} and differentiate the parity equation. It immediately tells you that put delta is call delta minus one and that their gammas and vegas agree.

Evaluate the Greeks at one common set of inputs

Set S=K=100S=K=100, τ=1\tau=1, r=5%r=5\%, and σ=20%\sigma=20\%. The call and put deltas are approximately 0.63680.6368 and −0.3632-0.3632. Both gammas are approximately 0.018760.01876 and both vegas are approximately 37.5237.52 for a unit change in decimal volatility. The call theta is about −6.41-6.41 per year, or −0.0176-0.0176 per calendar day using a 365-day convention. The put theta is about −1.66-1.66 per year in this example. Multiply per-share Greeks by the contract multiplier to obtain exposures for one contract.

Python and finite-difference checks

from math import exp, log, sqrt from scipy.stats import norm def greeks(spot, strike, maturity, rate, vol, *, call=True): root_t = sqrt(maturity) d1 = (log(spot / strike) + (rate + vol**2 / 2) * maturity) / (vol * root_t) d2 = d1 - vol * root_t present_strike = strike * exp(-rate * maturity) density = norm.pdf(d1) sign = 1 if call else -1 return { "delta": sign * norm.cdf(sign * d1), "gamma": density / (spot * vol * root_t), "vega_per_point": spot * density * root_t / 100, "theta_per_day": ( -spot * density * vol / (2 * root_t) - sign * rate * present_strike * norm.cdf(sign * d2) ) / 365, "rho_per_point": sign * maturity * present_strike * norm.cdf(sign * d2) / 100, } print(greeks(100, 100, 1, 0.05, 0.20))
Change one input at a time in the options pricer if you want a visual check of the signs of delta and vega.

Interactive example

Move volatility and expiry in Black–Scholes

This European call uses strike 100, a continuously compounded risk-free rate of 5% and zero dividends. The benchmark spot is 100.

Price at spot 100 is 10.45 · delta 0.637
Call prices across spot prices compared with the expiry payoff01020307085100115130Spot priceValue
  • Call price today
  • Expiry payoff

References and next steps