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§

source

fn price(&self) -> f64

Returns the price (net present value) of the instrument.

source

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).

source

fn valuation_date(&self) -> Date

Returns the date at which the NPV is calculated.

source

fn instrument_type(&self) -> &'static str

Instrument type.

Implementors§