pub struct DrawdownAnalysis {
pub max_drawdown: Decimal,
pub max_drawdown_duration: Positive,
pub recovery_duration: Option<Positive>,
pub time_to_max_drawdown: Positive,
pub drawdowns: Vec<DrawdownEvent>,
pub avg_drawdown: Decimal,
pub avg_recovery_time: Option<Positive>,
pub total_underwater_days: Positive,
pub underwater_percentage: Decimal,
}Expand description
Represents a comprehensive analysis of drawdown periods within a financial time series.
Drawdown refers to the decline from a historical peak in some variable, typically the cumulative profit or total value of a financial portfolio or instrument. This struct aggregates various metrics related to drawdowns observed over the analyzed period.
Fields§
§max_drawdown: DecimalThe magnitude of the largest single drawdown observed during the analysis period. This is typically expressed as a positive decimal representing the percentage loss from the peak to the subsequent trough (e.g., 0.1 for a 10% loss).
max_drawdown_duration: PositiveThe duration from the peak to the trough of the maximum drawdown event. Represented as a positive value (e.g., number of days).
recovery_duration: Option<Positive>The time it took for the value to recover from the trough of the maximum drawdown
back to the level of its preceding peak.
This is None if recovery did not occur by the end of the analysis period.
time_to_max_drawdown: PositiveThe duration from the beginning of the analysis period until the peak that preceded the maximum drawdown event.
drawdowns: Vec<DrawdownEvent>A vector containing details of every individual drawdown event identified
during the analysis period. See DrawdownEvent for details.
avg_drawdown: DecimalThe average magnitude of all drawdown events recorded in drawdowns.
avg_recovery_time: Option<Positive>The average time it took to recover from the trough back to the preceding peak
across all drawdown events that achieved recovery within the analysis period.
This is None if no drawdowns recovered.
total_underwater_days: PositiveThe total duration (e.g., number of days) the analyzed value spent below a previously established peak (“underwater”).
underwater_percentage: DecimalThe percentage of the total analysis duration that the value spent underwater.
Calculated as total_underwater_days divided by the total duration of the analysis period.
Trait Implementations§
Source§impl Clone for DrawdownAnalysis
impl Clone for DrawdownAnalysis
Source§impl Debug for DrawdownAnalysis
impl Debug for DrawdownAnalysis
Source§impl Default for DrawdownAnalysis
impl Default for DrawdownAnalysis
Source§impl<'de> Deserialize<'de> for DrawdownAnalysis
impl<'de> Deserialize<'de> for DrawdownAnalysis
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Auto Trait Implementations§
impl Freeze for DrawdownAnalysis
impl RefUnwindSafe for DrawdownAnalysis
impl Send for DrawdownAnalysis
impl Sync for DrawdownAnalysis
impl Unpin for DrawdownAnalysis
impl UnsafeUnpin for DrawdownAnalysis
impl UnwindSafe for DrawdownAnalysis
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,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
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.