Introduction to Financial Concepts in Python
Dakota Wixom
Quantitative Finance Analyst
NPV is equal to the sum of all discounted cash flows:
$ NPV = \sum_{t=1}^{T} \frac{C_t}{(1+r)^t} - C_0$
NPV is a simple cash flow valuation measure that does not allow for the comparison of different sized projects or lengths.
The internal rate of return must be computed by solving for IRR in the NPV equation when set equal to 0.
$ NPV = \sum_{t=1}^{T} \frac{C_t}{(1+IRR)^t} - C_0 = 0$
IRR can be used to compare projects of different sizes and lengths but requires an algorithmic solution and does not measure total value.
You can use the NumPy function .irr(values)
to compute the internal rate of return of an array of values.
Example:
import numpy as np
project_1 = np.array([-100,150,200])
np.irr(project_1)
1.35
Project 1 has an IRR of 135%
Introduction to Financial Concepts in Python