↩️

Internal Rate of Return

💡
This is not investment advice, there is no implication of any guarantee. All investment is risky and you should take advice from actual advisors. EDUCATION ONLY.

Definition

  • How to estimate the profitability of potential investments.
  • Annual rate of growth an investment is expected to generate.
  • Annual return needed to make the NPV 0.
  • The higher the IRR, the more desirable the investment - indicates it can generate a better return each period.

Formula

  • Ct = Net cashflow during period t
  • C0 = Total investment costs
  • IRR = Internal Rate of Return
  • t = Periods

Python Code

Let’s say we are a wizard and we own a magic shop full of evil artifacts. We could invest in one of two evil totems. Each year, patrons of the totems will come by and donate a tribute. We want to sell our totem at the end of five years. Our discount rate is 4%.

image
Gozer Statue
Veigo Statue
Initial Cost
100
100
Sell Value
100
120
Annual Cash Flow
10
5

IRR Coding - Simple

!pip install numpy_financial
import numpy_financial as npf

print(npf.irr([-100, 10,10,10,10,110]))

#0.09999999999999987 or 10%
#0.07578433692707276 or 7.5%

IRR - Complex

Coding the full equation by hand is complex. It’s a bunch of guess work (polynomial functions). Sometimes the solution is to fully code something yourself, other times it’s knowing when to just take the efficient route and use something provided. The point is understanding what a formula means and how to apply it. Maybe I’ll get ambitious enough one day.