## DEV Community

Ilona Codes

Posted on • Originally published at ilonacodes.com

# Time Value of Money in Finance and Investment For Software Developers

Benjamin Franklin once said: "Remember that time is money."

The Time Value of Money (TVM) just means that money in your hand right now is worth more than the same amount of money that you will receive in the future.

The idea is that money available at present is more worth than the same amount in the future. The core principle of finance:

‣ Invested capital can earn interest

‣ Any amount of money is worth more the sooner it's received.

The underlying fundamentals of the time value of money are often used to value investments like stocks, bonds, credits.

Let's search for equivalent amounts of money on time:

Would you prefer to get \$1000 today or \$1000 one year from now? – I bet that you would say \$1000 today.

What about the choice between \$1000 today or \$1001 next year? – I am pretty sure that you would still prefer the \$1000 today. Not the last reason is inflation because it will bring up that extra \$1 or more. So you might be even worse off. It's better to take the \$1000 now and not wait a year for just \$1.

"A bird in the hand is worth 2 in the bush."–Proverb

Let us make other more common examples of cash flow value today vs. in the future.

If you receive \$200 per year for the next six years, what is the net present value if the current inflation rate is 3%:

``````import pandas as pd
import numpy as np
import matplotlib.pyplot as plt

r = 0.03
cash_flow = pd.DataFrame({'Year': [1, 2, 3, 4, 5, 6],
'Cash': [200, 200, 200, 200, 200, 200]})
# PV (Present Value) = Cash (at period 1) / (1 + r)^n
cash_flow['PV'] = cash_flow['Cash'] / (1.0 + r) ** cash_flow['Year']
npv = cash_flow['PV'].sum()
print(round(cash_flow))
``````
Year Cash PV
1 200 194.0
2 200 189.0
3 200 183.0
4 200 178.0
5 200 173.0
6 200 167.0

The earned \$ in the future will not be worth as much as one made in the present—this discount rate element of NPV (Net Present Value)–the difference between the present value of cash and PV (Present Value) over a period of time.

According to your expectation, in 6 years, you will get \$1200, but their worth (NPV) at that time would be:

``````print('NPV is', + round(npv))

# NPV is 1083.0
``````

As you see, \$1200 in the present is \$1083 in the six years with the discount (inflation rate in our case) of 3%.

We can also use the same approach to calculate the NPV of uneven cash flows yearly, receiving different cash amounts with the same discount (inflation) rate of 3%:

``````# Calculate NPV of uneven cash flows

cash_flow = pd.DataFrame({'Year': [1, 2, 3, 4, 5, 6],
'Cash': [150, 200, 250, 350, 400, 450]})
print(cash_flow)
``````
# Year Cash
0 1 150
1 2 200
2 3 250
3 4 300
4 5 350
5 6 400

Looking at the table, you are expecting to get \$1800 in total in the six years. You are right, you will have this amount, but with the worth of:

``````r = 0.03
cash_flow['PV'] = cash_flow['Cash'] / (1 + r) ** cash_flow['Year']
npv = cash_flow['PV'].sum()
print('NPV is', + round(npv))

# NPV is 1596.0
``````

Yes, your present \$1800 will be \$1596 in the near future of 6 years.

Let's consider other hands-on examples of the time-value of money:

Often we have to calculate the present value of equal payments during determined X years. A good example is a lottery jackpot––\$1,000,000 payout. Usually, there are two options for how the winner can receive his money:

1. Receive five equal payments of \$200,000 during the next five years

2. The lump sum of \$940000 (because of 6% of the bank interest rate on the deposit)

At first glance, nobody wants to lose \$60000 and would prefer to wait these years while receiving \$200,000 yearly till the end of the payout period. After all, \$1,000,000 is more than \$940,000.

Precisely, we need to think of calculating the net present value to make the right decision. In the financial terminology, it would be called: calculating the present value of a finite annuity.

Let's see how much worth would be getting your \$1,000,000 through 5 equal payments of \$200,000 and five years from now with the bank interest rate on deposit of 6%:

``````payment = 200000
time = 5
rate = 0.06
cash_flow = pd.DataFrame({'Period': np.arange(1, 6),
'PMT': payment})
print(cash_flow)
``````
# Period PMT
0 1 200000
1 2 200000
2 3 200000
3 4 200000
4 5 200000

So far, we have created a cash_flow table as we did in the previous tables above to preview the cash flow better.

``````cash_flow['PV'] = cash_flow['PMT'] / (1 + rate) ** cash_flow['Period']
npv = cash_flow['PV'].sum()
print('NPV is ', + round(npv))

# NPV is 865895.0
``````

\$865,895 is the net present value of five equal payments and less than \$960,000 offered. Therefore, it's better to take the lump sum payment of \$960,000 and deposit it in the bank once.

As I mentioned before, in the finance world, the last calculation called: the present value of a finite annuity, the more advanced and often applicable concept to investors, especially to real estate investors, is the calculation of the present value of the finite growing annuity.

And here is an excellent example to consider for that:

Let's suppose you own a complex building with apartments. In your case, it means that the tenants pay you fixed rent monthly. To tackle higher inflation, you decide to increase the rent. Basically, the whole building from the finance side looks like an annuity payment that grows at the inflation rate. So that allows us to calculate the present value of those payments now:

• Current rent payment is \$800

• Growth rate of payments 6%

• Inflation rate of 3%

• Period is 5 years

``````rent_payment = 800
time = 5
rent_growth = 0.06
inflation_rate = 0.03
cash_flow = pd.DataFrame({'Year': np.arange(1,6),
'Cash': rent_payment})
print(cash_flow)
``````
# Year Cash
0 1 800
1 2 800
2 3 800
3 4 800
4 5 800

The next step is to increase cash flow at the growth rate to beat the inflation:

``````cash_flow['Cash'] = rent_payment * (1 + rent_growth) ** (cash_flow['Year'] - 1)
print(round(cash_flow))
``````
# Year Cash
0 1 800.0
1 2 848.0
2 3 899.0
3 4 853.0
4 5 1010.0

After increasing the rent payment, we need to calculate the present value of cash flow yearly by considering the inflation rate of 3%:

``````cash_flow['PV'] = cash_flow['Cash'] / (1 + inflation_rate) ** cash_flow['Year']
print(round(cash_flow))
``````
# Year Cash PV
0 1 800.0 777.0
1 2 848.0 799.0
2 3 899.0 823.0
3 4 953.0 847.0
4 5 1010.0 871.0

If the value of the "Cash" > "PV", then you did everything right as an investor: you beat the inflation rate and get "gross" returns from the rent payments. You earn money.

## Bottom Line

Money has time value due to inflation, deflation, devaluation, etc.

The present value of money helps investors decide the amount they should invest today to receive a particular amount of money with "Gain" in the future.

Take the PV, NPV, and FV (future value) concepts to apply them to calculate the output from your investment opportunities and get the time value of money at any given time. Because a dollar you hold in your hand today is worth more than a dollar you expect to get tomorrow. Mainly because you could invest the dollar you are having now.

If you want to learn more about finance and investment opportunities in general and today's world, you can become a reader of my newsletter (+bonus: the cheat sheet on how to free extra monthly cash from your dev-salary for investment).

Learn to invest with confidence!

Disclaimer: Author’s opinions are their own and do not constitute financial advice in any way whatsoever. Nothing published by IlonaCodes constitutes an investment recommendation, nor should any data or content published by IlonaCodes be relied upon for any investment activities.

Photo by Morgan Housel on Unsplash