[][src]Function xirr::compute

pub fn compute(payments: &Vec<Payment>) -> Result<f64, InvalidPaymentsError>

Calculates the internal rate of return of a series of irregular payments.

It tries to identify the rate of return using Newton's method with an initial guess of 0.1. If that does not provide a solution, it attempts with guesses from -0.99 to 0.99 in increments of 0.01.

Errors

This function will return InvalidPaymentsError if both positive and negative payments are not provided.