Struct FxView
pub struct FxView<'a, R: Scalar> {
data: &'a FxRates,
params: Cow<'a, [R]>,
}Expand description
FxRates lifted into one pricing mode.
Fields§
§data: &'a FxRates§params: Cow<'a, [R]>Implementations§
§impl<'a, R: Scalar> FxView<'a, R>
impl<'a, R: Scalar> FxView<'a, R>
pub fn parameters(&self) -> &[R]
pub fn parameters(&self) -> &[R]
This mode’s parameters.
pub fn rate(&self, pair: CurrencyPair) -> Result<R, MarketDataError>
pub fn rate(&self, pair: CurrencyPair) -> Result<R, MarketDataError>
The spot rate for pair: quote units per one base.
A pair stored the other way round is answered by its reciprocal, which carries the reciprocal’s sensitivity because the mode’s own arithmetic computes it. A currency against itself is one.
§Errors
MarketDataError::MissingFxRate naming the pair, if neither direction
was supplied.
fn quoted(&self, pair: CurrencyPair) -> Option<R>
fn quoted(&self, pair: CurrencyPair) -> Option<R>
This pair as quoted, directly or by its reciprocal. None when neither
direction is stored — no bridging.
fn missing(pair: CurrencyPair) -> MarketDataError
pub fn convert(
&self,
amount: R,
from: Currency,
to: Currency,
) -> Result<R, MarketDataError>
pub fn convert( &self, amount: R, from: Currency, to: Currency, ) -> Result<R, MarketDataError>
Trait Implementations§
Auto Trait Implementations§
impl<'a, R> Freeze for FxView<'a, R>
impl<'a, R> RefUnwindSafe for FxView<'a, R>where
R: RefUnwindSafe,
impl<'a, R> Send for FxView<'a, R>
impl<'a, R> Sync for FxView<'a, R>
impl<'a, R> Unpin for FxView<'a, R>where
R: Unpin,
impl<'a, R> UnsafeUnpin for FxView<'a, R>
impl<'a, R> UnwindSafe for FxView<'a, R>where
R: RefUnwindSafe + UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more