Crate xirr

Source
Expand description

§XIRR

xirr implements the XIRR function found in spreadsheet applications like LibreOffice Calc.

§Example

use xirr::*;

let payments = vec![
    Payment { date: "2015-06-11".parse().unwrap(), amount: -1000.0 },
    Payment { date: "2015-07-21".parse().unwrap(), amount: -9000.0 },
    Payment { date: "2018-06-10".parse().unwrap(), amount: 20000.0 },
    Payment { date: "2015-10-17".parse().unwrap(), amount: -3000.0 },
];

 assert_eq!(0.1635371584432641, compute(&payments).unwrap());

Structs§

  • An error returned when the payments provided to compute do not contain both negative and positive payments.
  • A payment made or received on a particular date.

Functions§

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