pub struct VanillaOption {
pub style: OptionStyle,
pub kind: OptionType,
pub strike: f64,
pub maturity: f64,
}Expand description
Specification of a single vanilla option contract.
This struct is model-agnostic; pricing models interpret the fields according to their own assumptions.
Fields§
§style: OptionStyleExercise style (European or American).
kind: OptionTypePayoff direction (call or put).
strike: f64Strike price of the option.
maturity: f64Time to maturity in years.
The exact day-count convention (e.g. ACT/365 or ACT/365.25) is
determined by how t is computed by the caller. The current
library typically uses 365.25 days per year.
Implementations§
Source§impl VanillaOption
impl VanillaOption
Sourcepub fn new(
style: OptionStyle,
kind: OptionType,
strike: f64,
maturity: f64,
) -> Self
pub fn new( style: OptionStyle, kind: OptionType, strike: f64, maturity: f64, ) -> Self
Creates a new vanilla option from its components.
Sourcepub fn european_call(strike: f64, maturity: f64) -> Self
pub fn european_call(strike: f64, maturity: f64) -> Self
Convenience constructor for a European call.
Sourcepub fn european_put(strike: f64, maturity: f64) -> Self
pub fn european_put(strike: f64, maturity: f64) -> Self
Convenience constructor for a European put.
Sourcepub fn american_call(strike: f64, maturity: f64) -> Self
pub fn american_call(strike: f64, maturity: f64) -> Self
Convenience constructor for an American call.
Sourcepub fn american_put(strike: f64, maturity: f64) -> Self
pub fn american_put(strike: f64, maturity: f64) -> Self
Convenience constructor for an American put.
Trait Implementations§
Source§impl Clone for VanillaOption
impl Clone for VanillaOption
Source§fn clone(&self) -> VanillaOption
fn clone(&self) -> VanillaOption
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 VanillaOption
impl Debug for VanillaOption
Source§impl PartialEq for VanillaOption
impl PartialEq for VanillaOption
impl Copy for VanillaOption
impl StructuralPartialEq for VanillaOption
Auto Trait Implementations§
impl Freeze for VanillaOption
impl RefUnwindSafe for VanillaOption
impl Send for VanillaOption
impl Sync for VanillaOption
impl Unpin for VanillaOption
impl UnwindSafe for VanillaOption
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<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.