Porting Python CLI Calculator application to TS: Implementing IRR Function

1 min readSep 10, 2021

At the new company I have been working on dealing with side effects of production environment, catching bugs and operation issues. Nearing the end of 3 month probation period, the team decided I could get on with a new feature that involved translating an existing python app to JS.

One of the things to be calculated was IRR, and there was this neat, dependecy-free library for JS. However I did not need to use all the functions, so I looked into the source code and extracted the IRR function.

Upon QA, we found there was a large gap between Python results that used numpy_financial, and JS results that used the function from financial npm library. Upon investigation…

Excel / Python’s numpy_financial IRR Function translated into JS needs to have maxIter of 20 instead of 100. maxIter of 100 is used in Excel’s XIRR Function instead.