Function rust_finprim::rate::mirr
source · pub fn mirr(
cash_flows: &[Decimal],
finance_rate: Decimal,
reinvest_rate: Decimal
) -> Decimal
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 Decimal values representing the cash flows of the investmentfinance_rate
- The cost of capital (interest rate) for financingreinvest_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;
use rust_decimal_macros::*;
let cash_flows = vec![dec!(-100), dec!(50), dec!(40), dec!(30), dec!(20)];
let finance_rate = dec!(0.1);
let reinvest_rate = dec!(0.05);
mirr(&cash_flows, finance_rate, reinvest_rate);