Finance.ts makes it easy to incorporate common financial calculations into your application. The library is built in Typescript without any dependencies.
This is a fork of https://github.com/ebradyjobory/finance.js.
Major differences:
- Written in Strict Typescript
- ESM and CJS compatible
- No more classes, just pure functions
- Functions are written without using
arguments
and rest parameters - Functions with more than 3 parameters uses object parameters instead
- Functions uses booleans and enums instead of integer flags
npm install @founderpath/financets --save
import { AM } from "@founderpath/financets"
AM({
principal: 20000,
rate: 7.5,
period: 5,
yearOrMonth: "year",
payAtBeginning: false,
});
// => 400.76
These are the available functions. Please refer to the typescript definition itself and/or tests for usage.
Amortization (AM) is the paying off of debt with a fixed repayment schedule in regular installments over a period of time.
Compound Annual Growth Rate (CAGR) is the year-over-year growth rate of an investment over a specified period of time.
Capital Asset Pricing Model (CAPM) describes the relationship between systematic risk, or the general perils of investing, and expected return for assets, particularly stocks.
Compound Interest (CI) is the interest calculated on the initial principal and also on the accumulated interest of previous periods of a deposit or loan.
Discount Factor (DF) is the factor by which a future cash flow must be multiplied in order to obtain the present value.
Future Value (FV) is the value of an asset or cash at a specified date in the future that is equivalent in value to a specified sum today
Inflation-adjusted return (IAR) measures the return taking into account the time period's inflation rate
Internal Rate of Return (IRR) is the discount rate often used in capital budgeting that makes the net present value of all cash flows from a particular project equal to zero.
Leverage Ratio (LR) is used to calculate the financial leverage of a company or individual to get an idea of the methods of financing or to measure ability to meet financial obligations.
Net Present Value (NPV) compares the money received in the future to an amount of money received today, while accounting for time and interest [through the discount rate]. It's based on the principal of time value of money (TVM), which explains how time affects monetary value.
Profitability Index (PI) is an index that attempts to identify the relationship between the costs and benefits of a proposed project through the use of a ratio calculated.
Loan Payment per Period (PMT) calculates payment for a loan based on constant payments and a constant interest rate
Payback Period (PP) is the length of time required to recover the cost of an investment.
Present Value (PV) is the current worth of a future sum of money or stream of cash flows given a specified rate of return
Rule of 72 (R72) is a rule stating that in order to find the number of years required to double your money at a given interest rate, you divide the compound return into 72.
Return on Investment (ROI) is a simple calculation that tells you the bottom line return of any investment.
Weighted Average Cost of Capital (WACC) is the rate that a company is expected to pay on average to all its security holders to finance its assets.
XIRR is used to determine the Internal Rate of Return when the cash flows are at Irregular intervals.