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

compounded-sofr

v1.0.0

Published

SOFR / risk-free-rate compounding-in-arrears math — ARRC & ISDA conventions (lookback, observation shift, lockout), the SOFR Index method, and the compounded average. Reproduces the NY Fed's published values. Zero dependencies.

Readme

compounded-sofr

SOFR compounding-in-arrears math — the ARRC & ISDA conventions (lookback, observation shift, lockout), the SOFR Index method, the compounded average, and daily-simple accrual. Zero dependencies.

npm install compounded-sofr

Why

SOFR replaced LIBOR, and unlike LIBOR it is an overnight rate — so a three-month SOFR coupon is a compounded average of daily rates set in arrears, with a small zoo of conventions (how many business days to look back, whether to shift the observation window, whether to lock out the final days). The New York Fed publishes a SOFR Index and 30/90/180-day averages built on exactly this math, and npm had no library that implements it. This one does — and reproduces those published numbers.

import { compoundedSofr, averageFromIndex, indexFromRates } from "compounded-sofr";

// observations: one { date, rate } per business day (rate in %), e.g. from the
// `newyorkfed` package. A Friday's rate carries its weekend weight automatically.
compoundedSofr({ observations, start: "2026-06-09", end: "2026-07-09" });
// 3.63409 — matches the NY Fed's published 30-day SOFR average for 2026-07-09

// The exact, path-independent method straight from the published SOFR Index
// (index on 2026-06-09 and 2026-07-09, 30 calendar days apart):
averageFromIndex(1.24646364, 1.25023844, 30); // 3.63409 — the same 30-day average

// Reconstruct the SOFR Index by compounding the daily series (seeded 1.0 on 2018-04-02):
indexFromRates(observations, 1.0);

API

Rates are percents (3.53 = 3.53%), matching the NY Fed API. Observations are { date: "YYYY-MM-DD", rate }, one per business day.

  • compoundedSofr({ observations, start, end, convention? }) — compounded-in-arrears rate for the interest period [start, end). convention is { type: "plain" } (default), { type: "lookback", businessDays }, { type: "observationShift", businessDays }, or { type: "lockout", businessDays }.
  • averageFromIndex(startIndex, endIndex, days) — compounded average between two SOFR Index values: (end/start − 1) × 360/days.
  • indexFromRates(observations, startIndex?) — compound a daily series forward into an index value.
  • compoundInArrears(periods) / dailySimpleAverage(periods) — the underlying primitives over { rate, days }[].
  • weightedRates(params) — the per-day { rate, days } schedule a convention produces (inspect or reuse it).
  • accruedInterest(notional, params)notional × rate/100 × totalDays/360.
  • withSpreadAdjustment(rate, spreadBps) — add an ISDA fallback spread.

The 360-day basis, the calendar-day weighting (weekends fold into the preceding business day), and in-arrears compounding all follow the ARRC conventions.

Correctness

Every path is validated against the NY Fed's own published series: the averageFromIndex method reproduces the published 30/90/180-day averages across a year of data, and indexFromRates reconstructs the published SOFR Index to ~1e-8. Plain compoundedSofr and the index method agree to floating-point precision.

Related

Pairs with newyorkfed (fetch the daily SOFR and index). Part of a fixed-income toolkit: treasurydirect · tbill · tips-index-ratio · day-count · accrued-interest · 32nds · sifma-holidays · instrument-identifiers.

Author

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

MIT © Moshe Malka