Playground¶
This page runs the real wayfault library — the exact same Python wheel you
pip install — directly in your browser. No rewrite, no server, no API.
How can Python run in the browser? (the porting question)
The library is not re-implemented in JavaScript. Instead it runs on Pyodide, which is CPython (plus numpy, scipy, …) compiled to WebAssembly. The page:
- loads the Pyodide runtime from a CDN,
micropip-installs the publishedwayfaultwheel (wayfault-*-py3-none-any.whl) — a pure-Python wheel, so it just works,- calls
estimate_wwr(...)and hands the resulting numbers to a JS chart library (Chart.js) for rendering.
Because wayfault's only hard dependency is numpy (which Pyodide ships
natively) and the optional extras are lazily imported, the whole library
drops into the browser unchanged. This is the recommended way to "port"
a numpy-based Python library to the web: don't port it — run it on
WebAssembly.
Initializing…
Baseline CVA–
WWR CVA–
Alpha α–
Uplift–
EEPE–
Class–
Exposure profiles
Alpha vs dependence knob
Computed live by wayfault.estimate_wwr running on Pyodide
(4 000 Monte-Carlo scenarios × 12 quarterly tenors).