Net present value and cash flows

Introduction to Financial Concepts in Python

Dakota Wixom

Quantitative Finance Analyst

Cash flows

Cash flows are a series of gains or losses from an investment over time.

Year Project 1 Cash Flows Project 2 Cash Flows
0 -$100 $100
1 $100 $100
2 $125 -$100
3 $150 $200
4 $175 $300
Introduction to Financial Concepts in Python

Assume a 3% discount rate

Year Cash Flows Formula Present Value
0 -$100 pv(rate=0.03, nper=0, pmt=0, fv=-100) -100
1 $100 pv(rate=0.03, nper=1, pmt=0, fv=100) 97.09
2 $125 pv(rate=0.03, nper=2, pmt=0, fv=125) 117.82
3 $150 pv(rate=0.03, nper=3, pmt=0, fv=150) 137.27
4 $175 pv(rate=0.03, nper=4, pmt=0, fv=175) 155.49

Sum of all present values = 407.67

Introduction to Financial Concepts in Python

Arrays in NumPy

Example:

import numpy as np
array_1 = np.array([100,200,300])
print(array_1*2)
[200 400 600]
Introduction to Financial Concepts in Python

Net Present Value

Project 1

import numpy as np
np.npv(rate=0.03, values=np.array([-100, 100, 125, 150, 175]))
407.67

Project 2

import numpy as np
np.npv(rate=0.03, values=np.array([100, 100, -100, 200, 300]))
552.40
Introduction to Financial Concepts in Python

Let's practice!

Introduction to Financial Concepts in Python

Preparing Video For Download...