Struct Digital
pub struct Digital {
pub call: Option<DigitalStrike>,
pub put: Option<DigitalStrike>,
pub naked: bool,
pub gap: f64,
}Expand description
Digital options on a floating coupon’s rate.
A call pays when the rate ends above its strike, a put when it ends below.
Still to fix, each is replicated by a call spread gap wide, centred on
the strike, over the coupon capped (a call) or floored (a put) either side
of it: (C(K − gap/2) − C(K + gap/2)) / gap for the digital call, the same
with floorlets for the put, times the cash rate — or times the strike plus
the caplet (floorlet, subtracted) at the strike for asset-or-nothing. The
coupon pays its own rate as well unless the option is naked.
Fields§
§call: Option<DigitalStrike>The call side, when there is one.
put: Option<DigitalStrike>The put side, when there is one.
naked: boolWhether the coupon pays only the options, not its own rate.
gap: f64The call spread’s width, on the rate; the default central replication
is 1e-4.
Implementations§
§impl Digital
impl Digital
pub const DEFAULT_GAP: f64 = 1e-4
pub const DEFAULT_GAP: f64 = 1e-4
The default call spread: centred, one basis point wide.
pub fn new(
call: Option<DigitalStrike>,
put: Option<DigitalStrike>,
naked: bool,
gap: f64,
) -> Result<Self, PayoffError>
pub fn new( call: Option<DigitalStrike>, put: Option<DigitalStrike>, naked: bool, gap: f64, ) -> Result<Self, PayoffError>
A digital with call and put sides, checked.
§Errors
PayoffError for no side, a gap that is not positive, or a strike
or cash rate that is not finite.