One Option, Five Numerical Methods#
The series has solved one problem in several ways. This page puts the answers side by side: the benchmark European call by a tree, simulation, a finite difference grid, a transform and quadrature, and an American put by a tree, a grid and regression. It compares accuracy, cost and the range of products that each method can handle, and ends with a guide to choosing one and to what a controller should ask of the choice.
The European call#
The reference is the Black-Scholes price of 9.413403. Each method is run at a setting that is typical of production use, and the price, the error against the reference and the time are recorded.
Python code
"""One option, five methods: the benchmark call and an American put, solved by each method, with error and time."""
import time
import numpy as np
from binomial_example import crr
from common import bs_price
from fourier_cf_example import cf_bs
from fourier_fft_cos_example import cos_call
from lsm_example import apply_policy, fit_policy, simulate, with_control
from mc_basic_example import mc_call
from pde_american_example import american_put
from pde_implicit_example import price_and_greeks, solve_call
from quadrature_example import gauss_legendre_split
from trinomial_example import trinomial
K_REF = 100.0
def timed(fn, repeats=3):
"""Result of the first call and the best time of several, in milliseconds."""
result = fn()
best = min((lambda s: (fn(), time.perf_counter() - s)[1])(time.perf_counter()) for _ in range(repeats))
return result, best * 1e3
if __name__ == "__main__":
exact = bs_price()
rng = np.random.default_rng(23)
print(f"European call, strike {K_REF:.0f}, one year. Black-Scholes {exact:.6f}\n")
print(f"{'Method':<40} {'Price':>10} {'Error':>11} {'Std error':>10} {'Time (ms)':>10}")
rows = [
("Binomial tree, 1000 steps", lambda: (crr(1000), None)),
("Trinomial tree, 1000 steps", lambda: (trinomial(1000), None)),
("Monte Carlo, 1,000,000 paths", lambda: mc_call(1_000_000, rng)),
("Finite difference, CN+Rannacher 400x400", lambda: (price_and_greeks(*solve_call(400, 400, rannacher=2))[0], None)),
("Fourier, COS with 64 terms", lambda: (cos_call(cf_bs, K_REF, 64)[0], None)),
("Quadrature, 32 Gauss-Legendre points", lambda: (gauss_legendre_split(32), None)),
]
for name, fn in rows:
(price, se), ms = timed(fn)
print(f"{name:<40} {price:10.6f} {price - exact:+11.2e} {'' if se is None else f'{se:10.5f}':>10} {ms:10.1f}")
reference = crr(10_000, call=False, american=True)
print(f"\nAmerican put, strike {K_REF:.0f}, one year. Binomial tree with 10,000 steps {reference:.5f}\n")
print(f"{'Method':<40} {'Price':>10} {'Error':>11} {'Std error':>10} {'Time (ms)':>10}")
train = simulate(100_000, 50, rng)
coefficients, _ = fit_policy(train, 3)
def lsm():
test = simulate(100_000, 50, rng)
return with_control(apply_policy(test, coefficients), test)
rows = [
("Binomial tree, 1000 steps", lambda: (crr(1000, call=False, american=True), None)),
("Trinomial tree, 1000 steps", lambda: (trinomial(1000, call=False, american=True), None)),
("Finite difference, 800x400 + penalty", lambda: (american_put(800, 400)[0], None)),
("Least-squares Monte Carlo (50 dates)", lsm),
]
for name, fn in rows:
(price, se), ms = timed(fn, repeats=1)
print(f"{name:<40} {price:10.5f} {price - reference:+11.2e} {'' if se is None else f'{se:10.5f}':>10} {ms:10.1f}")
print("The LSM price is for 50 exercise dates and has a lower value than continuous exercise, by about 0.007.")
The output is:
European call, strike 100, one year. Black-Scholes 9.413403
Method Price Error Std error Time (ms)
Binomial tree, 1000 steps 9.411420 -1.98e-03 4.8
Trinomial tree, 1000 steps 9.412865 -5.38e-04 8.3
Monte Carlo, 1,000,000 paths 9.398467 -1.49e-02 0.01409 50.9
Finite difference, CN+Rannacher 400x400 9.412812 -5.92e-04 24.8
Fourier, COS with 64 terms 9.413403 +4.62e-14 0.1
Quadrature, 32 Gauss-Legendre points 9.413403 -2.43e-13 1.3
The same methods at different settings give the error against time on a logarithmic chart:
Reading the table and the chart:
COS and quadrature are in a class of their own for this problem. They are accurate to machine precision in a fraction of a millisecond, because the integrand is smooth, the problem has one dimension, and the characteristic function or the density is known. No other method comes near.
The tree and the grid give three to four digits in a few milliseconds to a few tens, and improve slowly: a tree’s error falls in proportion to the number of steps, and a grid’s as the square of the space step. The trinomial tree is four times better than the binomial for the same steps.
Monte Carlo is the least accurate and the most flexible. One million paths give an error of 0.015 and a standard error of 0.014, and it needs 100 times as many paths for each extra digit. The price is within its standard error of the truth, as it should be.
The times are indicative. They depend on the machine, the load, the language and the vectorisation. The ranking of the methods is what matters, and the gaps are large.
The American put#
The same comparison for the put that can be exercised at any time. The reference is a binomial tree with 10,000 steps, 6.74290. Transform and quadrature methods do not apply, since they price a European payoff.
American put, strike 100, one year. Binomial tree with 10,000 steps 6.74290
Method Price Error Std error Time (ms)
Binomial tree, 1000 steps 6.74204 -8.52e-04 33.3
Trinomial tree, 1000 steps 6.74286 -3.66e-05 40.5
Finite difference, 800x400 + penalty 6.73902 -3.88e-03 51.6
Least-squares Monte Carlo (50 dates) 6.73365 -9.25e-03 0.01498 412.5
The tree and the grid are the right tools, and they agree to 0.004. The trinomial tree is the most accurate for the cost.
The regression method is the slowest and the least accurate, and it is the only one of the four that carries over to many factors. It is below the others because it has 50 exercise dates and not continuous exercise, which is about 0.007 lower, and because it is a lower-biased estimate with a standard error of 0.015.
Choosing a method#
If the product has |
Use |
Avoid |
|---|---|---|
A European payoff, and a model with a closed form or a characteristic function |
The closed form, or a transform method (Transform Methods, Part 2: FFT & the COS Method) |
Simulation, which is slower and noisier for the same price |
A European payoff in one to three dimensions, and a known density |
Quadrature (Numerical Integration: Quadrature) |
Simulation |
Early exercise, one or two factors |
A tree (Lattice Methods, Part 2: Trinomial Trees & Early Exercise) or a PDE grid (PDE Methods, Part 3: American Options & Trees vs Finite Differences) |
Plain Monte Carlo |
Early exercise, three or more factors |
Least-squares Monte Carlo (Advanced Methods, Part 1: Least-Squares Monte Carlo) |
Trees and grids |
Path dependence (averages, barriers, lookbacks) |
Monte Carlo (Monte Carlo, Part 2: Path-Dependent Options), or a PDE for a single barrier |
A tree, unless the path dependence is simple |
Many underlyings |
Monte Carlo, with variance reduction (Monte Carlo, Part 3: Variance Reduction & Quasi-Monte Carlo) |
Any grid or product rule |
A need for smooth Greeks in low dimension |
A PDE grid (PDE Methods, Part 2: Implicit & Crank-Nicolson), or the closed form |
Bump-and-revalue on a simulation |
A calibration loop |
A transform method (Calibration) |
Simulation, whose noise makes the objective rough |
A valuation control view#
Numerical risk is not model risk, and the series is organised to separate them: the same model solved by two methods isolates the numerical error. If the two agree to within their errors, a remaining difference with another price is a difference of model, or of inputs. See Model Risk in Valuation.
Require a benchmark for every engine: a case with a known answer, run with each release, for the product types that the engine prices. The benchmark of The Pricing Problem & the Benchmark is the simplest one.
Ask for the convergence evidence: the price at two or more settings (paths, steps, grid), the observed order of convergence and the standard error. A method used with no evidence of convergence has a price with an unknown error.
Size the numerical error against the reserve: a numerical error that is a large share of the valuation reserve, or of the bid-offer, is a problem to fix first. See Prudent Valuation: Requirements.
Check that the method suits the product, and not only the vanilla test: the tests of an engine on a European option say nothing about a barrier, an early exercise feature or a payoff with a kink in the Greeks. The tests should include a feature of each type that the engine prices, and the Greeks as well as the prices.
Keep an independent implementation: a second method for the main products, run on a sample, is the strongest control on a numerical engine, and it is the use to which most of the pages of this series can be put.
For the rates products, Interest Rate Mean Reversion applies the grid and regression methods of this series to the Bermudan swaption.