Module fit
Expand description
Fitting a parametric discount curve to a bond universe.
A smoother, not a repricer. Four parameters over fifty bonds cannot reproduce fifty prices and is not meant to: what it produces is a shape, and what makes the shape judgeable is the residual per bond. So the fit returns both, from one call — a residuals accessor nobody reaches for is how a smoother ships unjudged.
Use the calibration ladder (calibrate) where exactness
matters; it fits one parameter per quote and reprices every one.
§The Jacobian is seeded
The curve seam substitutes a mode-generic parameter vector, so the
sensitivity of every bond’s model price to every parameter comes from one
forward pass per bond — no bump size, no truncation error. Parameter counts
wider than one seeding block loop over blocks, which is what
par_quote_jacobian already does one layer up.
Structs§
- Bond
FitRow - One bond’s place in a fit.
- Fitted
Bond Curve - A fitted curve and the residuals that say how well it fits.
Enums§
- FitError
- Why a fit produced no curve.
- FitWeights
- How price residuals are weighted.
- Fitted
Form - Which functional shape a fit reaches for.
- Fitted
Form Kind - A parametric form named without its basis count.
Constants§
- LANES 🔒
- The seeding width one pass covers. Matches the calibration Jacobian’s, for
the same reason: it is the lane count
JetKcarries.
Functions§
- basis 🔒
- A bond’s street basis — semiannual, the compounding a fitted government curve’s inputs are quoted on.
- fit_
bond_ curve - Fit a parametric discount curve to
quotes—(bond, clean price)pairs — as ofreference. - model_
clean 🔒 - The clean price
bondtakes oncurve, per 100 face, in modeR, where it settles fromreference: the flows after settlement carried there. - residuals_
and_ 🔒jacobian - The weighted residual vector and its Jacobian at one parameter point.