Revisiting this series after some time, I ended up debugging and polishing a bit the UI I had built to facilitate my previous numerical experiments. So that it is now, hopefully, in good enough shape for anyone interested to download and play with.
This is obviously not intended to price real world deals. Its purpose is rather to provide a reference for what sort of performance (accuracy/CPU time) one can expect from a carefully implemented PDE-based pricing engine. In short, aiming for 1 bp accuracy should be achievable in milliseconds on a modern CPU core, not seconds (with just local, no stochastic volatility yet). But more on this below.
You can use this app to visualize the solution discretization error, just like I did when I was refining the engine. First calculate a benchmark price by setting the grid resolution to something like [2000, 500] for [spot, time] and choose the “CN++” scheme (this would be practically grid-converged). Press Ctrl+R to save this as the reference solution. Then switch to a working resolution and scheme, like [100, 250] and "CN+", price and press Ctrl+X to visualize the discretization error along the spot axis.
Calculating benchmark prices is very fast (should be in seconds still), especially for the Black Scholes (BS) model. This is very useful for testing the basic convergence properties of the implementation. Given the complex structure of the product, it is the details of the FD discretization that can make a big difference in terms of convergence and thus performance, even for the simplest model. Achieve good BS behavior first and then switch to the target model. This demo can easily (in most cases) achieve 10 significant digits of numerical accuracy when you rev it up. Yes really, it is a well oiled engine!
The Local Volatility Model (LVM) is included to make things a bit more "realistic", in case someone dismisses the BS performance as irrelevant. I haven't stress-tested this in any way. Let’s just say that it worked well for the few FX surfaces I found (produced smooth LV surfaces and almost perfect fits to the vanilla market). Just assume that some properly tested, production-grade LV module can be used instead. The sole purpose here is to ensure that introducing (S, t)-dependent diffusion coefficients does not significantly affect the PDE discretization's efficiency. The FX volatility surface and zero rate curves are simply read in from a text file. Just replace the data in the file with your data, keeping the same format.
The LVM will still in most cases be deemed inadequate for trading/risk-managing such a product. But an upgrade of the present setup to regime-switching local volatility (RSLV) would fix that, while inheriting the high-performance characteristics. Assuming for instance 2 regimes and second-order time splitting (so that we preserve the present setup's ${O}(\Delta t^2)$ accuracy), we would expect the computational cost to increase by a factor of 4 to 5, keeping accurate valuation times still well below 1 sec on average. To be confirmed in a future update of the demo adding RSLV pricing once I find some time to test it.
I’ve included a quasi-Monte Carlo engine as well for peace of mind, to facilitate cross validation.
I hope you enjoy playing with this as I did. For more usage details please read the README file that comes with the app before using it. Also do not hesitate to contact me with any queries and to report any bugs or problems you may find.
Yiannis Papadopoulos, Zurich, November 2025
This is obviously not intended to price real world deals. Its purpose is rather to provide a reference for what sort of performance (accuracy/CPU time) one can expect from a carefully implemented PDE-based pricing engine. In short, aiming for 1 bp accuracy should be achievable in milliseconds on a modern CPU core, not seconds (with just local, no stochastic volatility yet). But more on this below.
You can use this app to visualize the solution discretization error, just like I did when I was refining the engine. First calculate a benchmark price by setting the grid resolution to something like [2000, 500] for [spot, time] and choose the “CN++” scheme (this would be practically grid-converged). Press Ctrl+R to save this as the reference solution. Then switch to a working resolution and scheme, like [100, 250] and "CN+", price and press Ctrl+X to visualize the discretization error along the spot axis.
Calculating benchmark prices is very fast (should be in seconds still), especially for the Black Scholes (BS) model. This is very useful for testing the basic convergence properties of the implementation. Given the complex structure of the product, it is the details of the FD discretization that can make a big difference in terms of convergence and thus performance, even for the simplest model. Achieve good BS behavior first and then switch to the target model. This demo can easily (in most cases) achieve 10 significant digits of numerical accuracy when you rev it up. Yes really, it is a well oiled engine!
The Local Volatility Model (LVM) is included to make things a bit more "realistic", in case someone dismisses the BS performance as irrelevant. I haven't stress-tested this in any way. Let’s just say that it worked well for the few FX surfaces I found (produced smooth LV surfaces and almost perfect fits to the vanilla market). Just assume that some properly tested, production-grade LV module can be used instead. The sole purpose here is to ensure that introducing (S, t)-dependent diffusion coefficients does not significantly affect the PDE discretization's efficiency. The FX volatility surface and zero rate curves are simply read in from a text file. Just replace the data in the file with your data, keeping the same format.
The LVM will still in most cases be deemed inadequate for trading/risk-managing such a product. But an upgrade of the present setup to regime-switching local volatility (RSLV) would fix that, while inheriting the high-performance characteristics. Assuming for instance 2 regimes and second-order time splitting (so that we preserve the present setup's ${O}(\Delta t^2)$ accuracy), we would expect the computational cost to increase by a factor of 4 to 5, keeping accurate valuation times still well below 1 sec on average. To be confirmed in a future update of the demo adding RSLV pricing once I find some time to test it.
I’ve included a quasi-Monte Carlo engine as well for peace of mind, to facilitate cross validation.
I hope you enjoy playing with this as I did. For more usage details please read the README file that comes with the app before using it. Also do not hesitate to contact me with any queries and to report any bugs or problems you may find.
Yiannis Papadopoulos, Zurich, November 2025
P.S. If when running it for the first time you see ‘Windows protected your PC’, click ‘More info’ → ‘Run anyway’. This is expected — the app is signed with a local demo certificate.
RSS Feed