https://github.com/hyperjiang/finance
Financial functions with the Excel function names and parameter order, along with an installment calculator.
https://github.com/hyperjiang/finance
Last synced: 12 months ago
JSON representation
Financial functions with the Excel function names and parameter order, along with an installment calculator.
- Host: GitHub
- URL: https://github.com/hyperjiang/finance
- Owner: hyperjiang
- License: mit
- Created: 2020-07-05T14:59:44.000Z (almost 6 years ago)
- Default Branch: master
- Last Pushed: 2020-08-01T23:43:02.000Z (almost 6 years ago)
- Last Synced: 2025-03-02T08:46:02.340Z (over 1 year ago)
- Language: Go
- Homepage:
- Size: 19.5 KB
- Stars: 0
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# finance
[](https://pkg.go.dev/github.com/hyperjiang/finance?tab=doc)
[](https://travis-ci.org/hyperjiang/finance)
[](https://goreportcard.com/report/github.com/hyperjiang/finance)
[](https://codecov.io/gh/hyperjiang/finance)
[](https://github.com/hyperjiang/finance/releases)
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)
```