Blog

Refinance: reInteractive's Finance Library

Placeholder Avatar
Aaron Beckerman
June 5, 2013

One of our clients needed to do calculations related to loans. For example, if you reduce the interest rate of your loan by 1.1%, but continue to make the same monthly payments, exactly how much shorter will the loan be? Or, more challengingly, if you’re making X monthly payments of $Y to pay off a $Z loan, what effective interest rate are you being charged?

There are well-known mathematical formulas that allow us to answer these kinds of questions. (Installment loans like these are called annuities in finance theory.) We couldn’t find a pure-Ruby library that implemented them the way we wanted, so we made a gem: Refinance. We’ve been using it in production for a while, and we just released version 1.0.0.

Numerical analysis is hard, and this company of web developers doesn’t fancy parachuting into that warzone. We designed Refinance to be simple and direct, even if that means sacrificing speed, configurability, and numerical stability. Yes, the secant method has significant advantages, but we’re okay with boring ol’ Newton-Raphson.

We’re distributing the source under the MIT License. We’d love for other Ruby programmers to use Refinance, help improve it, and modify it for their own purposes.