Skip to main content

barrier_option

Function barrier_option 

pub fn barrier_option<R: Scalar>(
    spot: R,
    strike: f64,
    barrier: f64,
    rebate: f64,
    discount: R,
    vol: R,
    expiry: f64,
    kind: OptionKind,
    barrier_kind: BarrierKind,
) -> R
Expand description

A continuously monitored single-barrier European on a zero-dividend lognormal spot: the Reiner-Rubinstein closed form, as Haug states it, term for term. discount is the risk-free discount factor to expiry and expiry the vol’s year fraction to it; the rate is the one that makes the two agree, r = −ln P / τ. A knock-in’s rebate is paid at expiry if it never knocks in, a knock-out’s when it is hit. The spot is assumed on the live side of the barrier and the variance positive.