nautilus_analysis::statistic

Trait PortfolioStatistic

Source
pub trait PortfolioStatistic: Debug {
    type Item;

    // Required method
    fn name(&self) -> String;

    // Provided methods
    fn calculate_from_returns(&self, returns: &Returns) -> Option<Self::Item> { ... }
    fn calculate_from_realized_pnls(
        &self,
        realized_pnls: &[f64],
    ) -> Option<Self::Item> { ... }
    fn calculate_from_orders(
        &self,
        orders: Vec<Box<dyn Order>>,
    ) -> Option<Self::Item> { ... }
    fn calculate_from_positions(
        &self,
        positions: &[Position],
    ) -> Option<Self::Item> { ... }
    fn check_valid_returns(&self, returns: &Returns) -> bool { ... }
    fn downsample_to_daily_bins(&self, returns: &Returns) -> Returns { ... }
    fn calculate_std(&self, returns: &Returns) -> f64 { ... }
}

Required Associated Types§

Required Methods§

Source

fn name(&self) -> String

Provided Methods§

Source

fn calculate_from_returns(&self, returns: &Returns) -> Option<Self::Item>

Source

fn calculate_from_realized_pnls( &self, realized_pnls: &[f64], ) -> Option<Self::Item>

Source

fn calculate_from_orders( &self, orders: Vec<Box<dyn Order>>, ) -> Option<Self::Item>

Source

fn calculate_from_positions(&self, positions: &[Position]) -> Option<Self::Item>

Source

fn check_valid_returns(&self, returns: &Returns) -> bool

Source

fn downsample_to_daily_bins(&self, returns: &Returns) -> Returns

Source

fn calculate_std(&self, returns: &Returns) -> f64

Implementors§