Using Time Value of Money Methods to with Python (Find Single Amount)

8Qm4...xopC
8 Jan 2024
36

Hello all, to evaluate future value or present value of money important for people. Everyone’s goal is to reach financial reader to achieve this goal time value of money is the key concept of money.

As a Economics students I use those methods a lot and I amm trying to learn python and use it with financial methods. While I am learning it, I am writing them on here to share my knowledge.
So in this tutorial we will look into what is concept of Time Value of Money and how we evaluate money at the specific time period.

What is Time Value of Money

Before starting we have to understand that in the ongoing time period money is less worth than yesterday, there are lots of things to explain this situation but most of the time answer is inflation.
Photo by Morgan Housel on Unsplash
Example:
Let’s talk about toilet paper price in US, in 2021 was $8.32 and if we compare with 2022 price increased $8.91 that means toilet became %7 expensive than 2021, so if you could buy 100 units of toilet paper in 2021, in 2022 you could buy 93 units of toilet paper. If you did not get raise that means your capability of buying that good is decreased.

Time Value Of Money
The time value of money (TVM) is the concept that a sum of money is worth more now than the same sum will be at a future date due to its earnings potential in the interim.*

To answer “does this investment is a great opportunity for next 5 years” we have to identify Time Value of Money.

Single Amount Concept

In single Amount concept we only use starting balance, that means we don’t reinvest money etc.
Example:
Think that you won a lottery,
First option is you will $1.500 5 year from now.
Second option is you will receive $1.000 now
let’s think about which is better option? To find which is better option, we have to find future value and present value of both choices. Both scenario has the same interest rate = %8
Future Value
We use Future value to find the value of money with interest rate at the end of that time. 
If you choose the second option, you have to use Future Value method, so we will look into how much it will be worth at the end of the period(5 years) with a %8 interest rate.
Every year, it will be increased by %8. You have to multiply by %108 to reach a year’s compound.
Formula:

FV = PV*(1+i)ⁿ

FV= Future Value, PV = Present Value, i = Interest, n = Number of Periods/Years
Example Solution:
FV=1.000*(1+0.08)⁵ = $1.469,32
Present Value
We use present value to find the value of money with interest rate at the beginning of that period.
If you choose the first option, we have to use the present value method, so we will look into how much it could be worth right now, money that we receive 5 years later.
Formula:

PV = FV/(1+i)ⁿ

FV= Future Value, PV = Present Value, i = Interest, n = Number of Periods/Years
Example Solution:
PV=1500/(1+0,08)⁵=$1.020
If we compare both options Present value of first option higher than second option. So getting 5 years later is more wise option because of future value of money, we get nearly $30 more at the end of 5 years. Note that you have only 2 option putting on interest or getting 5 years later.
So It’s time to use python to find Single Amount Time Value of Money

Library

we will use

numpy-financial

there are lots of functions inside of this library but we will look into them later.
We will use PV and FV functions.
Firstly we have to import library, we imported numpy_financial but it has long name so we will use as npf.

import numpy_financial as npf

Secondly, let’s dive into the PV Formula (Present Value)

pv(rate, nper, pmt, fv, when)
rate = Rate of interest
nper = Number of compounding periods
pmt = Payment each period
fv = Future value
when = When payments are due (‘begin’ (1) or ‘end’ (0)) ** this about annuties
#present Value
presentValue = npf.pv(0.08,5,0,1500,0)
print(presentValue)

# OUTPUT: -1020.8747955506294

We don’t have any payment for the example so we wrote 0 for pmt. It doesn’t matter write 0 or 1 for “when” because we have zero payment.
Thirdly, let’s dive into the FV Formula (Future Value)

fv(rate, nper, pmt, pv[, when])
rate = Rate of interest
nper = Number of compounding periods
pmt = Payment each period
pv = present value
when = When payments are due (‘begin’ (1) or ‘end’ (0)) ** this about annuties
# Future Value
futureValue = npf.fv(0.08,5,0,1000,1)
print(futureValue)

# OUTPUT: -1469.3280768000006

We don’t have any payment for the example so we wrote 0 for pmt. It doesn’t matter write 0 or 1 for “when” because we have zero payment.
All of the code

# Time Value of Money Numpy Documentation

# Import Library

import numpy_financial as npf

# Future Value
futureValue = npf.fv(0.08,5,0,1000,0)
print(futureValue)

#present Value

presentValue = npf.pv(0.08,5,0,1500,0)
print(presentValue)

In this tutorial we learned how to find future value of single amount, and we learned how to use with python. In next chapter we will look into annuties, and we will solve different types of examples to understand annuties.

Get fast shipping, movies & more with Amazon Prime

Start free trial

Enjoy this blog? Subscribe to Eminnkotan

0 Comments