Docs / quant-cva / com.nablatensor.cva

final class

HwShortRate

A one-factor Hull-White short rate as an on-tape step block, plus an analytic zero-coupon bond reconstruction P(t, T) from the simulated r_t.

dr = a (b - r) dt + sigma dW

A flat instantaneous forward f(0, .) = r0 stands in for the full theta(t) term structure — the same simplification as com.nablatensor.quant.HullWhite1F#bond, which this mirrors. Every coefficient is an SDouble input, so one adjoint sweep of a valuation built on this block yields dV/dr0, dV/da, dV/db and dV/dsigma together.

Methods

static HwShortRate of(AadRecorder recorder, SDouble r0, SDouble level, SDouble meanReversion, SDouble sigma, double dt)
State start()

The path at t = 0: r = r0, integral 0.

State step(State s, SDouble z)

One Euler step forward given a standard-normal draw z.

SDouble discountFactor(State s)

exp(-integral_0^t r du) along this path — the stochastic discount factor.

SDouble bond(SDouble rt, double t, double horizon)

Analytic P(t, T) from the simulated short rate r_t, for an initial curve with a flat instantaneous forward f(0, .) = r0:

B(t,T) = (1 - e^{-a (T-t)}) / a
P(t,T) = exp( -r0 (T-t) + B r0 - sigma^2/(4a) B^2 (1 - e^{-2 a t}) - B r_t )