pub trait Instrument {
// Required method
fn try_npv(&self) -> Result<f64, RustyQLibError>;
// Provided methods
fn npv(&self) -> f64 { ... }
fn price(&self) -> Result<PricingResult, RustyQLibError> { ... }
}Required Methods§
Sourcefn try_npv(&self) -> Result<f64, RustyQLibError>
fn try_npv(&self) -> Result<f64, RustyQLibError>
Present value, or a typed error when the instrument cannot be priced (invalid inputs, or an engine/product combination the library refuses to price).
Provided Methods§
Sourcefn npv(&self) -> f64
fn npv(&self) -> f64
Present value, panicking on any pricing error. Convenience for
instruments already known to be valid; fallible callers (batch
pricing, services) should use Instrument::try_npv.
Sourcefn price(&self) -> Result<PricingResult, RustyQLibError>
fn price(&self) -> Result<PricingResult, RustyQLibError>
Price the instrument once, returning value, Greeks and (for Monte
Carlo engines) the standard error together in a PricingResult.
The default implementation reports the present value with zero Greeks; instruments that compute sensitivities override it.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".