Struct BondOption
pub struct BondOption {
pub bond: CallableBond,
pub expiry: NaiveDate,
pub settlement: NaiveDate,
pub strike: BondStrike,
pub kind: OptionKind,
pub engine: BondOptionEngine,
pub repo_key: Option<String>,
pub yield_vol_key: Option<String>,
}Expand description
A European option on a fixed-coupon bullet bond, physically settled.
Fields§
§bond: CallableBondThe deliverable bond, with its collateral and any security spread. A bullet: the call schedule is empty and the bond is not credit-tagged.
expiry: NaiveDateThe expiry — the exercise decision date the premium discounts from.
settlement: NaiveDateThe exercise settlement date the forward price is struck at: physical delivery settles like a cash trade done at expiry. A stored contract term, on or after the expiry.
strike: BondStrikeThe strike, in one of the market’s quoting forms.
kind: OptionKindCall (the right to buy the bond) or put.
engine: BondOptionEngineThe model the option prices under.
repo_key: Option<String>The repo curve the forward carries on, by key; None carries on the
discount curve.
yield_vol_key: Option<String>The key of the bond yield vol surface the option reads, one surface per
security if wanted; None reads
the bond’s currency.
Implementations§
§impl BondOption
impl BondOption
pub fn new(
bond: CallableBond,
expiry: NaiveDate,
strike: BondStrike,
kind: OptionKind,
) -> Result<Self, BondOptionError>
pub fn new( bond: CallableBond, expiry: NaiveDate, strike: BondStrike, kind: OptionKind, ) -> Result<Self, BondOptionError>
A bond option settling on its expiry, priced off the yield vol surface, carried on the discount curve.
§Errors
BondOptionError for a callable or credit-tagged underlying, a
non-finite strike, or an expiry on or after maturity.
pub fn with_yield_vol_key(self, key: impl Into<String>) -> Self
pub fn with_yield_vol_key(self, key: impl Into<String>) -> Self
This option reading the bond yield vol surface pinned under key
rather than its currency’s.
pub fn yield_vol_key(&self) -> &str
pub fn yield_vol_key(&self) -> &str
The key of the surface the option reads: its own, or the currency.
pub fn settling_on(self, settlement: NaiveDate) -> Result<Self, BondOptionError>
pub fn settling_on(self, settlement: NaiveDate) -> Result<Self, BondOptionError>
This option with exercise settling on settlement.
§Errors
BondOptionError::SettlementBeforeExpiry if it precedes the expiry.
pub fn with_engine(self, engine: BondOptionEngine) -> Self
pub fn with_engine(self, engine: BondOptionEngine) -> Self
This option priced under engine.
pub fn financed_on(self, key: impl Into<String>) -> Self
pub fn financed_on(self, key: impl Into<String>) -> Self
This option with the forward carried on the repo curve under key.
pub fn accrued_at_exercise(&self) -> f64
pub fn accrued_at_exercise(&self) -> f64
Accrued per 100 at exercise settlement.
pub fn dirty_strike(&self) -> f64
pub fn dirty_strike(&self) -> f64
The dirty cash strike at exercise settlement per 100 of the original face — the basis every price the crate reports is on — from whichever quoting form the strike carries.
A clean or dirty strike is quoted per 100 of the face alive at exercise settlement, so on an amortiser it is scaled by the fraction alive; the accrued already accrues on that fraction and is added as it is. A yield strike’s implied dirty price is on the original face already. A bullet’s fraction is exactly one.
§impl BondOption
impl BondOption
fn forward_dirty<R: Scalar>(
&self,
view: &PricingView<'_, R>,
) -> Result<R, PricingError>
fn forward_dirty<R: Scalar>( &self, view: &PricingView<'_, R>, ) -> Result<R, PricingError>
The forward dirty price per 100 at exercise settlement: the spot carried on the repo curve when the option declares one, on the discount curve otherwise — bit-identical to the discount-only price rebased to settlement in that case.
pub fn npv_with_diagnostics<R: Scalar>(
&self,
view: &PricingView<'_, R>,
) -> Result<(R, BondOptionDiagnostics), PricingError>
pub fn npv_with_diagnostics<R: Scalar>( &self, view: &PricingView<'_, R>, ) -> Result<(R, BondOptionDiagnostics), PricingError>
The yield-vol engine’s premium with the quantities it was built from.
The forward yield and duration are solved passively on the forward
and reattached in the mode by the implicit-function slopes
∂y/∂F = 1/P′ and ∂D/∂F = (−P″/P + (P′/P)²)/P′ from one second-order
pricing pass — so the surface is read at a duration that carries the
curve’s adjoints, and the price vol carries them through both factors.
Freezing either would drop its slope from the sensitivities.
§Errors
PricingError::UnsupportedForProduct under the Hull-White engine or
for an expired option, a missing surface, or the solver’s failures.
Trait Implementations§
§impl Clone for BondOption
impl Clone for BondOption
§fn clone(&self) -> BondOption
fn clone(&self) -> BondOption
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more§impl Debug for BondOption
impl Debug for BondOption
§impl PartialEq for BondOption
impl PartialEq for BondOption
§impl<R: Scalar> Priceable<R> for BondOption
impl<R: Scalar> Priceable<R> for BondOption
§fn npv(&self, view: &PricingView<'_, R>) -> Result<R, PricingError>
fn npv(&self, view: &PricingView<'_, R>) -> Result<R, PricingError>
Under the yield-vol engine, npv_with_diagnostics’s
premium; under Hull-White, the Jamshidian kernel on the deliverable
flows after exercise settlement against the dirty strike, per unit
face, scaled by the face. An expired option is worth nothing.
§fn par_rate(&self, _view: &PricingView<'_, R>) -> Result<R, PricingError>
fn par_rate(&self, _view: &PricingView<'_, R>) -> Result<R, PricingError>
§fn par_spread(&self, _view: &PricingView<'_, R>) -> Result<R, PricingError>
fn par_spread(&self, _view: &PricingView<'_, R>) -> Result<R, PricingError>
§impl PricingRiskFactors for BondOption
impl PricingRiskFactors for BondOption
§fn risk_factors(&self) -> Result<RiskFactors<'_>, PricingError>
fn risk_factors(&self) -> Result<RiskFactors<'_>, PricingError>
Discounts on the bond’s collateral with its security spread, carries on the declared repo curve, and declares only what the engine reads: the currency’s bond yield vols, or its Hull-White parameters.
§impl Product for BondOption
impl Product for BondOption
§fn currency(&self) -> Currency
fn currency(&self) -> Currency
§fn contract_dates(&self) -> Vec<(&'static str, NaiveDate)>
fn contract_dates(&self) -> Vec<(&'static str, NaiveDate)>
(name, date) pairs —
exactly the dates its stated constructor takes, so a product built
through a derived form can be read back and rebuilt through the stated
one. Empty for a product with no stated form. No default: every
product states which it is — see AnyInstrument::contract_dates.§fn legs(&self) -> Option<Vec<&Leg>>
fn legs(&self) -> Option<Vec<&Leg>>
None
for a product that holds none — see AnyInstrument::legs. No
default: every product states which it is.§fn final_payment_date(&self) -> Option<NaiveDate>
fn final_payment_date(&self) -> Option<NaiveDate>
None for a product no ladder is built from.§fn restruck_at_rate(&self, _rate: f64) -> Option<AnyInstrument>
fn restruck_at_rate(&self, _rate: f64) -> Option<AnyInstrument>
rate — the scalar a par
calibration rung on it is quoted in — or None for a product that
carries no such scalar. What a quote scenario moves a rung to.§fn restruck_at_spread(&self, _spread: f64) -> Option<AnyInstrument>
fn restruck_at_spread(&self, _spread: f64) -> Option<AnyInstrument>
spread on its spread
leg, or None for a product that quotes none.