Skip to content

onaclovtech/finance.js

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

70 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Build Status Finance.js

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

Installation

  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.

Example Usage

  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.

Tests

   npm test

Contributing

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.

To Do

  • Expand library with more financial calculations
  • Include edge cases in testing, if any

Example Usage in Browser

<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>

About

A JavaScript library for common financial calculations

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 62.7%
  • HTML 37.1%
  • Makefile 0.2%