@teakit/finance

@teakit/finance is a pure TypeScript library of financial calculation utilities.

Guide

NeedRead
Install and try the packageInstallation & Usage
Compact rules for AI agentsLLMs
Agent workflow for this packageFinance Skill

Installation & Usage

npm
yarn
pnpm
bun
deno
npm install @teakit/finance
import { AM, NPV, ROI } from "@teakit/finance";

AM({
  principal: 20_000,
  rate: 7.5,
  period: 5,
  yearOrMonth: "year",
});

NPV(10, [-500_000, 200_000, 300_000, 200_000]);
ROI(-55_000, 60_000);

Public Surface

FunctionReturns
AM(params)Amortized loan payment.
CAGR(beginningValue, endingValue, numOfPeriods)Growth rate percentage.
CAPM(rf, beta, emr)Expected return decimal.
CI(rate, numOfCompoundings, principal, numOfPeriods)Compound amount.
DF(rate, numOfPeriods)Discount factor array.
FV(rate, cf0, numOfPeriod)Future value.
IAR(investmentReturn, inflationRate)Inflation-adjusted return percentage.
IRR(cashFlows, depth?)Internal rate of return percentage.
LR(totalLiabilities, totalDebts, totalIncome)Leverage ratio.
NPV(rate, cashFlows)Net present value.
PI(rate, cashFlows)Profitability index.
PMT(rate, numOfPayments, principal)Payment per period.
PP(numOfPeriods, cashFlows)Payback period.
PV(rate, cf1, numOfPeriod?)Present value.
R72(rate)Years to double estimate.
ROI(initial, earnings)Return on investment percentage.
WACC(params)Weighted average cost of capital percentage.
XIRR(cashFlows, dates, guess?)Irregular IRR percentage or null.

LLMs

AI agents should start with LLMs, then open only the relevant source, test, or project documentation file.