Time value of money models

This module contains functions for computing the time value of the money.

  • pvfv: computes the missing value in the equation fval = pval * (1 + rate) ** nper, that represents the following cashflow.
_images/pvfv.png
  • pvpmt: computes the missing value (pmt, pval, nper, nrate) in a model relating a present value and a finite sequence of payments made at the end of the period (payments in arrears, or ordinary annuities), as indicated in the following cashflow diagram:
_images/pvpmt.png
  • pmtfv: computes the missing value (pmt, fval, nper, nrate) in a model relating a finite sequence of payments in advance (annuities due) and a future value, as indicated in the following diagram:
_images/pmtfv.png
  • tvmm: computes the missing value (pmt, fval, pval, `nper, nrate) in a model relating a finite sequence of payments made at the beginning or at the end of the period, a present value, a future value, and an interest rate, as indicated in the following diagram:
_images/tvmm.png
cashflows.tvmm.amortize(pval=None, fval=None, pmt=None, nrate=None, nper=None, due=0, pyr=1, noprint=True)[source]

Amortization schedule of a loan.

Parameters:
  • pval (float) – present value.
  • fval (float) – Future value.
  • pmt (float) – periodic payment per period.
  • nrate (float) – nominal interest rate per year.
  • nper (int) – total number of compounding periods.
  • due (int) – When payments are due.
  • pyr (int, list) – number of periods per year.
  • noprint (bool) – prints enhanced output
Returns:

(principal, interest, payment, balance)

Return type:

A tuple

Examples.

>>> pmt = tvmm(pval=100, nrate=10, nper=5, fval=0) 
>>> amortize(pval=100, nrate=10, nper=5, fval=0, noprint=False) 
t      Beginning     Periodic     Interest    Principal        Final
       Principal      Payment      Payment    Repayment    Principal
          Amount       Amount                                 Amount
--------------------------------------------------------------------
0         100.00         0.00         0.00         0.00       100.00
1         100.00       -26.38        10.00       -16.38        83.62
2          83.62       -26.38         8.36       -18.02        65.60
3          65.60       -26.38         6.56       -19.82        45.78
4          45.78       -26.38         4.58       -21.80        23.98
5          23.98       -26.38         2.40       -23.98         0.00
>>> amortize(pval=-100, nrate=10, nper=5, fval=0, noprint=False) 
t      Beginning     Periodic     Interest    Principal        Final
       Principal      Payment      Payment    Repayment    Principal
          Amount       Amount                                 Amount
--------------------------------------------------------------------
0        -100.00         0.00         0.00         0.00      -100.00
1        -100.00        26.38       -10.00        16.38       -83.62
2         -83.62        26.38        -8.36        18.02       -65.60
3         -65.60        26.38        -6.56        19.82       -45.78
4         -45.78        26.38        -4.58        21.80       -23.98
5         -23.98        26.38        -2.40        23.98        -0.00
>>> amortize(pval=100, nrate=10, nper=5, fval=0, due=1, noprint=False) 
t      Beginning     Periodic     Interest    Principal        Final
       Principal      Payment      Payment    Repayment    Principal
          Amount       Amount                                 Amount
--------------------------------------------------------------------
0         100.00       -23.98         0.00       -23.98        76.02
1          76.02       -23.98         7.60       -16.38        59.64
2          59.64       -23.98         5.96       -18.02        41.62
3          41.62       -23.98         4.16       -19.82        21.80
4          21.80       -23.98         2.18       -21.80         0.00
5           0.00         0.00         0.00         0.00         0.00
>>> amortize(pval=-100, nrate=10, nper=5, fval=0, due=1, noprint=False) 
t      Beginning     Periodic     Interest    Principal        Final
       Principal      Payment      Payment    Repayment    Principal
          Amount       Amount                                 Amount
--------------------------------------------------------------------
0        -100.00        23.98         0.00        23.98       -76.02
1         -76.02        23.98        -7.60        16.38       -59.64
2         -59.64        23.98        -5.96        18.02       -41.62
3         -41.62        23.98        -4.16        19.82       -21.80
4         -21.80        23.98        -2.18        21.80        -0.00
5          -0.00         0.00        -0.00        -0.00        -0.00
>>> principal, interest, payment, balance = amortize(pval=100,
... nrate=10, nper=5, fval=0) 
>>> principal  
[0, -16.37..., -18.01..., -19.81..., -21.80..., -23.98...]
>>> interest  
[0, 10.0, 8.36..., 6.56..., 4.57..., 2.39...]
>>> payment  
[0, -26.37..., -26.37..., -26.37..., -26.37..., -26.37...]
>>> balance  
[100, 83.62..., 65.60..., 45.78..., 23.98..., 1...]
>>> principal, interest, payment, balance = amortize(pval=100,
... nrate=10, nper=5, pmt=pmt) 
>>> sum(interest)  
31.89...
>>> sum(principal)  
-99.99...
>>> principal, interest, payment, balance = amortize(fval=0,
... nrate=10, nper=5, pmt=pmt) 
>>> sum(interest)  
31.89...
>>> sum(principal)  
-99.99...
>>> principal, interest, payment, balance = amortize(pval=100,
... fval=0, nper=5, pmt=pmt) 
>>> sum(interest)  
31.89...
>>> sum(principal)  
-99.99...
>>> amortize(pval=100, fval=0, nrate=10, pmt=pmt, noprint=False) 
t      Beginning     Periodic     Interest    Principal        Final
       Principal      Payment      Payment    Repayment    Principal
          Amount       Amount                                 Amount
--------------------------------------------------------------------
0         100.00         0.00         0.00         0.00       100.00
1         100.00       -26.38        10.00       -16.38        83.62
2          83.62       -26.38         8.36       -18.02        65.60
3          65.60       -26.38         6.56       -19.82        45.78
4          45.78       -26.38         4.58       -21.80        23.98
5          23.98       -26.38         2.40       -23.98         0.00
>>> principal, interest, payment, balance = amortize(pval=100,
... fval=0, nrate=10, pmt=pmt) 
>>> sum(interest)  
31.89...
>>> sum(principal)  
-99.99...
cashflows.tvmm.pmtfv(pmt=None, fval=None, nrate=None, nper=None, pyr=1, noprint=True)[source]

CComputes the missing argument (set to None) in the function call.

Parameters:
  • pmt (float, list) – Periodic payment.
  • fval (float, list) – Future value.
  • nrate (float, list) – Nominal rate per year.
  • nper (int, list) – Number of compounding periods.
  • pyr (int, list) – number of periods per year.
  • noprint (bool) – prints enhanced output
Returns:

The value of the parameter set to None in the function call.

Effective interest rate per period is calculated as nrate / pyr.

cashflows.tvmm.pvfv(pval=None, fval=None, nrate=None, nper=None, pyr=1, noprint=True)[source]

Computes the missing argument (set to None) in the function call.

Parameters:
  • pval (float, list) – Present value.
  • fval (float, list) – Future value.
  • nrate (float, list) – Nominal interest rate per year.
  • nper (int, list) – Number of compounding periods.
  • pyr (int, list) – number of periods per year.
  • noprint (bool) – prints enhanced output
Returns:

The value of the parameter set to None in the function call.

Effective interest rate per period is calculated as nrate / pyr.

cashflows.tvmm.pvpmt(pmt=None, pval=None, nrate=None, nper=None, pyr=1, noprint=True)[source]

Computes the missing argument (set to None) in the function call.

Parameters:
  • pmt (float, list) – Periodic payment.
  • pval (float, list) – Present value.
  • nrate (float, list) – Nominal interest rate per year.
  • nper (int, list) – Number of compounding periods.
  • pyr (int, list) – number of periods per year.
  • noprint (bool) – prints enhanced output
Returns:

The value of the parameter set to None in the function call.

Effective interest rate per period is calculated as nrate / pyr.

cashflows.tvmm.tvmm(pval=None, fval=None, pmt=None, nrate=None, nper=None, due=0, pyr=1, noprint=True)[source]

Computes present and future values, periodic payments, nominal interest rate or number of periods.

Parameters:
  • pval (float, list) – Present value.
  • fval (float, list) – Future value.
  • pmt (float, list) – Periodic payment.
  • nrate (float, list) – Nominal interest rate per year.
  • nper (int, list) – Number of compounding periods.
  • due (int) – When payments are due.
  • pyr (int, list) – number of periods per year.
  • noprint (bool) – prints enhanced output
Returns:

Argument set to None in the function call.

Effective interest rate per period is calculated as nrate / pyr.

Examples.

In this example shows how to find different values for a loan of 5000, with a monthly payment of 130 at the end of the month, a life of 48 periods, and a interest rate of 0.94 per month (equivalent to 11.32% nominal)

  • Periodic payment:
>>> pmt = tvmm(pval=5000, nrate=11.32/12, nper=48, fval=0)
>>> pmt 
-130.00...
  • Future value:
>>> tvmm(pval=5000, nrate=11.32/12, nper=48, pmt=pmt) 
-0.0...
  • Present value:
>>> tvmm(nrate=11.32/12, nper=48, pmt=pmt, fval = 0.0) 
5000...
  • Rate:
>>> tvmm(pval=5000, nper=48, pmt=pmt, fval = 0.0) 
0.94...
  • Number of periods:
>>> tvmm(pval=5000, nrate=11.32/12, pmt=pmt, fval=0.0) 
48.0...
  • Periodic paymnts:
>>> tvmm(pval=5000, nrate=11.32, nper=48, fval=0, pyr=12) 
-130.00...
  • Nominal rate:
>>> tvmm(pval=5000, nper=48, pmt=pmt, fval = 0.0, pyr=12) 
11.32...
>>> tvmm(pval=5000, nrate=11.32, nper=48, fval=0, pyr=12, noprint=False) 
Present Value: .......  5000.00
Future Value: ........     0.00
Payment: .............  -130.01
Due: .................      END
No. of Periods: ......    48.00
Compoundings per Year:    12
Nominal Rate: .......     11.32
Effective Rate: .....     11.93
Periodic Rate: ......      0.94
>>> tvmm(pval=[5, 500, 5], nrate=11.32, nper=48, fval=0, pyr=12, noprint=False) 
#   pval   fval    pmt   nper  nrate  erate  prate due
------------------------------------------------------
0   5.00   0.00  -0.13  48.00  11.32  11.93   0.94 END
1 500.00   0.00  -0.13  48.00  11.32  11.93   0.94 END
2   5.00   0.00  -0.13  48.00  11.32  11.93   0.94 END