Skip to main content

Time Value of Money

Project description

Author:

Ken Kundert

Version:
0.3.0
Released:

2019-04-04

What?

Time value of money calculations relate the following quantities:

  • future value

  • present value

  • payments

  • number of periods

  • discount rate

tvm computes one of these values (other than discount rate) given the others.

The number of periods is split between two values, the number of years and the number of periods per year (the frequency).

Getting Started

Install using:

pip3 install --user tvm

This installs tvm to ~/.local/bin; make sure this directory is on your path.

Usage:

tvm [options] [fv|pv|pmt|years]

Options:

-f <val>, --fv <val>     future value
-p <val>, --pv <val>     present value
-P <val>, --pmt <val>    payment per period
-y <val>, --years <val>  total number of years
-n <val>, --freq <val>   number of payments per year
-r <val>, --rate <val>   annual discount rate
-i, --ignore             ignore any previously specified values

If a value is not given it is recalled from the previous invocation. Specify –ignore to use the default values for all unspecified options, which are: pv=0, fv=0, pmt=0, years=30, freq=12.

When the program runs, it always prints the computed value first, and then prints the remaining values to make it easy for you to confirm that you used the right values.

Savings Accounts

Consider case where you have a interest bearing account that pays 5% per annum compounded monthly. If you start with $10,000, you can compute the amount you will have after 5 years with:

tvm --pv=10000 --rate=5 --freq=12 --years=5 fv

The amount in 5 years is referred to as the future value (fv). The current amount is the present value (pv). The frequency is the number of periods per year. The program responds with:

fv = $12,833.59
pv = $10,000.00
pmt = $0.00
r = 5%
N = 60

N is the total number of periods and equals the product of the years and the number of periods per year.

You can specify values with SI scale factors, units, and commas. The units and commas are ignored. So you can do the same thing with either:

tvm --pv='$10,000' --rate=5% --freq=12 --years=5 fv

or:

tvm --pv=10k --rate=5% --freq=12 --years=5 fv

The quotes are needed in the first case to prevent $ from being interpreted by the shell.

tvm remembers the values specified on the previous invocation and uses them if they are not specified. This allows you to rapidly run what-if experiments without having to re-specify values that do not change. So, once you have run the first command, you can now quickly determine how much you will have in 10 years using:

tvm -y 10

fv = $16,470.09
pv = $10,000.00
pmt = $0.00
r = 5%
N = 120

Without changing anything else, you can determine what happens if you make an additional $100 contribution each month:

tvm --pmt 100

fv = $31,998.32
pv = $10,000.00
pmt = $100.00
r = 5%
N = 120

Loans

You can also use tvm to explore loans. For example, you can compute the payment for a mortgage given the principal, interest rate, and length:

tvm --ignore --pv=-250k --rate=4.375 --years=30 pmt

pmt = $1,248.21
pv = -$250,000.00
fv = $0.00
r = 4.38%
N = 360

The –ignore option was added so that we start from scratch; any values that were previously specified are ignored.

You can now understand how paying a little extra affects how long it takes to pay off the loan using:

tvm --pmt=1.5k years

years = 21.42
pv = -$250,000.00
pmt = $1,500.00
fv = $0.00
r = 4.38%
N = 257.08

To compute the payments for a 5-year interest only balloon mortgage, use:

tvm -y 5 -f -250k pmt

pmt = $911.46
pv = -$250,000.00
fv = -$250,000.00
r = 4.38%
N = 60

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

tvm-0.3.0.tar.gz (4.6 kB view details)

Uploaded Source

File details

Details for the file tvm-0.3.0.tar.gz.

File metadata

  • Download URL: tvm-0.3.0.tar.gz
  • Upload date:
  • Size: 4.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.21.0 setuptools/40.6.2 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.7.2

File hashes

Hashes for tvm-0.3.0.tar.gz
Algorithm Hash digest
SHA256 62dc947f43a4bfd28d185254c915a9a7ce38c225aab6cdfcaca2e6995882d24b
MD5 33501862acbf0bc8a39405a383dd6d95
BLAKE2b-256 d521adb1f04c1a69c2db5aa55f69289c35bbb1af07daad2892ef0f1752efc95c

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page