pub struct DrawdownEvent {
pub start_date: NaiveDateTime,
pub bottom_date: NaiveDateTime,
pub recovery_date: Option<NaiveDateTime>,
pub magnitude: Decimal,
pub duration: Positive,
pub recovery_duration: Option<Positive>,
}Expand description
Represents a single drawdown event in a time series, typically of asset prices or portfolio values.
A drawdown is a peak-to-trough decline during a specific period for an investment, trading account, or fund. It is usually quoted as the percentage between the peak and the subsequent trough.
This struct captures the key dates, the magnitude (severity) of the drawdown, and its duration, including the time it takes to recover back to the initial peak value.
Fields§
§start_date: NaiveDateTimeThe date and time when the drawdown period started (the peak before the decline).
bottom_date: NaiveDateTimeThe date and time when the value reached its lowest point (the trough) during the drawdown.
recovery_date: Option<NaiveDateTime>The date and time when the value recovered back to the level of start_date.
This is None if the value has not yet recovered by the end of the analyzed period.
magnitude: DecimalThe magnitude of the drawdown, typically expressed as a positive decimal representing
the percentage loss from the peak (start_date) to the trough (bottom_date).
For example, a value of 0.1 represents a 10% drawdown.
duration: PositiveThe duration of the drawdown from the start_date to the bottom_date,
represented as a positive value (e.g., number of days or other time units).
recovery_duration: Option<Positive>The duration it took for the value to recover from the bottom_date back to
the start_date level. This is None if the recovery has not occurred
(i.e., recovery_date is None). Represented as a positive value.
Trait Implementations§
Source§impl Clone for DrawdownEvent
impl Clone for DrawdownEvent
Source§fn clone(&self) -> DrawdownEvent
fn clone(&self) -> DrawdownEvent
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for DrawdownEvent
impl Debug for DrawdownEvent
Source§impl Default for DrawdownEvent
impl Default for DrawdownEvent
Source§fn default() -> DrawdownEvent
fn default() -> DrawdownEvent
Source§impl<'de> Deserialize<'de> for DrawdownEvent
impl<'de> Deserialize<'de> for DrawdownEvent
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 DrawdownEvent
impl RefUnwindSafe for DrawdownEvent
impl Send for DrawdownEvent
impl Sync for DrawdownEvent
impl Unpin for DrawdownEvent
impl UnsafeUnpin for DrawdownEvent
impl UnwindSafe for DrawdownEvent
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.