pub enum StrategyErrorKind {
InvalidLegs {
expected: usize,
found: usize,
reason: String,
},
InvalidCombination {
strategy_type: String,
reason: String,
},
}Expand description
Enum representing specific error types that can occur in options trading strategies.
This enum captures errors that may arise during the validation and execution of options trading strategies. It provides structured error information including detailed reasons for various strategy-related failures.
§Variants
-
InvalidLegs- Represents errors when the number of strategy legs doesn’t match the expected count for a particular strategy type. -
InvalidCombination- Represents errors when the combination of options in a strategy doesn’t meet the required criteria (strike prices, expiration dates, option types, etc.).
§Usage
This error type is typically used in strategy validation, construction, and analysis to provide specific feedback about why a particular options combination doesn’t constitute a valid strategy.
Variants§
InvalidLegs
Error indicating an invalid number of legs in a strategy
This variant is used when the provided legs don’t match the required count for a specific strategy type.
Fields
InvalidCombination
Error indicating an invalid combination of options for a strategy
This variant is used when the provided options don’t form a valid strategy according to specific rules (e.g., strike price relationships, expiration alignment, option types).
Trait Implementations§
Source§impl Debug for StrategyErrorKind
impl Debug for StrategyErrorKind
Source§impl Display for StrategyErrorKind
impl Display for StrategyErrorKind
Source§impl Error for StrategyErrorKind
impl Error for StrategyErrorKind
1.30.0 · Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
use the Display impl or to_string()
Source§impl PartialEq for StrategyErrorKind
impl PartialEq for StrategyErrorKind
impl StructuralPartialEq for StrategyErrorKind
Auto Trait Implementations§
impl Freeze for StrategyErrorKind
impl RefUnwindSafe for StrategyErrorKind
impl Send for StrategyErrorKind
impl Sync for StrategyErrorKind
impl Unpin for StrategyErrorKind
impl UnsafeUnpin for StrategyErrorKind
impl UnwindSafe for StrategyErrorKind
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> 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> Pointable for T
impl<T> Pointable 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.