Use case · Treasury & risk

Close the risk book while the market is open.

The Monday reality: positions in one workbook, FX in a terminal, VaR in a Python job someone reruns by hand, and a PDF at 4pm. In Grid it's one model — live FX, revalued positions, VaR three ways — computing continuously, with an API your other systems read directly.

Grids
@
01 · The model

Monday morning, as source.

risk-book.gridgrid
# FX input with an explicit assumed fallback
eur_usd = FX_RATE("EUR", "USD")
rate = eur_usd DEFAULT 1.08

# the book, revalued as rates move
mv_usd = notionals * prices * rate

# one-period tail risk and annualized performance
var_hist = VAR_HISTORICAL(returns, 0.95)
var_normal = VAR_MONTE_CARLO(returns, 0.95, 1, 100000)
sharpe = SHARPE(returns, 0.02, 252)

# record a scheduled timestamp
EVERY 15min SKIP MISSED THEN
  refresh_stamp = NOW()
END

Historical VaR uses the empirical return quantile. VAR_MONTE_CARLO uses deterministic normal-quantile scenarios with estimated mean and volatility; it does not simulate random paths. Both risk estimates here use a one-period horizon.DEFAULT supplies an assumed FX fallback, and the schedule records a timestamp; neither establishes quote freshness.

Not a demo. A working domain.

The canonical library ships a full portfolio risk engine and treasury control plane — position translation, carry, duration stress, liquidity ladders — as working models, not slideware.

More MondaysAll use cases