CashflowJS is comprehensive JavaScript library for time value of money calculations and financial analysis.
- Present value (PV) of a single cash flow
- Future value (FV) of a single cash flow
- Support for both discrete and continuous compounding
- Present value of ordinary annuity (PVOA)
- Present value of annuity due (PVAD)
- Future value of ordinary annuity (FVOA)
- Future value of annuity due (FVAD)
- Payment calculation (PMT)
- Number of periods calculation (NPER)
CashflowJS includes TypeScript definitions for all functions and return types.
Use the package manager npm to install cashflowjs.
npm install cashflowjs
var cashflowjs = require('cashflowjs');
// Basic cash flow functions
const pv = cashflowjs.pv(1000, 0.05, 5, 1); // PV of $1000 in 5 years at 5% annual interest
const fv = cashflowjs.fv(1000, 0.05, 5, 1); // FV of $1000 in 5 years at 5% annual interest
const pv_cont = cashflowjs.pv(1000, 0.05, 5); // PV of $1000 in 5 years with continuous compounding
const fv_cont = cashflowjs.fv(1000, 0.05, 5); // FV of $1000 in 5 years with continuous compounding
// Annuity calculations
const pvoa = cashflowjs.pvoa(100, 0.05, 10, 12); // PV of $100 monthly payment for 10 years at 5%
const pvad = cashflowjs.pvad(100, 0.05, 10, 12); // PV of annuity due
const fvoa = cashflowjs.fvoa(100, 0.05, 10, 12); // FV of ordinary annuity
const fvad = cashflowjs.fvad(100, 0.05, 10, 12); // FV of annuity due
const pmt = cashflowjs.pmt(10000, 0.05, 60, 12); // Monthly payment on $10,000 loan
const nper = cashflowjs.nper(10000, 200, 0.05, 12); // How long to pay off $10,000 at $200/month
For issue submission please visit GitHub
- Add calculations for internal rate of return (IRR)
- Add calculations for net present value (NPV)
- Add calculations for amortization schedule
Pull requests are welcome for bug resolution. Please open an issue prior to initiating a pull request.