Time Value of Money in Finance.
The basic idea behind Time Value of Money (TVM) is One Dollar today will worth more than one dollar tomorrow because you can invest or save your money today and earn interest tomorrow.

All required TVM calculations can be easily realised with Python.
Future Value (FV) - Compounding formula:
Where:
FV: Future Value
PV: Present Value (today)
r: Interest Rate (per period)
n: number of periods
PV = 100
r = 0.05
n = 3
FV = PV * (1 + r)**n
You can also calculate FV using NUMPY library which is much more simple way to do it.
import numpy as np
import numpy_financial as npf
PV = 0
cf = -2000
r = 0.03
n = 25
FV = npf.fv(rate = r, nper = n, pmt = cf, pv = PV)
FV
Present Value (PV) - Discounting formula:
Where:
FV: Future Value
PV: Present Value (today)
r: Interest Rate (per period)
n: number of periods
FV = 20000
n = 4
r = 0.045
PV = FV / (1 + r)**n
You can also calculate PV using NUMPY library which is much more simple way to do it.
import numpy as np
import numpy_financial as npf
FV = 20000
r = 0.03
n = 25
cf = 5000
PV = npf.pv(rate = r, nper = n, pmt = cf, fv = FV)
PV
Interest Rates formula:
Where:
FV: Future Value
PV: Present Value (today)
r: Interest Rate (per period)
n: number of periods
pv = 10000
fv = 15000
n = 10
r = (fv / pv)**(1/n) - 1
Stock Returns (Price Return) formula:
Where:
Pt: Price @ timestamp t
Pt+1: Price @ t+1
r: Period Return (Price Return)
p0 = 976
p1 = 1053
p_ret = p1 / p0 - 1
Stock Returns (Total Return = Price Return + Dividend Yield) formula:
Where:
Pt: Price @ timestamp t
Pt+1: Price @ t+1
Dt+1: Dividend payment @ t+1
r: Period Return (Total Return)
div = 40
div_y = div / p0
total_ret = p_ret + div_y