#[repr(u8)]pub enum OptionStyle {
Call = 0,
Put = 1,
}Expand description
Re-export of core financial types from the standalone financial_types crate.
This module re-exports fundamental trading enums (Action, Side,
OptionStyle, UnderlyingAssetType) and option contract type definitions
(OptionType, sub-enums, OptionBasicType) from their respective
external crates.
Specifies the style of an option contract.
Defines the fundamental classification of options contracts based on their payoff direction. The style determines whether the holder has the right to buy (Call) or sell (Put) the underlying asset.
This is a critical attribute for options contracts as it directly affects valuation, pricing models, and exercise strategies.
§Stability
This enum is intentionally exhaustive. Option payoff direction is
a closed two-state concept (call vs. put); no future variants are
planned. Downstream code may rely on exhaustive match.
§Examples
use financial_types::OptionStyle;
let style = OptionStyle::Call;
assert!(style.is_call());
assert!(!style.is_put());
assert_eq!(format!("{style}"), "Call");
assert!(OptionStyle::Call < OptionStyle::Put);Variants§
Call = 0
A call option gives the holder the right (but not obligation) to buy the underlying asset at the strike price before or at expiration. Call options typically increase in value when the underlying asset price rises.
Put = 1
A put option gives the holder the right (but not obligation) to sell the underlying asset at the strike price before or at expiration. Put options typically increase in value when the underlying asset price falls.
Implementations§
Source§impl OptionStyle
impl OptionStyle
Sourcepub const ALL: &'static [OptionStyle]
pub const ALL: &'static [OptionStyle]
All variants in discriminant order.
Sourcepub const fn opposite(&self) -> OptionStyle
pub const fn opposite(&self) -> OptionStyle
Returns the opposite option style.
Call→PutPut→Call
Sourcepub const fn as_str(&self) -> &'static str
pub const fn as_str(&self) -> &'static str
Returns the canonical string representation of this variant.
Matches the fmt::Display output exactly and is allocation-free.
Trait Implementations§
Source§impl Clone for OptionStyle
impl Clone for OptionStyle
Source§fn clone(&self) -> OptionStyle
fn clone(&self) -> OptionStyle
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreimpl Copy for OptionStyle
Source§impl Debug for OptionStyle
impl Debug for OptionStyle
Source§impl Default for OptionStyle
impl Default for OptionStyle
Source§fn default() -> OptionStyle
fn default() -> OptionStyle
Source§impl<'de> Deserialize<'de> for OptionStyle
impl<'de> Deserialize<'de> for OptionStyle
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<OptionStyle, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<OptionStyle, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Source§impl Display for OptionStyle
impl Display for OptionStyle
impl Eq for OptionStyle
Source§impl FromStr for OptionStyle
impl FromStr for OptionStyle
Source§type Err = ParseEnumError
type Err = ParseEnumError
Source§fn from_str(s: &str) -> Result<OptionStyle, <OptionStyle as FromStr>::Err>
fn from_str(s: &str) -> Result<OptionStyle, <OptionStyle as FromStr>::Err>
s to return a value of this type. Read moreSource§impl Hash for OptionStyle
impl Hash for OptionStyle
Source§impl Ord for OptionStyle
impl Ord for OptionStyle
Source§fn cmp(&self, other: &OptionStyle) -> Ordering
fn cmp(&self, other: &OptionStyle) -> Ordering
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Source§impl PartialEq for OptionStyle
impl PartialEq for OptionStyle
Source§impl PartialOrd for OptionStyle
impl PartialOrd for OptionStyle
Source§impl Serialize for OptionStyle
impl Serialize for OptionStyle
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
impl StructuralPartialEq for OptionStyle
Source§impl ToSchema for OptionStyle
impl ToSchema for OptionStyle
Source§impl TryFrom<&str> for OptionStyle
impl TryFrom<&str> for OptionStyle
Source§type Error = ParseEnumError
type Error = ParseEnumError
Source§fn try_from(
value: &str,
) -> Result<OptionStyle, <OptionStyle as TryFrom<&str>>::Error>
fn try_from( value: &str, ) -> Result<OptionStyle, <OptionStyle as TryFrom<&str>>::Error>
Source§impl TryFrom<u8> for OptionStyle
impl TryFrom<u8> for OptionStyle
Source§type Error = ParseEnumError
type Error = ParseEnumError
Source§fn try_from(
value: u8,
) -> Result<OptionStyle, <OptionStyle as TryFrom<u8>>::Error>
fn try_from( value: u8, ) -> Result<OptionStyle, <OptionStyle as TryFrom<u8>>::Error>
Auto Trait Implementations§
impl Freeze for OptionStyle
impl RefUnwindSafe for OptionStyle
impl Send for OptionStyle
impl Sync for OptionStyle
impl Unpin for OptionStyle
impl UnsafeUnpin for OptionStyle
impl UnwindSafe for OptionStyle
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.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>
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>
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> PartialSchema for Twhere
T: ComposeSchema + ?Sized,
impl<T> PartialSchema for Twhere
T: ComposeSchema + ?Sized,
Source§impl<T> Pointable for T
impl<T> Pointable for T
impl<T> Scalar for T
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>
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
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
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.