Skip to main content

z_spread_with

Function z_spread_with 

pub fn z_spread_with<R: Scalar>(
    bond: &FixedRateBond,
    view: &PricingView<'_, R>,
    price: f64,
    basis: PriceBasis,
) -> Result<f64, PricingError>
Expand description

The z-spread implied by a bond’s dirty price against a resolved view — a passive solve, as the OAS is.

The kernel lives in bonds::z_spread_on_curve over a bare curve, because a flat spread over a term structure needs no market seam. This is the seam-side entry point, so a caller holding a resolved view reaches it the same way it reaches callable_oas_with — and so the two spreads, which coincide at zero volatility, are requested through matching doors.

§Errors

PricingError::UnbracketedSolve when no spread in the bracket reprices the quote; PricingError::SolverUnconverged on the cap; the curve errors otherwise.