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>
impl<'a, R: Scalar> FixingsView<'a, R>
pub fn parameters(&self) -> &[R]
pub fn parameters(&self) -> &[R]
This mode’s parameters.
pub fn store(&self) -> &'a FixingStore
pub fn store(&self) -> &'a FixingStore
The store this view reads.
pub fn published(&self, index: &str, date: NaiveDate) -> Option<R>
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>
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>
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
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>
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_ofis history and must be in the store —fixing, whose error names the missing day; - a reset on
as_ofreads 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_ofis 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>
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>
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>
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>
impl<'a, R: Clone + Scalar> Clone for FixingsView<'a, R>
§fn clone(&self) -> FixingsView<'a, R>
fn clone(&self) -> FixingsView<'a, R>
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more