Skip to main content
Question

Calculating an Internal Rate of Return from a list of Cashflows

  • January 6, 2025
  • 2 replies
  • 112 views

maxelmer1997
Contributor
Forum|alt.badge.img

Hi all,

I’m looking for assistance with calculating the Internal Rate of Return (IRR) in FME for a dataset containing annual cash flows grouped by a RecordID attribute.

I’ve attached a sample CSV file ("Annual_cashflows_by_RecordID") that includes the data I’m working with. Each RecordID represents a unique group of annual cash flow amounts. My goal is to calculate the IRR for each RecordID.

From my research, it seems the best approach is to use a PythonCaller transformer, but I’m not familiar with Python coding or how to configure this transformer for the task.

If anyone has experience with similar calculations or can provide guidance on setting up the necessary transformers (or Python script), I would greatly appreciate your help!

Cheers,

2 replies

redgeographics
Celebrity
Forum|alt.badge.img+47

It may not be necessary to use Python for this. Since I’m not that familiar with financial calculations and I can’t find a clear answer on Google, could you tell me which formula you’d like to use?


maxelmer1997
Contributor
Forum|alt.badge.img
  • Author
  • Contributor
  • January 7, 2025

Hi ​@redgeographics, thanks for taking the time.

The Internal Rate of Return (IRR) is a way to measure how profitable an investment is. It’s the percentage rate that makes the total money going in and out of a project add up to zero when adjusted for time. I.e. its the value of ‘IRR’ in the formula below that makes NPV (Net Present Value) equal to 0.

 

 

The tricky part is that there’s no single formula to calculate IRR directly. Instead, it generally has to be figured out through a process of trial and error, trying different percentages until you find the right one.

From what I have seen, while FME doesn't have a dedicated transformer for IRR calculations, the PythonCaller transformer allows you to leverage Python's financial libraries (like numpy or scipy) to perform the calculation efficiently. These libraries have built-in functions for IRR that handle the iterative process, saving time and effort.

In my research I found that there is a potential alternative to calculate IRR in FME without using Python, by using the FME Calculator transformer to implement the NPV formula manually and iterate over a range of discount rates, selecting the one that is closest to making NPV 0. However, this approach is more complex and less efficient than using Python, particularly given that my actual dataset will contain over 1,000,000 different RecordID’s for which IRR needs to be calculated for.

 

Cheers


Reply


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings