Curves

Trait Curves 

Source
pub trait Curves<C> {
    // Required methods
    fn new(dates: &[Date], rates: &[f64]) -> Self;
    fn initial_date(&self) -> Date;
    fn terminal_date(&self) -> Date;
    fn get_rate(&mut self, date: Date) -> f64;
    fn get_rates(&mut self, dates: &[Date]) -> Vec<f64>;
    fn insert_rate(&mut self, date: Date, rate: f64);
    fn fit(&mut self) -> Result<(), Error>;
    fn plot(&self);
}
Expand description

Generic trait for curves.

Required Methods§

Source

fn new(dates: &[Date], rates: &[f64]) -> Self

Create a new curve from a set of Dates and rates (f64s).

Source

fn initial_date(&self) -> Date

Get the initial date of the curve.

Source

fn terminal_date(&self) -> Date

Get the terminal date of the curve.

Source

fn get_rate(&mut self, date: Date) -> f64

Get the rate for a specific date.

Source

fn get_rates(&mut self, dates: &[Date]) -> Vec<f64>

Get multiple rates for a set of dates.

Source

fn insert_rate(&mut self, date: Date, rate: f64)

Insert a new rate into the curve.

Source

fn fit(&mut self) -> Result<(), Error>

Fit the curve to a Nelson-Siegel-Svensson model.

Source

fn plot(&self)

Plot the curve.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§

Source§

impl<C> Curves<C> for DiscountCurve<Date, C>
where C: Calendar + Clone,

Source§

impl<C> Curves<C> for ForwardCurve<Date, C>
where C: Calendar + Clone,

Source§

impl<C> Curves<C> for SpotCurve<Date, C>
where C: Calendar + Clone,