Пример #1
0
func exPMTG(pmt bool) {
	fmt.Println("Enter gradient amount, # of periods, rate")
	vals, err := read3Values()
	if err != nil {
		fmt.Println("Error reading values: ", err)
		return
	}
	if pmt {
		v := finmath.PMTG(vals[0], vals[1], vals[2])
		fmt.Printf("PMTG: %f RTC(PMTG): %.2f\n", v, finmath.RTC(v))
		return
	}
	v := finmath.PVG(vals[0], vals[1], vals[2])
	fmt.Printf("PVG: %f RTC(PVG): %.2f\n", v, finmath.RTC(v))
}
Пример #2
0
func exPFV(fv bool) {
	fmt.Println("Enter payment amount, # of periods, rate")
	vals, err := read3Values()
	if err != nil {
		fmt.Println("Error reading values: ", err)
		return
	}
	if fv {
		v := finmath.FV(vals[0], vals[1], vals[2])
		fmt.Printf("FV: %f RTC(FV): %.2f\n", v, finmath.RTC(v))
		return
	}
	v := finmath.PV(vals[0], vals[1], vals[2])
	fmt.Printf("PV: %f RTC(PV): %.2f\n", v, finmath.RTC(v))
}
Пример #3
0
func exCI() {
	fmt.Println("Enter PV/FV, # of periods and rate per period:")
	vals, err := read3Values()
	if err != nil {
		fmt.Println("Error reading values: ", err)
		return
	}
	ci := finmath.CompoundInterest(vals[0], vals[1], vals[2])
	fmt.Printf("CI: %f RTC(CI): %.2f\n", ci, finmath.RTC(ci))
}
Пример #4
0
func exPMTFS() {
	fmt.Println("Enter FV, SV, # of periods and rate per period")
	vals, err := read4Values()
	if err != nil {
		fmt.Println("Error reading values: ", err)
		return
	}
	pmt := finmath.PMTFS(vals[0], vals[1], vals[2], vals[3])
	fmt.Printf("PMTFS: %f RTC(PMTFS): %.2f\n", pmt, finmath.RTC(pmt))
}
Пример #5
0
func exPMT(fv bool) {
	// If fv is true, we'll use PMTF instead of PMT.
	if fv {
		fmt.Println("Enter FV, # of periods and rate per period")
	} else {
		fmt.Println("Enter PV, # of periods and rate per period")
	}
	vals, err := read3Values()
	if err != nil {
		fmt.Println("Error reading values: ", err)
		return
	}
	if fv {
		pmt := finmath.PMTF(vals[0], vals[1], vals[2])
		fmt.Printf("PMTF: %f RTC(PMTF): %.2f\n", pmt, finmath.RTC(pmt))
	} else {
		pmt := finmath.PMT(vals[0], vals[1], vals[2])
		fmt.Printf("PMT: %f RTC(PMT): %.2f\n", pmt, finmath.RTC(pmt))
	}
}