SigmaField

Practice Options

Compute Greeks by finite differences without the noise

Medium+25 pointsAbout 40 minutesOptions

The brief

An options desk gets its prices from a vendor library that rounds every price to 6 decimal places. Its risk system finds each call's delta and gamma by bumping the stock price by 1% and repricing.

For an at-the-money call a week from expiry, that bump gets gamma about 1.1% wrong. A 1-cent bump is no cure: rounding alone makes the gamma of the 6-month at-the-money call 8.0% wrong. The desk wants each option's bumps chosen to balance the two errors, and checked against the exact values.

Your task

  1. Write bumped_greeks(price, S, h): the pair (delta, gamma) from central differences of price, a function of the stock price alone, with a bump of h dollars. Raise ValueError unless 0<h<S0 < h < S.
  2. Write truncation_coefficients(price, S, pilot): the pair (b, a). The bumped delta is about Δ+bh2\Delta + b h^2 and the bumped gamma about Γ+ah2\Gamma + a h^2. Measure bb and aa from the two bumps pilot and pilot / 2.
  3. Write best_bumps(price, S, noise, pilot): the pair (h_delta, h_gamma), each chosen where its truncation error equals its rounding error. Each price is off by up to noise, so rounding moves the bumped delta by up to noiseh\frac{\text{noise}}{h}. It moves the bumped gamma by up to 4 noiseh2\frac{4\,\text{noise}}{h^2}.
  4. Write greek_report(book): one dict per option, with the keys h_delta, h_gamma, delta, gamma, delta_error and gamma_error. Price with vendor_call and take NOISE as its noise. Each error is the bumped Greek minus the exact one from bs_delta_gamma.

In best_bumps, never bump by more than the pilot, and use the pilot when a coefficient is 0. Raise ValueError if noise is not positive. In greek_report, use the pilot SσT5\frac{S\sigma\sqrt{T}}{5}: a fifth of the stock's typical move over the option's life.

The data

BOOK holds five European calls, each a dict of S, K, T, r and sigma. The code provides bs_call, the exact bs_delta_gamma and the rounded vendor_call. NOISE is half a unit in the sixth decimal place.

Hint: Where to start

Case study 2.8.4 bumps the stock both ways and reprices; use its central differences for delta and gamma. Lesson 2.8.1 gives their truncation errors, 16f′′′(x) h2\frac{1}{6}f'''(x)\,h^2 and 112f(4)(x) h2\frac{1}{12}f^{(4)}(x)\,h^2. Both grow like h2h^2, which is why one coefficient describes each.

Hint: Measuring the coefficients

With the pilot h0h_0, the bumped delta is about Δ+bh02\Delta + b h_0^2, and with h02\frac{h_0}{2} about Δ+14bh02\Delta + \frac{1}{4} b h_0^2. Subtract the two: the unknown Δ\Delta cancels and leaves 34bh02\frac{3}{4} b h_0^2. Gamma works the same way.

Hint: Balancing the errors

Lesson 2.8.1 picks the step where the truncation error equals the rounding ceiling. Here that is ∣b∣ h2=noiseh|b|\,h^2 = \frac{\text{noise}}{h} for delta and ∣a∣ h2=4 noiseh2|a|\,h^2 = \frac{4\,\text{noise}}{h^2} for gamma. Case study 2.8.4 explains why a noisier pricer needs a larger bump.