Skip to main content

FxIndex

Struct FxIndex 

pub struct FxIndex {
    pub name: String,
    pub base: Currency,
    pub quote: Currency,
    pub fixing_calendar: Arc<dyn Calendar>,
    pub settlement_calendar: Option<Arc<dyn Calendar>>,
    pub fixing_lag_days: u8,
}
Expand description

An FX fixing index: the pair it observes and its settlement (spot) conventions — fixing_calendar / fixing_lag_days, dating when a spot or forward trade’s cash moves, the lag between a fixing and its value date.

Fields§

§name: String

Index identifier — the fixing-store key (canonically "FX-EURUSD").

§base: Currency

Base currency of the pair (fixings are quote per 1 base).

§quote: Currency

Quote currency of the pair.

§fixing_calendar: Arc<dyn Calendar>

The calendar the fixing lag is counted on.

§settlement_calendar: Option<Arc<dyn Calendar>>

A second calendar the value date must also be a business day of (the USD spot rule: count on the pair’s centres, settle on a New York business day). None settles on fixing_calendar alone.

§fixing_lag_days: u8

Settlement (spot) lag in business days between fixing date and value date.

Implementations§

§

impl FxIndex

pub fn canonical_name(base: &Currency, quote: &Currency) -> String

The canonical index identifier for a pair: "FX-{BASE}{QUOTE}".

pub fn new( base: Currency, quote: Currency, fixing_calendar: Arc<dyn Calendar>, fixing_lag_days: u8, ) -> Self

An index with explicit settlement conventions and the canonical name.

pub fn with_settlement_calendar(self, settlement: Arc<dyn Calendar>) -> Self

The same index, its value dates also good on settlement.

pub fn pair_code(&self) -> String

The vendor-style pair symbol, e.g. "EURUSD".

pub fn value_date(&self, fixing_date: NaiveDate) -> NaiveDate

The value (settlement) date for a fixing observed on fixing_date: the fixing lag counted in business days on the fixing calendar, rolled following onto a business day of that calendar and, when one is set, of the settlement calendar.

pub fn spot_fixing_date(&self, value_date: NaiveDate) -> NaiveDate

The settlement-convention fixing date for a settlement on value_date: the value date (adjusted preceding onto the fixing calendar if needed) rolled back the spot lag in business days. Inverse of value_date up to that roll. This dates a settlement fixing (an NDF’s netting observation).

Trait Implementations§

§

impl Clone for FxIndex

§

fn clone(&self) -> FxIndex

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 FxIndex

§

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

Formats the value using the given formatter. Read more

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.