Lab

More models running live

These demonstrations complete the ones on the homepage. Everything is computed in your browser by the site's tested library; the models are stylised and their parameters fictitious.

Markowitz efficient frontier

Five fictitious assets. The unconstrained frontier is in closed form; the frontier without short sales is traced by the critical line algorithm, exact piece by piece. Inconsistent correlations are reported, never silently repaired.

Assets, correlations and rate
Correlations
AssetReturn (%)Volatility (%)
A
B
C
D
E
ABCDE
A1.000.200.100.000.10
B0.201.000.500.400.30
C0.100.501.000.600.40
D0.000.400.601.000.50
E0.100.300.400.501.00
ABCDE0.02.55.07.510.012.5010203040expected return (%)volatility (%)
Fig. 1 — Unconstrained frontier in closed form (Merton, 1972): σ²(m) = (A·m² − 2B·m + C)/D, dotted below the minimum variance where it is inefficient. Long-only frontier by the critical line algorithm (Markowitz, 1956), exact between its corner portfolios. The capital market line starts at the risk-free rate and touches the frontier at the tangency portfolio. Fictitious parameters.
A0 / -13 %B1 / 17 %C45 / 44 %D49 / 42 %E5 / 10 %-50 %0 %50 %100 %
Fig. 2 — Weights at the same target return: long-only left of the “/”, unconstrained right of it. Without constraints, negative weights (short sales) lower the variance; the long-only constraint can only raise it.

SSVI volatility surface free of static arbitrage

Gatheral and Jacquier's SSVI parameterisation. The sliders stay inside the domain where the paper guarantees no static arbitrage; tick the box to leave it and watch Durrleman's condition fail.

SSVI parameters

Inside the static no-arbitrage domain: γ ≤ ½ and η(1 + |ρ|) ≤ 2.

k = ln(K/F)T (years)σ 14–59 %
Fig. 3 — Surface SVI (Gatheral and Jacquier, 2014): total variance w(k, θ) = θ/2·(1 + ρφk + √((φk + ρ)² + 1 − ρ²)), power-law curvature φ(θ) = η/(θ^γ·(1 + θ)^(1−γ)), with θ_T = σ_ATM²·T; the volatility shown is σ = √(w/T). Axes: k left to right, T in depth, σ upwards; on a phone, a heat map: k across, T up, σ in colour, from the background's tint to full slate, scale at the top right, capped at the 9th decile so that the short wings do not flatten the rest. Fictitious parameters.
1020304050-1.0-0.50.00.51.0σk = ln(K/F)
Fig. 4 — Slices of the surface at three maturities. ρ < 0 tilts the smile towards low strikes, as for equities.
-1012-1.0-0.50.00.51.0g(k)k = ln(K/F)
Fig. 5 — Durrleman's condition: a slice is free of butterfly arbitrage if g(k) = (1 − k·w′/(2w))² − (w′²/4)(1/w + 1/4) + w″/2 ≥ 0. Inside the domain γ ≤ ½, η(1 + |ρ|) ≤ 2 (the paper's Theorem 4.2), it holds everywhere; the tests check it on a grid.

Rolling correlations and a regime change

Eight assets, one market factor and two sector factors. During a stress episode, correlations rise; the rolling window sees it late and with noise, which can be compared with the true matrix.

Estimation window (days)
Matrix shown

Day 300 · stress regime · mean gap to the true matrix 0.09

1.00.50.50.50.40.30.30.40.51.00.70.70.50.60.50.50.50.71.00.70.50.50.40.50.50.70.71.00.60.60.50.60.40.50.50.61.00.60.70.70.30.60.50.60.61.00.70.60.30.50.40.50.70.71.00.60.40.50.50.60.70.60.61.0A1A2A3A4B1B2B3B4A1A2A3A4B1B2B3B4
Fig. 6 — Eight fictitious assets in two sectors: return = β·market + γ·sector + own noise. Under stress the β rise from about 0.6 to 1.4. Empirical correlation on the rolling window (positive semidefinite once the window exceeds the number of assets) or the regime's true correlation, known in closed form. Colours: brick negative, slate positive, neutral around zero.
0204060800150300450600market-mode share (%)day
Fig. 7 — Market-mode share, λ₁/n of the correlation matrix. The estimate follows the truth about one window late, with noise that grows as the window shortens: the speed–noise trade-off of any rolling estimate. Fictitious parameters.

Zero-intelligence order book

Orders that arrive at random, with no strategy: the resulting spread and depth depend only on the arrival and cancellation rates, as Smith, Farmer, Gillemot and Krishnamurthy show.

Order flow
Average spread (ticks)
4.0
Depth at the best quote
2.1
Trades
800

t = 200 · best bid 194 · best ask 198

Last trades

  1. 199.9buy196
  2. 199.7buy195
  3. 199.0buy197
  4. 198.8sell194
  5. 198.8sell195
  6. 198.7sell201
  7. 198.6buy202
  8. 198.3buy200
20682057204220312021201200199119811971961951942193119261916190718961887187718612price (ticks)resting orders
Fig. 8 — Zero-intelligence order book (Smith, Farmer, Gillemot and Krishnamurthy, 2003): unit orders, limit orders at rate α per tick on the 30 ticks behind the opposite best quote, market orders at rate μ on each side, each cancelled at rate δ. Event-driven Gillespie simulation. Far from the mid, depth tends to α/δ.
190195200205100200price (ticks)t
Fig. 9 — Best quotes and spread. More market orders widen the spread, more limit orders narrow it: the tests check it over several seeds. The model knows no strategy, information or impact beyond one order: that is its point and its limit. Fictitious parameters.