pub enum MetricsError {
BasicError(String),
ShapeError(String),
RangeError(String),
TrendError(String),
RiskError(String),
CurveError(String),
SurfaceError(String),
StdError {
reason: String,
},
}
Expand description
Error types specifically related to financial and statistical metrics calculations.
This enum represents various error conditions that can occur during metrics processing, analysis, and validation within the library’s metrics module. Each variant provides context about the specific type of error encountered.
§Variants
BasicError
- General metrics calculation errorsShapeError
- Errors related to data shape mismatches or incompatible dimensionsRangeError
- Errors when data falls outside of expected/valid rangesTrendError
- Errors in trend analysis, regression, or pattern detectionRiskError
- Errors in risk metrics calculations (like VaR, Sharpe ratio, etc.)CurveError
- Errors related to curve-fitting or curve-based calculationsSurfaceError
- Errors in surface modeling or multi-dimensional metricsStdError
- Standard error conditions with additional context
§Examples
use optionstratlib::error::MetricsError;
// Creating different error types
let basic_err = MetricsError::BasicError("Calculation failed".to_string());
let range_err = MetricsError::RangeError("Value outside expected bounds".to_string());
Variants§
BasicError(String)
General errors in metrics calculations.
ShapeError(String)
Errors related to data shape mismatches or dimensional incompatibility. This typically occurs when input data has an unexpected structure.
RangeError(String)
Errors when data falls outside expected or valid ranges. This can indicate outliers or invalid input values.
TrendError(String)
Errors in trend analysis, regression, or pattern detection algorithms.
RiskError(String)
Errors specifically related to financial risk metrics calculations, such as Value at Risk (VaR), Conditional VaR, or Sharpe ratio.
CurveError(String)
Errors encountered during curve-fitting or curve-based calculations, such as yield curves or volatility curves.
SurfaceError(String)
Errors in surface modeling or multi-dimensional metrics, such as volatility surfaces or correlation matrices.
StdError
Standard error with additional contextual information.
Trait Implementations§
Source§impl Debug for MetricsError
impl Debug for MetricsError
Source§impl Display for MetricsError
impl Display for MetricsError
Source§impl Error for MetricsError
impl Error for MetricsError
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
Source§impl From<CurveError> for MetricsError
impl From<CurveError> for MetricsError
Source§fn from(err: CurveError) -> Self
fn from(err: CurveError) -> Self
Source§impl From<MetricsError> for CurveError
impl From<MetricsError> for CurveError
Source§fn from(err: MetricsError) -> Self
fn from(err: MetricsError) -> Self
Source§impl From<SurfaceError> for MetricsError
impl From<SurfaceError> for MetricsError
Source§fn from(err: SurfaceError) -> Self
fn from(err: SurfaceError) -> Self
Auto Trait Implementations§
impl Freeze for MetricsError
impl RefUnwindSafe for MetricsError
impl Send for MetricsError
impl Sync for MetricsError
impl Unpin for MetricsError
impl UnwindSafe for MetricsError
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.