A new finance library for javascript. Intended to improve the workflow of JavaScript developers who are also in the finance industry. The package includes nice helper functions to quickly get values for ratio analysis, time value of money, managerial calculations etc.
Currently version 1.x.x only has Time Value of Money
npm install businessjs
<script src="https://cdn.jsdelivr.net/npm/businessjs@1.2.1/build/index.min.js"></script>
This will give you the package available for use in any front-end or Node.js environment.
Import syntax:
import businessjs from 'businessjs';
In node environment:
const businessjs = require('businessjs');
const tvm = businessjs.tvm;
Using the CDN is recommended though.
<!DOCTYPE html>
<html>
<head>
<script src="node_modules/businessjs/build/index.js"></script>
</head>
<body></body>
</html>
This should create the instance globally on the window
<script>
const tvm = businessjs.tvm;
</script>
Methods
- Requires the present value and effective interest in decimal format and returns a future value based on a number of periods.
numPeriods
defaults to 1 as in 1 year.perPeriod
The amount of times an interest rate is compounded defaults to 1.
- Requires the present value and interest in decimal format and returns a future value.
numPeriods
defaults to 1 as in 1 year.perPeriod
The amount of times an interest rate is compounded defaults to 1.
- Returns the number of periods that an investment / loan would take to realise, pay off.
perPeriod
The amount of times an interest rate is compounded defaults to 1.
- Returns the interest rate of a given investment/loan.
numPeriods
defaults to 1 as in 1 year.perPeriod
The amount of times an interest rate is compounded defaults to 1.
- Returns the future value of an annuity paid at the end of every cycle with an effective interest rate.
numPeriods
defaults to 1 as in 1 year.perPeriod
The amount of times an interest rate is compounded defaults to 1.
- Returns the future value of an annuity paid at the beginning of every cycle with an effective interest rate.
numPeriods
defaults to 1 as in 1 year.perPeriod
The amount of times an interest rate is compounded defaults to 1.
- Returns the present value of an annuity paid at the end of every cycle with an effective interest rate.
numPeriods
defaults to 1 as in 1 year.perPeriod
The amount of times an interest rate is compounded defaults to 1.
- Returns the present value of an annuity paid at the beginning of every cycle with an effective interest rate.
numPeriods
defaults to 1 as in 1 year.perPeriod
The amount of times an interest rate is compounded defaults to 1.
- Returns the annual effective interest rate from a nominal rate and per-period compund amount.
- Useful because all other functions use effective rate, eg.
const tvm = require('businessjs').tvm;
// Convert the monthly nominal rate to yearly effective inline
tvm.futureValue(100, tvm.effectiveRate(0.1, 12), 1, 1);
- Returns an array of objects that have the following shape:
{
period,
payment,
interestPortion,
principlePortion,
totalBalance,
principleBalance
}
- Returns the tabular data of an amortisation with breakdown of interest and principle amounts.
numPeriods
defaults to 1 as in 1 year.perPeriod
The amount of times an interest rate is compounded defaults to 12 payments per year.
These are just the first few methods in version 1, Documentation will be updated as version improves.