Barrier digital call (source code)

= Barrier digital call
{title2=$e^{-rT}\mathbb Q(\sup_{s\leq T}S_s\geq c)$}

A cash-at-maturity upper-barrier <digital option> pays a fixed amount if the stock touches an upper barrier by maturity. In the <Black-Scholes model>, write $a=\log(c/S_0)/\sigma$ and $b=-(r-\sigma^2/2)/\sigma$. Its unit-payoff price is $e^{-rT}$ times the <linear-boundary Brownian first-passage distribution> at $T$. This differs from paying at the hitting time, when the discount factor is random, and from an ordinary terminal-price <digital option>.