# @floydspace/bond-calculator

> Yield and price calculations for bonds

Latest version **0.2.0** (published 2019-10-12) · MIT license · 0 weekly downloads

## Install

```sh
npm install @floydspace/bond-calculator
pnpm add @floydspace/bond-calculator
yarn add @floydspace/bond-calculator
bun add @floydspace/bond-calculator
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.2.0 |
| Published | 2019-10-12 |
| First published | 2019-09-25 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 3 |
| Unpacked size | 17.5 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 4 |
| Author | Jonathan Goldwasser |
| Maintainers | f1oyd |

## Links

- npm: https://www.npmjs.com/package/@floydspace/bond-calculator
- Repository: https://github.com/floydspace/bond-calculator
- Homepage: https://github.com/floydspace/bond-calculator#readme
- Issues: https://github.com/floydspace/bond-calculator/issues
- npm.io page: https://npm.io/package/@floydspace/bond-calculator

## Dependencies (3)

- [ramda](https://npm.io/package/ramda.md) ^0.26.1
- [date-fns](https://npm.io/package/date-fns.md) ^1.30.1
- [@hapi/joi](https://npm.io/package/@hapi/joi.md) ^15.1.1

## Recent versions

- 0.2.0 (latest) — 2019-10-12
- 0.1.12 — 2019-09-26
- 0.1.11 — 2019-09-26
- 0.1.10 — 2019-09-25

## README

# Bond calculator

[![npm version](https://badge.fury.io/js/%40floydspace%2Fbond-calculator.svg)](https://badge.fury.io/js/%40floydspace%2Fbond-calculator)
[![Build Status](https://travis-ci.org/floydspace/bond-calculator.svg?branch=master)](https://travis-ci.org/floydspace/bond-calculator)
[![Coverage Status](https://coveralls.io/repos/github/floydspace/bond-calculator/badge.svg?branch=master)](https://coveralls.io/github/floydspace/bond-calculator?branch=master)

Yield and price calculations for bonds.

Gives the same results as Excel [YIELD](https://support.office.com/en-US/article/YIELD-function-F5F5CA43-C4BD-434F-8BD2-ED3C9727A4FE) and [PRICE](https://support.office.com/en-us/article/PRICE-function-3ea9deac-8dfa-436f-a7c8-17ea02c21b0a) 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](https://en.wikipedia.org/wiki/Day_count_convention).

## Installation
```
npm install --save @floydspace/bond-calculator
```

## Usage
```javascript
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
```

---
_Source: https://npm.io/package/@floydspace/bond-calculator · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
