Macaulay Duration JS
A library to calculate the Macaulay Duration and Modified Duration in Node.js
Installation
npm install --save macaulay-duration
Usage
Macaulay Duration
ES5
var duration = duration;var faceValue = 10000; // 10000 dollarsvar couponRate = 005; // 5%var maturity = 5; // 5 yearsvar years = ;console;// The Macaulay Duration is 4.546 years
ES6
const faceValue = 10000 // 10000 dollarsconst couponRate = 005 // 5%const maturity = 5 // 5 yearsconst years =console// The Macaulay Duration is 4.546 years
Modified Duration
ES5
var modifiedDuration = modifiedDuration;var faceValue = 10000; // 10000 dollarsvar couponRate = 005; // 5%var maturity = 5; // 5 yearsvar years = ;console;// The Modified Duration is 4.546 years
ES6
const faceValue = 10000 // 10000 dollarsconst couponRate = 005 // 5%const maturity = 5 // 5 yearsconst years =console// The Modified Duration is 4.546 years
Contributing
- Fork it!
- Create your feature branch:
git checkout -b my-new-feature
- Commit your changes:
git commit -am 'Add some feature'
- Push to the branch:
git push origin my-new-feature
- Submit a pull request :D
License
Copyright (c) 2016 Supasate Choochaisri
Licensed under the Apache License.