
Python for Finance

The Internal Rate of Return (IRR) is defined as the discount rate that makes NPV equal zero. Assume that we invest $100 today and the future cash flows will be $30, $40, $40, and $50 for the next four years. Assuming that all cash flows happen at the end of the year, what is the IRR for this investment? In the following program, the scipy.irr()
function is applied:
>>>import scipy as sp >>> cashflows=[-100,30,40,40,50] >>> sp.irr(cashflows) 0.2001879105140867
We could verify whether such a rate does make NPV equal zero. Since the NPV is zero, 20.02% is indeed an IRR:
>>> r=sp.irr(cashflows) >>> sp.npv(r,cashflows) 1.7763568394002505e-14 >>>
For a normal project, the IRR rule is given here:
Here, Rc is the cost of capital. This IRR rule holds only for a normal project. Let's look at the following investment opportunity. The initial investment is $100 today and $50 next year. The cash inflows for...
Change the font size
Change margin width
Change background colour