@floydspace/bond-calculator

0.2.0 • Public • Published

Bond calculator

npm version Build Status Coverage Status

Yield and price calculations for bonds.

Gives the same results as Excel YIELD and PRICE functions.

The following day count conventions are supported:

  • 30U/360
  • ACTUAL/ACTUAL
  • ACTUAL/360
  • ACTUAL/365
  • 30E/360
  • 30/360

More info about day count conventions can be found on Wikipedia.

Installation

npm install --save @floydspace/bond-calculator

Usage

const bondCalculator = require('@floydspace/bond-calculator');

const bond = bondCalculator({
  settlement: '2016-12-26',
  maturity: '2023-01-17',
  rate: 0.02625, // 2.625%
  redemption: 100,
  frequency: 2, // 1=Annual, 2=Semiannual, 4=Quarterly, 12=Monthly
  convention: '30U/360',
});

// Calculate yield for a given price
const yld = bond.yield(98); // 2.98817753210426%

// Calculate price for a given yield
const price = bond.price(0.025); // 100.69785390232649

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 0.2.0
    11
    • latest

Version History

Package Sidebar

Install

npm i @floydspace/bond-calculator

Weekly Downloads

16

Version

0.2.0

License

MIT

Unpacked Size

17.9 kB

Total Files

9

Last publish

Collaborators

  • f1oyd