Skip to main content

FxImplied

Struct FxImplied 

pub struct FxImplied {
    base: Box<Curve>,
    spot: f64,
    taus: Vec<f64>,
    forwards: Vec<f64>,
    reference_date: NaiveDate,
    pair: Option<CurrencyPair>,
}
Expand description

A foreign discount curve implied by FX forwards over a base funding curve.

Covered interest parity implies a quote-currency discount curve from a base-currency funding curve, an FX spot and a strip of forward outrights. For a pair quoted as quote units per 1 base, anchored at the FX spot settlement date t₀:

DF(t) = (spot / F(t)) · DF_base(t)/DF_base(t₀)

where F interpolates the forward strip with a leading (t₀, spot) node, so F(t₀) = spot. Three properties follow: it is 1 at t₀ by construction; it reprices the strip exactly at each pillar; and because the base is read live rather than snapshotted, it inherits the funding curve’s shape between pillars and the base’s pillar sensitivities flow through the division.

The spot is the free parameter, the outrights are not. That is the whole asymmetry: a reverse sweep yields the base’s pillar risk and the FX delta ∂DF/∂spot on its own axis, while the outrights are market constants that pin the shape.

Fields§

§base: Box<Curve>§spot: f64

FX spot, quote per 1 base — the single free parameter.

§taus: Vec<f64>

Strip year fractions from reference_date, ascending, with a leading 0.0 for the spot node. One longer than forwards.

§forwards: Vec<f64>

Forward outrights at the non-spot pillars. MarketContext constants.

§reference_date: NaiveDate

The FX spot settlement date t₀, where the curve is 1.

§pair: Option<CurrencyPair>

The pair the spot and outrights are quoted in, when stated: what an FX scenario holding outrights matches the curve by.

Implementations§

§

impl FxImplied

pub fn new( base: Curve, spot: f64, spot_date: NaiveDate, forwards: &[(NaiveDate, f64)], ) -> Result<Self, CurveError>

A curve implied over base by spot and the forwards outrights, all quoted as quote per 1 base, anchored at the spot settlement date.

§Errors

CurveError::Malformed if spot is not strictly positive, if a forward date does not strictly increase from the spot date, or if a forward outright is not strictly positive.

pub fn with_pair(self, pair: CurrencyPair) -> Self

This curve naming the pair its spot and outrights are quoted in (quote units per one base), so an FX scenario that holds outrights can find it.

pub fn pair(&self) -> Option<CurrencyPair>

The pair the spot and outrights are quoted in, when stated.

pub fn spot(&self) -> f64

The FX spot — the curve’s one free parameter.

pub fn with_spot(&self, spot: f64) -> Result<Self, CurveError>

This curve at another spot with the outrights held: the rates it implies re-derived by covered interest parity, as the AD FX delta moves them.

§Errors

CurveError::Malformed for a spot that is not finite and positive.

pub fn base(&self) -> &Curve

The funding curve the implication is read over.

pub fn parameters(&self) -> &[f64]

The free parameter — the FX spot, on its own axis.

pub fn forwards(&self) -> &[f64]

The forward outrights that pin the shape. MarketContext constants, not parameters.

pub fn view<R: Scalar>(&self) -> FxImpliedView<'_, R>

This curve lifted into mode R. The base is lifted, not copied.

pub(crate) fn view_with_slice<'a, R: Scalar>( &'a self, rest: &mut &'a [R], ) -> FxImpliedView<'a, R>

One step of a substituted walk. See take_params.

Its own spot comes off the front before the base’s, matching the order parameter_owners reports.

pub(crate) fn view_seeding<R: Scalar + Seedable>( &self, seed: &mut Option<usize>, ) -> FxImpliedView<'_, R>

One step of the seeded walk. See take_seed.

This family owns one parameter and reads a curve, so it consumes its own spot off the front before handing what is left to the base — the same order Curve::parameter_owners reports them in.

Trait Implementations§

§

impl Clone for FxImplied

§

fn clone(&self) -> FxImplied

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
§

impl Debug for FxImplied

§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
§

impl PartialEq for FxImplied

§

fn eq(&self, other: &FxImplied) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
§

impl StructuralPartialEq for FxImplied

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.