Guide 01 Closed forms and their sensitivities

Pricing and Greeks

Black–ScholesBlackbinariesGreekscomputed at build time

Black and Scholes model

In the Black and Scholes model (Black and Scholes) the prices of a European call and of a European put are

\[C_{bs}(S, K, r, T, \sigma, d) = S e^{-d T} N(d_1) - K e^{-r T} N(d_2), \qquad P_{bs}(S, K, r, T, \sigma, d) = K e^{-r T} N(-d_2) - S e^{-d T} N(-d_1)\]

where $N$ is the cumulative distribution function of a standard Gaussian random variable (normcdf) and

\[d_1 = \frac{\ln\left(\frac{S}{K}\right) + \left(r - d + \frac{\sigma^2}{2}\right) T}{\sigma\sqrt{T}}, \qquad d_2 = d_1 - \sigma\sqrt{T}\]

with:

  • $S$ the spot price of the underlying;
  • $K$ the strike price;
  • $r$ the risk free rate;
  • $T$ the time to maturity;
  • $\sigma$ the volatility of the underlying;
  • $d$ the dividend yield of the underlying.

blsprice takes the arguments in this order, and a last argument that is true for a call (the default) and false for a put:

using FinancialToolbox
S = 100.0; K = 100.0; r = 0.02; T = 1.2; σ = 0.2; d = 0.01
price_call = blsprice(S, K, r, T, σ, d)
9.169580760087895
price_put = blsprice(S, K, r, T, σ, d, false)
7.990980449685762

The two prices satisfy the put-call parity $C - P = S e^{-d T} - K e^{-r T}$:

price_call - price_put ≈ S * exp(-d * T) - K * exp(-r * T)
true

blsbin prices the binary (cash-or-nothing) option paying 1, $e^{-r T} N(\pm d_2)$:

blsbin(S, K, r, T, σ, d), blsbin(S, K, r, T, σ, d, false)
(0.46682072807488145, 0.5094649816830278)

Barrier options are combinations of these two functions, see Barrier options.

Black model

The Black model (Black) prices options on a forward $F$:

\[C_{bk}(F, K, r, T, \sigma) = e^{-r T} \left(F N(d_1) - K N(d_2)\right), \qquad P_{bk}(F, K, r, T, \sigma) = e^{-r T} \left(K N(-d_2) - F N(-d_1)\right)\]

\[d_1 = \frac{\ln\left(\frac{F}{K}\right) + \frac{\sigma^2}{2} T}{\sigma\sqrt{T}}, \qquad d_2 = d_1 - \sigma\sqrt{T}\]

F = 100.0; K = 102.0
blkprice(F, K, r, T, σ), blkprice(F, K, r, T, σ, false)
(7.6599239845829, 9.612495404098706)

It is the Black and Scholes price with the forward as spot and a dividend yield equal to the rate:

blkprice(F, K, r, T, σ) ≈ blsprice(F, K, r, T, σ, r)
true

Greeks

The sensitivities of the Black and Scholes price take the same arguments as blsprice:

FunctionGreekDefinition
blsdeltadelta$\partial_S V$
blsgammagamma$\partial^2_S V$
blsvegavega$\partial_\sigma V$
blsrhorho$\partial_r V$
blsthetatheta$-\partial_T V$
blspsipsi$\partial_d V$
blslambdalambda$\partial_S V \, S / V$
blsvannavanna$\partial_S \partial_\sigma V$

Price, delta, gamma and vega of a call and a put as functions of the spotPrice, delta, gamma and vega of a call and a put as functions of the spot

K = 100.0
greeks = (blsdelta, blsgamma, blsvega, blsrho, blstheta, blspsi, blslambda, blsvanna)
[nameof(f) => (f(S, K, r, T, σ, d), f(S, K, r, T, σ, d, false)) for f in greeks]
8-element Vector{Pair{Symbol, Tuple{Float64, Float64}}}:
  :blsdelta => (0.5585165356757604, -0.42955517718617015)
  :blsgamma => (0.017750677670750958, 0.017750677670750958)
   :blsvega => (42.6016264098023, 42.6016264098023)
    :blsrho => (56.018487368985774, -61.13579780196334)
  :blstheta => (-3.925260454624194, -2.960760747970306)
    :blspsi => (-67.02198428109125, 51.546621262340416)
 :blslambda => (6.090971335426753, -5.375500289242506)
  :blsvanna => (0.10650406602450574, 0.10650406602450574)

The closed form Greeks agree with automatic differentiation of the price, here with ForwardDiff.jl:

using ForwardDiff
ForwardDiff.gradient(x -> blsprice(x[1], K, x[2], x[3], x[4], x[5]), [S, r, T, σ, d])  # S, r, T, σ, d
5-element Vector{Float64}:
   0.5585165356757609
  56.018487368985824
   3.9252604546241945
  42.6016264098023
 -67.02198428109129
[blsdelta(S, K, r, T, σ, d), blsrho(S, K, r, T, σ, d), -blstheta(S, K, r, T, σ, d), blsvega(S, K, r, T, σ, d), blspsi(S, K, r, T, σ, d)]
5-element Vector{Float64}:
   0.5585165356757604
  56.018487368985774
   3.925260454624194
  42.6016264098023
 -67.02198428109125