Skip to main content

attribution

Function attribution 

Source
pub fn attribution(
    legs: &[(&str, Decimal, &[ReturnPoint])],
) -> HashMap<String, Decimal>
Expand description

Per-leg P&L attribution.

Returns a map of leg name -> contribution percentage. Contribution = (w_i * cumulative_return_i) / portfolio_cumulative_return * 100.