Expand description
COS method: Fourier-cosine series pricing of European vanillas from a characteristic function (Fang & Oosterlee, 2008).
The risk-neutral density of y = ln S_T is unknown for Heston/Bates
models but its Fourier transform — the characteristic function phi —
is closed-form. The density’s cosine-series coefficients on a
truncated interval [a, b] are values of phi, and the payoff’s
cosine coefficients have closed forms, so the price collapses to a
dot product with exponential convergence in the number of terms:
V ~ e^{-rT} sum_k' Re{ phi(u_k) e^{-i u_k a} } * V_k(K), u_k = k pi/(b-a)The phi(u_k) sweep depends only on the model and expiry — not the
strike — so one [CosPricer] prices an entire smile for the cost of
one option. That is what makes characteristic-function calibration
fast: the Levenberg-Marquardt objective revalues the whole quote grid
thousands of times, and with COS each revaluation is one CF sweep per
expiry instead of two 4000-point integrations per quote.
The truncation range is set from the distribution’s cumulants,
estimated numerically from ln phi near zero — so any model with a CF
(Heston, both Bates variants, GBM) works without per-model formulas.
The legacy P1/P2 integration (heston_price/bates_price) is kept
as the independent cross-check oracle in the tests.
Constants§
- CALIBRATION_
TERMS - Series terms used by the calibration objectives: enough for ~1e-8 vanilla accuracy on market-typical parameters.
- DEFAULT_
TERMS - Series terms for full-accuracy pricing and cross-checks. Exponential convergence makes the sweep cheap; 2048 converges even the slowly decaying CFs of high vol-of-vol (Feller-violated) parameter sets.