[][src]Function hull_white::american_payer_swaption_t

pub fn american_payer_swaption_t(
    r_t: f64,
    a: f64,
    sigma: f64,
    t: f64,
    swap_tenor: f64,
    option_maturity: f64,
    delta: f64,
    swap_rate: f64,
    num_steps: usize,
    yield_curve: &dyn Fn(f64) -> f64,
    forward_curve: &dyn Fn(f64) -> f64
) -> f64

Returns price of an American payer swaption at some future time t

Comments

This function uses a tree to solve and will take longer to compute than other pricing functions.

Examples

let r_t = 0.04; //current rate
let a = 0.2; //speed of mean reversion for underlying Hull White process
let sigma = 0.3; //volatility of underlying Hull White process
let t = 1.0; //time from "now" (0) to start valuing the bond
let option_maturity = 2.0;
let swap_tenor = 4.0; //swap_tenor is how long the swap will be once entered in
let delta = 0.25; //delta is the tenor of the Libor rate
let swap_rate = 0.04; //the swap rate is what the payer agrees to pay if option is exercised
let yield_curve = |t:f64|0.05*t; //yield curve returns the "raw" yield (not divided by maturity)
let forward_curve = |t:f64|t.ln();
let num_tree_steps = 100;
let swaption = hull_white::american_payer_swaption_t(
    r_t, a, sigma, t,
    swap_tenor, option_maturity,
    delta, swap_rate, num_tree_steps,
    &yield_curve, &forward_curve
);