# Annual return rate calculation

**URL:** <https://community.mycapitally.com/t/annual-return-rate-calculation/176>\
**Category:** Questions\
**Created:** [July 13, 2024, 9:19am UTC](https://community.mycapitally.com/t/annual-return-rate-calculation/176 "2024-07-13T09:19:04Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![Roel](https://community.mycapitally.com/letter_avatar_proxy/v4/letter/r/0d9488/32.png) [@Roel](https://community.mycapitally.com/u/Roel)\
**Post date:** [July 13, 2024, 9:19am UTC](https://community.mycapitally.com/t/annual-return-rate-calculation/176/1 "2024-07-13T09:19:04Z")

</div>

Hi there - I hope you are not getting tired of my questions… Please take your time for this one.

I was reading your blog on measuring investment returns. You give the following formula for calculating annualized returns:

CAGR = (RoR + 1)^(1 / Years) - 1

I created the following transactions in Capitally for a dummy assset:

| Txn Date | Txn Type | Shares | Price | Amount | Quantity Held | Market Value |
| --- | --- | --- | --- | --- | --- | --- |
| 1/5/2023 | Buy | 1,490.00 | 10.00 | 14,900.00 | 1,490.00 | 14,900.00 |
| 3/5/2023 | Buy | 1,000.00 | 12.00 | 12,000.00 | 2,490.00 | 29,880.00 |
| 5/5/2023 | Buy | 1,500.00 | 14.00 | 21,000.00 | 3,990.00 | 55,860.00 |

And then I calculated the annualized rate of return in Excel as follows:

| Market value | 55,860.00 |
| --- | --- |
| Invested principal | 47,900.00 |
| Total returns | 7,960.00 |
| Rate or return (ROI) | 16.62% |
| Years invested | 0.3288 |

Annualized return = (1+0.1662)^(1 / 0.3288) - 1 = **59.62%**

But when I enter the same transactions and prices in Capitally, it shows me **58.45%**. See screenshot.

 ![image](https://community.mycapitally.com/uploads/default/original/1X/ca2ea316515b60c2d4f19977537c7b76b5ba95ad.png)

I also tried this with a Google Sheets spreadsheet I found elsewhere, and it gives me the same result as I calculated myself.

Where am I going wrong? Happy to send you the spreadsheet and/or an export from Capitally. Just let me know.

---

<div class="post-metadata">

**Author:** ![rafal](https://community.mycapitally.com/user_avatar/community.mycapitally.com/rafal/32/18_2.png) [@rafal](https://community.mycapitally.com/u/rafal)\
**Post date:** [July 13, 2024, 9:35am UTC](https://community.mycapitally.com/t/annual-return-rate-calculation/176/2 "2024-07-13T09:35:37Z")

</div>

Please send me both if you can

---

<div class="post-metadata">

**Author:** ![Roel](https://community.mycapitally.com/letter_avatar_proxy/v4/letter/r/0d9488/32.png) [@Roel](https://community.mycapitally.com/u/Roel)\
**Post date:** [July 13, 2024, 9:58am UTC](https://community.mycapitally.com/t/annual-return-rate-calculation/176/3 "2024-07-13T09:58:18Z")

</div>

I can’t upload Excel so sharing the link. Let me know when you have it, so I can remove the share.

[Portfolio Performance Calculations v2.xlsx](https://1drv.ms/x/s!AhAcGFzl-LztnKR9pQJoPO3q_x3nsw?e=qO3DF8)

**This is the export from Capitally**

[Test - Transactions.csv](https://community.mycapitally.com/uploads/short-url/zpaFauWwiFV8Mhe8YNAUQDVeyhI.csv) (805 Bytes)

---

<div class="post-metadata">

**Author:** ![rafal](https://community.mycapitally.com/user_avatar/community.mycapitally.com/rafal/32/18_2.png) [@rafal](https://community.mycapitally.com/u/rafal)\
**Post date:** [July 13, 2024, 10:16am UTC](https://community.mycapitally.com/t/annual-return-rate-calculation/176/4 "2024-07-13T10:16:07Z")

</div>

I downloaded them and will take a look

---

<div class="post-metadata">

**Author:** ![Roel](https://community.mycapitally.com/letter_avatar_proxy/v4/letter/r/0d9488/32.png) [@Roel](https://community.mycapitally.com/u/Roel)\
**Post date:** [July 13, 2024, 10:25am UTC](https://community.mycapitally.com/t/annual-return-rate-calculation/176/5 "2024-07-13T10:25:54Z")

</div>

> **[Rate of Return Calculation Methods (RV)](https://docs.google.com/spreadsheets/d/1cvCJgi-L7uchTzeTZkYuPRcdrXlEtGSeKoYQZMK8GzA/edit?usp=sharing)**
>
> This Sheet is private

I took a copy of the spreadsheet you shared in the blog and modified it with my data. I get the same result as in my own Excel, but not the same result I see in Capitally. Hope this helps. This stuff is fascinating 😉

---

<div class="post-metadata">

**Author:** ![rafal](https://community.mycapitally.com/user_avatar/community.mycapitally.com/rafal/32/18_2.png) [@rafal](https://community.mycapitally.com/u/rafal)\
**Post date:** [July 13, 2024, 1:04pm UTC](https://community.mycapitally.com/t/annual-return-rate-calculation/176/6 "2024-07-13T13:04:46Z")

</div>

Ok, I think I figured this out:

- Capitally calculates this a little differently. The money invested is assumed at the beginning of the day. The investment value is taken at end of day. So if you look at the period of `2023-01-05 : 2023-01-05` it will be a period of 1 day, while the spreadsheet approach would have a period of 0 days.
- The day period taken for annualization was wrong by one day - the above example period would be 2 days (as it wrongly included the base date `2023-01-04 : 2023-01-05`. It’s now fixed in version 1.36.2. (it includes Splits on Funds as well).
- Capitally uses 364.25 as an average amount of days in a year for annualization

So to get the same result, you would need to use `firstTransactionDate - 1` and 364.25 for the length of year. I think that `yearFrac` takes into account lengths of years between the dates.

It’s indeed fascinating. I’m constantly balancing between typical standard formulas and what actually makes sense when having a more complex portfolio, instead of an isolated case.

---

<div class="post-metadata">

**Author:** ![Roel](https://community.mycapitally.com/letter_avatar_proxy/v4/letter/r/0d9488/32.png) [@Roel](https://community.mycapitally.com/u/Roel)\
**Post date:** [July 14, 2024, 8:03am UTC](https://community.mycapitally.com/t/annual-return-rate-calculation/176/7 "2024-07-14T08:03:56Z")

</div>

Seeing the Split transaction type now. Thank you. Follow up question: how do I import that? because when I import, I don’t see this transaction type.

---

<div class="post-metadata">

**Author:** ![rafal](https://community.mycapitally.com/user_avatar/community.mycapitally.com/rafal/32/18_2.png) [@rafal](https://community.mycapitally.com/u/rafal)\
**Post date:** [July 14, 2024, 8:29am UTC](https://community.mycapitally.com/t/annual-return-rate-calculation/176/8 "2024-07-14T08:29:49Z")

</div>

There’s no support for import right now unfortunately. It will be supported on a later date, along with the revamp of the whole import experience

---

<div class="post-metadata">

**Author:** ![Roel](https://community.mycapitally.com/letter_avatar_proxy/v4/letter/r/0d9488/32.png) [@Roel](https://community.mycapitally.com/u/Roel)\
**Post date:** [July 14, 2024, 9:44am UTC](https://community.mycapitally.com/t/annual-return-rate-calculation/176/9 "2024-07-14T09:44:17Z")

</div>

I updated the spreadsheet. Now using 121 days instead of 120. And using 364.25 as days in year. That gives me 58.85%. Capitally is still at 58.45% - no change there from last time - should there not have been a change with the fix you made?

Instead of **364.25** , should it not use **365.25** , because a normal year is 365 days and every fourth year is a leap year with 366 days, so the average will be **365.25**.

In your blog, you are using **365.2425**.

 ![image](https://community.mycapitally.com/uploads/default/original/1X/d4a8b54726405912f2af8dd9fcdd60979a4823e1.png)

---

<div class="post-metadata">

**Author:** ![rafal](https://community.mycapitally.com/user_avatar/community.mycapitally.com/rafal/32/18_2.png) [@rafal](https://community.mycapitally.com/u/rafal)\
**Post date:** [July 14, 2024, 1:51pm UTC](https://community.mycapitally.com/t/annual-return-rate-calculation/176/10 "2024-07-14T13:51:27Z")

</div>

My bad, it _does_ use **365.25**. I’ll correct it on the blog, as 365.25 is calendar-based, while **365.2425** is more accurate scientifically, but actually less-so if you annualize.

I just checked the code, and I’ve fixed all annualized metrics _apart_ from ROI and TWR 🤦‍♂️ By the way, IRR was always correct in this regard.

I’ve just pushed a new version 1.36.3 - it shows 59.05% for annualized ROI.

Juggling all these numbers and complexity may be sometimes confusing. Many thanks for being patient and sharing the test case ❤

---

<div class="post-metadata">

**Author:** ![Roel](https://community.mycapitally.com/letter_avatar_proxy/v4/letter/r/0d9488/32.png) [@Roel](https://community.mycapitally.com/u/Roel)\
**Post date:** [July 21, 2024, 9:44am UTC](https://community.mycapitally.com/t/annual-return-rate-calculation/176/11 "2024-07-21T09:44:37Z")

</div>

Sorry for my delay in reply. I didn’t get the time to look at this until now. Yes, now it matches! Both ROI for period and per annum now matches my spreadsheet. Same for TWR.

What do you use for MWR? Is that an implementation that tries to replicate XIRR() in Excel? Do you have any plans to make Modified Dietz available?

---

<div class="post-metadata">

**Author:** ![rafal](https://community.mycapitally.com/user_avatar/community.mycapitally.com/rafal/32/18_2.png) [@rafal](https://community.mycapitally.com/u/rafal)\
**Post date:** [July 21, 2024, 10:08am UTC](https://community.mycapitally.com/t/annual-return-rate-calculation/176/12 "2024-07-21T10:08:17Z")

</div>

Great to hear that!

MWR is calculated by converging on a single solution in a loop - which is roughly what XIRR does. The Newton-Raphson method is used to converge quicker with some slight modifications to quickly catch edge-cases that don’t produce a valid result.

I found Modified-Dietz to be highly inaccurate in all tested edge-cases. From my understanding, it’s mostly used when iterative approaches like above are not feasable.

Why would you need it?
