Book Image

Python for Finance

By : Yuxing Yan
Book Image

Python for Finance

By: Yuxing Yan

Overview of this book

Table of Contents (20 chapters)
Python for Finance
Credits
About the Author
Acknowledgments
About the Reviewers
www.PacktPub.com
Preface
Index

Net present value and the NPV rule


Net present value (NPV) is defined as the difference between the present value of all the benefits and costs, as shown in the following formula:

Assume that we have a 5-year project with an initial investment of $100 million. The future cash flows at the end of each year for the next five years are $20m, $40m, $50m, $20m, and $10m, respectively. If the discount rate for such type of investments is 5 percent per year, should we take the project? First, we have to estimate the NPV of our project. Second, we have to apply the following decision rule (the NPV rule):

If we manually estimate the NPV, we can do the following calculations

>>>-100 + 20/(1+0.05)+40/(1+0.05)**2 +50/(1+0.05)**3+20/(1+0.05)**4+10/(1+0.05)**5
22.80998927303707

Since the NPV of our project is positive, we should accept it.

It is quite tedious to type each value. For example, we typed 0.05 (the r value) five times. To make our typing a little easier, we could assign a value to r...