Function mirr

Source
pub fn mirr<T: FloatLike>(
    cash_flows: &[T],
    finance_rate: T,
    reinvest_rate: T,
) -> T
Expand description

MIRR - Modified Internal Rate of Return

The modified internal rate of return (MIRR) is a financial metric that adjusts the internal rate of return (IRR) to account for a different cost of capital and reinvestment rate. Similar behavior and usage to the MIRR function in Excel.

The MIRR assumes that positive cash flows are reinvested at a reinvestment rate, and any negative cash flows are financed at the cost of capital.

§Arguments

  • cash_flows - A slice of values representing the cash flows of the investment
  • finance_rate - The cost of capital (interest rate) for financing
  • reinvest_rate - The reinvestment rate for positive cash flows

§Returns

  • The modified internal rate of return (MIRR)

§Example

  • Cash flows of $-100, $50, $40, $30, $20, finance rate of 0.1, reinvestment rate of 0.05
use rust_finprim::rate::mirr;

let cash_flows = vec![-100.0, 50.0, 40.0, 30.0, 20.0];
let finance_rate = 0.1;
let reinvest_rate = 0.05;
mirr(&cash_flows, finance_rate, reinvest_rate);