Giter VIP home page Giter VIP logo

tvm's Introduction

TVM โ€” Time Value of Money

https://pepy.tech/badge/tvm/month
Author:Ken Kundert
Version:1.0.0
Released:2020-07-19

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 shows the specified values along with the computed value to make it easy for you to confirm that you used the right values. The computed value is capitalized and shown in a different color to make it easier to pick out.

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:

pv = $10,000.00
pmt = $0.00
FV = $12,833.59
r = 5%
periods = 60
years = 5

periods 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

pv = $10,000.00
pmt = $0.00
FV = $16,470.09
r = 5%
periods = 120
years = 10

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

tvm --pmt 100

pv = $10,000.00
pmt = $100.00
FV = $31,998.32
r = 5%
periods = 120
years = 10

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

pv = -$250,000.00
PMT = $1,248.21
fv = $0.00
r = 4.375%
periods = 360
years = 30

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

pv = -$250,000.00
pmt = $1,500.00
fv = $0.00
r = 4.375%
periods = 257.08
YEARS = 21.42

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

tvm -y 5 -f -250k pmt

pv = -$250,000.00
PMT = $911.46
fv = -$250,000.00
r = 4.375%
periods = 60
years = 5

tvm's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

ukosuagwu

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.