pub enum TradeError {
InvalidTrade {
reason: String,
},
InvalidTradeStatus {
reason: String,
},
}Expand description
Represents errors that can occur during trade-related operations.
This enum encapsulates various error conditions that may arise during trade execution, validation, or parameter processing. It provides detailed context about what went wrong during trading operations.
TradeError is particularly useful for diagnosing problems in trade execution and validation.
Variants§
InvalidTrade
Error indicating that a trade is invalid.
This variant is used when a trade doesn’t meet the requirements for valid trading operations.
InvalidTradeStatus
Error indicating that a trade status is invalid.
This variant is used when a trade status doesn’t meet the requirements for valid trading operations.
Implementations§
Source§impl TradeError
Helper methods for creating trading-related errors
impl TradeError
Helper methods for creating trading-related errors
This implementation provides a set of convenience helper methods for creating different types of trading errors. These methods create properly structured error instances with clear, descriptive information about what went wrong.
§Methods
These helper methods simplify error creation throughout the codebase and ensure that errors have consistent formatting and information.
Sourcepub fn invalid_trade(reason: &str) -> Self
pub fn invalid_trade(reason: &str) -> Self
Sourcepub fn invalid_trade_status(reason: &str) -> Self
pub fn invalid_trade_status(reason: &str) -> Self
Trait Implementations§
Source§impl Debug for TradeError
impl Debug for TradeError
Source§impl Display for TradeError
impl Display for TradeError
Source§impl Error for TradeError
impl Error for TradeError
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 From<&str> for TradeError
impl From<&str> for TradeError
Source§impl From<String> for TradeError
impl From<String> for TradeError
Source§impl From<TradeError> for StrategyError
impl From<TradeError> for StrategyError
Source§fn from(value: TradeError) -> Self
fn from(value: TradeError) -> Self
Source§impl From<TradeError> for Error
impl From<TradeError> for Error
Source§fn from(source: TradeError) -> Self
fn from(source: TradeError) -> Self
Auto Trait Implementations§
impl Freeze for TradeError
impl RefUnwindSafe for TradeError
impl Send for TradeError
impl Sync for TradeError
impl Unpin for TradeError
impl UnsafeUnpin for TradeError
impl UnwindSafe for TradeError
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.