Skip to main content

fx_swap_rung

Function fx_swap_rung 

pub fn fx_swap_rung(
    code: &str,
    template: &AnyTemplate,
    valuation: NaiveDate,
    tenor: Period,
    quote: FxSwapQuote,
    notional: f64,
    spot: f64,
) -> Result<Rung, RungBuildError>
Expand description

The par rung of an FX swap on an FX-swap template value: the near leg on the valuation date at spot — where both discount factors are one, so the near exchange is worth exactly zero whatever the two curves — and the far leg on tenor advanced from the pair’s spot date (two business days on the template’s calendar) under its convention, at the quoted outright. The foreign leg’s collateral is the foreign currency under the template’s collateral currency, so the rung solves discount(<foreign>-CSA-<coll>); its quote is the outright, which the swap’s fair far rate verifies, and its residual is covered interest parity on the far date anchored at the valuation date — FxImplied’s reading from the same spot and outrights.

helixio’s stored spot is the valuation-date rate (the pricer discounts a spot-settled leg as a two-day forward), which is why the near leg is dated today; a desk’s spot-settled points differ from this by the two-day stub.

§Errors

RungBuildError::NotFamily for a template of another family; RungBuildError::Build for a currency the template names that is not one, or a swap the pair refuses.