Skip to content

Financial functions with the Excel function names and parameter order, along with an installment calculator.

License

Notifications You must be signed in to change notification settings

hyperjiang/finance

Repository files navigation

finance

GoDoc Build Status codecov Release

Financial functions with the Excel function names and parameter order, along with an installment calculator.

Require go version >= 1.13.

Available Functions

  • PMT: calculates the payment for a loan based on constant payments and a constant interest rate.
  • IPMT: returns the interest payment for a given period for an investment based on periodic, constant payments and a constant interest rate.
  • PPMT: returns the payment on the principal for a given period for an investment based on periodic, constant payments and a constant interest rate.
  • PV: returns the present value of an investment.
  • FV: returns the future value of an investment based on periodic, constant payments and a constant interest rate.
  • NPER: returns the number of periods for an investment based on periodic, constant payments and a constant interest rate.
  • RATE: calculates interest rate per period of an annuity.

Installment Calculator

Demo usage:

import (
    "fmt"
    "github.com/hyperjiang/finance"
)

loan := finance.Loan{
    AnnualRate: 0.07,
    Periods:    12,
    Amount:     1000000,
    Method:     finance.EqualPayment,
}

installments := loan.CalculateInstallments()

fmt.Println(installments)

About

Financial functions with the Excel function names and parameter order, along with an installment calculator.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages