Struct FxOption
pub struct FxOption {
pub base: Currency,
pub quote: Currency,
pub notional_base: f64,
pub kind: OptionKind,
pub expiry: NaiveDate,
pub delivery: NaiveDate,
pub strike: Strike,
pub base_collateral: CollateralSpec,
pub quote_collateral: CollateralSpec,
pub settlement: Settlement,
}Expand description
A European FX vanilla: a call or put on the base currency against the quote currency, premium in the quote currency. Every field is passive.
Fields§
§base: CurrencyThe base currency — the one the option is a call or put on.
quote: CurrencyThe quote currency — the premium currency.
notional_base: f64Base-currency notional the option is written on.
kind: OptionKindCall or put on the base currency.
expiry: NaiveDateThe option expiry.
delivery: NaiveDateThe delivery date of the underlying exchange.
strike: StrikeThe strike, absolute or delta-labelled.
base_collateral: CollateralSpecThe collateral key the base-currency leg discounts under.
quote_collateral: CollateralSpecThe collateral key the quote-currency leg discounts under.
settlement: SettlementHow the exercised option settles: physically by default, or in cash at a fixing — a non-deliverable option.
Implementations§
§impl FxOption
impl FxOption
pub(crate) fn currency_of_value(&self) -> Currency
pub(crate) fn currency_of_value(&self) -> Currency
The currency this option values in: a cash-settled one’s settlement currency, as an NDF’s, a physical one’s quote currency.
pub fn new(
base: Currency,
quote: Currency,
notional_base: f64,
kind: OptionKind,
expiry: NaiveDate,
delivery: NaiveDate,
strike: Strike,
) -> Self
pub fn new( base: Currency, quote: Currency, notional_base: f64, kind: OptionKind, expiry: NaiveDate, delivery: NaiveDate, strike: Strike, ) -> Self
A vanilla on notional_base of base, struck at strike, expiring on
expiry and delivering on delivery, each leg on its own currency’s
cash collateral.
pub fn cash_settled(
self,
index: impl Into<FixingSource>,
fixing_date: NaiveDate,
settle: Currency,
) -> Result<Self, FxError>
pub fn cash_settled( self, index: impl Into<FixingSource>, fixing_date: NaiveDate, settle: Currency, ) -> Result<Self, FxError>
This option cash-settled at index’s fixing on fixing_date, its
payoff paid in settle on the delivery date — a non-deliverable
option. index is one FX key or a FixingSource cross. The leg
never paid discounts offshore, as FxForward::cash_settled’s does.
§Errors
§impl FxOption
impl FxOption
fn lapsed(&self, as_of: NaiveDate) -> bool
fn lapsed(&self, as_of: NaiveDate) -> bool
Settled on its delivery date, as an FX forward is: nothing is left to value, and the curves are not asked for a date behind them. A physical option is also worth nothing once expired, decided before the inputs too, since its delivery may lie in the past.
fn resolved_strike<R: Scalar>(
&self,
inputs: &FxOptionInputs<'_, '_, R>,
) -> Result<f64, PricingError>
fn resolved_strike<R: Scalar>( &self, inputs: &FxOptionInputs<'_, '_, R>, ) -> Result<f64, PricingError>
The absolute strike the option prices at: as stated, or resolved from a delta label on the derivative-free projection — a delta-quoted trade is booked at the strike it resolves to, and that strike is then a contract term of the pricing call.
pub fn diagnostics<R: Scalar>(
&self,
view: &PricingView<'_, R>,
) -> Result<FxOptionDiagnostics, PricingError>
pub fn diagnostics<R: Scalar>( &self, view: &PricingView<'_, R>, ) -> Result<FxOptionDiagnostics, PricingError>
pub fn npv_at_vol(
&self,
view: &PricingView<'_, f64>,
vol: f64,
) -> Result<f64, PricingError>
pub fn npv_at_vol( &self, view: &PricingView<'_, f64>, vol: f64, ) -> Result<f64, PricingError>
The option’s passive value at a stated flat volatility — the surface pricer with one input replaced, so a strategy solve prices exactly what the market prices. The strike still resolves on the surface: a delta-labelled strike is a contract term, not a function of the vol being solved for.
§Errors
As Priceable::npv.
Trait Implementations§
§impl<R: Scalar> Priceable<R> for FxOption
impl<R: Scalar> Priceable<R> for FxOption
§fn npv(&self, view: &PricingView<'_, R>) -> Result<R, PricingError>
fn npv(&self, view: &PricingView<'_, R>) -> Result<R, PricingError>
notional · black76(F, K, σ(K), τ) · DF_quote(delivery) in the quote
currency, with F the parity forward to delivery and σ(K) read off
the surface in the mode — so vega per node flows. A cash-settled
option paying in its base currency values there, at spot, as an NDF
does.
§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 FxOption
impl PricingRiskFactors for FxOption
§fn risk_factors(&self) -> Result<RiskFactors<'_>, PricingError>
fn risk_factors(&self) -> Result<RiskFactors<'_>, PricingError>
§impl Product for FxOption
impl Product for FxOption
§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.