Kernelin projects / Risk Engine

Price an options book with greeks in milliseconds, on the GPU in your browser.

Monte Carlo simulation of six products, including path-dependent Asian, barrier and lookback options, over 252 trading days, with Delta, Gamma and Vega. The whole engine is ~150 lines of plain Kotlin. Kernelin compiles it to a WebGPU shader; the same code is unit-tested on the JVM.

starting…

Market and contract

Each report runs 4 scenarios (base, spot ±1%, vol +1 pt) on the same random numbers.

Result

GPU, full risk report
–
press "Run"
CPU, same Kotlin (Wasm, 1 thread)
–
optional
GPU speedup
–
same paths, same numbers
Simulated price steps / second
–
paths × days × scenarios
ProductPrice± 95%Exact formulaCheckDeltaGammaVega (1 pt)
Run a report to fill this table.

200 simulated price paths
Drawn from the GPU, with the strike and the knock-out barrier.
Convergence to the exact Black–Scholes price
European call, 95% interval narrows as 1/√paths. Each point is one GPU run.

Why a trading desk cares

Exotics have no formula

Barrier, Asian and lookback payoffs depend on the whole price path. Monte Carlo is the industry method, and it needs millions of paths for a stable price and stable greeks.

Risk is many reprices

Every greek is another full simulation. A book of hundreds of trades, repriced on every market move, is exactly the workload banks buy GPU farms for.

Without a second language

Usually this means CUDA or C++ kernels next to the Kotlin service. Here the pricer is one Kotlin function: tested on the JVM, run on any GPU through WebGPU.

The code

loading…