Skip to main content

Module pricers

Module pricers 

Expand description

The pricers: one generic implementation per product.

Each impl block below is written once, against R: Scalar, and serves every pricing mode. There is no per-mode duplicate anywhere in this file, and that is the property 6.7 asks for — a pricing body that had to be written twice would mean the seam had not actually abstracted the mode.

They live here rather than with the instrument types because pricing needs the resolved market view, and the view is this layer’s business. An instrument that fetched its own curves would invert the layering.

Macros§

fixed_float_priceable 🔒
The fixed-float swap valuation, one body for the vanilla and the overnight swap: their legs, index and collateral are the same fields, and only the product name a refusal reports differs.

Structs§

Caplet
One caplet of a strip, passively: what a formula prices it on.
CdsLegs 🔒
A CDS’s leg values from one pass: the premium leg’s annuity and value, the protection leg’s value, and the settlement flows.
CdsOptionValue
A single-name CDS option’s value, and the forward it was struck against.
CreditLinkedComponents 🔒
A credit-linked swap’s components from one pass, in the trade currency.
CreditWalk 🔒
The premium schedule and protection start of a standard credit contract, walked as the contract runs: periods ending on or before the protection start are skipped (the first accrual still starts at the prior IMM date), protection is discounted at each period’s midpoint and premium at its payment date, both clamped to the valuation.
DiscretizedBermudan 🔒
The rollback asset for a Bermudan swaption: per exercise slice, the affine factors of every remaining fixed payment’s discount bond seen from that date, so the co-terminal swap’s model value at a node is N·(P(t,S) − Σ c_i·A_i·e^{−B_i·r}) with c_i = (K + s)·τ_i (s the basis spread that strikes on the swap’s own floating leg), the unit redemption on the last, and P(t,S) the par leg at the delivered swap’s start. The factors are in the mode — they carry the curve’s and the parameters’ sensitivities — and the exercise decision compares passive values, freezing nothing: the exercised node takes the model value, which is itself active.
DiscretizedCallableBond 🔒
The rollback asset for a callable/puttable bond: face-scaled (step, amount) cashflow injections plus (step, dirty redemption, kind) exercise entries, all on exact grid slices, step-sorted. Amounts are passive — they are contract terms — and enter the mode arithmetic as right-hand operands.
DiscretizedCallableLoan 🔒
DiscretizedCallableBond with its flows and strikes in the pricing mode: a callable loan’s floating coupons read the curves.
FutureOptionParts 🔒
A futures option’s per-100 value and the parts it is built from, in the mode.
FxOptionInputs 🔒
What every FX-option verb starts from: the parity forward to delivery, the two discount factors, the option’s life, and the surface.
IndexIntrinsic
An index CDS measured against its constituents: the replicating single-name portfolio’s value, and its duration-weighted spread.
IndexPeriod 🔒
One premium period an index pays after an option’s expiry: years from expiry to its start (expiry itself, for the period running across it) and its payment, its accrual, the years it had accrued by its start, and the forward discount factors from expiry to its start and payment.
IndexSkew
The skew adjustment of an index’s constituents: one piecewise-constant term structure of hazard multipliers, (pillar, factor) in pillar order, that every constituent’s curve is scaled by (ScaledSurvival).
LatticeMoments
The callable’s clean price and its first two derivatives with respect to a parallel continuous shift of the discounting, from one lattice pass.
LoanOnLattice 🔒
A callable loan’s servicing on its Hull-White lattice, from the lender’s side: its fixed flows and exercises on their steps, and each floating coupon still to fix as (start step, payment step, N).
SideCurves 🔒
The curves one side of a cross-currency swap prices on.

Enums§

ResolvedRecovery 🔒
A tranche’s recovery model as the view resolves it: the contract’s, or Amraoui–Hitier on the market’s lifted floor.

Constants§

INDEX_OPTION_BOUND 🔒
How far into either tail of the spread’s normal driver an index option integrates: |z| ≤ 8 holds the density to ~1e-15.
INDEX_OPTION_NODES 🔒
Gauss–Legendre points on each side of an index option’s exercise boundary.
MARGIN_BRACKET 🔒
The bracket a discount margin is searched over — the spread bracket, since a margin is a spread.
OAS_ITERATION_CAP 🔒
The spread solves’ backstop. A 0.4-wide bracket reaches f64 resolution in about fifty halvings even if every interpolated step were refused; the tolerance exits long before, and hitting this is a reported failure.
ONE_BP 🔒
One basis point, the unit Leg::bpv reports in.

Functions§

bracketed_root 🔒
The root of a monotone f on [0, ∞): bracketed from [0, 1] by doubling the upper end, then refined by Illinois false position until |f| ≤ tolerance. None when no bracket is found.
callable_oas_with
The continuous OAS implied by a quoted clean price — a passive solve.
caplet_times 🔒
The expiry a caplet is keyed on and the time its variance accrues over.
cash_annuity 🔒
The par-yield cash annuity: DF(S)·N·Σ τₖ·(1 + F/f)^(−f·tₖ) over the fixed periods entered on or after the expiry, with S the first entered period’s accrual start, tₖ the fixed day count’s year fraction from S to each payment and f the fixed leg’s periods a year — the fixed leg discounted at the forward swap rate itself, as the ISDA cash-settlement par yield curve method defines it. In the mode, so its rate sensitivity flows through the forward.
cds_option
A single-name CDS option under Black’s model on the forward spread: the right at expiry to enter underlying — the CDS the option exercises into, its protection starting after expiry — a payer (the right to pay the strike spread, buying protection) or a receiver (the right to receive it). short is the seller’s side: the same option, its value negated.
cip_forward 🔒
The covered-interest-parity forward spot·DF_base(T)/DF_quote(T), quote per one base, from the two resolved curves and the pair spot.
clean_price_at_oas_with
The clean price per 100 face of bond at a given continuous OAS, in the caller’s mode.
conversion 🔒
What one unit of a non-deliverable leg’s currency paid on pays is worth today in the settlement currency, converted as how says:
converted_annuity 🔒
A non-deliverable leg’s annuity in the settlement currency: each coupon’s notional · τ times its conversion, principal exchanges left out — the value one unit of fixed rate adds, signed by the leg’s side.
effective_risk_of 🔒
The callable’s LatticeMoments at a given OAS: one lattice build, one rollback, in second-order forward mode.
exact_step 🔒
The slice date sits on, which must be exact.
exercise_steps 🔒
The (step, strike, kind) exercises of live entries after cut: each on its date rolled by pays_on (Bermudan), or under american on every slice from its date to the slice before the next entry’s, the last on its date alone. strike(entry, on) is the redemption on on, in currency.
exercised 🔒
E[max(±X(z), 0)] over a standard normal driver z, for a payoff X rising in z: the payer’s side above the exercise boundary, the receiver’s below it, each by Gauss–Legendre. The boundary is found passively — the payoff is zero on it, so it carries no first-order term.
fair_forward_rate
The fair forward rate of forward — the covered-interest-parity forward to its value date, quote per one base: the contract rate at which it is worth nothing.
fair_margin_with
The funding margin that zeroes a total return swap, closed-form.
forward_and_annuity 🔒
The underlying’s forward swap rate and its fixed-leg annuity Σ τ_i·N·P(t, T_i) — the two curve quantities the option formula needs, both read off the swap’s own legs. The annuity is reported positive whichever side pays fixed: the option formula supplies the sign.
forward_yield_error 🔒
A passively solved forward yield that cannot be found, as a pricing error.
fra_rate 🔒
The FRA’s contract rate: the published fixing once the fixing date has passed, or once it has printed on the fixing date itself, else the simple forward over the accrual on the projection curve.
fra_settlement
The FRA’s settlement amount, paid on the accrual start: the accrual difference discounted by the contract rate itself, side · N · τ · (r − K) / (1 + τ·r). The factor is the contract, not an approximation — paying the undiscounted difference at the accrual end is a different instrument, and one no market quotes.
futures_convexity
The contract’s convexity adjustment, as a rate: its futures rate less the forward rate of the same contract with no adjustment — the Hull–White model’s where the contract is priced under it, the stated spread otherwise, a term or an overnight contract alike. In the mode.
futures_price
The model price, 100 − 100 · futures rate, in price points.
futures_rate 🔒
The contract’s futures rate plus the convexity adjustment: for a contract on an overnight index, its reference period’s overnight rate — realised days from the fixings, today’s if it has printed, the rest projected, compounded or averaged as the contract settles; for a contract on a term rate, the simple forward over the accrual on the projection curve.
fx_option_inputs 🔒
hull_white_basis 🔒
The deterministic basis spread a Hull-White swaption strikes on, entering on start the fixed periods entered as (payment date, accrual): s = (P(S) − P(tₙ) − FL)/A per unit notional, so that the discount par leg the one-factor model values, P(S) − P(tₙ), less (K + s)·A is the delivered swap’s own value FL − K·A. FL is the present value of the floating coupons whose accrual starts on or after S, off the index’s projection curve — the payment lag, a projection curve other than the discount curve and a float schedule other than the fixed one are all in it. In the mode, so the basis carries its curve risk.
hull_white_parameters 🔒
The view’s Hull-White parameters, refusing a view without them — a hand-built view lacking the model is a missing input, not a zero-vol price.
implied_repo 🔒
A deliverable’s implied repo and the coupons it pays inside the window: every coupon paid after valuation and on or before delivery, reinvested to delivery at the implied repo itself, so I + Σcᵢ(1 + r·τᵢ) = P(1 + r·τ) and r = (I + Σcᵢ − P) / (P·τ − Σcᵢ·τᵢ), simple on day_count. A non-positive price or denominator reads a rate of zero.
index_intrinsic
The intrinsic value and spread of index from its constituents.
index_skew
Solves the skew that makes an index’s constituents reprice it.
isda_annuity 🔒
The risky annuity from expiry at a quoted spread s, as the ISDA standard model converts a quote to an upfront: the flat hazard at which the periods’ protection, at loss lgd, is worth s times their premium, and the premium’s value per unit spread at that hazard.
leg_boundaries 🔒
A leg’s accrual boundaries: every coupon’s start, then the last end.
leg_value 🔒
A leg’s value in the currency it settles in: its ordinary value off disc for a deliverable leg; for a non-deliverable one, each payment still to come converted into the settlement currency by conversion and discounted on the settlement currency’s curve. No quanto adjustment is applied.
loan_clean_price_at_oas_with 🔒
A callable loan’s clean price per 100 of its outstanding at a continuous oas, as clean_price_at_oas_with reads a callable bond’s.
loan_oas_with 🔒
The continuous OAS at which a callable loan’s clean price is clean_price, a passive solve as callable_oas_with’s.
non_deliverable_par_rate 🔒
The fixed rate that values a non-deliverable swap at zero, given its floating leg’s converted value: off the fixed leg’s converted annuity for a leg paying per coupon, and in closed form — (1 + A/N)^(1/τ) − 1 — for one accruing a compounded rate into a single payment, as BRL’s does.
note_z_spread_with
The z-spread implied by a structured note’s dirty price per 100 of face — the flat continuously-compounded spread s over the note’s discounting for which Σ aᵢ·DF(tᵢ)·exp(−s·τᵢ) reprices it: the note’s twin of z_spread_with, and a passive solve as that is.
oas_solve 🔒
The spread at which clean_at, monotone decreasing, reprices clean_price.
option_kind 🔒
A payer is a call on the forward swap rate, a receiver a put.
overnight_hull_white_rate 🔒
An overnight contract’s futures rate under Hull–White, from its strip rate rate (realised days read, the rest projected, no convexity).
own_currency_cash
The default collateral for a currency: own-currency cash.
par_by_linearity 🔒
The root of a value affine in one contract number, from the product struck at 0 and at 1: −V(0) / (V(1) − V(0)).
par_rate_of 🔒
The par rate of a fixed-against-floating swap.
require_annuity 🔒
Rejects a zero annuity before a par measure divides by it.
risky_from 🔒
risky_on_view with the default walk starting at default_from — a loan or deposit not yet drawn cannot default on principal it has not lent.
risky_on_view 🔒
The survival-weighted value of flows with the view’s credit, refusing a view without a market recovery — a hand-built view lacking one is a missing input, not a zero-recovery price.
running_coupon 🔒
The running coupon of a standard credit contract.
settlement_fixing 🔒
The rate a cash-settled forward nets at, quote units per one base unit: the published fixing once its date has passed or it has printed today, else the parity forward spot · DF_base / DF_quote, which a physical forward always reads.
spread_solve_error 🔒
The spread kernel’s failure, in the seam’s own taxonomy.
step_credit 🔒
The view’s credit on grid’s steps, recovering on face_at — the same refusals as risky_on_view for a missing curve or recovery.
z_spread_with
The z-spread implied by a bond’s dirty price against a resolved view — a passive solve, as the OAS is.

Type Aliases§

AffinePayment 🔒
One remaining fixed payment seen from an exercise slice: the affine factors (A, B) of its discount bond and its coupon (K + s)·τ (plus the unit redemption on the last), s the slice’s basis spread.