pub enum PositionLimitErrorKind {
MaxPositionsReached {
current: usize,
maximum: usize,
},
MaxExposureReached {
current_exposure: f64,
max_exposure: f64,
},
}Expand description
Represents errors related to position limits in trading operations.
This enum captures different types of limit violations that can occur when managing trading positions, such as exceeding the maximum number of allowed positions or reaching the maximum exposure threshold for a portfolio.
§Variants
-
MaxPositionsReached- Error indicating that the maximum number of allowed positions has been reached, preventing the creation of additional positions. -
MaxExposureReached- Error indicating that the maximum allowed financial exposure has been reached, preventing positions that would increase exposure.
§Usage
This error type is typically used in position management systems, risk control mechanisms, and trading platforms to enforce safety limits and prevent excessive risk taking.
Variants§
MaxPositionsReached
Error indicating the maximum number of positions has been reached
This variant is triggered when attempting to create a new position would exceed the configured maximum number of positions allowed in a portfolio or trading account.
Fields
MaxExposureReached
Error indicating the maximum allowed exposure has been reached
This variant is triggered when a new position or modification would cause the total portfolio exposure to exceed the configured maximum risk threshold. Exposure is typically measured in monetary terms based on position value or risk.
Trait Implementations§
Source§impl Debug for PositionLimitErrorKind
impl Debug for PositionLimitErrorKind
Source§impl Display for PositionLimitErrorKind
impl Display for PositionLimitErrorKind
Source§impl Error for PositionLimitErrorKind
impl Error for PositionLimitErrorKind
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()