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

@gibme/finance

v22.0.0

Published

A simple collection of financial equations

Readme

@gibme/finance

A simple collection of financial equations for Node.js and the browser.

Documentation

https://gibme-npm.github.io/finance/

Requirements

  • Node.js >= 22

Installation

npm install @gibme/finance
yarn add @gibme/finance

Features

Amortization

  • Payment - Calculate monthly payment breakdown (principal, interest, balance)
  • Table - Generate a full amortization schedule with optional extra payment support
  • Loan Information - Summarize total interest, savings from extra payments, and effective rates
  • Principal from Payment - Reverse-calculate the loan principal given a known payment amount

Interest

  • Annual Percentage Yield (APY) - Convert a nominal rate to its effective annual yield given a compounding period
  • Compound Interest - Calculate the future value of a principal using the compound interest formula
  • Simple Interest - Calculate the future value of a principal using the simple interest formula
  • Simple Interest Loan - Summarize payment, total interest, and effective rate for a simple interest loan

Pricing

  • Margin - Calculate the margin on a product given cost and selling price
  • Markup - Calculate the markup on a product given cost and selling price

Valuation

  • Present Value from Future Value - Discount a future value back to its present value at a constant rate

Moving Averages

  • SMA - Simple Moving Average
  • EMA - Exponential Moving Average
  • LWMA - Linearly Weighted Moving Average
  • EWMA - Exponentially Weighted Moving Average
  • CMA - Cumulative Moving Average

Usage

import {
    calculate_amortization_loan,
    calculate_compound_interest,
    calculate_apy,
    calculate_sma
} from '@gibme/finance';

// 30-year mortgage at 6% with $200 extra/month starting month 1
const loan = calculate_amortization_loan(200000, 0.06, 360, [
    { month: 1, amount: 200, fill: true }
]);
console.log(loan.payment);        // monthly payment
console.log(loan.months_saved);    // months saved by extra payments
console.log(loan.interest_saved);  // interest saved by extra payments

// Compound interest: $10,000 at 5% compounded monthly for 5 years
const futureValue = calculate_compound_interest(10000, 0.05, 'monthly', 60);
console.log(futureValue);

// APY for 5% compounded daily
const apy = calculate_apy(0.05, 'daily');
console.log(apy);

// Simple moving average with a 3-period window
const sma = calculate_sma([10, 20, 30, 40, 50], 3);
console.log(sma); // [20, 30, 40]

Compounding Periods

The following compounding periods are supported wherever a CompoundPeriod is accepted:

daily | weekly | biweekly | semimonthly | monthly | bimonthly | quarterly | semiannually | annually | biannually

APR Handling

Functions that accept an apr parameter will automatically convert values greater than 1 to a decimal (e.g. 5 becomes 0.05). You can pass either form.

License

MIT