Skip to main content
atoti.finance.irr(
    *,
    cash_flows: VariableMeasureConvertible,
    market_value: VariableMeasureConvertible,
    date: Hierarchy,
    precision: float = 0.001,
    period: Literal[‘annualized’, ‘total’] = 'total',
    guess: float | None = None,
) → MeasureDefinition
Return the Internal Rate of Return based on the underlying cash flows and market values.
This feature is experimental, its key is "finance.irr".
The IRR is the rate rr that nullifies the Net Present Value: NPV=i=0TCFi(1+r)tiP=0NPV = \sum_{{i=0}}^{{T}} CF_i (1 + r)^{{\frac{{-t_i}}{{P}}}} = 0 With:
  • TT the total number of days since the beginning
  • tit_i the number of days since the beginning for date ii
  • PP the unit period in days in which the rate is expressed
  • CFiCF_i the enhanced cashflow for date ii
    • CF of the first day is the opposite of the market value for this day: CF0=MV0CF_0 = - MV_0.
    • CF of the last day is increased by the market value for this day: CFT=cash_flowT+MVTCF_T = cash\_flow_T + MV_T.
    • Otherwise CF is the input cash flow: CFi=cash_flowiCF_i = cash\_flow_i.
This equation is solved using Newton’s method.

Parameters

cash_flows

The measure representing the cash flows.

market_value

The measure representing the market value, used to enhanced the cashflows first and last value. If the cash flows don’t need to be enhanced then 0 can be used.

date

The date hierarchy. It must have a single date level.

precision

The precision of the IRR value.

period

Unit period in which to express the rate.
  • annualized: The measure evaluates to a rate as a percentage per 365-day period, i.e. P=365P = 365.
  • total: The measure evaluates to a rate over the entire date range, i.e. P=TP = T.

guess

Estimated value of the IRR, used when the default guesses do not converge to a solution.
See also: The IRR Wikipedia page.