Financial is a collection of finance calculations mimicking some of Excel Financial Functions interface.
IRR and NPV functions are faster since powers are pre-computed iteratively instead of using power function multiple times. Take this with a grain of salt since no benches tests are offered at the moment.
- FV(Rate, Nper, Pmt, Pv, Pmt_is_due)
- PV(Rate, Nper, Pmt, Fv, Pmt_is_due)
- NPV(Rate, values)
- XNPV(Rate), values, dates)
- XIRR(values, dates)
- MIRR(values, finance_rate, reinvest_rate)
- Add More Functions (NPER, PMT, Rate, effect)
- This crate has over 180 test case, most of them are compared to Excel outputs.
- XIRR is not compared against Excel, since Excel XIRR doesn't always converge to the correct answer and often produce the wrong answer of 0.000000002980. Instead XIRR are tested by using the XIRR to produce a zero XNPV value.
- Note that the precision used for equality of floating points is 1e-7
- Using the crate and providing feedback or pointing out any issues.
- Adding more test cases is encouraged.
- Any contribution that serves the crate is welcome.
Calculates the future value of an investment based on a constant interest rate. You can use FV with either periodic, constant payments, or a single lump sum payment.
Calculates the internal rate of return for a series of cash flows occurring at regular interval represented by the numbers in values.
Returns the modified internal rate of return for a series of periodic cash flows. MIRR considers both the cost of the investment and the interest received on reinvestment of cash.
Calculates the net present value of an investment by using a discount rate and a series of future payments (negative values) and income (positive values).
Calculates the present value of a loan or an investment, based on a constant interest rate. You can use PV with either periodic, constant payments (such as a mortgage or other loan), or a future value that's your investment goal.
Returns the internal rate of return for a schedule of cash flows that is not necessarily periodic
Returns the net present value for a schedule of cash flows that is not necessarily periodic.