Skip to content

Commit

Permalink
;doc:roi: mention annualization differences, clean up TWR section
Browse files Browse the repository at this point in the history
  • Loading branch information
adept committed Aug 1, 2023
1 parent 588d0df commit ea31659
Showing 1 changed file with 28 additions and 23 deletions.
51 changes: 28 additions & 23 deletions hledger/Hledger/Cli/Commands/Roi.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,11 @@ could be an empty query (`--pnl ""` or `--pnl STR` where `STR` does
not match any of your accounts).

This command will compute and display the internalized rate of return
(IRR) and time-weighted rate of return (TWR) for your investments for
the time period requested. Both rates of return are annualized before
display, regardless of the length of reporting interval.
(IRR, also known as money-weighted rate of return) and time-weighted
rate of return (TWR) for your investments for the time period
requested. IRR is always annualized due to the way it is computed, but
TWR is reported both as a rate over the chosen reporting period and as
an annual rate.

Price directives will be taken into account if you supply appropriate
`--cost` or `--value` flags (see [VALUATION](https://hledger.org/hledger.html#valuation)).
Expand Down Expand Up @@ -125,15 +127,15 @@ different ways to compute rate of return, and this command implements
two of them: IRR and TWR.

Internal rate of return, or "IRR" (also called "money-weighted rate of
return") takes into account effects of in-flows and out-flows.
Naively, if you are withdrawing from your investment, your future
gains would be smaller (in absolute numbers), and will be a smaller
percentage of your initial investment, and if you are adding to your
investment, you will receive bigger absolute gains (but probably at
the same rate of return). IRR is a way to compute rate of return for
each period between in-flow or out-flow of money, and then combine
them in a way that gives you a compound annual rate of return that investment
is expected to generate.
return") takes into account effects of in-flows and out-flows, and the
time between them. Investment at a particular fixed interest rate is
going to give you more interest than the same amount invested at the
same interest rate, but made later in time. If you are withdrawing from
your investment, your future gains would be smaller (in absolute
numbers), and will be a smaller percentage of your initial investment,
so your IRR will be smaller. And if you are adding to your investment,
you will receive bigger absolute gains, which will be a bigger
percentage of your initial investment, so your IRR will be larger.

As mentioned before, in-flows and out-flows would be any cash that you
personally put in or withdraw, and for the "roi" command, these are
Expand All @@ -152,25 +154,28 @@ present value, and tries to find a discount rate that makes net
present value of all the cash flows of your investment to add up to
zero. This could be hard to wrap your head around, especially if you
haven't done discounted cash flow analysis before. Implementation of
IRR in hledger should produce results that match the `XIRR` formula in
IRR in hledger should produce results that match the `=XIRR` formula in
Excel.

Second way to compute rate of return that `roi` command implements is
called "time-weighted rate of return" or "TWR". Like IRR, it will also
break the history of your investment into periods between in-flows,
out-flows and value changes, to compute rate of return per each period
and then a compound rate of return. However, internal workings of TWR
are quite different.

TWR represents your investment as an imaginary "unit fund" where in-flows/
out-flows lead to buying or selling "units" of your investment and changes in
its value change the value of "investment unit". Change in "unit price" over the
reporting period gives you rate of return of your investment.
called "time-weighted rate of return" or "TWR". Like IRR, it will
account for the effect of your in-flows and out-flows, but unlike IRR
it will try to compute the true rate of return of the underlying
asset, compensating for the effect that deposits and withdrawas have
on the apparent rate of growth of your investment.

TWR represents your investment as an imaginary "unit fund" where
in-flows/ out-flows lead to buying or selling "units" of your
investment and changes in its value change the value of "investment
unit". Change in "unit price" over the reporting period gives you rate
of return of your investment, and make TWR less sensitive than IRR to
the effects of cash in-flows and out-flows.

References:

* [Explanation of rate of return](https://www.investopedia.com/terms/r/rateofreturn.asp)
* [Explanation of IRR](https://www.investopedia.com/terms/i/irr.asp)
* [Explanation of TWR](https://www.investopedia.com/terms/t/time-weightedror.asp)
* [IRR vs TWR](https://smartasset.com/investing/time-weighted-return)
* [Examples of computing IRR and TWR and discussion of the limitations of both metrics](https://blog.commonwealth.com/measuring-portfolio-performance-twr-vs.-irr)

0 comments on commit ea31659

Please sign in to comment.