Skip to main content

FixingsView

Struct FixingsView 

pub struct FixingsView<'a, R: Scalar> {
    data: &'a FixingStore,
    params: Cow<'a, [R]>,
}
Expand description

A FixingStore lifted into one pricing mode.

Fields§

§data: &'a FixingStore§params: Cow<'a, [R]>

Implementations§

§

impl<'a, R: Scalar> FixingsView<'a, R>

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

This mode’s parameters.

pub fn store(&self) -> &'a FixingStore

The store this view reads.

pub fn published(&self, index: &str, date: NaiveDate) -> Option<R>

The fixing published on date, if the store holds one — the read a reset dated today makes, falling back to the curve when nothing has been published yet; a reset before today reads fixing and must be there.

pub fn fixing(&self, index: &str, date: NaiveDate) -> Result<R, MarketDataError>

The rate index fixed at on date.

§Errors

MarketDataError::MissingFixing naming both, rather than a zero or a silent fallback to projection — a reset that should have been observed and was not is a data problem, and pricing through it hides one.

pub fn try_fixing(&self, index: &str, date: NaiveDate) -> Option<R>

The rate index fixed at on date, or None if it was never published.

For callers deciding whether a reset has been observed, where absence is an ordinary answer rather than a failure.

pub fn sum_between( &self, index: &str, after: NaiveDate, through: NaiveDate, ) -> R

The sum of index’s prints dated in (after, through] — zero when none is published. How an equity’s dividends over a period are read.

pub fn observe( &self, index: &str, date: NaiveDate, as_of: NaiveDate, ) -> Result<Option<R>, MarketDataError>

Whether the reset index makes on date has been observed as of as_of: Some(rate) when it has, None when it is to be projected.

The one rule every product that reads a fixing applies:

  • a reset before as_of is history and must be in the store — fixing, whose error names the missing day;
  • a reset on as_of reads the print if it has been published and is projected otherwise — an overnight rate prints the next morning and a term rate may not be out when a spot-starting trade is priced;
  • a reset after as_of is projected, and a value stored against it is not read.

The three cases are keyed on the fixing date. A reset that projects carries curve risk; once its print is published the exposure moves to the fixing’s own ladder.

§Errors

MarketDataError::MissingFixing for a reset before as_of the store does not hold.

pub fn observe_source( &self, source: &FixingSource, date: NaiveDate, as_of: NaiveDate, ) -> Result<Option<R>, MarketDataError>

The settlement fixing source reads on date, as of as_of, under observe’s rule — None before the fixing date or on it with nothing printed. A single key reads exactly as observe does. A cross reads both keys on the one date and returns reference units per one settlement unit: each key oriented to units per USD — a key quoting USD per unit (FX-EURUSD) inverted — and the reference divided by the settlement. This is the one place a settlement fixing is oriented. A cross prints only once both its series have.

§Errors

The store’s typed gap error, naming the key that is missing.

pub fn observe_for_pair( &self, source: &FixingSource, base: &str, quote: &str, date: NaiveDate, as_of: NaiveDate, ) -> Result<Option<R>, MarketDataError>

The settlement fixing source reads, as quote units per one base unit of a base/quote forward: observe_source’s reading, inverted where the source quotes the pair the other way round: a single key (FX-USDKRW read for a KRW-base forward), or a cross, whose reading is its reference per its settlement currency, read for a forward based in the reference currency.

§Errors

As observe_source.

pub fn passive(&self) -> FixingsView<'a, f64>

This view re-lifted at the passive mode, borrowing the same storage.

Trait Implementations§

§

impl<'a, R: Clone + Scalar> Clone for FixingsView<'a, R>

§

fn clone(&self) -> FixingsView<'a, R>

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<'a, R: Debug + Scalar> Debug for FixingsView<'a, R>

§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<'a, R> Freeze for FixingsView<'a, R>

§

impl<'a, R> RefUnwindSafe for FixingsView<'a, R>
where R: RefUnwindSafe,

§

impl<'a, R> Send for FixingsView<'a, R>

§

impl<'a, R> Sync for FixingsView<'a, R>

§

impl<'a, R> Unpin for FixingsView<'a, R>
where R: Unpin,

§

impl<'a, R> UnsafeUnpin for FixingsView<'a, R>

§

impl<'a, R> UnwindSafe for FixingsView<'a, R>

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.