pub struct BinaryOption {
pub instrument: Instrument,
pub strike: f64,
pub time_to_maturity: f64,
pub option_type: OptionType,
pub option_style: OptionStyle,
}Expand description
A struct representing a Binary option.
Fields§
§instrument: InstrumentThe underlying instrument.
strike: f64Strike price of the option (aka exercise price).
time_to_maturity: f64The time horizon (in years).
option_type: OptionTypeType of the option (Call or Put).
option_style: OptionStyleStyle of the option (Binary with specific type).
Implementations§
Source§impl BinaryOption
impl BinaryOption
Sourcepub fn new(
instrument: Instrument,
strike: f64,
time_to_maturity: f64,
option_type: OptionType,
binary_option_type: BinaryType,
) -> Self
pub fn new( instrument: Instrument, strike: f64, time_to_maturity: f64, option_type: OptionType, binary_option_type: BinaryType, ) -> Self
Create a new BinaryOption.
Sourcepub fn cash_or_nothing(
instrument: Instrument,
strike: f64,
time_to_maturity: f64,
option_type: OptionType,
) -> Self
pub fn cash_or_nothing( instrument: Instrument, strike: f64, time_to_maturity: f64, option_type: OptionType, ) -> Self
Create a new CashOrNothing binary option.
Sourcepub fn asset_or_nothing(
instrument: Instrument,
strike: f64,
time_to_maturity: f64,
option_type: OptionType,
) -> Self
pub fn asset_or_nothing( instrument: Instrument, strike: f64, time_to_maturity: f64, option_type: OptionType, ) -> Self
Create a new AssetOrNothing binary option.
Sourcepub fn binary_option_type(&self) -> &BinaryType
pub fn binary_option_type(&self) -> &BinaryType
Get the binary option type.
Trait Implementations§
Source§impl Clone for BinaryOption
impl Clone for BinaryOption
Source§fn clone(&self) -> BinaryOption
fn clone(&self) -> BinaryOption
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for BinaryOption
impl Debug for BinaryOption
Source§impl Option for BinaryOption
impl Option for BinaryOption
Source§fn instrument(&self) -> &Instrument
fn instrument(&self) -> &Instrument
Get the underlying instrument of the option. Read more
Source§fn instrument_mut(&mut self) -> &mut Instrument
fn instrument_mut(&mut self) -> &mut Instrument
Get the underlying instrument of the option (mutable). Read more
Source§fn set_instrument(&mut self, instrument: Instrument)
fn set_instrument(&mut self, instrument: Instrument)
Set the underlying instrument of the option. Read more
Source§fn time_to_maturity(&self) -> f64
fn time_to_maturity(&self) -> f64
Time horizon (in years). Read more
Source§fn set_time_to_maturity(&mut self, time_to_maturity: f64)
fn set_time_to_maturity(&mut self, time_to_maturity: f64)
Set the time horizon (in years). Read more
Source§fn option_type(&self) -> OptionType
fn option_type(&self) -> OptionType
Get the type of the option. Read more
Source§fn style(&self) -> &OptionStyle
fn style(&self) -> &OptionStyle
Get the style of the option. Read more
Source§fn payoff(&self, spot: Option<f64>) -> f64
fn payoff(&self, spot: Option<f64>) -> f64
Calculate the payoff of the option at maturity. Read more
Source§fn expiration_dates(&self) -> Option<&Vec<f64>>
fn expiration_dates(&self) -> Option<&Vec<f64>>
Get the expiration dates of the option. Read more
Source§fn price<T: OptionPricing>(&self, model: T) -> f64
fn price<T: OptionPricing>(&self, model: T) -> f64
Calculate the price of the option. Read more
Source§fn time_value<T: OptionPricing>(&self, model: T) -> f64
fn time_value<T: OptionPricing>(&self, model: T) -> f64
Calculate the time value of the option. Read more
Auto Trait Implementations§
impl Freeze for BinaryOption
impl RefUnwindSafe for BinaryOption
impl Send for BinaryOption
impl Sync for BinaryOption
impl Unpin for BinaryOption
impl UnsafeUnpin for BinaryOption
impl UnwindSafe for BinaryOption
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
The inverse inclusion map: attempts to construct
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
Checks if
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
Use with care! Same as
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
The inclusion map: converts
self to the equivalent element of its superset.