Trait RustQuant::instruments::instrument::Instrument
source · pub trait Instrument {
// Required methods
fn price(&self) -> f64;
fn error(&self) -> Option<f64>;
fn valuation_date(&self) -> Date;
fn instrument_type(&self) -> &'static str;
}
Expand description
Instrument trait The trait provides a common interface for all instruments. All instruments can be queried for their net present value (NPV) and error (if available). The valuation date is the date at which the instrument’s NPV is being calculated; for most instruments it is the trade date, for some exotic products it might be the exercise date.
Required Methods§
sourcefn error(&self) -> Option<f64>
fn error(&self) -> Option<f64>
Returns the error on the NPV in case the pricing engine can provide it (e.g. Monte Carlo pricing engine).
sourcefn valuation_date(&self) -> Date
fn valuation_date(&self) -> Date
Returns the date at which the NPV is calculated.
sourcefn instrument_type(&self) -> &'static str
fn instrument_type(&self) -> &'static str
Instrument type.