#[repr(C)]pub struct Expectancy {}Expand description
Calculates the expectancy of a trading strategy based on realized PnLs.
Expectancy is defined as: (Average Win × Win Rate) + (Average Loss × Loss Rate)
This metric provides insight into the expected profitability per trade and helps
evaluate the overall edge of a trading strategy.
A positive expectancy indicates a profitable system over time, while a negative expectancy suggests losses.
§References
- Tharp, V. K. (1998). Trade Your Way to Financial Freedom. McGraw-Hill.
- Elder, A. (1993). Trading for a Living. John Wiley & Sons.
- Vince, R. (1992). The Mathematics of Money Management. John Wiley & Sons.
Trait Implementations§
Source§impl Clone for Expectancy
impl Clone for Expectancy
Source§fn clone(&self) -> Expectancy
fn clone(&self) -> Expectancy
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for Expectancy
impl Debug for Expectancy
Source§impl Display for Expectancy
impl Display for Expectancy
Source§impl PortfolioStatistic for Expectancy
impl PortfolioStatistic for Expectancy
type Item = f64
Source§fn name(&self) -> String
fn name(&self) -> String
Returns the name of this statistic for display and identification purposes.
Source§fn calculate_from_realized_pnls(
&self,
realized_pnls: &[f64],
) -> Option<Self::Item>
fn calculate_from_realized_pnls( &self, realized_pnls: &[f64], ) -> Option<Self::Item>
Calculates the statistic from realized profit and loss values. Read more
Source§fn calculate_from_returns(&self, _returns: &Returns) -> Option<Self::Item>
fn calculate_from_returns(&self, _returns: &Returns) -> Option<Self::Item>
Calculates the statistic from time-indexed returns data. Read more
Source§fn calculate_from_positions(
&self,
_positions: &[Position],
) -> Option<Self::Item>
fn calculate_from_positions( &self, _positions: &[Position], ) -> Option<Self::Item>
Calculates the statistic from position data. Read more
Source§fn calculate_from_orders(
&self,
orders: Vec<Box<dyn Order>>,
) -> Option<Self::Item>
fn calculate_from_orders( &self, orders: Vec<Box<dyn Order>>, ) -> Option<Self::Item>
Calculates the statistic from order data. Read more
Source§fn calculate_from_returns_with_benchmark(
&self,
returns: &Returns,
benchmark: &Returns,
) -> Option<Self::Item>
fn calculate_from_returns_with_benchmark( &self, returns: &Returns, benchmark: &Returns, ) -> Option<Self::Item>
Calculates the statistic from time-indexed strategy returns relative to a benchmark. Read more
Source§fn align_returns(&self, a: &Returns, b: &Returns) -> (Vec<f64>, Vec<f64>)
fn align_returns(&self, a: &Returns, b: &Returns) -> (Vec<f64>, Vec<f64>)
Aligns two returns series onto a common daily grid. Read more
Source§fn check_valid_returns(&self, returns: &Returns) -> bool
fn check_valid_returns(&self, returns: &Returns) -> bool
Validates that returns data is not empty.
Source§fn downsample_to_daily_bins(&self, returns: &Returns) -> Returns
fn downsample_to_daily_bins(&self, returns: &Returns) -> Returns
Downsamples high-frequency returns to daily bins by geometric compounding. Read more
Source§fn calculate_std(&self, returns: &Returns) -> f64
fn calculate_std(&self, returns: &Returns) -> f64
Calculates the standard deviation of returns with Bessel’s correction.
Auto Trait Implementations§
impl Freeze for Expectancy
impl RefUnwindSafe for Expectancy
impl Send for Expectancy
impl Sync for Expectancy
impl Unpin for Expectancy
impl UnsafeUnpin for Expectancy
impl UnwindSafe for Expectancy
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
Mutably borrows from an owned value. Read more