Dollar-Weighted Yield

A common problem in finance is to calculate an interest rate that solves the time \tau equation of value:

\sum_k C_{t_k} (1 + i)^{\tau-t_k} = B(1 + i)^{\tau - T}.

This interest rate is called the internal rate of return (IRR), the yield rate or the dollar-weighted yield rate.

Not every equation of value has a yield rate, and when an equation of value has a yield rate, it is not guaranteed to be unique.

Examples

Suppose we make an investment of 10,000. In return, we will receive 5,000 at the end of 1 year, and 6,000 at the end of two years. What is the internal rate of return?

We can solve this problem by declaring a Payments object and then calling the irr() method. If the equation of value happens to be a polynomial, TmVal will use a function from the SciPy package to calculate the roots. Otherwise, it will use Newton’s method.

In [1]: from tmval import Payments

In [2]: pmts = Payments(
   ...:     amounts=[-10000, 5000, 6000],
   ...:     times=[0, 1, 2]
   ...: )
   ...: 

In [3]: print(pmts.irr())
[0.0639410298049854, -1.5639410298049854]

This equation of value happens to have two solutions. If we are to restrict ourselves to positive rates, the answer is 6.394%