---
title: "Fourier Pricing and Calibration Engineering"
book: "Derivatives and Volatility"
subject: quant
language: en
chapter: 24
exercises: 8
source: https://one-course.com/books/quant/5/en/chapter/24-fourier-pricing-and-calibration-engineering
---

# Chapter 24 — Fourier Pricing and Calibration Engineering

Every morning a job fits a [Heston model](https://one-course.com/books/quant/5/en/chapter/10-stochastic-volatility#def-dv-stochastic-volatility-heston) to twenty option quotes. On day 58 of this chapter’s synthetic market the fitted [volatility of volatility](https://one-course.com/books/quant/5/en/chapter/10-stochastic-volatility#def-dv-stochastic-volatility-sv) is 0.51; on day 59 it is 0.28, with the fit error unchanged at 0.31 volatility point. Nothing happened in the market that the quotes can see: the move is noise, amplified by a direction in parameter space along which the fit barely changes. But the exotics priced with the model see it. The convexity adjustment of a one-year [volatility swap](https://one-course.com/books/quant/5/en/chapter/14-variance-swaps-and-volatility-derivatives#def-dv-variance-swaps-and-volatility-derivatives-volswap) falls from 1.32 to 0.39 volatility point overnight, and a desk that marks its book this way books a profit or loss that no hedge can explain. This chapter covers the two halves of the job: pricing fast enough from a characteristic function to calibrate on it, and calibrating in a way whose output a desk can use from one day to the next.

## 24.1 Pricing by transform

Chapters 10 and 13 wrote every model through the characteristic function $\varphi(u)=\E[e^{iux_T}]$ of $x_T=\ln(S_T/F)$, and priced with one integral. That integral comes from Parseval’s identity.

**Definition 24.1 (Lewis formula).**

The *Lewis formula* prices a European call from the characteristic function of $x_T$ along the line $\operatorname{Im}u=-\frac12$: with $k=\ln(K/F)$,

$$
C=P(0,T)\Bigl(F-\frac{\sqrt{FK}}{\pi}\int_0^\infty\operatorname{Re}\bigl(e^{-iuk}\varphi(u-\tfrac i2)\bigr)\frac{du}{u^2+\frac14}\Bigr).
$$

**Proposition 24.2 (Derivation).**

With $g(x)=\min(e^x,e^k)$, $F-C/P(0,T)=F\,\E[g(x_T)]$. For $0<\operatorname{Im}z<1$ the transform $\hat g(z)=\int e^{izx}g(x)\,dx$ is

$$
\hat g(z)=\int_{-\infty}^k e^{(1+iz)x}dx+e^k\int_k^\infty e^{izx}dx=\frac{e^{(1+iz)k}}{1+iz}-\frac{e^{(1+iz)k}}{iz}=\frac{e^{(1+iz)k}}{z^2-iz},
$$

and Parseval’s identity gives $\E[g(x_T)]=\frac1{2\pi}\int\varphi(-z)\hat g(z)\,du$ along $z=u+\frac i2$. There $z^2-iz=u^2+\frac14$ and $e^{(1+iz)k}=e^{k/2}e^{iuk}$. Changing $u$ to $-u$ and folding the integral onto $u>0$ gives the formula, since $Fe^{k/2}=\sqrt{FK}$.

The same argument prices any payoff whose transform is known on a strip, which is Lewis’s point. A second route damps the call itself.

**Definition 24.3 (Carr–Madan formula).**

The *Carr–Madan formula* writes the damped call $e^{\alpha k}C(k)$, $\alpha>0$, as a Fourier integral in the log-strike: with $F=1$,

$$
C(k)=\frac{e^{-\alpha k}}{\pi}\int_0^\infty\operatorname{Re}\bigl(e^{-ivk}\psi(v)\bigr)dv,\qquad
\psi(v)=\frac{P(0,T)\,\varphi\bigl(v-(\alpha+1)i\bigr)}{\alpha^2+\alpha-v^2+i(2\alpha+1)v},
$$

which on a grid in $v$ and $k$ is a discrete Fourier transform: the fast Fourier transform returns the calls on a whole grid of log-strikes at once.

The COS method (One Quant Book 4, chapter 28) takes a third route. It expands the density of $\ln(S_T/K)$ in a cosine series on a truncated interval $[a,b]$. The coefficients come from $\varphi$ directly, and the put’s payoff integrates against each cosine in closed form. For smooth densities the error falls exponentially in the number of terms.

**Example 24.4 (Three pricers, one smile).**

One-year calls in chapter 10’s base [Heston model](https://one-course.com/books/quant/5/en/chapter/10-stochastic-volatility#def-dv-stochastic-volatility-heston), at 17 strikes from 60 to 140, against a reference (the Lewis integral by Gauss–Legendre panels to $u=1\,000$, accurate to about $10^{-9}$; at the money it gives 6.7509). The COS method’s largest error is 0.012 with 64 terms, $8.6\times10^{-5}$ with 128 and $4.1\times10^{-7}$ with 256. Carr–Madan with interpolation between the grid’s log-strikes reaches $2.1\times10^{-4}$ with 1 024 points, $1.8\times10^{-6}$ with 4 096, and stalls near $2\times10^{-7}$ ([Figure 24.1](#fig-dv-fourier-pricing-and-calibration-engineering-transform)). The truncation interval matters as much as the terms. With $[a,b]$ at twelve standard deviations instead of sixteen, COS stops at $3.0\times10^{-5}$ however many terms it gets, because Heston’s left tail is fatter than a normal’s.

![Largest error over 17 strikes of a one-year Heston call against the number of terms or grid points: COS converges exponentially to the reference; the FFT converges fast and then stalls on its interpolation and damping errors. Data: the tutorial.](https://one-course.com/images/onecourse/chapters/quant-5/dv-fourier-pricing-and-calibration-engineering/fig-42439d48cddb.svg)

***Figure 24.1.** Largest error over 17 strikes of a one-year Heston call against the number of terms or grid points: COS converges exponentially to the reference; the FFT converges fast and then stalls on its interpolation and damping errors. Data: the tutorial.*

For calibration the choice is practical. COS prices the strikes a desk quotes, where they are, in a few hundred operations each. The FFT prices a fixed grid, and quoted strikes need interpolation. A smile of five strikes costs 800 characteristic-function evaluations by COS with 160 terms, and 4 096 by the FFT. A Levenberg–Marquardt calibration needs six residual evaluations per iteration (five for the Jacobian, one for the step) and, started from yesterday, about eight iterations: some two hundred smiles.

## 24.2 Calibration as a pipeline

Book 4, chapter 24 treated calibration as an inverse problem. On a desk it is a job that runs every morning on data nobody has checked. The build is a pipeline with five stages, each with its own failure modes.

1. **Quotes.** Bid and ask volatilities by expiry and strike, with the forward and the discount curve. A quote set is a snapshot, kept, so that any past calibration can be rerun.
2. **Filter.** Drop quotes with no bid, crossed quotes (bid above ask), stale ones (spreads too wide to carry information) and strikes too far out to matter. The synthetic market of this chapter corrupts one quote a day each way. The filter drops those two and keeps the other eighteen.
3. **Objective.** Weighted errors, and optionally a penalty (next sections).
4. **Optimiser.** Levenberg–Marquardt, started from yesterday’s parameters, in unconstrained coordinates $z=(\ln v_0,\ln\kappa,\ln\bar v,\ln\eta,\operatorname{artanh}\rho)$ so that every step is admissible.
5. **Diagnostics.** Fit error overall and by expiry, the condition number of the Jacobian, parameter changes against limits. An alarm stops the parameters from reaching the pricers until someone looks.

## 24.3 Objective, weights and constraints

Calibrating in implied volatility is natural, since that is how errors are judged. But each residual then needs an implied-volatility inversion. Calibrating in price is faster and needs a weight per quote.

**Definition 24.5 (Vega weighting).**

*Vega weighting* divides each price error by the Black [vega](https://one-course.com/books/quant/5/en/chapter/4-greeks-and-the-hedging-p-l#def-dv-greeks-and-the-hedging-pnl-greeks) of its quote, so that $(C^{\text{model}}-C^{\text{mid}})/
\mathcal V\approx\sigma^{\text{model}}-\sigma^{\text{mid}}$: a price calibration then minimises implied-volatility errors to first order, without inverting.

Without weights, price errors on long-dated at-the-money options dominate, since their [vegas](https://one-course.com/books/quant/5/en/chapter/4-greeks-and-the-hedging-p-l#def-dv-greeks-and-the-hedging-pnl-greeks) are largest.

**Example 24.6 (What the weights buy).**

On the first day of the synthetic market (four expiries from one month to one year, five strikes each, eighteen after the filter), the Heston fit’s root-mean-square error by expiry, in volatility points, is:

| weights | 1 month | 3 months | 6 months | 1 year | all |
| --- | --- | --- | --- | --- | --- |
| [vega](https://one-course.com/books/quant/5/en/chapter/4-greeks-and-the-hedging-p-l#def-dv-greeks-and-the-hedging-pnl-greeks) | 0.35 | 0.21 | 0.14 | 0.11 | 0.22 |
| equal (price errors) | 0.46 | 0.15 | 0.12 | 0.06 | 0.24 |

Equal weights buy a better one-year fit with a worse one-month one. At the money a one-month option’s [vega](https://one-course.com/books/quant/5/en/chapter/4-greeks-and-the-hedging-p-l#def-dv-greeks-and-the-hedging-pnl-greeks) is the one-year’s divided by $\sqrt{12}$, so in price its errors count twelve times less.

Constraints come from the model and from the desk. The transformation keeps $v_0,\kappa,\bar v,\eta>0$ and $|\rho|<1$. The Feller condition is not imposed. It fails in most equity calibrations, including this one ($2\kappa\bar v=0.19$ against $\eta^2=0.24$), and the simulation schemes of chapter 23 are built for that case.

## 24.4 Stability from day to day

A calibration can reproduce the quotes perfectly and still be useless, if a small change in the quotes moves the parameters a lot. Cont and Ben Hamida showed that the in-sample error can have many near-global minima, so that the calibration problem is ill-posed. The fit error then says nothing about which minimum was picked.

**Example 24.7 (A flat valley).**

The first day’s fit is $v_0=0.0451$, $\kappa=1.82$, $\bar v=0.0518$, $\eta=0.488$, $\rho=-0.632$, with an error of 0.22 volatility point. Holding $\eta$ fixed and refitting the other four gives errors of 0.29 at $\eta=0.35$, 0.23 at 0.45 and 0.55, and 0.27 at 0.65 ([Figure 24.2](#fig-dv-fourier-pricing-and-calibration-engineering-valley), left). Across the whole range the error moves by less than the quotes’ noise of 0.3 volatility point, while $\kappa$ moves along with $\eta$. The market data (a [Bates model](https://one-course.com/books/quant/5/en/chapter/13-jumps-and-levy-models#def-dv-jumps-and-levy-models-bates), chapter 13, with noise) cannot tell these [Heston models](https://one-course.com/books/quant/5/en/chapter/10-stochastic-volatility#def-dv-stochastic-volatility-heston) apart.

![Left: the best fit error with the volatility of volatility held fixed, first day; the dashed line is the quotes’ noise. Right: the fitted ( , ) over 60 days without and with a penalty on parameter changes, and the first day’s valley (the best for each fixed ): unpenalised, the fits scatter widely; penalised, they stay in a tight cluster. Data: the tutorial.](https://one-course.com/images/onecourse/chapters/quant-5/dv-fourier-pricing-and-calibration-engineering/fig-4b47f8d70180.svg)

***Figure 24.2.** Left: the best fit error with the [volatility of volatility](https://one-course.com/books/quant/5/en/chapter/10-stochastic-volatility#def-dv-stochastic-volatility-sv) held fixed, first day; the dashed line is the quotes’ noise. Right: the fitted $(\eta,\kappa)$ over 60 days without and with a penalty on parameter changes, and the first day’s valley (the best $\kappa$ for each fixed $\eta$): unpenalised, the fits scatter widely; penalised, they stay in a tight cluster. Data: the tutorial.*

Wandering along the valley costs money, because exotics are not priced by the fitted vanillas alone.

**Definition 24.8 (Recalibration P&L).**

The *recalibration P&L* of a position is the change in its model value caused by refitting the model’s parameters, with the market inputs that its hedges cover held fixed; in a P&L attribution it lands in the unexplained column, and it has no hedge.

The remedy is to tell the optimiser that yesterday’s parameters are informative. With $z$ the unconstrained parameters, the objective adds $\lambda\lVert z-z_{\text{yesterday}}\rVert^2$ to the weighted squared errors, a Tikhonov penalty (Book 4, chapter 24). Along the valley the penalty dominates and the parameters stay put. Across it the quotes dominate, and the parameters move when the market does.

**Example 24.9 (Sixty days with and without a penalty).**

Unpenalised, the daily fits move $\eta$ by as much as 0.235 in a day, and the convexity adjustment of a one-year [volatility swap](https://one-course.com/books/quant/5/en/chapter/14-variance-swaps-and-volatility-derivatives#def-dv-variance-swaps-and-volatility-derivatives-volswap) (chapter 14) changes by 0.36 volatility point a day (standard deviation). With $\lambda=10^{-3}$ the largest daily move of $\eta$ is 0.071, the adjustment’s daily changes fall to 0.07 volatility point, and the average fit error rises from 0.291 to 0.303 volatility point ([Figure 24.3](#fig-dv-fourier-pricing-and-calibration-engineering-daily)). On day 59, where the free fit took $\eta$ from 0.51 to 0.28, the penalised adjustment moves by 0.18 volatility point instead of 0.93.

![Sixty daily Heston calibrations to a noisy synthetic market. Left: the fitted volatility of volatility. Right: the convexity adjustment of a one-year volatility swap (variance-swap volatility minus volatility-swap price) implied by each day’s fit. Data: the tutorial.](https://one-course.com/images/onecourse/chapters/quant-5/dv-fourier-pricing-and-calibration-engineering/fig-74ed7ccba5a2.svg)

***Figure 24.3.** Sixty daily Heston calibrations to a noisy synthetic market. Left: the fitted [volatility of volatility](https://one-course.com/books/quant/5/en/chapter/10-stochastic-volatility#def-dv-stochastic-volatility-sv). Right: the convexity adjustment of a one-year [volatility swap](https://one-course.com/books/quant/5/en/chapter/14-variance-swaps-and-volatility-derivatives#def-dv-variance-swaps-and-volatility-derivatives-volswap) (variance-swap volatility minus volatility-swap price) implied by each day’s fit. Data: the tutorial.*

The penalty weight is a choice. Too small, and the parameters wander; too large, and they lag behind a market that moves. The build chooses it by replaying history: for each $\lambda$ on a grid, run the daily calibration over past quote sets, record the largest daily parameter move and the average fit error, and pick the smallest weight that meets the desk’s limits ([Figure 24.4](#fig-dv-fourier-pricing-and-calibration-engineering-scan)).

![Replaying 60 days for each penalty weight. Left: the largest daily move of the volatility of volatility, against a limit of 0.1. Right: the rise in the average fit error, against a limit of 0.1 volatility point. Data: the tutorial.](https://one-course.com/images/onecourse/chapters/quant-5/dv-fourier-pricing-and-calibration-engineering/fig-df35499e8676.svg)

***Figure 24.4.** Replaying 60 days for each penalty weight. Left: the largest daily move of the [volatility of volatility](https://one-course.com/books/quant/5/en/chapter/10-stochastic-volatility#def-dv-stochastic-volatility-sv), against a limit of 0.1. Right: the rise in the average fit error, against a limit of 0.1 volatility point. Data: the tutorial.*

## 24.5 Testing a calibration

A calibration is code and gets the tests that code gets, plus three of its own.

- **Round trip.** Generate quotes from known parameters and recover them. From quotes made by $v_0=0.045$ , $\kappa=2$ , $\bar v=0.05$ , $\eta=0.5$ , $\rho=-0.65$ , the pipeline recovers every parameter to $10^{-11}$ , from a start at chapter 10’s base parameters. This tests the pricer, the transformation and the optimiser together.
- **Identification.** Add noise and refit many times. With 0.3 volatility point of noise, twenty refits give standard deviations of 0.0007 for $v_0$ (0.16 volatility point of at-the-money volatility), 0.049 for $\eta$ , 0.046 for $\rho$ , 0.0024 for $\bar v$ and 0.56 for $\kappa$ , 28% of its value. The quotes pin down the short-term level and the skew, not the speed of mean reversion. The Jacobian’s condition number, 30 here, says the same in one number.
- **Replay.** Rerun past quote sets with the production settings and check the parameter paths against the alarm limits, as in [Figure 24.4](#fig-dv-fourier-pricing-and-calibration-engineering-scan) .

Only the round trip has a right answer. The other two measure what the quotes can support, which decides how exotics that depend on $\kappa$ should be reserved (chapter 27).

## 24.6 Tutorial: transforms and a daily calibration

**Goal.** Price a Heston smile by COS, Carr–Madan and the Lewis reference; calibrate a [Heston model](https://one-course.com/books/quant/5/en/chapter/10-stochastic-volatility#def-dv-stochastic-volatility-heston) every day for 60 days of a noisy synthetic market with and without a penalty on parameter changes, and choose the penalty weight by replay. **End state:** the four figures, the weights table and the numbers of the weekend problem.

1. **The COS pricer**, one row of cosine terms per strike: `def cos_calls (model, fwd: float , strikes, t: float , n: int = 160 , width: float = 16.0 , df: float = 1.0 ) -> np.ndarray: """European calls by the COS method: puts from the cosine coefficients of the density of y = ln(S_T / K) on [a, b] = c1 + ln(F / K) +- width sqrt(c2), then calls by parity. n terms, one cf evaluation per term and strike.""" strikes = np.asarray(strikes, float ) x0 = np.log(fwd / strikes) c1, c2 = cumulants(model, t) a = x0 + c1 - width * math.sqrt(c2) b = x0 + c1 + width * math.sqrt(c2) w = np.outer(math.pi / (b - a), np.arange(n)) # u_k = k pi / (b - a), one row per strike phi = model.cf(w, t) aa = a[:, None ] chi = (np.cos(-w * aa) - np.cos(0 * w) * np.exp(aa) + w * np.sin(-w * aa)) / (1 + w * w) with np.errstate(divide=" ignore " , invalid=" ignore " ): psi = np.where(w == 0 , -aa, np.sin(-w * aa) / np.where(w == 0 , 1.0 , w)) coef = 2 / (b - a)[:, None ] * (psi - chi) # put payoff (1 - e^y)^+ on [a, 0] terms = np.real(phi * np.exp(1 j * w * (x0 - a)[:, None ])) * coef terms[:, 0 ] *= 0.5 puts = df * strikes * terms.sum(axis=1 ) return puts + df * (fwd - strikes)` **Listing 24.1.** Calls by the COS method. code/firm/calib/firm_calib.py
2. **The calibration**: vega-weighted residuals, the penalty on the change from yesterday, Levenberg–Marquardt, diagnostics: `def calibrate (q: QuoteSet, z0, make=heston_from, weights=None , prior=None , reg: float = 0.0 , max_iter: int = 100 , pricer=cos_calls) -> Fit: """Levenberg-Marquardt on weighted price errors w_i (model_i - mid_i), plus sqrt(reg) (z - prior) when a prior (yesterday's z) is given. Default weights 1 / vega turn price errors into volatility errors.""" target = mid_prices(q) w = 1 / black_vega(q.fwd, q.strike, q.t, q.mid()) if weights is None else np.asarray(weights, float ) z = np.asarray(z0, float ).copy() prior = None if prior is None else np.asarray(prior, float ) def residuals (zz): r = w * (model_prices(make(zz), q, pricer) - target) if prior is not None and reg > 0 : r = np.concatenate([r, math.sqrt(reg) * (zz - prior)]) return r r = residuals(z) cost, lam, it, going = float (r @ r), 1e-3 , 0 , True while going and it < max_iter: it += 1 jac = np.column_stack([(residuals(z + 1e-6 * e) - r) / 1e-6 for e in np.eye(len (z))]) a, g = jac.T @ jac, jac.T @ r going = False while lam < 1e10 : step = np.linalg.solve(a + lam * np.diag(np.diag(a) + 1e-14 ), -g) with np.errstate(all =" ignore " ): r_new = residuals(z + step) c_new = float (r_new @ r_new) if np.all(np.isfinite(r_new)) else math.inf if c_new < cost: going = cost - c_new >= 1e-12 * cost and float (np.max(np.abs(step))) >= 1e-9 z, r, cost, lam = z + step, r_new, c_new, max (lam / 3 , 1e-12 ) break lam *= 4 n_q = len (q.t) fit_part = r[:n_q] sv = np.linalg.svd(jac[:n_q], compute_uv=False ) return Fit(make(z), z, float (math.sqrt(fit_part @ fit_part / n_q)), float (r[n_q:] @ r[n_q:]), it, float (sv[0 ] / sv[-1 ]) if sv[-1 ] > 0 else math.inf)` **Listing 24.2.** Levenberg–Marquardt with a penalty on parameter changes. code/firm/calib/firm_calib.py
3. **Run** `dv_calib.transform_study()` , `weights_table()` , `profile()` , `daily(0.0)` , `scan()` , `round_trip()` and `fig_calib.py` .

**What to change next.** Calibrate a [Bates model](https://one-course.com/books/quant/5/en/chapter/13-jumps-and-levy-models#def-dv-jumps-and-levy-models-bates) to the same quotes and watch the jump parameters wander; penalise only $\kappa$ and $\eta$; replace the Tikhonov penalty by a prior centred on a long-run average rather than on yesterday.

## 24.7 Build: the calibration pipeline

**Purpose.** The miniature firm’s calibration service: transform pricers for any model with a characteristic function, and a daily pipeline that turns quotes into parameters the pricers can trust.

**Interface.** `cos_calls(model, fwd, strikes, t, n, width)`, `carr_madan(model, fwd, t, n, eta, alpha)`, `carr_madan_at`, `lewis_calls` (reference), `cumulants`; `QuoteSet(t, strike, bid, ask, fwd)`, `filter_quotes(q, max_spread, max_sd)`; `calibrate(q, z0, make, weights, prior, reg)` $\to$ `Fit(model, z, rmse, penalty, iterations, condition)`; `vol_errors`, `jump_alarm(z_new, z_old, limits)`; `heston_from`, `heston_to`.

**Rules.** Quote sets are stored and every calibration can be replayed; the filter reports what it dropped and why; weights are explicit; the calibration starts from yesterday’s parameters; an alarm blocks parameters that move beyond their limits.

**Acceptance tests.** `code/firm/calib/tests/`: COS, Carr–Madan and the Lewis reference against Black’s formula and against each other; the cumulants of a lognormal; the filter’s four reasons; the round trip; an infinite penalty keeps yesterday’s parameters; the vega-weighted price error equals the volatility error to first order.

**Stretch.** The FFT engine for the time-dependent models of chapter 12; analytic Jacobians from the characteristic function’s derivatives; a calibration of the [Bates model](https://one-course.com/books/quant/5/en/chapter/13-jumps-and-levy-models#def-dv-jumps-and-levy-models-bates) with the jump parameters penalised to a long-run prior.

Sources and further reading

- P. Carr and D. B. Madan, “Option valuation using the fast Fourier transform”, *Journal of Computational Finance* 2(4) (1999) 61–73.
- A. L. Lewis, “A simple option formula for general jump-diffusion and other exponential Lévy processes”, working paper (2001).
- F. Fang and C. W. Oosterlee, “A novel pricing method for European options based on Fourier-cosine series expansions”, *SIAM Journal on Scientific Computing* 31(2) (2008) 826–848.
- R. Cont and S. Ben Hamida, “Recovering volatility from option prices by evolutionary optimization”, *Journal of Computational Finance* 8(4) (2005) 43–76.

## 24.8 Exercises

**Exercise 24.1 ★.**

Check that the [Lewis formula](#def-dv-fourier-pricing-and-calibration-engineering-lewis) gives $C=P(0,T)F$ at $K=0$ and that $\varphi(-i)=1$ is what makes $x_T$ a forward-martingale log-price.

**Solution of Exercise 24.1.**

$|\varphi(u-\frac i2)|\le\E[e^{x_T/2}]\le1$ by Jensen’s inequality, since $\E[e^{x_T}]=1$. The integral is therefore bounded by $\int_0^\infty du/(u^2+\frac14)=\pi$, and $\sqrt{FK}\to0$ gives $C\to P(0,T)F$. $\varphi(-i)=\E[e^{x_T}]=\E[S_T]/F=1$ says that the forward is the mean of $S_T$ under the pricing measure, as it must be for a forward-martingale price.

**Exercise 24.2 ★.**

Why does the [Carr–Madan formula](#def-dv-fourier-pricing-and-calibration-engineering-cm) need the damping factor $e^{\alpha k}$, and what limits $\alpha$ from above?

**Solution of Exercise 24.2.**

As $k\to-\infty$ the call tends to $F$, so it is not integrable in $k$ and has no Fourier transform. The factor $e^{\alpha k}$ makes it decay on that side. The transform then involves $\varphi(v-(\alpha+1)i)$, that is $\E[(S_T/F)^{\alpha+1}]$, which must be finite: $\alpha$ is limited by the moments the model has. In Heston with a strongly negative correlation and a long expiry, high moments explode in finite time.

**Exercise 24.3 ★.**

Show that a price error divided by the Black [vega](https://one-course.com/books/quant/5/en/chapter/4-greeks-and-the-hedging-p-l#def-dv-greeks-and-the-hedging-pnl-greeks) is the implied-volatility error to first order.

**Solution of Exercise 24.3.**

The model price is Black’s formula at the model’s implied volatility: $C^{\text{model}}=C^{\text{Black}}(\sigma^{\text{model}})$. Expanding around $\sigma^{\text{mid}}$, $C^{\text{model}}-C^{\text{mid}}=\mathcal V(\sigma^{\text{model}}-\sigma^{\text{mid}})+\frac12\,\partial_\sigma\mathcal
V\,(\sigma^{\text{model}}-\sigma^{\text{mid}})^2+\dots$ Dividing by $\mathcal V$ leaves the volatility error plus a second-order term (the [volga](https://one-course.com/books/quant/5/en/chapter/4-greeks-and-the-hedging-p-l#def-dv-greeks-and-the-hedging-pnl-greeks)).

**Exercise 24.4 ★★.**

With 0.3 volatility point of quote noise and twenty quotes, what fit error should a correct model reach? Compare with the chapter’s fits.

**Solution of Exercise 24.4.**

With $n$ quotes of independent noise $\sigma$ and $p$ fitted parameters, a correct model leaves residuals of root-mean-square $\sigma\sqrt{(n-p)/n}$: $0.3\sqrt{13/18}=0.255$ volatility point for eighteen quotes after the filter. The chapter’s fits give 0.22 on the first day and 0.291 on average: noise plus a little misspecification, since the market is a [Bates model](https://one-course.com/books/quant/5/en/chapter/13-jumps-and-levy-models#def-dv-jumps-and-levy-models-bates). A fit well below the noise floor would be fitting the noise.

**Exercise 24.5 ★★.**

Why does COS stall at $3\times10^{-5}$ with a twelve-standard-deviation interval, and why do more terms not help?

**Solution of Exercise 24.5.**

COS prices the option under the density truncated to $[a,b]$. The mass outside, in the heavy left tail of a [Heston model](https://one-course.com/books/quant/5/en/chapter/10-stochastic-volatility#def-dv-stochastic-volatility-heston) with $\rho=-0.7$ and $\eta=0.6$, is simply lost. More terms converge to the price under the truncated density, not the true one. Only a wider interval (sixteen standard deviations) removes the error, at the cost of more terms for the same resolution.

**Exercise 24.6 ★★.**

Explain why $\kappa$ and $\eta$ move together along the valley of [Figure 24.2](#fig-dv-fourier-pricing-and-calibration-engineering-valley).

**Solution of Exercise 24.6.**

The [volatility of volatility](https://one-course.com/books/quant/5/en/chapter/10-stochastic-volatility#def-dv-stochastic-volatility-sv) shows up in the smile’s curvature and skew, damped by mean reversion. Over a horizon $T$, the variance’s response to its own shocks is averaged by the factor $(1-e^{-\kappa T})/(\kappa T)$. A larger $\eta$ with a faster $\kappa$ gives about the same effective volatility of variance at the quoted expiries (up to a year). The quotes see the product, not the two separately, hence the valley.

**Exercise 24.7 ★★★.**

*Coding.* Rerun the 60-day calibration with equal price weights instead of [vega](https://one-course.com/books/quant/5/en/chapter/4-greeks-and-the-hedging-p-l#def-dv-greeks-and-the-hedging-pnl-greeks) weights, unpenalised. Does the [volatility of volatility](https://one-course.com/books/quant/5/en/chapter/10-stochastic-volatility#def-dv-stochastic-volatility-sv) wander more or less, and why?

**Solution of Exercise 24.7.**

With equal price weights the largest daily move of $\eta$ is 0.255 (0.235 with [vega](https://one-course.com/books/quant/5/en/chapter/4-greeks-and-the-hedging-p-l#def-dv-greeks-and-the-hedging-pnl-greeks) weights), and the standard deviation of the daily moves 0.066 (0.089). The wander is about the same. The weights change which quotes pin the parameters (with equal weights, the one-year options, whose [vegas](https://one-course.com/books/quant/5/en/chapter/4-greeks-and-the-hedging-p-l#def-dv-greeks-and-the-hedging-pnl-greeks) are largest), not the flatness of the valley. The penalty is still needed.

**Exercise 24.8 ★★★.**

*Find the flaw.* “Our calibration is excellent: the fit error has been below 0.45 volatility point every day for two months.”

**Solution of Exercise 24.8.**

The fit error measures only the vanillas. In the chapter the unpenalised fits stay below 0.45 volatility point every day (at most 0.42), while $\eta$ moves by 0.235 in a day and a [volatility swap](https://one-course.com/books/quant/5/en/chapter/14-variance-swaps-and-volatility-derivatives#def-dv-variance-swaps-and-volatility-derivatives-volswap)’s convexity adjustment by 0.93 volatility point. Check the parameter paths, their alarms and the [recalibration P&L](#def-dv-fourier-pricing-and-calibration-engineering-recalib) of the exotics too.

## 24.9 Problem: The Wandering Parameter

**Problem 24.1.**

Weekend problem — how much to penalise

A desk calibrates a [Heston model](https://one-course.com/books/quant/5/en/chapter/10-stochastic-volatility#def-dv-stochastic-volatility-heston) every morning to twenty quotes (one, three, six and twelve months; five strikes each) and prices [volatility swaps](https://one-course.com/books/quant/5/en/chapter/14-variance-swaps-and-volatility-derivatives#def-dv-variance-swaps-and-volatility-derivatives-volswap) and [cliquets](https://one-course.com/books/quant/5/en/chapter/16-asians-lookbacks-cliquets-and-forward-starts#def-dv-asians-lookbacks-cliquets-and-forward-starts-cliquet) with it. Over sixty days the unpenalised [volatility of volatility](https://one-course.com/books/quant/5/en/chapter/10-stochastic-volatility#def-dv-stochastic-volatility-sv) wanders.

**Part I — The pricer.**

1. Which of COS and Carr–Madan would you use for this calibration, and why?
2. How many COS terms give a price error below $10^{-4}$ on the one-year smile?
3. What sets the truncation interval, and what happens when it is too narrow?
4. Roughly how long does one calibration take, and what dominates it?
5. How would you check the pricer independently of the calibration?

**Part II — The fit.**

6. What does the filter drop on a typical day in the synthetic market?
7. Give the first day’s parameters and fit error.
8. What happens to the one-month fit with equal price weights?
9. How flat is the fit error along $\eta$ , compared with the noise?
10. What does the round trip with noise say about which parameters the quotes identify?

**Part III — Day to day.**

11. Give the largest daily move of $\eta$ without a penalty, and the day it happens.
12. What does it do to the [volatility swap](https://one-course.com/books/quant/5/en/chapter/14-variance-swaps-and-volatility-derivatives#def-dv-variance-swaps-and-volatility-derivatives-volswap) ’s convexity adjustment, and what is that in money for a [vega notional](https://one-course.com/books/quant/5/en/chapter/14-variance-swaps-and-volatility-derivatives#def-dv-variance-swaps-and-volatility-derivatives-veganot) of 100 000 per volatility point?
13. Why is this move a [recalibration P&L](#def-dv-fourier-pricing-and-calibration-engineering-recalib) and not a market move?
14. How does the penalty change the parameter and the adjustment paths?
15. What does the penalty cost in fit error?

**Part IV — Choosing the weight.**

16. Describe the replay that chooses $\lambda$ .
17. What is the risk of a penalty that is too large?
18. Which parameters would you penalise more, and which less?
19. State the *named result* : the regularisation weight at which the day-to-day moves of the [volatility of volatility](https://one-course.com/books/quant/5/en/chapter/10-stochastic-volatility#def-dv-stochastic-volatility-sv) fall below 0.1 while the fit error rises by less than 0.1 volatility point.
20. In one sentence: what does a penalty on parameter changes buy?

**Solution of Problem 24.1.**

**1.** COS: it prices the quoted strikes directly, and its error falls exponentially with the terms. The FFT gives a fixed grid and needs interpolation. **2.** 128 terms ($8.6\times10^{-5}$). **3.** The cumulants: $[a,b]=c_1+\ln(F/K)\pm L\sqrt{c_2}$ with $L=16$. Too narrow ($L=12$) and the error stalls at $3.0\times10^{-5}$. **4.** About eight iterations of six residual evaluations, each pricing four smiles: some two hundred smiles, 800 characteristic-function evaluations each. Those evaluations (complex exponentials and logarithms) dominate; in the build a calibration takes well under a second. **5.** Against the Gauss–Legendre Lewis reference, against Black’s formula with a lognormal characteristic function, and by $\varphi(0)=
\varphi(-i)=1$. **6.** Two quotes, one crossed and one stale (wide); eighteen remain. **7.** $v_0=0.0451$, $\kappa=1.82$, $\bar v=0.0518$, $\eta=0.488$, $\rho=-0.632$; 0.22 volatility point. **8.** Its error rises from 0.35 to 0.46 volatility point. **9.** Between $\eta=0.35$ and 0.65 the best error stays between 0.23 and 0.29 volatility point. Over the whole range from 0.25 to 1 it varies by less than the 0.3 point of quote noise. **10.** $v_0$, $\rho$ and $\eta$ are identified (standard deviations 0.0007, 0.046 and 0.049); $\kappa$ is not (0.56, 28% of its value). **11.** 0.235, from day 58 to day 59 (0.51 to 0.28). **12.** It falls from 1.32 to 0.39 volatility point, a change of 0.93: 93 000 for a [vega notional](https://one-course.com/books/quant/5/en/chapter/14-variance-swaps-and-volatility-derivatives#def-dv-variance-swaps-and-volatility-derivatives-veganot) of 100 000. **13.** The quotes barely changed (the fit error is 0.31 on both days); the parameters slid along the valley. No risk factor that a hedge covers moved. **14.** The largest daily move of $\eta$ falls to 0.071; the convexity adjustment’s daily changes fall from 0.36 to 0.07 volatility point (standard deviation), and on day 59 it moves by 0.18 instead of 0.93. **15.** The average fit error rises from 0.291 to 0.303 volatility point, by 0.012. **16.** For each $\lambda$ on a grid from $10^{-5}$ to $10^{-2}$, rerun the sixty days with the production pipeline; record the largest daily move of $\eta$ and the average fit error; take the smallest $\lambda$ that meets both limits. **17.** The parameters lag a genuine change in the market (a real rise in the [volatility of volatility](https://one-course.com/books/quant/5/en/chapter/10-stochastic-volatility#def-dv-stochastic-volatility-sv) after a shock). The fit error rises and the model misprices until it catches up. The fit-error alarm must be able to override the penalty. **18.** Penalise the poorly identified directions ($\kappa$, $\eta$) more, and the well-identified ones ($v_0$, $\rho$) less, so that these follow the market every day. **19.** $\lambda=10^{-3}$: the largest daily move of $\eta$ falls from 0.235 to 0.071 (at $3\times10^{-4}$ it is still 0.133), and the average fit error rises by 0.012 volatility point. **20.** Parameters that move only when the quotes require it, so that exotic prices follow the market and not the noise.

## 24.10 Interview questions

**Interview question 24.1 ★ developer, researcher.**

How do you price a European option when you only know the characteristic function?

**Solution of Interview question 24.1.**

Write the price as an integral in Fourier space: the [Lewis formula](#def-dv-fourier-pricing-and-calibration-engineering-lewis) (Parseval’s identity with the payoff’s transform on a strip), the Carr–Madan damped-call transform evaluated by FFT, or the COS expansion of the density. All need only $\varphi$, and all are checked by $\varphi(0)=\varphi(-i)=1$ and by a lognormal case against Black.

*What the interviewer is looking for: one of the three routes, and a check.*

**Interview question 24.2 ★★ researcher.**

Compare the Carr–Madan FFT and the COS method.

**Solution of Interview question 24.2.**

Carr–Madan: a whole log-strike grid in one FFT, but a damping parameter to choose, interpolation to the quoted strikes, and errors from the grid’s spacing and range. COS: any strikes, exponential convergence for smooth densities, few terms; it needs a truncation interval from the cumulants, and heavy tails need a wide one.

*What the interviewer is looking for: grid versus strikes, damping versus truncation, convergence.*

**Interview question 24.3 ★★ researcher, bank.**

Your Heston calibration’s parameters jump from day to day while the fit stays good. What is happening and what do you do?

**Solution of Interview question 24.3.**

The problem is ill-posed: a valley of near-equal fits (for Heston, $\kappa$ and $\eta$ together), along which noise moves the optimum. Measure it (profile, refits with noise, the Jacobian’s condition number). Then add a penalty on changes from yesterday, chosen by replay, and fix or penalise the poorly identified parameters; watch the exotics’ [recalibration P&L](#def-dv-fourier-pricing-and-calibration-engineering-recalib).

*What the interviewer is looking for: ill-posedness, penalty, identification.*

**Interview question 24.4 ★★ developer.**

Design a daily calibration job. What does it store, check and alarm on?

**Solution of Interview question 24.4.**

Store the quote snapshot, the filter’s decisions, settings, the start point, the result and diagnostics, so that any day can be replayed. Check the filter counts, the fit error overall and by expiry, the condition number and the parameter moves. Alarm when a parameter moves beyond its limit or the fit error beyond its own, and hold the previous parameters until a person releases the new ones.

*What the interviewer is looking for: replayability, diagnostics, and an alarm that blocks.*

**Interview question 24.5 ★★ trader, risk.**

Your book shows a large unexplained P&L on a quiet day. How could the calibration be the cause?

**Solution of Interview question 24.5.**

If the model’s parameters jumped along a flat direction, the exotics’ values moved with no move in any hedged risk factor: [recalibration P&L](#def-dv-fourier-pricing-and-calibration-engineering-recalib), which the attribution leaves unexplained. Check the parameter history for that day, reprice with yesterday’s parameters on today’s market, and compare.

*What the interviewer is looking for: [recalibration P&L](#def-dv-fourier-pricing-and-calibration-engineering-recalib), and repricing with yesterday’s parameters.*

**Interview question 24.6 ★★★ researcher.**

Why should you weight a calibration, and how would you choose the weights?

**Solution of Interview question 24.6.**

Unweighted price errors let long-dated at-the-money options dominate. Weight by inverse [vega](https://one-course.com/books/quant/5/en/chapter/4-greeks-and-the-hedging-p-l#def-dv-greeks-and-the-hedging-pnl-greeks) to fit in volatility, and further by inverse bid–ask spread (or quote reliability), so that liquid quotes count more. Then add weights for what the book needs, such as the expiries and strikes of its exotics’ hedges.

*What the interviewer is looking for: [vega](https://one-course.com/books/quant/5/en/chapter/4-greeks-and-the-hedging-p-l#def-dv-greeks-and-the-hedging-pnl-greeks), spread, and the book’s needs.*
