pub struct TradeStatistics {Show 17 fields
pub number_of_trades: usize,
pub winners: usize,
pub losers: usize,
pub break_even: usize,
pub average_trade_return: Decimal,
pub median_trade_return: Decimal,
pub largest_win: Option<Decimal>,
pub largest_loss: Option<Decimal>,
pub average_holding_period: Positive,
pub median_holding_period: Positive,
pub min_holding_period: Positive,
pub max_holding_period: Positive,
pub long_trades: usize,
pub short_trades: usize,
pub call_trades: usize,
pub put_trades: usize,
pub spread_trades: usize,
}Expand description
Represents detailed statistical information aggregated from a collection of individual trades.
This struct provides insights into trading performance by summarizing various aspects such as the number of trades, win/loss ratios, average returns, trade durations, and breakdowns by trade type (e.g., long, short, call, put).
Fields§
§number_of_trades: usizeThe total number of trades included in the statistics.
winners: usizeThe number of trades that resulted in a profit.
losers: usizeThe number of trades that resulted in a loss.
break_even: usizeThe number of trades that resulted in neither profit nor loss (return is zero).
average_trade_return: DecimalThe average return per trade, expressed as a decimal value.
median_trade_return: DecimalThe median return across all trades. Half the trades had a return less than or equal to this value, and half had a return greater than or equal to this value.
largest_win: Option<Decimal>The largest profit recorded among all winning trades. None if there were no winning trades.
largest_loss: Option<Decimal>The largest loss recorded among all losing trades (represented as a negative value). None if there were no losing trades.
average_holding_period: PositiveThe average duration for which trades were held open. Represented as a non-negative Decimal.
median_holding_period: PositiveThe median duration for which trades were held open. Represented as a non-negative Decimal.
min_holding_period: PositiveThe minimum duration any trade was held open. Represented as a non-negative Decimal.
max_holding_period: PositiveThe maximum duration any trade was held open. Represented as a non-negative Decimal.
long_trades: usizeThe number of trades that were long positions.
short_trades: usizeThe number of trades that were short positions.
call_trades: usizeThe number of trades involving call options.
put_trades: usizeThe number of trades involving put options.
spread_trades: usizeThe number of trades involving spreads (multi-leg option strategies).
Trait Implementations§
Source§impl Clone for TradeStatistics
impl Clone for TradeStatistics
Source§impl Debug for TradeStatistics
impl Debug for TradeStatistics
Source§impl Default for TradeStatistics
impl Default for TradeStatistics
Source§impl<'de> Deserialize<'de> for TradeStatistics
impl<'de> Deserialize<'de> for TradeStatistics
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 TradeStatistics
impl RefUnwindSafe for TradeStatistics
impl Send for TradeStatistics
impl Sync for TradeStatistics
impl Unpin for TradeStatistics
impl UnsafeUnpin for TradeStatistics
impl UnwindSafe for TradeStatistics
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.