npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

accrued-interest

v1.0.0

Published

Bond accrued interest between coupon dates — ACT/ACT-ICMA (US Treasuries), 30/360, ACT/360, and more. Zero dependencies, verified against TreasuryDirect's published figures.

Readme

accrued-interest

Bond accrued interest between coupon dates — ACT/ACT-ICMA (US Treasuries), 30/360 (US corporates/munis), 30E/360, ACT/360, ACT/365F, ACT/ACT-ISDA. Zero dependencies.

npm install accrued-interest

Why

Accrued interest is on every bond ticket and in every fixed-income P&L, yet npm had no package that computes it. The formula is one line — the day-count conventions underneath are not. This package does both, and its default convention reproduces the US Treasury's own published numbers.

import { accruedInterest, accruedDays, couponPayment } from "accrued-interest";

// T 4.375% — TreasuryDirect publishes accruedInterestPer1000 = 7.25204
// for this exact security (CUSIP 91282CQQ7, issued 2026-07-15):
accruedInterest({
  face: 1000,
  rate: 0.04375,          // annual coupon, decimal
  frequency: 2,           // semiannual
  periodStart: "2026-05-15",  // last coupon (dated date)
  periodEnd: "2026-11-15",    // next coupon
  settlement: "2026-07-15",
}); // 7.252038043478261

// A 30/360 corporate:
accruedInterest({
  face: 100_000,
  rate: 0.06,
  frequency: 2,
  periodStart: "2026-01-31",
  periodEnd: "2026-07-31",
  settlement: "2026-03-31",
  convention: "30/360",
}); // 1000

API

accruedInterest(params) → number

  • face — par amount
  • rate — annual coupon as a decimal (0.04375; passing 4.375 throws with a helpful message)
  • frequency — coupon payments per year (2 for Treasuries and most corporates)
  • periodStart / periodEnd — the coupon period bracketing settlement
  • settlement — must lie within the period
  • convention — default "ACT/ACT-ICMA"

ACT/ACT-ICMA computes coupon × accruedDays / periodDays; other conventions compute face × rate × yearFraction(periodStart, settlement). Returns the exact unrounded amount — round per your market's convention. Dates are "YYYY-MM-DD" strings (recommended) or Date objects read as UTC calendar dates; impossible dates throw.

accruedDays(params) → number

The day count from periodStart to settlement under the convention (actual days for ACT, 360-basis count for the 30/360 family).

couponPayment(face, rate, frequency) → number

One period's coupon: face × rate / frequency.

Related

Part of a small fixed-income toolkit: 32nds (Treasury quote notation) · day-count (the conventions, standalone) · sifma-holidays (bond-market calendar) · treasurydirect (auction data client).

Author

Built by Moshe Malka — engineering leader in New York City. Studio work at Quentin.Code.

MIT © Moshe Malka