pub struct SyntheticInstrument_API(/* private fields */);Expand description
C compatible Foreign Function Interface (FFI) for an underlying
SyntheticInstrument.
This struct wraps SyntheticInstrument in a way that makes it compatible with C function
calls, enabling interaction with SyntheticInstrument in a C environment.
It implements the Deref trait, allowing instances of SyntheticInstrument_API to be
dereferenced to SyntheticInstrument, providing access to SyntheticInstruments’s methods without
having to manually access the underlying instance.
Methods from Deref<Target = SyntheticInstrument>§
Sourcepub fn is_valid_formula(&self, formula: &str) -> bool
pub fn is_valid_formula(&self, formula: &str) -> bool
Returns whether the given formula compiles against this instrument’s components.
Sourcepub fn change_formula(&mut self, formula: &str) -> Result<()>
pub fn change_formula(&mut self, formula: &str) -> Result<()>
Replaces the derivation formula, recompiling it against the existing components.
§Errors
Returns an error if parsing the new formula fails.
Sourcepub fn calculate_from_map(&self, inputs: &HashMap<String, f64>) -> Result<Price>
pub fn calculate_from_map(&self, inputs: &HashMap<String, f64>) -> Result<Price>
Calculates the price of the synthetic instrument based on component input prices provided as a map.
§Errors
Returns an error if formula evaluation fails or a required component price is missing from the input map.
Sourcepub fn calculate(&self, inputs: &[f64]) -> Result<Price>
pub fn calculate(&self, inputs: &[f64]) -> Result<Price>
Calculates the price of the synthetic instrument based on the given component input prices
provided as an array of f64 values.
§Errors
Returns an error if the input length does not match, any input is non-finite, or formula evaluation fails.
Trait Implementations§
Source§impl Debug for SyntheticInstrument_API
impl Debug for SyntheticInstrument_API
Source§impl Deref for SyntheticInstrument_API
impl Deref for SyntheticInstrument_API
Auto Trait Implementations§
impl Freeze for SyntheticInstrument_API
impl RefUnwindSafe for SyntheticInstrument_API
impl Send for SyntheticInstrument_API
impl Sync for SyntheticInstrument_API
impl Unpin for SyntheticInstrument_API
impl UnsafeUnpin for SyntheticInstrument_API
impl UnwindSafe for SyntheticInstrument_API
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
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more