Accuracy and speed¶
Accuracy¶
The tables compare implied volatilities with 72 reference smiles computed by
tests/reference_pricer.py,
a separate implementation that shares no code with roughprix. It solves the Riccati equation by
implicit product integration on a 2000-step graded mesh, uses the classical Heston closed form at
\(H = \tfrac12\), and prices with the Lewis formula on Gauss–Legendre panels out to where the integrand
falls below \(10^{-17}\). Each reference vol carries two error estimates: the change from halving the
time steps, and the change when the Fourier cutoff moves 1.5 times as far.
Away from \(H = \tfrac12\) the reference uses the same kind of scheme as the default solver of roughprix, implemented separately and run much finer. Agreement therefore shows that the default settings are converged; the error estimates bound the error of the reference itself.
The smiles cover three parameter sets, each at \(H \in \{\tfrac12, 0.3, 0.1, 0, -0.2, -0.4\}\) and four maturities, with nine strikes at \(\log K = z \sqrt{V_0 T}\) for \(z\) from \(-3\) to \(3\) (\(S_0 = 1\), \(r = 0\)):
| Set | \(\lambda\) | \(\theta\) | \(\nu\) | \(\rho\) | \(V_0\) |
|---|---|---|---|---|---|
| A | 0.3 | 0.006 | 0.3 | −0.7 | 0.02 |
| B | 1.0 | 0.025 | 0.4 | −0.65 | 0.025 |
| C | 0 | 0 | 0.5 | −0.9 | 0.04 |
Set C has a steep skew and no mean reversion. Each entry is the largest difference in implied volatility, in basis points, over the values of \(H\) and the strikes. Strikes count where the out-of-the-money price is at least \(10^{-6} S_0\); below that, rounding dominates the vols of both pricers. "no vol" means that a counted strike got no implied vol.
The reference's own error estimates stay below 0.0013 bp at every compared strike.
Default settings¶
| Set | 1 week | 1 month | 1 year | 5 years |
|---|---|---|---|---|
| A | 0.002 | 0.002 | 0.002 | 0.001 |
| B | 0.002 | 0.002 | 0.001 | 0.0008 |
| C | 0.002 | 0.002 | 0.003 | 0.002 |
Root-Padé base¶
| Set | 1 week | 1 month | 1 year | 5 years |
|---|---|---|---|---|
| A | 0.33 | 0.23 | 0.067 | 0.67 |
| B | 0.13 | 0.11 | 0.15 | 1.3 |
| C | 2.9 | 1.6 | 0.85 | 3.2 |
H-expansion of order 2¶
| \(H_0 \to H\) | 1 week | 1 month | 1 year | 5 years |
|---|---|---|---|---|
| 0 → 0.1 | 84 | 29 | 0.34 | 0.83 |
| 0 → -0.2 | 94 | 36 | 1.6 | 16 |
| 0.5 → 0.3 | 85 | 37 | 4.9 | no vol |
H-expansion of order 4¶
| \(H_0 \to H\) | 1 week | 1 month | 1 year | 5 years |
|---|---|---|---|---|
| 0 → 0.1 | 4.4 | 0.33 | 0.009 | 0.004 |
| 0 → -0.2 | 14 | 3.2 | 0.14 | 0.47 |
| 0.5 → 0.3 | 10 | 9.5 | 0.38 | 15 |
The H-expansion rows price the target \(H\) from the anchor \(H_0\) with the default base at the anchor: implicit product integration at \(H_0 = 0\) and the classical Heston solution at \(H_0 = \tfrac12\). Each entry is the largest error over the three parameter sets. The largest errors sit at the outer strikes, two to three standard deviations from the money. At five years from \(H_0 = \tfrac12\) they come from set C: 15 bp at order 4, against 0.4 bp or less for sets A and B. In such cases the accuracy check warns, with estimates close to the errors, for example 17.7 bp for set C at five years. For more on the accuracy of the expansion see Pricing with the H-expansion.
Speed¶
Wall-clock times of eur_call_put, pricing nine strikes of set A with the default settings unless
stated otherwise. The defaults include the accuracy check, which adds about 10–35 % run time.
Time per call¶
| Nine strikes, set A | 1 week | 1 month | 1 year | 5 years |
|---|---|---|---|---|
| Default, \(H = 0.1\) | 75 | 74 | 60 | 41 |
| Root-Padé base, \(H = 0.1\) | 119 | 111 | 74 | 47 |
| Exact Heston, \(H = \tfrac12\) | 69 | 65 | 77 | 57 |
| Expansion \(N = 4\), \(H_0 = 0 \to H = 0.1\) | 224 | 201 | 164 | 140 |
Many values of H in one call¶
| Nine strikes, 21 values of \(H\) in \([-0.2, 0.2]\) | Expansion \(N = 4\) from \(H_0 = 0\), one call | Default solver, one call per \(H\) |
|---|---|---|
| 1 month | 316 | 1396 |
| 1 year | 228 | 1060 |
Times in milliseconds, medians of 7 calls after a first call. The first call in a session compiles; here it took 1.3 s. Machine: Apple M3, 8 cores; Python 3.13.9, JAX 0.9.2, NumPy 2.3.3, roughprix 0.1.0. Load average during the timings: 4.0.
To reproduce the tables, run python docs/scripts/benchmarks.py from the repository root. It
rewrites docs/generated/accuracy.md and docs/generated/speed.md in a few minutes.