atoti.finance.irr()#
- atoti.finance.irr(*, cash_flows, market_value, date, precision=0.001)#
Return the Internal Rate of Return based on the underlying cash flows and market values.
Warning
This feature is
experimental
, its key is"finance.irr"
.The IRR is the rate
r
that nullifies the Net Present Value:\[NPV = \sum_{{i=0}}^{{T}} CF_i (1 + r)^{{\frac{{T - t_i}}{{T}}}} = 0\]With:
\(T\) the total number of days since the beginning
\(t_i\) the number of days since the beginning for date \(i\)
\(CF_i\) the enhanced cashflow for date \(i\)
CF of the first day is the opposite of the market value for this day: \(CF_0 = - MV_0\).
CF of the last day is increased by the market value for this day: \(CF_T = cash\_flow_T + MV_T\).
Otherwise CF is the input cash flow: \(CF_i = cash\_flow_i\).
This equation is solved using the Newton’s method.
- Parameters:
cash_flows (VariableMeasureConvertible) – The measure representing the cash flows.
market_value (VariableMeasureConvertible) – 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 (Hierarchy) – The date hierarchy. It must have a single date level.
precision (float) – The precision of the IRR value.
- Return type:
MeasureDefinition
See also
The IRR Wikipedia page.