Finance.js makes it easy to incorporate common financial calculations into your application. The library is built on pure JavaScript without any dependencies. For full documentation, please visit financejs.org.
This project is hosted on GitHub. You can report bugs and discuss features on the GitHub issues page. Finance.js is available for use under the MIT software license.
##Getting Started
npm install financejs --save
or
- Download or fork the repository from GitHub.
- Extract the file finance.js from the project and include it in your application on the client side.
var Finance = require('financejs');
var finance = new Finance();
// To calculate Amortization
finance.AM(20000, 7.5, 5, 0);
// => 400.76
To see all available calculations and their usage, visit financejs.org.
npm test
Contributions are welcome to aid in the expansion of the library. In lieu of a formal styleguide, take care to maintain the existing coding style. Add unit tests for any new or changed functionality, and please lint and test your code.
- Expand library with more financial calculations
- Include edge cases in testing, if any
<html>
<head>
<script src="finance.js"></script>
<script>
//var finance = Finance();
var finance = Finance.prototype;
//console.log(finance.AMSchedule(204800, 4.5, 360, 1,100))
//console.log(finance.AMSchedule(204800, 1.75, 360, 1, 0)["total interest"])
var targetInterest = finance.AMSchedule(204800, 1.75, 360, 1, 0)["total interest"];
//console.log(finance.AM(204800, 4.5, 360, 1, 0))
//console.log(finance.AMByInterest(204800, 4.5, 360, 1, targetInterest))
var targetPayment = finance.AMByInterest(204800, 4.5, 360, 1, targetInterest);
console.log(targetPayment);
console.log(targetInterest);
console.log(finance.AMSchedule(204800, 4.5, 360, 1,targetPayment));
var lineData = [];
for (i=0; i < 1500; i+=100){
lineData.push([i, finance.AMSchedule(204800, 4.5, 360, 1,i)["total interest"]]);
}
// Show the distribution of interest as your increase your payment
console.log(lineData);
</script>
</head>
<body>
</body>
</html>