σμimplied vol · KKmax(S−K,0)udβρᵢⱼfat tailsPnL · drawdownyield · TdSₜ = μSₜ dt + σSₜ dWₜC = S·N(d₁) − K·e⁻ʳᵀ·N(d₂)σₚ² = wᵀΣwd₁ = [ln(S/K) + (r + σ²⁄2)T] ⁄ σ√T∂V/∂t + ½σ²S²·∂²V/∂S² + rS·∂V/∂S − rV = 0Sharpe = (Rₚ − R_f) ⁄ σₚVaR₉₉ = μ − 2.33σρ = Cov(X,Y) ⁄ σₓσᵧE[Rₚ] = Σ wᵢ·E[Rᵢ]φ(x) = e^(−x²/2) ⁄ √2πE[Rᵢ] = R_f + βᵢ(E[Rₘ] − R_f)dXₜ = θ(μ − Xₜ)dt + σ dWₜσ²ₜ = ω + α·ε²ₜ₋₁ + β·σ²ₜ₋₁C − P = S − K·e⁻ʳᵀΔ = ∂V/∂S Γ = ∂²V/∂S²p = (e^(rΔt) − d) ⁄ (u − d)rₜ = ln(Pₜ ⁄ Pₜ₋₁)E[Xₜ₊₁ | ℱₜ] = Xₜf* = (bp − q) ⁄ bz = (x − μ) ⁄ σP(N=k) = λᵏe^(−λ) ⁄ k!Θ = −∂V/∂Tν = S·φ(d₁)·√Tmin wᵀΣw s.t. wᵀμ = μ*∫Σ∂∞λ
uantCraft AcademyRoadmapsSkills
Ctrl K
AO
+1.2k Learners
LoginJoin ↗
RoadmapsSkills
AO
+1.2k Learners
Login
  • English
  • Français
  • Español
  • العربية
  • Português
  • Deutsch
  • 日本語
  • 中文
σμimplied vol · KKmax(S−K,0)udβρᵢⱼfat tailsPnL · drawdownyield · TdSₜ = μSₜ dt + σSₜ dWₜC = S·N(d₁) − K·e⁻ʳᵀ·N(d₂)σₚ² = wᵀΣwd₁ = [ln(S/K) + (r + σ²⁄2)T] ⁄ σ√T∂V/∂t + ½σ²S²·∂²V/∂S² + rS·∂V/∂S − rV = 0Sharpe = (Rₚ − R_f) ⁄ σₚVaR₉₉ = μ − 2.33σρ = Cov(X,Y) ⁄ σₓσᵧE[Rₚ] = Σ wᵢ·E[Rᵢ]φ(x) = e^(−x²/2) ⁄ √2πE[Rᵢ] = R_f + βᵢ(E[Rₘ] − R_f)dXₜ = θ(μ − Xₜ)dt + σ dWₜσ²ₜ = ω + α·ε²ₜ₋₁ + β·σ²ₜ₋₁C − P = S − K·e⁻ʳᵀΔ = ∂V/∂S Γ = ∂²V/∂S²p = (e^(rΔt) − d) ⁄ (u − d)rₜ = ln(Pₜ ⁄ Pₜ₋₁)E[Xₜ₊₁ | ℱₜ] = Xₜf* = (bp − q) ⁄ bz = (x − μ) ⁄ σP(N=k) = λᵏe^(−λ) ⁄ k!Θ = −∂V/∂Tν = S·φ(d₁)·√Tmin wᵀΣw s.t. wᵀμ = μ*∫Σ∂∞λ
uantCraft AcademyRoadmapsSkills
Ctrl K
AO
+1.2k Learners
LoginJoin ↗
RoadmapsSkills
AO
+1.2k Learners
Login
  • English
  • Français
  • Español
  • العربية
  • Português
  • Deutsch
  • 日本語
  • 中文
Stochastic Calculus skill›Module 5 · Simulation and practice›Topic 5.2·~1 hr 40 minAdvanced

Capstone: simulate price and hedge with discrete rebalancing

Skill positionModule 5 of 5 · Topic 2 of 2
5.2 Capstone: simulate price and hedge with discrete rebalancing
—Lab score— / 100Total XP—Streak—

From a model to a hedge

An option is worth what it costs to hedge it. This lab walks through the whole chain on SPY prices. First estimate a geometric Brownian motion from the daily returns. The volatility σ is the standard deviation of the returns scaled to a year. The drift of the price is μ=r̄·252+σ²/2: the extra σ²/2 comes from Itô's lemma, because the log price grows more slowly than the price itself. Then simulate paths from a matrix of normal draws, once with the exact scheme and once with the Euler scheme. The same draws feed both, so you can compare them path by path.

Sₖ₊₁=Sₖ e^((μ-σ²/2)h+σ√h z), Sₖ₊₁=Sₖ (1+μh+σ√h z), h=T/n

Next, price a call two ways. The Black-Scholes formula is the exact average under the risk-neutral measure. Monte Carlo reaches it by simulating with the drift r, averaging the payoff and discounting. It is never exact: it is off by about its standard error. Finally, hedge. Sell the call, buy Δ shares and keep the rest in cash. At each rebalancing date, let the cash grow at the rate r, recompute Δ with the time that is left and trade to it. The error at maturity is what the hedge leaves behind.

Vₙ=C₀exp(rT)+ΣⱼΔⱼ₋₁(Sⱼ-Sⱼ₋₁exp(rh))exp(r(T-tⱼ)), e=Vₙ-max(Sₙ-K,0)
What the real data saysSPY since 2005 gives μ≈11.6% and σ≈19.0% a year. For a stock at 100 and strike 100, a call with three months to run is worth about 4.03 and has a delta of 0.54. In the simulated market the standard deviation of the hedging error is 1.79 with 3 rebalances, 1.08 with 9, 0.70 with 21 and 0.44 with 63. It falls roughly like 1/√n. On the 85 real quarters it is 1.81, 1.71, 1.59 and 1.74: more rebalancing does not help. The reason is that volatility is not constant. The realised volatility of a quarter ranged from 6% to 70%, and the hedge used 19% every time.
  • Exact and Euler: the same draws give two paths. The gap between them is the discretisation error of the last topic.
  • Price = cost of the hedge: with continuous trading the hedge is perfect, with few rebalances an error of order 1/√n is left.
  • The real error is a volatility error: rebalancing more often cannot fix a wrong σ.
Simplifications to rememberThe rate is fixed at 2%, and there are no trading costs or dividends. The hedge uses the volatility of the whole sample, which no trader knew in advance, so the real errors are if anything too kind. The 85 quarters are few, and they are not independent of the market regime. What matters here is the ordering of the results, not the dollar figures.

Lab · what's graded

  • Estimate the model10 pts
  • Exact paths15 pts
  • Euler paths10 pts
  • The Black-Scholes call15 pts
  • The delta5 pts
  • Monte Carlo price10 pts
  • The hedge25 pts
  • The hedging study10 pts
Explorer · lab-so-09
▾ lab-so-09
▾ data
…
bash · in-browser
learner@quantcraft:~/lab-so-09$
Python not loaded yetPythonLn 1, Col 1Spaces: 4UTF-8

Reset this topic?

Everything in lab-so-09 goes back to the starter files and the terminal is cleared. Your current solution will be lost — this can't be undone.

Will be reset
  • main.py → starter code
  • Terminal history and test output
  • Unsubmitted changes
Will be kept
  • Best lab score
  • Your XP and streak
  • Lecture progress and notes

Log in to run your code.

Every lecture is free to read. Create an account or log in to run code, run tests and submit this lab.

  • In-browser IDE with a bash terminal — nothing to install
  • Instant grading, XP and your place on the skill
Create an accountLog in
OR
Continue with GitHub