DEV Community

Stephen for Knock

Posted on

Loan Calculator Library

As part of Knock’s mission to make home buying and selling easy, we launched the Knock Home Swap™ almost exactly one year ago. Offering competitive financial products to our clients brought with it a host of opportunities, challenges, and new features for Knockstars to develop!

For example, take this Home Swap interest rates card from Knock HomePro (Android / iOS), our app for Real Estate agents:

Screen Shot 2021-07-20 at 9.53.25 AM

We brought mortgage rates into the HomePro app to show agents and their customers that we offer competitive interest rates. We are also legally required to show the Annual Percentage Rate (APR) whenever we provide an interest rate. This gives agents and customers a uniform metric to compare interest rates and fees across lenders.

To our surprise, it was difficult to find a simple NPM module to convert an interest rate to APR the way that innumerable online calculators do (1, 2, 3, the list goes on!). In particular, we could not find a module that would properly account for the various parameters (payment frequency, loaned fees, upfront fees, etc.) which are readily available in many of the online tools.

And so, we created this open source module: @knockaway/loan-calculator. The goal of this project is to make loan calculations as simple as using any one of the free online loan calculators. Just inputs and outputs! The first release includes methods to calculate APR, APY, periodic payments, and to convert compounding frequencies.

Have an idea for a new loan calculator function? Visit our GitHub page to make a contribution or feature request. Happy calculating!

Latest comments (0)