Cash digital delta: ∂V_cash/∂S = e^{-rτ} · ϕ(d₂) / (S σ √τ). Direct chain rule on Φ(d₂(S)).
ℝ → ℝ → ℝ → ℝ → ℝ → ℝ
Cash-or-nothing digital call price as a function of (S, τ).
For the two digital (binary) European options:
V_cash(S, τ) = e^{-rτ} Φ(d₂).V_asset(S, τ) = S Φ(d₁).We derive their deltas and gammas:
hasDerivAt_bsCashDigital_S — δ_cash = e^{-rτ} ϕ(d₂) / (S σ √τ).hasDerivAt_bsAssetDigital_S — δ_asset = Φ(d₁) + ϕ(d₁) / (σ √τ).hasDerivAt_deriv_bsAssetDigital_S — γ_asset = -ϕ(d₁) · d₂ / (S σ² τ).hasDerivAt_deriv_bsCashDigital_S — γ_cash = -e^{-rτ} ϕ(d₂) · d₁ / (S² σ² τ).(δ_asset is the product rule on S · Φ(d₁(S)), with S · ϕ(d₁) · ∂_S d₁ = ϕ(d₁)/(σ√τ); γ_asset collapses via σ√τ − d₁ = -d₂, and γ_cash via d₂ + σ√τ = d₁. Each gamma differentiates its delta's formula (hasDerivAt_bsAssetDigital_SS, hasDerivAt_bsCashDigital_SS) before hasDerivAt_deriv_of_eventually makes it a statement about the price.)
The strike derivative of the cash digital, −e^{-rτ} ϕ(d₂) / (K σ √τ), is hasDerivAt_bsCashDigital_K in StrikeGreeks.lean.
bsCashDigital: the cash-or-nothing call price e^{−rτ} Φ(d₂) as a function of (S, τ).bsAssetDigital: the asset-or-nothing call price S Φ(d₁) as a function of (S, τ).hasDerivAt_bsCashDigital_S, hasDerivAt_bsAssetDigital_S: the deltas e^{−rτ} ϕ(d₂) / (S σ √τ) and Φ(d₁) + ϕ(d₁) / (σ √τ), for positive K, σ, S, τ.hasDerivAt_deriv_bsCashDigital_S, hasDerivAt_deriv_bsAssetDigital_S: the gammas −e^{−rτ} ϕ(d₂) d₁ / (S² σ² τ) and −ϕ(d₁) d₂ / (S σ² τ), as derivatives of the delta.hasDerivAt_bsCashDigital_sigma, hasDerivAt_bsAssetDigital_sigma: the vegas −e^{−rτ} ϕ(d₂) d₁ / σ and −S ϕ(d₁) d₂ / σ.hasDerivAt_bsCashDigital_r, hasDerivAt_bsAssetDigital_r: the rhos e^{−rτ} (ϕ(d₂) √τ/σ − τ Φ(d₂)) and S ϕ(d₁) √τ/σ.hasDerivAt_bsCashDigital_tau, hasDerivAt_bsAssetDigital_tau: the τ-derivatives (thetas in the maturity variable) of the two prices.digital option, binary option Greeks, delta and gamma, cash-or-nothing, asset-or-nothing, MSC 91G20, JEL G13
Above: what it imports. Below: what imports it.
Cash digital delta: ∂V_cash/∂S = e^{-rτ} · ϕ(d₂) / (S σ √τ). Direct chain rule on Φ(d₂(S)).
Asset digital delta: ∂V_asset/∂S = Φ(d₁) + ϕ(d₁) / (σ √τ). Product rule on S · Φ(d₁(S)).
Asset-or-nothing digital gamma: the second S-derivative of the asset-digital price, ∂²V_asset/∂S² = -ϕ(d₁)·d₂/(S σ² τ); the Φ-term and pdf-term contributions of the delta Φ(d₁) + ϕ(d₁)/(σ√τ) collapse via σ√τ − d₁ = -d₂.
Cash-or-nothing digital gamma: the second S-derivative of the cash-digital price, ∂²V_cash/∂S² = -e^{-rτ}·ϕ(d₂)·d₁/(S² σ² τ); differentiating the delta e^{-rτ}·ϕ(d₂)/(S·σ·√τ) is a quotient rule collapsed via d₂ + σ√τ = d₁.
Asset digital rho: ∂_r V_asset = S · ϕ(d₁) · √τ/σ. Direct chain rule using ∂_r d₁ = √τ/σ.
Cash digital rho: ∂_r V_cash = e^{-rτ}·(ϕ(d₂)·√τ/σ − τ·Φ(d₂)). Product rule on e^{-rτ}·Φ(d₂(r)).
Asset digital vega: ∂_σ V_asset = -S · ϕ(d₁) · d₂ / σ. Chain rule with ∂_σ d₁ = -d₂/σ via bsd2_eq.
Cash digital vega: ∂_σ V_cash = -e^{-rτ} · ϕ(d₂) · d₁ / σ. Chain rule with ∂_σ d₂ = -d₁/σ.
Asset digital theta: ∂_τ V_asset = S · ϕ(d₁) · ((r + σ²/2)τ − log(S/K))/(2στ√τ). Direct chain rule.
Cash digital theta: ∂_τ V_cash = -r·e^{-rτ}·Φ(d₂) + e^{-rτ}·ϕ(d₂)·∂_τ d₂. Product rule on e^{-rτ}·Φ(d₂(τ)).
ℝ → ℝ → ℝ → ℝ → ℝ → ℝ
Cash-or-nothing digital call price as a function of (S, τ).
ℝ → ℝ → ℝ → ℝ → ℝ → ℝ
Asset-or-nothing digital call price as a function of (S, τ).
∀ {K r σ : ℝ}, 0 < K → 0 < σ → ∀ {S τ : ℝ}, 0 < S → 0 < τ → HasDerivAt (fun s => bsCashDigital K r σ s τ) (Real.exp (-(r * τ)) * gaussianPDFReal 0 1 (bsd2 S K r σ τ) / (S * σ * √τ)) SCash-or-nothing delta: ∂_S V_cash = e^{-rτ} ϕ(d₂) / (S σ √τ).
Direct chain rule on Φ ∘ d₂(S).
∀ {K r σ : ℝ}, 0 < K → 0 < σ → ∀ {S τ : ℝ}, 0 < S → 0 < τ → HasDerivAt (fun s => bsAssetDigital K r σ s τ) (Phi (bsd1 S K r σ τ) + gaussianPDFReal 0 1 (bsd1 S K r σ τ) / (σ * √τ)) SAsset-or-nothing delta: ∂_S V_asset = Φ(d₁) + ϕ(d₁) / (σ √τ).
The chain rule gives Φ(d₁) + S · ϕ(d₁) · ∂_S d₁ = Φ(d₁) + S · ϕ(d₁) · 1/(S σ √τ) = Φ(d₁) + ϕ(d₁) / (σ √τ).
∀ {K r σ : ℝ}, 0 < K → 0 < σ → ∀ {S τ : ℝ}, 0 < S → 0 < τ → HasDerivAt (deriv fun s => bsAssetDigital K r σ s τ) (-(gaussianPDFReal 0 1 (bsd1 S K r σ τ) * bsd2 S K r σ τ / (S * σ ^ 2 * τ))) SAsset-or-nothing gamma: ∂²V_asset/∂S² = -ϕ(d₁) · d₂ / (S σ² τ), for the price itself: δ_asset is ∂V_asset/∂S on all of S > 0 (hasDerivAt_bsAssetDigital_S), and its derivative is the gamma formula (hasDerivAt_bsAssetDigital_SS).
∀ (S K r σ : ℝ), 0 < σ → ∀ {τ : ℝ}, 0 < τ → HasDerivAt (fun t => bsAssetDigital K r σ S t) (S * gaussianPDFReal 0 1 (bsd1 S K r σ τ) * (((r + σ ^ 2 / 2) * τ - Real.log (S / K)) / (2 * σ * τ * √τ))) τAsset-or-nothing theta: ∂_τ V_asset = S · ϕ(d₁) · ∂_τ d₁.
Direct chain rule. The Lean form of ∂_τ d₁ is ((r + σ²/2)τ − log(S/K)) / (2 σ τ √τ); this equals the textbook clean form (r + σ²/2)/(σ√τ) − d₁/(2τ) by algebraic identity (left to the consumer).
∀ (S K r σ : ℝ), 0 < σ → ∀ {τ : ℝ}, 0 < τ → HasDerivAt (fun t => bsCashDigital K r σ S t) (-r * Real.exp (-(r * τ)) * Phi (bsd2 S K r σ τ) + Real.exp (-(r * τ)) * gaussianPDFReal 0 1 (bsd2 S K r σ τ) * (((r + σ ^ 2 / 2) * τ - Real.log (S / K)) / (2 * σ * τ * √τ) - σ / (2 * √τ))) τCash-or-nothing theta: ∂_τ V_cash = -r · e^{-rτ} · Φ(d₂) + e^{-rτ} · ϕ(d₂) · ∂_τ d₂.
Product rule on V_cash(τ) = e^{-rτ} · Φ(d₂(τ)):
∂_τ e^{-rτ} = -r · e^{-rτ}∂_τ Φ(d₂(τ)) = ϕ(d₂) · ∂_τ d₂. ∀ (S K r : ℝ) {σ τ : ℝ}, 0 < σ → 0 < τ → HasDerivAt (fun σ' => bsAssetDigital K r σ' S τ) (-(S * gaussianPDFReal 0 1 (bsd1 S K r σ τ) * bsd2 S K r σ τ / σ)) σAsset-or-nothing vega: ∂_σ V_asset = -S · ϕ(d₁) · d₂ / σ.
Chain rule on Φ ∘ d₁. The Lean form of ∂_σ d₁ is (σ²τ/2 − log(S/K) − rτ)/(σ²√τ), which equals -d₂/σ via bsd2_eq.
∀ (S K : ℝ) {r σ τ : ℝ}, 0 < σ → 0 < τ → HasDerivAt (fun σ' => bsCashDigital K r σ' S τ) (-(Real.exp (-(r * τ)) * gaussianPDFReal 0 1 (bsd2 S K r σ τ) * bsd1 S K r σ τ / σ)) σCash-or-nothing vega: ∂_σ V_cash = -e^{-rτ} · ϕ(d₂) · d₁ / σ.
Chain rule on Φ ∘ d₂. The Lean form of ∂_σ d₂ = ∂_σ d₁ − √τ equals -d₁/σ via bsd2_eq plus the identity bsd2 + σ√τ = bsd1.
∀ (S K σ : ℝ), 0 < σ → ∀ {τ : ℝ}, 0 < τ → ∀ (r : ℝ), HasDerivAt (fun r' => bsAssetDigital K r' σ S τ) (S * gaussianPDFReal 0 1 (bsd1 S K r σ τ) * (√τ / σ)) rAsset-or-nothing rho: ∂_r V_asset = S · ϕ(d₁) · √τ / σ.
Direct chain rule since ∂_r d₁ = √τ/σ (the difference d₁ − d₂ is r-independent).
∀ (S K σ : ℝ), 0 < σ → ∀ {τ : ℝ}, 0 < τ → ∀ (r : ℝ), HasDerivAt (fun r' => bsCashDigital K r' σ S τ) (Real.exp (-(r * τ)) * (gaussianPDFReal 0 1 (bsd2 S K r σ τ) * (√τ / σ) - τ * Phi (bsd2 S K r σ τ))) rCash-or-nothing rho: ∂_r V_cash = e^{-rτ} · (ϕ(d₂) · √τ/σ − τ · Φ(d₂)).
Product rule on V_cash(r) = e^{-rτ} · Φ(d₂(r)):
∂_r e^{-rτ} = -τ · e^{-rτ}∂_r Φ(d₂(r)) = ϕ(d₂) · √τ/σ. ∀ {K r σ : ℝ}, 0 < K → 0 < σ → ∀ {S τ : ℝ}, 0 < S → 0 < τ → HasDerivAt (deriv fun s => bsCashDigital K r σ s τ) (-(Real.exp (-(r * τ)) * gaussianPDFReal 0 1 (bsd2 S K r σ τ) * bsd1 S K r σ τ / (S ^ 2 * σ ^ 2 * τ))) SCash-or-nothing gamma: ∂²V_cash/∂S² = -e^{-rτ} · ϕ(d₂) · d₁ / (S² σ² τ), for the price itself: δ_cash is ∂V_cash/∂S on all of S > 0 (hasDerivAt_bsCashDigital_S), and its derivative is the gamma formula (hasDerivAt_bsCashDigital_SS).