Struct Straddle
pub struct Straddle {
pub first: AnyInstrument,
pub second: AnyInstrument,
}Expand description
Two options of one strategy, valued as their sum.
Fields§
§first: AnyInstrumentThe first option.
second: AnyInstrumentThe second option.
Implementations§
§impl Straddle
impl Straddle
pub fn new(
first: AnyInstrument,
second: AnyInstrument,
) -> Result<Self, StraddleError>
pub fn new( first: AnyInstrument, second: AnyInstrument, ) -> Result<Self, StraddleError>
The pair as one product.
§Errors
StraddleError for a leg that is not an FX option or a European
swaption, or two legs that read different markets.
Trait Implementations§
§impl<R: Scalar> Priceable<R> for Straddle
impl<R: Scalar> Priceable<R> for Straddle
§fn npv(&self, view: &PricingView<'_, R>) -> Result<R, PricingError>
fn npv(&self, view: &PricingView<'_, R>) -> Result<R, PricingError>
The two options’ values, summed.
§fn par_rate(&self, _view: &PricingView<'_, R>) -> Result<R, PricingError>
fn par_rate(&self, _view: &PricingView<'_, R>) -> Result<R, PricingError>
The par rate — the fixed rate at which the product is worth nothing. Read more
§fn par_spread(&self, _view: &PricingView<'_, R>) -> Result<R, PricingError>
fn par_spread(&self, _view: &PricingView<'_, R>) -> Result<R, PricingError>
The par (breakeven) floating-leg spread. Zero for a product with no
floating leg. Read more
§impl PricingRiskFactors for Straddle
impl PricingRiskFactors for Straddle
§fn risk_factors(&self) -> Result<RiskFactors<'_>, PricingError>
fn risk_factors(&self) -> Result<RiskFactors<'_>, PricingError>
The one market both options read, checked equal at construction.
§impl Product for Straddle
impl Product for Straddle
§fn currency(&self) -> Currency
fn currency(&self) -> Currency
The currency the product pays in. An FX product values in its quote
currency; a book converts.
§fn contract_dates(&self) -> Vec<(&'static str, NaiveDate)>
fn contract_dates(&self) -> Vec<(&'static str, NaiveDate)>
The contract dates the product resolved to, as
(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>>
The legs the product itself holds, in a declared order, or
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>
The date of the product’s final payment, where a calibration rung can
be built on it;
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>
This product re-struck at the par rate
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>
This product re-struck at the basis spread
spread on its spread
leg, or None for a product that quotes none.impl StructuralPartialEq for Straddle
Auto Trait Implementations§
impl !RefUnwindSafe for Straddle
impl !UnwindSafe for Straddle
impl Freeze for Straddle
impl Send for Straddle
impl Sync for Straddle
impl Unpin for Straddle
impl UnsafeUnpin for Straddle
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more