Function hull_white::coupon_bond_price_now
source · pub fn coupon_bond_price_now(
coupon_times: &[f64],
bond_maturity: f64,
coupon_rate: f64,
yield_curve: &dyn Fn(f64) -> f64
) -> f64
Expand description
Returns price of a coupon bond at current date
Examples
let coupon_times = vec![1.25, 1.5, 1.75]; //should be between t and bond_maturity
let bond_maturity = 2.0;
let coupon_rate = 0.05;
let yield_curve = |t:f64|0.05*t; //yield curve returns the "raw" yield (not divided by maturity)
let bond_price = hull_white::coupon_bond_price_now(
&coupon_times, bond_maturity,
coupon_rate,
&yield_curve
);