Skip to main content

PerformanceTearsheet

Struct PerformanceTearsheet 

Source
pub struct PerformanceTearsheet {
Show 15 fields pub observation_count: usize, pub total_return: f64, pub annualised_return: f64, pub annualised_volatility: f64, pub sharpe_ratio: Option<f64>, pub max_drawdown: f64, pub calmar_ratio: Option<f64>, pub annualised_excess_return: f64, pub tracking_error: f64, pub information_ratio: Option<f64>, pub sortino_ratio: Option<f64>, pub win_rate: f64, pub return_min: f64, pub return_max: f64, pub return_mean: f64,
}
Expand description

Comprehensive performance summary computed from a return series.

Covers absolute performance, risk-adjusted metrics, and drawdown analysis.

§Example

use fin_primitives::attribution::{PerformanceTearsheet, ReturnObservation};

let obs = vec![
    ReturnObservation { label: "d1".to_owned(), portfolio_return: 0.01, benchmark_return: 0.008 },
    ReturnObservation { label: "d2".to_owned(), portfolio_return: -0.005, benchmark_return: -0.003 },
    ReturnObservation { label: "d3".to_owned(), portfolio_return: 0.02, benchmark_return: 0.015 },
];
let ts = PerformanceTearsheet::compute(&obs, 252).unwrap();
assert!(ts.annualised_return.is_finite());
assert!(ts.max_drawdown <= 0.0);

Fields§

§observation_count: usize

Number of observations used.

§total_return: f64

Compounded total portfolio return over all periods.

§annualised_return: f64

Annualised portfolio return (geometric).

§annualised_volatility: f64

Annualised volatility of portfolio returns.

§sharpe_ratio: Option<f64>

Sharpe ratio: annualised_return / annualised_volatility. None if volatility is zero.

§max_drawdown: f64

Maximum peak-to-trough drawdown (always <= 0).

§calmar_ratio: Option<f64>

Calmar ratio: annualised_return / |max_drawdown|. None if max_drawdown is zero.

§annualised_excess_return: f64

Annualised excess return over the benchmark.

§tracking_error: f64

Annualised tracking error (std dev of excess returns).

§information_ratio: Option<f64>

Information ratio: annualised_excess_return / tracking_error. None if tracking error is zero.

§sortino_ratio: Option<f64>

Sortino ratio: annualised_return / downside_deviation. None if downside deviation is zero.

§win_rate: f64

Win rate: fraction of periods with positive portfolio return.

§return_min: f64

Per-period return statistics: min, max, mean.

§return_max: f64

Maximum single-period return.

§return_mean: f64

Mean single-period return.

Implementations§

Source§

impl PerformanceTearsheet

Calculates a PerformanceTearsheet from a sequence of return observations.

Source

pub fn compute( observations: &[ReturnObservation], periods_per_year: usize, ) -> Result<Self, FinError>

Compute all performance metrics from a return series.

§Parameters
  • observations — Ordered sequence of return observations.
  • periods_per_year — Annualisation factor: 252 for daily, 12 for monthly, 4 for quarterly.
§Errors

Returns FinError::InvalidInput if:

  • observations is empty.
  • periods_per_year is zero.
  • Any return value is non-finite.
Source

pub fn summary(&self) -> String

Format a brief one-line summary of the tearsheet.

Trait Implementations§

Source§

impl Clone for PerformanceTearsheet

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for PerformanceTearsheet

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.