Skip to main content

DiscretizedBermudan

Struct DiscretizedBermudan 

struct DiscretizedBermudan<R: Scalar> {
    exercises: Vec<(usize, R, Vec<(R, R, R)>)>,
    notional: f64,
    sign: f64,
    last: usize,
}
Expand description

The rollback asset for a Bermudan swaption: per exercise slice, the affine factors of every remaining fixed payment’s discount bond seen from that date, so the co-terminal swap’s model value at a node is N·(P(t,S) − Σ c_i·A_i·e^{−B_i·r}) with c_i = (K + s)·τ_i (s the basis spread that strikes on the swap’s own floating leg), the unit redemption on the last, and P(t,S) the par leg at the delivered swap’s start. The factors are in the mode — they carry the curve’s and the parameters’ sensitivities — and the exercise decision compares passive values, freezing nothing: the exercised node takes the model value, which is itself active.

Fields§

§exercises: Vec<(usize, R, Vec<(R, R, R)>)>

(step, the curve forward f(0, t) the factors were built on, remaining payments as (A, B, coupon)), ascending by step. The forward is kept so the factors can be re-keyed to the lattice’s own at each slice.

§notional: f64§sign: f64

+1 for a payer (the holder receives 1 − bond), −1 for a receiver.

§last: usize

Implementations§

§

impl<R: Scalar> DiscretizedBermudan<R>

fn assemble( swaption: &BermudanSwaption, grid: &TimeGrid, view: &PricingView<'_, R>, params: &HullWhiteParameters<R>, ) -> Result<Self, PricingError>

Assembles the asset on grid, keeping exercises strictly after the valuation date that still have a fixed payment to enter.

fn swap_value(&self, terms: &[(R, R, R)], r: R, shift: R) -> R

The co-terminal swap’s value to the holder at short rate r, per unit notional: ±(P(t,S) − Σ c_i·P(t,t_i)), every bond A·e^{−B·r} with each A moved by e^{B·shift} from the forward it was built on to the lattice’s. The par leg P(t,S) is the first term, carried at coupon −1.

Trait Implementations§

§

impl<R: Scalar> DiscretizedAsset<R> for DiscretizedBermudan<R>

§

fn last_step(&self) -> usize

The last (latest) step index where the asset has value — rollback starts here.
§

fn adjust_values( &self, step: usize, lattice: &HullWhiteLattice<R>, values: &mut [R], )

Adjust the slice values at step: inject cashflows, apply exercise. Called once at the terminal step (with zero-initialised values) to set the terminal payoff, then after each rollback step. values is indexed by node offset (0 ⇒ j = −half_width). Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.