internalRateSchedule¶
Evaluates the internal rate of return for a schedule of cash flows. It is not necessary that the cash flows be periodic.
Synopsis¶
internalRateSchedule (values, dates)
Required Arguments¶
- float
values[]
(Input) - Array of size
count
of cash flows, which includes the initial investment. - struct tm
dates[]
(Input) - Array of size
count
of dates cash flows are made see the Usage Notes section of this chapter.
Return Value¶
The internal rate of return for a schedule of cash flows that is not necessarily periodic. If no result can be computed, NaN is returned.
Optional Arguments¶
xguess
, float (Input)- Initial guess at the internal rate of return.
highest
, float (Input)Maximum value of the internal rate of return allowed.
Default: 1.0 (100%)
Description¶
Function internalRateSchedule
computes the internal rate of return for a
schedule of cash flows that is not necessarily periodic. The internal rate
such that the stream of payments has a net present value of zero.
It can be found by solving the following:
In the equation above, \(d_i\) represents the i-th payment date. \(d_1\) represents the 1st payment date. \(value_i\) represents the i-th cash flow. rate is the internal rate of return.
Example¶
In this example, internalRateSchedule
computes the internal rate of
return for nine cash flows, -$800, $800, $800, $600, $600, $800, $800, $700
and $3,000, with an initial investment of $4,500.
from __future__ import print_function
from numpy import *
from datetime import date
from pyimsl.math.internalRateSchedule import internalRateSchedule
values = [-4500., -800., 800., 800., 600.,
600., 800., 800., 700., 3000.]
dates = [date(1998, 1, 1),
date(1998, 10, 1),
date(1999, 5, 5),
date(2000, 5, 5),
date(2001, 6, 1),
date(2002, 7, 1),
date(2003, 8, 30),
date(2004, 9, 15),
date(2005, 10, 15),
date(2006, 11, 1)]
xirr = internalRateSchedule(values, dates)
print("After approximately 9 years, the internal")
print("rate of return on the cows is %.2f%%." % (xirr * 100.))
Output¶
After approximately 9 years, the internal
rate of return on the cows is 7.69%.