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: f64FX 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: NaiveDateThe 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
impl FxImplied
pub fn new(
base: Curve,
spot: f64,
spot_date: NaiveDate,
forwards: &[(NaiveDate, f64)],
) -> Result<Self, CurveError>
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
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>
pub fn pair(&self) -> Option<CurrencyPair>
The pair the spot and outrights are quoted in, when stated.
pub fn with_spot(&self, spot: f64) -> Result<Self, CurveError>
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 parameters(&self) -> &[f64]
pub fn parameters(&self) -> &[f64]
The free parameter — the FX spot, on its own axis.
pub fn forwards(&self) -> &[f64]
pub fn forwards(&self) -> &[f64]
The forward outrights that pin the shape. MarketContext constants, not parameters.
pub fn view<R: Scalar>(&self) -> FxImpliedView<'_, R>
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>
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>
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.